Prechádzať zdrojové kódy

工作内容加一行合计行

user5 4 rokov pred
rodič
commit
f8a5713862
20 zmenil súbory, kde vykonal 1973 pridanie a 62 odobranie
  1. 1 0
      src/main/java/com/jeeplus/modules/workcontent/common/WorkContentDetailFactory.java
  2. 4 0
      src/main/webapp/webpage/modules/projectrecord/workContentFromAndView/workContentView.jsp
  3. 65 2
      src/main/webapp/webpage/modules/workcontent/workClaimList.jsp
  4. 103 1
      src/main/webapp/webpage/modules/workcontent/workClaimListView.jsp
  5. 61 5
      src/main/webapp/webpage/modules/workcontent/workContentBranchAccountList.jsp
  6. 125 1
      src/main/webapp/webpage/modules/workcontent/workContentBranchAccountListView.jsp
  7. 94 21
      src/main/webapp/webpage/modules/workcontent/workContentCompleteAccountList.jsp
  8. 144 1
      src/main/webapp/webpage/modules/workcontent/workContentCompleteAccountListView.jsp
  9. 72 3
      src/main/webapp/webpage/modules/workcontent/workContentCtrlpriceList.jsp
  10. 127 2
      src/main/webapp/webpage/modules/workcontent/workContentCtrlpriceListView.jsp
  11. 100 5
      src/main/webapp/webpage/modules/workcontent/workContentInvestmentCostList.jsp
  12. 203 1
      src/main/webapp/webpage/modules/workcontent/workContentInvestmentCostListView.jsp
  13. 65 2
      src/main/webapp/webpage/modules/workcontent/workDesignChangeList.jsp
  14. 103 1
      src/main/webapp/webpage/modules/workcontent/workDesignChangeListView.jsp
  15. 74 4
      src/main/webapp/webpage/modules/workcontent/workFiveDirectionsAffirmList.jsp
  16. 134 2
      src/main/webapp/webpage/modules/workcontent/workFiveDirectionsAffirmListView.jsp
  17. 105 7
      src/main/webapp/webpage/modules/workcontent/workPreliminaryDesignEstimateList.jsp
  18. 226 1
      src/main/webapp/webpage/modules/workcontent/workPreliminaryDesignEstimateListView.jsp
  19. 64 2
      src/main/webapp/webpage/modules/workcontent/workSiteVisaList.jsp
  20. 103 1
      src/main/webapp/webpage/modules/workcontent/workSiteVisaListView.jsp

+ 1 - 0
src/main/java/com/jeeplus/modules/workcontent/common/WorkContentDetailFactory.java

@@ -65,6 +65,7 @@ public class WorkContentDetailFactory {
             case "32":
                 return biddingplanService;
             case "34":
+            case "23":
                 return ctrlpriceService;
             case "41":
                 return contractinfoService;

+ 4 - 0
src/main/webapp/webpage/modules/projectrecord/workContentFromAndView/workContentView.jsp

@@ -170,6 +170,7 @@
                     $("#contentDetail").load("${ctx}/workcontent/workContentBiddingplan/form",param2);
                     break;
                 case '34':
+                case '23':
                     $("#contentDetail").load("${ctx}/workcontent/workContentCtrlprice/form",param2);
                     break;
                 case '41':
@@ -1183,6 +1184,7 @@
                 return "${ctx}/workcontent/workContentContprogram/form";
             case '32':
                 return "${ctx}/workcontent/workContentBiddingplan/form";
+            case '23':
             case '34':
                 return "${ctx}/workcontent/workContentCtrlprice/getTableType";
             case '41':
@@ -1251,6 +1253,7 @@
             case '32':
                 $("#contentDetail").load("${ctx}/workcontent/workContentBiddingplan/form",param2);
                 break;
+            case '23':
             case '34':
                 $("#contentDetail").load("${ctx}/workcontent/workContentCtrlprice/form",param2);
                 break;
@@ -1333,6 +1336,7 @@
             case '32':
                 $("#contentDetail").load("${ctx}/workcontent/workContentBiddingplan/form",param2);
                 break;
+            case '23':
             case '34':
                 $("#contentDetail").load("${ctx}/workcontent/workContentCtrlprice/form",param2);
                 break;

+ 65 - 2
src/main/webapp/webpage/modules/workcontent/workClaimList.jsp

@@ -1,5 +1,29 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
 <%@ include file="/webpage/include/taglib.jsp"%>
+<script type="text/javascript">
+    function beforeCostSum(obj,index) {
+        updateSum("sendMoney")
+        updateSum("confirmMoney")
+    }
+
+    function updateSum(name) {
+        var totalSum = 0;
+        for(var i = 1; i<100; i++){
+            //判断是否是隐藏行,如果是隐藏行则不进行运算
+            if(!$("#investmentCostList"+i).is(":hidden")){
+                var reult = parseFloat($("#investmentCostList"+i+"_"+name).val());
+                if(!isNaN(reult)){
+                    totalSum += reult;
+                }
+            }
+        }
+        if(0 == totalSum){
+            document.getElementById(name).innerHTML='';
+        }else{
+            document.getElementById(name).innerHTML=totalSum.toFixed(2);
+        }
+    }
+</script>
 
 <form id="subForm"  action="#" onsubmit="return false;" method="post" class="form-horizontal">
     <div class="layui-item nav-btns" style="padding-left:0px;">
@@ -26,6 +50,8 @@
         </thead>
         <tbody id="investmentCostList">
         </tbody>
+        <tfoot id="preliminaryFootList">
+        </tfoot>
     </table>
 	<script type="text/template" id="investmentCostTpl">//<!--
         <tr id="investmentCostList{{idx}}">
@@ -48,21 +74,52 @@
                 <input id="investmentCostList{{idx}}_content" subName="content" type="text" value="{{row.content}}"   class="form-control contentDetail"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_sendMoney" subName="sendMoney" type="text" value="{{row.sendMoney}}"   class="form-control required contentDetail"/>
+                <input id="investmentCostList{{idx}}_sendMoney" subName="sendMoney" onchange="beforeCostSum(this,{{idx}});" type="text" value="{{row.sendMoney}}"   class="form-control number money required contentDetail"/>
             </td>
             <td>
                 <input id="investmentCostList{{idx}}_procedure" subName="procedure" type="text"  value="{{row.procedure}}"  class="form-control required contentDetail"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_confirmMoney" subName="confirmMoney" type="text"    value="{{row.confirmMoney}}"  class="form-control required contentDetail"/>
+                <input id="investmentCostList{{idx}}_confirmMoney" subName="confirmMoney" onchange="beforeCostSum(this,{{idx}});" type="text"    value="{{row.confirmMoney}}"  class="form-control number money required contentDetail"/>
             </td>
             <td class="text-center op-td">
                         <a href="#" onclick="delRow(this, '#investmentCostList{{idx}}')"   class="op-btn op-btn-delete"><i class="fa fa-trash"></i>取消</a>
             </td>
         </tr>//-->
     </script>
+
+    <script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="sendMoney">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="confirmMoney">
+
+            </td>
+            <td class="text-center op-td" style="text-align: center">
+
+            </td>
+        </tr>//-->
+    </script>
     <script type="text/javascript">
+        var recordInt = 0;
         var investmentCostIdx = 0, investmentCostTpl = $("#investmentCostTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+        var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
         var validateForm2;
         $(function(){
             validateForm2 = $("#subForm").validate({
@@ -90,6 +147,10 @@
             idx = idx+1;
             bornTemplete(list, idx, tpl, row, idx);
             investmentCostIdx +=1;
+            if(recordInt ==0){
+                bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+            }
+            recordInt+=1;
         }
 
         function bornTemplete(list, idx, tpl, row, idx1){
@@ -126,6 +187,8 @@
                 delFlag.val("1");
                 $(obj).parent().parent().hide();
             }
+            updateSum("sendMoney")
+            updateSum("confirmMoney")
         }
 
         function genRow(data) {

+ 103 - 1
src/main/webapp/webpage/modules/workcontent/workClaimListView.jsp

@@ -45,5 +45,107 @@
                 </tr>
             </c:forEach>
         </tbody>
+        <tfoot id="preliminaryFootList">
+        </tfoot>
     </table>
-</form>
+</form>
+
+<script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="sendMoney" style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="confirmMoney" style="text-align: center">
+
+            </td>
+        </tr>//-->
+</script>
+
+<script type="text/javascript">
+    var recordInt = 0;
+    var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+    var validateForm2;
+    $(function(){
+        validateForm2 = $("#subForm").validate({
+            errorContainer: "#messageBox",
+            errorPlacement: function(error, element) {
+                $("#messageBox").text("输入有误,请先更正。");
+                if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    error.appendTo(element.parent().parent());
+                } else {
+                    error.insertAfter(element);
+                }
+            }
+        });
+        addRowCost('#preliminaryFootList', preliminaryFootIdx, preliminaryFootTpl,"");
+        $(":input.money").change();
+    })
+
+    function addRowCost(list, idx, tpl, row){
+        idx = idx+1;
+        if(recordInt ==0){
+            bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+        }
+        recordInt+=1;
+    }
+
+    function bornTemplete(list, idx, tpl, row, idx1){
+        var idx1 = $("#investmentCostList tr").length +1;
+        $(list).append(Mustache.render(tpl, {
+            idx: idx, delBtn: true, row: row,
+            order:idx1 + 1, idx1:idx1
+        }));
+        $(list+idx).find("select").each(function(){
+            $(this).val($(this).attr("data-value"));
+        });
+        $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+            var ss = $(this).attr("data-value").split(',');
+            for (var i=0; i<ss.length; i++){
+                if($(this).val() == ss[i]){
+                    $(this).attr("checked","checked");
+                }
+            }
+        });
+    }
+    function sendMoney() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(4)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function confirmMoney() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(6)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    if(document.readyState=="complete"){
+        var sendMoney = sendMoney();
+        var confirmMoney = confirmMoney();
+
+        document.getElementById('sendMoney').innerHTML=sendMoney;
+        document.getElementById('confirmMoney').innerHTML=confirmMoney;
+
+    }
+</script>

+ 61 - 5
src/main/webapp/webpage/modules/workcontent/workContentBranchAccountList.jsp

@@ -1,5 +1,32 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
 <%@ include file="/webpage/include/taglib.jsp"%>
+<script type="text/javascript">
+    function beforeCostSum(obj,index) {
+        updateSum("contractAccount")
+        updateSum("submitAccount")
+        updateSum("setAccount")
+        updateSum("businessAdd")
+        updateSum("businessReduce")
+    }
+
+    function updateSum(name) {
+        var totalSum = 0;
+        for(var i = 1; i<100; i++){
+            //判断是否是隐藏行,如果是隐藏行则不进行运算
+            if(!$("#investmentCostList"+i).is(":hidden")){
+                var reult = parseFloat($("#investmentCostList"+i+"_"+name).val());
+                if(!isNaN(reult)){
+                    totalSum += reult;
+                }
+            }
+        }
+        if(0 == totalSum){
+            document.getElementById(name).innerHTML='';
+        }else{
+            document.getElementById(name).innerHTML=totalSum.toFixed(2);;
+        }
+    }
+</script>
 
 <form id="subForm"  action="#" onsubmit="return false;" method="post" class="form-horizontal">
     <c:forEach items="${signList}" var="sign">
@@ -46,6 +73,8 @@
                 </thead>
                 <tbody id="investmentCostList">
                 </tbody>
+                <tfoot id="preliminaryFootList">
+                </tfoot>
             </table>
         </c:if>
     </c:forEach>
@@ -64,19 +93,19 @@
                 <input id="investmentCostList{{idx}}_accountName" subName="accountName" value="{{row.accountName}}" type="text" class="form-control contentDetail"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_contractAccount" subName="contractAccount" type="text" value="{{row.contractAccount}}"  class="form-control number contentDetail money"/>
+                <input id="investmentCostList{{idx}}_contractAccount" subName="contractAccount" onchange="beforeCostSum(this,{{idx}});" type="text" value="{{row.contractAccount}}"  class="form-control number contentDetail money"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_submitAccount" subName="submitAccount" type="text" value="{{row.submitAccount}}"   class="form-control number contentDetail money"/>
+                <input id="investmentCostList{{idx}}_submitAccount" subName="submitAccount" onchange="beforeCostSum(this,{{idx}});" type="text" value="{{row.submitAccount}}"   class="form-control number contentDetail money"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_setAccount" subName="setAccount" type="text" value="{{row.setAccount}}"   class="form-control number contentDetail money"/>
+                <input id="investmentCostList{{idx}}_setAccount" subName="setAccount" onchange="beforeCostSum(this,{{idx}});" type="text" value="{{row.setAccount}}"   class="form-control number contentDetail money"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_businessAdd" subName="businessAdd" type="text"  value="{{row.businessAdd}}"  class="form-control number  contentDetail money"/>
+                <input id="investmentCostList{{idx}}_businessAdd" subName="businessAdd" onchange="beforeCostSum(this,{{idx}});" type="text"  value="{{row.businessAdd}}"  class="form-control number  contentDetail money"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_businessReduce" subName="businessReduce" type="text"    value="{{row.businessReduce}}"  class="form-control number contentDetail"/>
+                <input id="investmentCostList{{idx}}_businessReduce" subName="businessReduce" onchange="beforeCostSum(this,{{idx}});" type="text"    value="{{row.businessReduce}}"  class="form-control number contentDetail"/>
             </td>
             <td>
                 <input id="investmentCostList{{idx}}_businessRate" subName="businessRate" type="text"  value="{{row.businessRate}}"  class="form-control number contentDetail"/>
@@ -87,8 +116,26 @@
             </td>
         </tr>//-->
     </script>
+
+    <script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center"></td>
+            <td id="contractAccount"></td>
+            <td id="submitAccount"></td>
+            <td id="setAccount"></td>
+            <td id="businessAdd"></td>
+            <td id="businessReduce"></td>
+            <td style="text-align: center"></td>
+            <td class="text-center op-td" style="text-align: center"></td>
+        </tr>//-->
+    </script>
     <script type="text/javascript">
+        var recordInt = 0;
         var investmentCostIdx = 0, investmentCostTpl = $("#investmentCostTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+        var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
         var validateForm2;
         $(function(){
             validateForm2 = $("#subForm").validate({
@@ -116,6 +163,10 @@
             idx = idx+1;
             bornTemplete(list, idx, tpl, row, idx);
             investmentCostIdx +=1;
+            if(recordInt ==0){
+                bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+            }
+            recordInt+=1;
         }
 
         function bornTemplete(list, idx, tpl, row, idx1){
@@ -145,6 +196,11 @@
                 delFlag.val("1");
                 $(obj).parent().parent().hide();
             }
+            updateSum("contractAccount")
+            updateSum("submitAccount")
+            updateSum("setAccount")
+            updateSum("businessAdd")
+            updateSum("businessReduce")
         }
 
         function genRow(data) {

+ 125 - 1
src/main/webapp/webpage/modules/workcontent/workContentBranchAccountListView.jsp

@@ -52,7 +52,131 @@
                 </tr>
             </c:forEach>
             </tbody>
+            <tfoot id="preliminaryFootList">
+            </tfoot>
         </table>
     </c:if>
     </c:forEach>
-</form>
+</form>
+
+<script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center"></td>
+            <td id="contractAccount" style="text-align: center"></td>
+            <td id="submitAccount" style="text-align: center"></td>
+            <td id="setAccount" style="text-align: center"></td>
+            <td id="businessAdd" style="text-align: center"></td>
+            <td id="businessReduce" style="text-align: center"></td>
+            <td style="text-align: center"></td>
+        </tr>//-->
+</script>
+
+<script type="text/javascript">
+    var recordInt = 0;
+    var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+    var validateForm2;
+    $(function(){
+        validateForm2 = $("#subForm").validate({
+            errorContainer: "#messageBox",
+            errorPlacement: function(error, element) {
+                $("#messageBox").text("输入有误,请先更正。");
+                if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    error.appendTo(element.parent().parent());
+                } else {
+                    error.insertAfter(element);
+                }
+            }
+        });
+        addRowCost('#preliminaryFootList', preliminaryFootIdx, preliminaryFootTpl,"");
+        $(":input.money").change();
+    })
+
+    function addRowCost(list, idx, tpl, row){
+        idx = idx+1;
+        if(recordInt ==0){
+            bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+        }
+        recordInt+=1;
+    }
+
+    function bornTemplete(list, idx, tpl, row, idx1){
+        var idx1 = $("#investmentCostList tr").length +1;
+        $(list).append(Mustache.render(tpl, {
+            idx: idx, delBtn: true, row: row,
+            order:idx1 + 1, idx1:idx1
+        }));
+        $(list+idx).find("select").each(function(){
+            $(this).val($(this).attr("data-value"));
+        });
+        $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+            var ss = $(this).attr("data-value").split(',');
+            for (var i=0; i<ss.length; i++){
+                if($(this).val() == ss[i]){
+                    $(this).attr("checked","checked");
+                }
+            }
+        });
+    }
+    function contractAccount() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(2)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function submitAccount() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(3)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function setAccount() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(4)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function businessAdd() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(5)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function businessReduce() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(6)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    if(document.readyState=="complete"){
+        var contractAccount = contractAccount();
+        var submitAccount = submitAccount();
+        var setAccount = setAccount();
+        var businessAdd = businessAdd();
+        var businessReduce = businessReduce();
+
+        document.getElementById('contractAccount').innerHTML=contractAccount;
+        document.getElementById('submitAccount').innerHTML=submitAccount;
+        document.getElementById('setAccount').innerHTML=setAccount;
+        document.getElementById('businessAdd').innerHTML=businessAdd;
+        document.getElementById('businessReduce').innerHTML=businessReduce;
+
+    }
+</script>

+ 94 - 21
src/main/webapp/webpage/modules/workcontent/workContentCompleteAccountList.jsp

@@ -1,6 +1,32 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
 <%@ include file="/webpage/include/taglib.jsp"%>
+<script type="text/javascript">
+    function beforeCostSum(obj,index) {
+        updateSum("completeContract")
+        updateSum("completeSubmit")
+        updateSum("completeExamine")
+        updateSum("completeAdd")
+        updateSum("completeReduce")
+    }
 
+    function updateSum(name) {
+        var totalSum = 0;
+        for(var i = 1; i<100; i++){
+            //判断是否是隐藏行,如果是隐藏行则不进行运算
+            if(!$("#investmentCostList"+i).is(":hidden")){
+                var reult = parseFloat($("#investmentCostList"+i+"_"+name).val());
+                if(!isNaN(reult)){
+                    totalSum += reult;
+                }
+            }
+        }
+        if(0 == totalSum){
+            document.getElementById(name).innerHTML='';
+        }else{
+            document.getElementById(name).innerHTML=totalSum.toFixed(2);;
+        }
+    }
+</script>
 <form id="subForm"  action="#" onsubmit="return false;" method="post" class="form-horizontal">
     <c:forEach items="${signList}" var="sign">
         <c:if test="${sign =='completeAccount'}">
@@ -11,28 +37,30 @@
 
             <table id="contentTable" class="table table-bordered table-condensed can-edit">
                 <thead>
-                    <tr>
-                        <th colspan="9" style="font-size: 20px">输变电工程竣工结算审核单</th>
-                    </tr>
-                    <tr>
-                        <th class="hide"></th>
-                        <th>序号</th>
-                        <th>单位工程名称</th>
-                        <th>合同价(元)</th>
-                        <th>送审价(元)</th>
-                        <th>审定价(元)</th>
-                        <th>核增额(元)</th>
-                        <th>核减额(元)</th>
-                        <th>核增、核减额(%)</th>
-                        <th width="60" rowspan="3">操作</th>
-                    </tr>
+                <tr>
+                    <th colspan="9" style="font-size: 20px">输变电工程竣工结算审核单</th>
+                </tr>
+                <tr>
+                    <th class="hide"></th>
+                    <th>序号</th>
+                    <th>单位工程名称</th>
+                    <th>合同价(元)</th>
+                    <th>送审价(元)</th>
+                    <th>审定价(元)</th>
+                    <th>核增额(元)</th>
+                    <th>核减额(元)</th>
+                    <th>核增、核减额(%)</th>
+                    <th width="60" rowspan="3">操作</th>
+                </tr>
                 </thead>
                 <tbody id="investmentCostList">
                 </tbody>
+                <tfoot id="preliminaryFootList">
+                </tfoot>
             </table>
         </c:if>
     </c:forEach>
-	<script type="text/template" id="investmentCostTpl">//<!--
+    <script type="text/template" id="investmentCostTpl">//<!--
         <tr id="investmentCostList{{idx}}">
             <td class="hide">
                 <input id="investmentCostList{{idx}}_id" subName="id" class="contentDetail" type="hidden" value="{{row.id}}"/>
@@ -46,20 +74,21 @@
             <td>
                 <input id="investmentCostList{{idx}}_completeName" subName="completeName" value="{{row.completeName}}" type="text" class="form-control contentDetail"/>
             </td>
+
             <td>
-                <input id="investmentCostList{{idx}}_completeContract" subName="completeContract" type="text" value="{{row.completeContract}}"  class="form-control number contentDetail money"/>
+                <input id="investmentCostList{{idx}}_completeContract" subName="completeContract" onchange="beforeCostSum(this,{{idx}});" type="text" value="{{row.completeContract}}"  class="form-control number contentDetail money"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_completeSubmit" subName="completeSubmit" type="text" value="{{row.completeSubmit}}"   class="form-control number contentDetail money"/>
+                <input id="investmentCostList{{idx}}_completeSubmit" subName="completeSubmit" onchange="beforeCostSum(this,{{idx}});" type="text" value="{{row.completeSubmit}}"   class="form-control number contentDetail money"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_completeExamine" subName="completeExamine" type="text" value="{{row.completeExamine}}"   class="form-control number contentDetail money"/>
+                <input id="investmentCostList{{idx}}_completeExamine" subName="completeExamine" onchange="beforeCostSum(this,{{idx}});" type="text" value="{{row.completeExamine}}"   class="form-control number contentDetail money"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_completeAdd" subName="completeAdd" type="text"  value="{{row.completeAdd}}"  class="form-control number  contentDetail money"/>
+                <input id="investmentCostList{{idx}}_completeAdd" subName="completeAdd" type="text" onchange="beforeCostSum(this,{{idx}});" value="{{row.completeAdd}}"  class="form-control number  contentDetail money"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_completeReduce" subName="completeReduce" type="text"    value="{{row.completeReduce}}"  class="form-control number contentDetail"/>
+                <input id="investmentCostList{{idx}}_completeReduce" subName="completeReduce" type="text" onchange="beforeCostSum(this,{{idx}});" value="{{row.completeReduce}}"  class="form-control number contentDetail"/>
             </td>
             <td>
                 <input id="investmentCostList{{idx}}_completeRate" subName="completeRate" type="text"  value="{{row.completeRate}}"  class="form-control number contentDetail"/>
@@ -70,8 +99,42 @@
             </td>
         </tr>//-->
     </script>
+
+    <script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="completeContract">
+
+            </td>
+            <td id="completeSubmit">
+
+            </td>
+            <td id = "completeExamine">
+
+            </td>
+            <td id="completeAdd">
+
+            </td>
+            <td id="completeReduce">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td class="text-center op-td" style="text-align: center">
+
+            </td>
+        </tr>//-->
+    </script>
     <script type="text/javascript">
+        var recordInt = 0;
         var investmentCostIdx = 0, investmentCostTpl = $("#investmentCostTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+        var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
         var validateForm2;
         $(function(){
             validateForm2 = $("#subForm").validate({
@@ -99,6 +162,10 @@
             idx = idx+1;
             bornTemplete(list, idx, tpl, row, idx);
             investmentCostIdx +=1;
+            if(recordInt ==0){
+                bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+            }
+            recordInt+=1;
         }
 
         function bornTemplete(list, idx, tpl, row, idx1){
@@ -128,6 +195,12 @@
                 delFlag.val("1");
                 $(obj).parent().parent().hide();
             }
+
+            updateSum("completeContract")
+            updateSum("completeSubmit")
+            updateSum("completeExamine")
+            updateSum("completeAdd")
+            updateSum("completeReduce")
         }
 
         function genRow(data) {

+ 144 - 1
src/main/webapp/webpage/modules/workcontent/workContentCompleteAccountListView.jsp

@@ -52,7 +52,150 @@
                 </tr>
             </c:forEach>
             </tbody>
+            <tfoot id="preliminaryFootList">
+            </tfoot>
         </table>
     </c:if>
     </c:forEach>
-</form>
+</form>
+
+
+<script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="completeContract" style="text-align: center">
+
+            </td>
+            <td id="completeSubmit" style="text-align: center">
+
+            </td>
+            <td id = "completeExamine" style="text-align: center">
+
+            </td>
+            <td id="completeAdd" style="text-align: center">
+
+            </td>
+            <td id="completeReduce" style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+        </tr>//-->
+</script>
+
+
+<script type="text/javascript">
+    var recordInt = 0;
+    var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+    var validateForm2;
+    $(function(){
+        validateForm2 = $("#subForm").validate({
+            errorContainer: "#messageBox",
+            errorPlacement: function(error, element) {
+                $("#messageBox").text("输入有误,请先更正。");
+                if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    error.appendTo(element.parent().parent());
+                } else {
+                    error.insertAfter(element);
+                }
+            }
+        });
+        addRowCost('#preliminaryFootList', preliminaryFootIdx, preliminaryFootTpl,"");
+        $(":input.money").change();
+    })
+
+    function addRowCost(list, idx, tpl, row){
+        idx = idx+1;
+        if(recordInt ==0){
+            bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+        }
+        recordInt+=1;
+    }
+
+    function bornTemplete(list, idx, tpl, row, idx1){
+        var idx1 = $("#investmentCostList tr").length +1;
+        $(list).append(Mustache.render(tpl, {
+            idx: idx, delBtn: true, row: row,
+            order:idx1 + 1, idx1:idx1
+        }));
+        $(list+idx).find("select").each(function(){
+            $(this).val($(this).attr("data-value"));
+        });
+        $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+            var ss = $(this).attr("data-value").split(',');
+            for (var i=0; i<ss.length; i++){
+                if($(this).val() == ss[i]){
+                    $(this).attr("checked","checked");
+                }
+            }
+        });
+    }
+    function completeContract() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(2)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function completeSubmit() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(3)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function completeExamine() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(4)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function completeAdd() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(5)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function completeReduce() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(6)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    if(document.readyState=="complete"){
+        var completeContract = completeContract();
+        var completeSubmit = completeSubmit();
+        var completeExamine = completeExamine();
+        var completeAdd = completeAdd();
+        var completeReduce = completeReduce();
+        completeContract = completeContract.toFixed(2);
+        completeSubmit = completeSubmit.toFixed(2);
+        completeExamine = completeExamine.toFixed(2);
+        completeAdd = completeAdd.toFixed(2);
+        completeReduce = completeReduce.toFixed(2);
+        document.getElementById('completeContract').innerHTML=completeContract;
+        document.getElementById('completeSubmit').innerHTML=completeSubmit;
+        document.getElementById('completeExamine').innerHTML=completeExamine;
+        document.getElementById('completeAdd').innerHTML=completeAdd;
+        document.getElementById('completeReduce').innerHTML=completeReduce;
+    }
+</script>

+ 72 - 3
src/main/webapp/webpage/modules/workcontent/workContentCtrlpriceList.jsp

@@ -14,8 +14,34 @@
 		var total=(parseFloat(highestBidBefore) - parseFloat(highestBidAfter)).toFixed(2);
 		$("#ctrlpriceList"+index+"_highestBidAdjust").val(total);
 
+		updateSum("highestBidBefore");
+		updateSum("highestBidAfter");
+		updateSum("highestBidAdjust");
 		if(!isNumber(val))return;
 	}
+
+	function beforeCost(obj,index) {
+		updateSum("constructionBudget")
+	}
+
+	function updateSum(name) {
+		var totalSum = 0;
+
+		for(var i = 1; i<100; i++){
+			//判断是否是隐藏行,如果是隐藏行则不进行运算
+			if(!$("#ctrlpriceList"+i).is(":hidden")){
+				var reult = parseFloat($("#ctrlpriceList"+i+"_"+name).val());
+				if(!isNaN(reult)){
+					totalSum += reult;
+				}
+			}
+		}
+		if(0 == totalSum){
+			document.getElementById(name).innerHTML='';
+		}else{
+			document.getElementById(name).innerHTML=totalSum.toFixed(2);;
+		}
+	}
 </script>
 <div class="form-group layui-row lw12">
     <div class="layui-item layui-col-sm12">
@@ -45,7 +71,7 @@
 				</tr>
 				<tr>
 					<th rowspan="2" class="hide"></th>
-					<th rowspan="2" style="width: 30px;">序号</th>
+					<th rowspan="2" style="width: 60px;">序号</th>
 					<th rowspan="2">建设单位</th>
 					<th rowspan="2">工程名称</th>
 					<th rowspan="2">施工图预算静态投资</th>
@@ -61,6 +87,8 @@
 				</thead>
 				<tbody id="ctrlpriceList">
 				</tbody>
+				<tfoot id="preliminaryFootList">
+				</tfoot>
 			</table>
 		</c:if>
 	</c:forEach>
@@ -81,7 +109,7 @@
                 <input style="text-align: center" id="ctrlpriceList{{idx}}_projectName" subName="projectName" type="text" value="{{row.projectName}}" class="form-control contentDetail"/>
             </td>
             <td>
-                <input style="text-align: center" id="ctrlpriceList{{idx}}_constructionBudget" subName="constructionBudget" type="text" value="{{row.constructionBudget}}" class="form-control number contentDetail money"/>
+                <input style="text-align: center" id="ctrlpriceList{{idx}}_constructionBudget" subName="constructionBudget" type="text" value="{{row.constructionBudget}}" onchange="beforeCost(this,{{idx}});" class="form-control number contentDetail money"/>
             </td>
             <td>
                 <input style="text-align: center" id="ctrlpriceList{{idx}}_highestBidBefore" subName="highestBidBefore" type="text" value="{{row.highestBidBefore}}" onchange="formatNumMoney(this,{{idx}});" class="form-control number contentDetail money"/>
@@ -101,6 +129,38 @@
         </tr>//-->
 	</script>
 
+	<script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="ctrlpriceList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center" id="constructionBudget">
+
+            </td>
+            <td style="text-align: center" id="highestBidBefore">
+
+            </td>
+            <td style="text-align: center" id = "highestBidAfter">
+
+            </td>
+            <td style="text-align: center" id="highestBidAdjust">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td class="text-center op-td" style="text-align: center">
+
+            </td>
+        </tr>//-->
+	</script>
+
 
 	<%--<table id="contentTable" class="table table-bordered table-condensed can-edit">
 		<thead>
@@ -164,8 +224,10 @@
         </tr>//-->
         </script>--%>
         <script type="text/javascript">
+			var recordInt = 0;
             var ctrlpriceIdx = 0, ctrlpriceTpl = $("#ctrlpriceTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
-            $(function(){
+			var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+			$(function(){
                     var data = ${fns:toJson(ctrlpricelist)};
                     if(data!=null) {
                         for (var i = 0; i < data.length; i++) {
@@ -179,6 +241,10 @@
                 idx=idx+1;
                 bornTemplete(list, idx, tpl, row, idx);
                 ctrlpriceIdx +=1;
+				if(recordInt ==0){
+					bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+				}
+				recordInt+=1;
             }
 
             /*function addRow(list, idx, tpl, row){
@@ -213,6 +279,9 @@
                     delFlag.val("1");
                     $(obj).parent().parent().hide();
                 }
+				updateSum("highestBidBefore");
+				updateSum("highestBidAfter");
+				updateSum("highestBidAdjust");
             }
 
             function genRow(data) {

+ 127 - 2
src/main/webapp/webpage/modules/workcontent/workContentCtrlpriceListView.jsp

@@ -21,7 +21,7 @@
             </tr>
             <tr>
                 <th rowspan="2" class="hide"></th>
-                <th rowspan="2" style="width: 30px;">序号</th>
+                <th rowspan="2" style="width: 60px;">序号</th>
                 <th rowspan="2">建设单位</th>
                 <th rowspan="2">工程名称</th>
                 <th rowspan="2">施工图预算静态投资</th>
@@ -66,5 +66,130 @@
                 </tr>
             </c:forEach>
 		</tbody>
+        <tfoot id="preliminaryFootList">
+        </tfoot>
 	</table>
-</form>
+</form>
+<script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="ctrlpriceList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center" id="constructionBudget">
+
+            </td>
+            <td style="text-align: center" id="highestBidBefore">
+
+            </td>
+            <td style="text-align: center" id = "highestBidAfter">
+
+            </td>
+            <td style="text-align: center" id="highestBidAdjust">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+        </tr>//-->
+</script>
+<script type="text/javascript">
+    var recordInt = 0;
+    var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+    var validateForm2;
+    $(function(){
+        validateForm2 = $("#subForm").validate({
+            errorContainer: "#messageBox",
+            errorPlacement: function(error, element) {
+                $("#messageBox").text("输入有误,请先更正。");
+                if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    error.appendTo(element.parent().parent());
+                } else {
+                    error.insertAfter(element);
+                }
+            }
+        });
+        addRowCost('#preliminaryFootList', preliminaryFootIdx, preliminaryFootTpl,"");
+        $(":input.money").change();
+    })
+
+    function addRowCost(list, idx, tpl, row){
+        idx = idx+1;
+        if(recordInt ==0){
+            bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+        }
+        recordInt+=1;
+    }
+
+    function bornTemplete(list, idx, tpl, row, idx1){
+        var idx1 = $("#ctrlpriceList tr").length +1;
+        $(list).append(Mustache.render(tpl, {
+            idx: idx, delBtn: true, row: row,
+            order:idx1 + 1, idx1:idx1
+        }));
+        $(list+idx).find("select").each(function(){
+            $(this).val($(this).attr("data-value"));
+        });
+        $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+            var ss = $(this).attr("data-value").split(',');
+            for (var i=0; i<ss.length; i++){
+                if($(this).val() == ss[i]){
+                    $(this).attr("checked","checked");
+                }
+            }
+        });
+    }
+    function constructionBudget() {
+        var totalSum = 0
+        $('#ctrlpriceList tr').each(function() {
+            $(this).find('td:eq(3)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function highestBidBefore() {
+        var totalSum = 0
+        $('#ctrlpriceList tr').each(function() {
+            $(this).find('td:eq(4)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function highestBidAfter() {
+        var totalSum = 0
+        $('#ctrlpriceList tr').each(function() {
+            $(this).find('td:eq(5)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function highestBidAdjust() {
+        var totalSum = 0
+        $('#ctrlpriceList tr').each(function() {
+            $(this).find('td:eq(6)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    if(document.readyState=="complete"){
+        var constructionBudget = constructionBudget();
+        var highestBidBefore = highestBidBefore();
+        var highestBidAfter = highestBidAfter();
+        var highestBidAdjust = highestBidAdjust();
+
+        document.getElementById('constructionBudget').innerHTML=constructionBudget;
+        document.getElementById('highestBidBefore').innerHTML=highestBidBefore;
+        document.getElementById('highestBidAfter').innerHTML=highestBidAfter;
+        document.getElementById('highestBidAdjust').innerHTML=highestBidAdjust;
+
+    }
+</script>

+ 100 - 5
src/main/webapp/webpage/modules/workcontent/workContentInvestmentCostList.jsp

@@ -18,6 +18,10 @@
         var total=(parseFloat(examineAfterRestsCost) + parseFloat(examineAfterArchitectureCost)+parseFloat(examineAfterInstallCost)).toFixed(2);
         $("#investmentCostList"+index+"_examineCount").val(total);
 
+        updateSum("examineAfterRestsCost")
+        updateSum("examineAfterArchitectureCost")
+        updateSum("examineAfterInstallCost")
+        updateSum("examineCount")
         if(!isNumber(val))return;
 
         /*  var money = parseFloat((val + "").replace(/[^\d\.-]/g, "")).toFixed(2) + "";
@@ -30,6 +34,32 @@
           }
           $(obj).val(t.split("").reverse().join("") + "." + r);*/
     }
+
+    function beforeCostSum(obj,index) {
+        updateSum("caliberBudgetEstimateCost")
+        updateSum("examineBeforeCost")
+        updateSum("examineAdjustUnit")
+        updateSum("amount")
+        updateSum("money")
+    }
+
+    function updateSum(name) {
+        var totalSum = 0;
+        for(var i = 1; i<100; i++){
+            //判断是否是隐藏行,如果是隐藏行则不进行运算
+            if(!$("#investmentCostList"+i).is(":hidden")){
+                var reult = parseFloat($("#investmentCostList"+i+"_"+name).val());
+                if(!isNaN(reult)){
+                    totalSum += reult;
+                }
+            }
+        }
+        if(0 == totalSum){
+            document.getElementById(name).innerHTML='';
+        }else{
+            document.getElementById(name).innerHTML=totalSum.toFixed(2);;
+        }
+    }
 </script>
 <form id="subForm"  action="#" onsubmit="return false;" method="post" class="form-horizontal">
     <c:forEach items="${signList}" var="sign">
@@ -87,6 +117,8 @@
                 </thead>
                 <tbody id="investmentCostList">
                 </tbody>
+                <tfoot id="preliminaryFootList">
+                </tfoot>
             </table>
         </c:if>
     </c:forEach>
@@ -104,11 +136,12 @@
             <td>
                 <input id="investmentCostList{{idx}}_costName" subName="costName" value="{{row.costName}}" type="text" class="form-control contentDetail"/>
             </td>
+
             <td>
-                <input id="investmentCostList{{idx}}_caliberBudgetEstimateCost" subName="caliberBudgetEstimateCost" type="text" value="{{row.caliberBudgetEstimateCost}}"  class="form-control number contentDetail money"/>
+                <input id="investmentCostList{{idx}}_caliberBudgetEstimateCost" subName="caliberBudgetEstimateCost" type="text" value="{{row.caliberBudgetEstimateCost}}" onchange="beforeCostSum(this,{{idx}});" class="form-control number contentDetail"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_examineBeforeCost" subName="examineBeforeCost" type="text" value="{{row.examineBeforeCost}}"   class="form-control number contentDetail money"/>
+                <input id="investmentCostList{{idx}}_examineBeforeCost" subName="examineBeforeCost" type="text" value="{{row.examineBeforeCost}}"  onchange="beforeCostSum(this,{{idx}});" class="form-control number contentDetail money"/>
             </td>
             <td>
                 <input id="investmentCostList{{idx}}_examineAfterArchitectureCost" subName="examineAfterArchitectureCost" type="text" value="{{row.examineAfterArchitectureCost}}"  onchange="formatNumMoney(this,{{idx}});" class="form-control number contentDetail money"/>
@@ -123,14 +156,15 @@
                 <input id="investmentCostList{{idx}}_examineCount" subName="examineCount" type="text"  value="{{row.examineCount}}" readonly="readonly"  class="form-control number contentDetail"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_examineAdjustUnit" subName="examineAdjustUnit" type="text"  value="{{row.examineAdjustUnit}}" class="form-control number contentDetail"/>
+                <input id="investmentCostList{{idx}}_examineAdjustUnit" subName="examineAdjustUnit" type="text"  value="{{row.examineAdjustUnit}}" onchange="beforeCostSum(this,{{idx}});" class="form-control number contentDetail"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_amount" subName="amount" type="text"  value="{{row.amount}}" class="form-control number contentDetail"/>
+                <input id="investmentCostList{{idx}}_amount" subName="amount" type="text"  value="{{row.amount}}" onchange="beforeCostSum(this,{{idx}});" class="form-control number contentDetail"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_money" subName="money" type="text"  value="{{row.money}}" class="form-control number contentDetail"/>
+                <input id="investmentCostList{{idx}}_money" subName="money" type="text"  value="{{row.money}}" onchange="beforeCostSum(this,{{idx}});" class="form-control number contentDetail"/>
             </td>
+
             <td>
                 <input id="investmentCostList{{idx}}_cause" subName="cause" type="text"  value="{{row.cause}}" class="form-control  contentDetail"/>
             </td>
@@ -139,6 +173,51 @@
             </td>
         </tr>//-->
     </script>
+
+    <script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+
+            <td id="caliberBudgetEstimateCost">
+
+            </td>
+            <td id="examineBeforeCost">
+
+            </td>
+            <td id = "examineAfterArchitectureCost">
+
+            </td>
+            <td id="examineAfterInstallCost">
+
+            </td>
+            <td id="examineAfterRestsCost">
+
+            </td>
+            <td id="examineCount">
+
+            </td>
+            <td id="examineAdjustUnit">
+
+            </td>
+            <td id="amount">
+
+            </td>
+            <td id= "money">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td class="text-center op-td" style="text-align: center">
+
+            </td>
+        </tr>//-->
+    </script>
     <%--<script type="text/template" id="investmentCostTpl">//<!--
         <tr id="investmentCostList{{idx}}">
             <td class="hide">
@@ -215,7 +294,9 @@
         </tr>//-->
     </script>--%>
         <script type="text/javascript">
+            var recordInt = 0;
             var investmentCostIdx = 0, investmentCostTpl = $("#investmentCostTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+            var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
             var validateForm2;
             $(function(){
                 validateForm2 = $("#subForm").validate({
@@ -249,6 +330,10 @@
                 idx = idx+1;
                 bornTemplete(list, idx, tpl, row, idx);
                 investmentCostIdx +=1;
+                if(recordInt ==0){
+                    bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+                }
+                recordInt+=1;
             }
 
             function bornTemplete(list, idx, tpl, row, idx1){
@@ -278,6 +363,16 @@
                     delFlag.val("1");
                     $(obj).parent().parent().hide();
                 }
+
+                updateSum("examineAfterRestsCost")
+                updateSum("examineAfterArchitectureCost")
+                updateSum("examineAfterInstallCost")
+                updateSum("examineCount")
+                updateSum("caliberBudgetEstimateCost")
+                updateSum("examineBeforeCost")
+                updateSum("examineAdjustUnit")
+                updateSum("amount")
+                updateSum("money")
             }
 
             function genRow(data) {

+ 203 - 1
src/main/webapp/webpage/modules/workcontent/workContentInvestmentCostListView.jsp

@@ -99,7 +99,209 @@
                 </tr>
             </c:forEach>
             </tbody>
+            <tfoot id="preliminaryFootList">
+            </tfoot>
         </table>
     </c:if>
     </c:forEach>
-</form>
+</form>
+
+<script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+
+            <td id="caliberBudgetEstimateCost" style="text-align: center">
+
+            </td>
+            <td id="examineBeforeCost" style="text-align: center">
+
+            </td>
+            <td id = "examineAfterArchitectureCost" style="text-align: center">
+
+            </td>
+            <td id="examineAfterInstallCost" style="text-align: center">
+
+            </td>
+            <td id="examineAfterRestsCost" style="text-align: center">
+
+            </td>
+            <td id="examineCount" style="text-align: center">
+
+            </td>
+            <td id="examineAdjustUnit" style="text-align: center">
+
+            </td>
+            <td id="amount" style="text-align: center">
+
+            </td>
+            <td id= "money" style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+        </tr>//-->
+</script>
+
+<script type="text/javascript">
+    var recordInt = 0;
+    var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+    var validateForm2;
+    $(function(){
+        validateForm2 = $("#subForm").validate({
+            errorContainer: "#messageBox",
+            errorPlacement: function(error, element) {
+                $("#messageBox").text("输入有误,请先更正。");
+                if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    error.appendTo(element.parent().parent());
+                } else {
+                    error.insertAfter(element);
+                }
+            }
+        });
+        addRowCost('#preliminaryFootList', preliminaryFootIdx, preliminaryFootTpl,"");
+        $(":input.money").change();
+    })
+
+    function addRowCost(list, idx, tpl, row){
+        idx = idx+1;
+        if(recordInt ==0){
+            bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+        }
+        recordInt+=1;
+    }
+
+    function bornTemplete(list, idx, tpl, row, idx1){
+        var idx1 = $("#investmentCostList tr").length +1;
+        $(list).append(Mustache.render(tpl, {
+            idx: idx, delBtn: true, row: row,
+            order:idx1 + 1, idx1:idx1
+        }));
+        $(list+idx).find("select").each(function(){
+            $(this).val($(this).attr("data-value"));
+        });
+        $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+            var ss = $(this).attr("data-value").split(',');
+            for (var i=0; i<ss.length; i++){
+                if($(this).val() == ss[i]){
+                    $(this).attr("checked","checked");
+                }
+            }
+        });
+    }
+    function caliberBudgetEstimateCost() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(2)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function examineBeforeCost() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(3)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function examineAfterArchitectureCost() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(4)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function examineAfterInstallCost() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(5)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function examineAfterRestsCost() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(6)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function examineCount() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(7)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function examineAdjustUnit() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(8)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function amount() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(9)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function money() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(10)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    if(document.readyState=="complete"){
+        var caliberBudgetEstimateCost = caliberBudgetEstimateCost();
+        var examineBeforeCost = examineBeforeCost();
+        var examineAfterArchitectureCost = examineAfterArchitectureCost();
+        var examineAfterInstallCost = examineAfterInstallCost();
+        var examineAfterRestsCost = examineAfterRestsCost();
+        var examineCount = examineCount();
+        var examineAdjustUnit = examineAdjustUnit();
+        var amount = amount();
+        var money = money();
+        caliberBudgetEstimateCost = caliberBudgetEstimateCost.toFixed(2);
+        examineBeforeCost = examineBeforeCost.toFixed(2);
+        examineAfterArchitectureCost = examineAfterArchitectureCost.toFixed(2);
+        examineAfterInstallCost = examineAfterInstallCost.toFixed(2);
+        examineAfterRestsCost = examineAfterRestsCost.toFixed(2);
+        examineCount = examineCount.toFixed(2);
+        examineAdjustUnit = examineAdjustUnit.toFixed(2);
+        amount = amount.toFixed(2);
+        money = money.toFixed(2);
+        document.getElementById('caliberBudgetEstimateCost').innerHTML=caliberBudgetEstimateCost;
+        document.getElementById('examineBeforeCost').innerHTML=examineBeforeCost;
+        document.getElementById('examineAfterArchitectureCost').innerHTML=examineAfterArchitectureCost;
+        document.getElementById('examineAfterInstallCost').innerHTML=examineAfterInstallCost;
+        document.getElementById('examineAfterRestsCost').innerHTML=examineAfterRestsCost;
+        document.getElementById('examineCount').innerHTML=examineCount;
+        document.getElementById('examineAdjustUnit').innerHTML=examineAdjustUnit;
+        document.getElementById('amount').innerHTML=amount;
+        document.getElementById('money').innerHTML=money;
+    }
+</script>

+ 65 - 2
src/main/webapp/webpage/modules/workcontent/workDesignChangeList.jsp

@@ -1,5 +1,29 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
 <%@ include file="/webpage/include/taglib.jsp"%>
+<script type="text/javascript">
+    function beforeCostSum(obj,index) {
+        updateSum("sendMoney")
+        updateSum("confirmMoney")
+    }
+
+    function updateSum(name) {
+        var totalSum = 0;
+        for(var i = 1; i<100; i++){
+            //判断是否是隐藏行,如果是隐藏行则不进行运算
+            if(!$("#investmentCostList"+i).is(":hidden")){
+                var reult = parseFloat($("#investmentCostList"+i+"_"+name).val());
+                if(!isNaN(reult)){
+                    totalSum += reult;
+                }
+            }
+        }
+        if(0 == totalSum){
+            document.getElementById(name).innerHTML='';
+        }else{
+            document.getElementById(name).innerHTML=totalSum.toFixed(2);;
+        }
+    }
+</script>
 
 <form id="subForm"  action="#" onsubmit="return false;" method="post" class="form-horizontal">
     <div class="layui-item nav-btns" style="padding-left:0px;">
@@ -26,6 +50,8 @@
         </thead>
         <tbody id="investmentCostList">
         </tbody>
+        <tfoot id="preliminaryFootList">
+        </tfoot>
     </table>
 	<script type="text/template" id="investmentCostTpl">//<!--
         <tr id="investmentCostList{{idx}}">
@@ -48,21 +74,52 @@
                 <input id="investmentCostList{{idx}}_content" subName="content" type="text" value="{{row.content}}"   class="form-control contentDetail"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_sendMoney" subName="sendMoney" type="text" value="{{row.sendMoney}}"   class="form-control required contentDetail"/>
+                <input id="investmentCostList{{idx}}_sendMoney" subName="sendMoney" onchange="beforeCostSum(this,{{idx}});" type="text" value="{{row.sendMoney}}"   class="form-control number money required contentDetail"/>
             </td>
             <td>
                 <input id="investmentCostList{{idx}}_procedure" subName="procedure" type="text"  value="{{row.procedure}}"  class="form-control required contentDetail"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_confirmMoney" subName="confirmMoney" type="text"    value="{{row.confirmMoney}}"  class="form-control required contentDetail"/>
+                <input id="investmentCostList{{idx}}_confirmMoney" subName="confirmMoney" onchange="beforeCostSum(this,{{idx}});" type="text"    value="{{row.confirmMoney}}"  class="form-control number money required contentDetail"/>
             </td>
             <td class="text-center op-td">
                         <a href="#" onclick="delRow(this, '#investmentCostList{{idx}}')"   class="op-btn op-btn-delete"><i class="fa fa-trash"></i>取消</a>
             </td>
         </tr>//-->
     </script>
+
+    <script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="sendMoney">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="confirmMoney">
+
+            </td>
+            <td class="text-center op-td" style="text-align: center">
+
+            </td>
+        </tr>//-->
+    </script>
     <script type="text/javascript">
+        var recordInt = 0;
         var investmentCostIdx = 0, investmentCostTpl = $("#investmentCostTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+        var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
         var validateForm2;
         $(function(){
             validateForm2 = $("#subForm").validate({
@@ -90,6 +147,10 @@
             idx = idx+1;
             bornTemplete(list, idx, tpl, row, idx);
             investmentCostIdx +=1;
+            if(recordInt ==0){
+                bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+            }
+            recordInt+=1;
         }
 
         function bornTemplete(list, idx, tpl, row, idx1){
@@ -126,6 +187,8 @@
                 delFlag.val("1");
                 $(obj).parent().parent().hide();
             }
+            updateSum("sendMoney")
+            updateSum("confirmMoney")
         }
 
         function genRow(data) {

+ 103 - 1
src/main/webapp/webpage/modules/workcontent/workDesignChangeListView.jsp

@@ -45,5 +45,107 @@
                 </tr>
             </c:forEach>
         </tbody>
+        <tfoot id="preliminaryFootList">
+        </tfoot>
     </table>
-</form>
+</form>
+
+<script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="sendMoney" style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="confirmMoney" style="text-align: center">
+
+            </td>
+        </tr>//-->
+</script>
+
+<script type="text/javascript">
+    var recordInt = 0;
+    var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+    var validateForm2;
+    $(function(){
+        validateForm2 = $("#subForm").validate({
+            errorContainer: "#messageBox",
+            errorPlacement: function(error, element) {
+                $("#messageBox").text("输入有误,请先更正。");
+                if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    error.appendTo(element.parent().parent());
+                } else {
+                    error.insertAfter(element);
+                }
+            }
+        });
+        addRowCost('#preliminaryFootList', preliminaryFootIdx, preliminaryFootTpl,"");
+        $(":input.money").change();
+    })
+
+    function addRowCost(list, idx, tpl, row){
+        idx = idx+1;
+        if(recordInt ==0){
+            bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+        }
+        recordInt+=1;
+    }
+
+    function bornTemplete(list, idx, tpl, row, idx1){
+        var idx1 = $("#investmentCostList tr").length +1;
+        $(list).append(Mustache.render(tpl, {
+            idx: idx, delBtn: true, row: row,
+            order:idx1 + 1, idx1:idx1
+        }));
+        $(list+idx).find("select").each(function(){
+            $(this).val($(this).attr("data-value"));
+        });
+        $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+            var ss = $(this).attr("data-value").split(',');
+            for (var i=0; i<ss.length; i++){
+                if($(this).val() == ss[i]){
+                    $(this).attr("checked","checked");
+                }
+            }
+        });
+    }
+    function sendMoney() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(4)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function confirmMoney() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(6)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    if(document.readyState=="complete"){
+        var sendMoney = sendMoney();
+        var confirmMoney = confirmMoney();
+
+        document.getElementById('sendMoney').innerHTML=sendMoney;
+        document.getElementById('confirmMoney').innerHTML=confirmMoney;
+
+    }
+</script>

+ 74 - 4
src/main/webapp/webpage/modules/workcontent/workFiveDirectionsAffirmList.jsp

@@ -1,5 +1,31 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
 <%@ include file="/webpage/include/taglib.jsp"%>
+<script type="text/javascript">
+    function beforeCostSum(obj,index) {
+        updateSum("ownerTenderNum")
+        updateSum("designAffirmTotal")
+        updateSum("roadworkDemandDosage")
+        updateSum("consultAuditTotal")
+    }
+
+    function updateSum(name) {
+        var totalSum = 0;
+        for(var i = 1; i<100; i++){
+            //判断是否是隐藏行,如果是隐藏行则不进行运算
+            if(!$("#fiveDirectionsAffirmList"+i).is(":hidden")){
+                var reult = parseFloat($("#fiveDirectionsAffirmList"+i+"_"+name).val());
+                if(!isNaN(reult)){
+                    totalSum += reult;
+                }
+            }
+        }
+        if(0 == totalSum){
+            document.getElementById(name).innerHTML='';
+        }else{
+            document.getElementById(name).innerHTML=totalSum.toFixed(2);;
+        }
+    }
+</script>
 <form id="subForm"  action="#" onsubmit="return false;" method="post" class="form-horizontal">
     <c:forEach items="${signList}" var="sign">
         <c:if test="${sign =='fiveDirectionsAffirm'}">
@@ -49,6 +75,8 @@
                 </thead>
                 <tbody id="fiveDirectionsAffirmList">
                 </tbody>
+                <tfoot id="preliminaryFootList">
+                </tfoot>
             </table>
         </c:if>
     </c:forEach>
@@ -77,7 +105,7 @@
                 <input id="fiveDirectionsAffirmList{{idx}}_ownerUnits" subName="ownerUnits" type="text" value="{{row.ownerUnits}}" class="form-control contentDetail"/>
             </td>
             <td title="{{row.ownerTenderNum}}">
-                <input id="fiveDirectionsAffirmList{{idx}}_ownerTenderNum" subName="ownerTenderNum" type="text"  value="{{row.ownerTenderNum}}" class="form-control contentDetail"/>
+                <input id="fiveDirectionsAffirmList{{idx}}_ownerTenderNum" subName="ownerTenderNum"  onchange="beforeCostSum(this,{{idx}});" type="text"  value="{{row.ownerTenderNum}}" class="form-control number money required contentDetail"/>
             </td>
 
             <td title="{{row.designMaterialName}}">
@@ -90,7 +118,7 @@
                 <input id="fiveDirectionsAffirmList{{idx}}_designAttritionRate" subName="designAttritionRate" type="text"  value="{{row.designAttritionRate}}" class="form-control contentDetail"/>
             </td>
             <td title="{{row.designAffirmTotal}}">
-                <input id="fiveDirectionsAffirmList{{idx}}_designAffirmTotal" subName="designAffirmTotal" type="text"  value="{{row.designAffirmTotal}}" class="form-control contentDetail"/>
+                <input id="fiveDirectionsAffirmList{{idx}}_designAffirmTotal" subName="designAffirmTotal" onchange="beforeCostSum(this,{{idx}});" type="text"  value="{{row.designAffirmTotal}}" class="form-control number money required contentDetail"/>
             </td>
             <td title="{{row.designRemarks}}">
                 <input id="fiveDirectionsAffirmList{{idx}}_designRemarks" subName="designRemarks" type="text"  value="{{row.designRemarks}}" class="form-control contentDetail"/>
@@ -103,7 +131,7 @@
                 <input id="fiveDirectionsAffirmList{{idx}}_roadworkAttritionRate" subName="roadworkAttritionRate" type="text"  value="{{row.roadworkAttritionRate}}" class="form-control contentDetail"/>
             </td>
             <td title="{{row.roadworkDemandDosage}}">
-                <input id="fiveDirectionsAffirmList{{idx}}_roadworkDemandDosage" subName="roadworkDemandDosage" type="text"  value="{{row.roadworkDemandDosage}}" class="form-control  contentDetail"/>
+                <input id="fiveDirectionsAffirmList{{idx}}_roadworkDemandDosage" subName="roadworkDemandDosage" onchange="beforeCostSum(this,{{idx}});" type="text"  value="{{row.roadworkDemandDosage}}" class="form-control number money required contentDetail"/>
             </td>
             <td title="{{row.roadworkDemandDateStr}}">
                 <input lay-verify="date" placeholder="yyyy-MM-dd" id="fiveDirectionsAffirmList{{idx}}_roadworkDemandDate" subName="roadworkDemandDate" type="text" value="{{row.roadworkDemandDateStr}}"  class="form-control contentDetail"/>
@@ -119,7 +147,7 @@
                 <input id="fiveDirectionsAffirmList{{idx}}_consultAttritionRate" subName="consultAttritionRate" type="text"  value="{{row.consultAttritionRate}}" class="form-control  contentDetail"/>
             </td>
             <td title="{{row.consultAuditTotal}}">
-                <input id="fiveDirectionsAffirmList{{idx}}_consultAuditTotal" subName="consultAuditTotal" type="text"  value="{{row.consultAuditTotal}}" class="form-control  contentDetail"/>
+                <input id="fiveDirectionsAffirmList{{idx}}_consultAuditTotal" subName="consultAuditTotal" onchange="beforeCostSum(this,{{idx}});" type="text"  value="{{row.consultAuditTotal}}" class="form-control number money required contentDetail"/>
             </td>
             <td title="{{row.consultRemarks}}">
                 <input id="fiveDirectionsAffirmList{{idx}}_consultRemarks" subName="consultRemarks" type="text"  value="{{row.consultRemarks}}" class="form-control  contentDetail"/>
@@ -130,8 +158,42 @@
             </td>
         </tr>//-->
     </script>
+
+    <script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td id="ownerTenderNum"></td>
+
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td id="designAffirmTotal"></td>
+
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td id="roadworkDemandDosage"></td>
+
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td id="consultAuditTotal"></td>
+            <td style="text-align: center"></td>
+            <td class="text-center op-td" style="text-align: center"></td>
+        </tr>//-->
+    </script>
+
     <script type="text/javascript">
+        var recordInt = 0;
         var preliminaryIdx = 0, preliminaryTpl = $("#preliminaryTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+        var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
         var validateForm2;
         $(function(){
             validateForm2 = $("#subForm").validate({
@@ -160,6 +222,10 @@
             idx = idx+1;
             bornTemplete(list, idx, tpl, row, idx);
             preliminaryIdx +=1;
+            if(recordInt ==0){
+                bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+            }
+            recordInt+=1;
 
             laydate.render({
                 elem : (list+idx+"_roadworkDemandDate"),
@@ -196,6 +262,10 @@
                 delFlag.val("1");
                 $(obj).parent().parent().hide();
             }
+            updateSum("ownerTenderNum")
+            updateSum("designAffirmTotal")
+            updateSum("roadworkDemandDosage")
+            updateSum("consultAuditTotal")
         }
 
         function genRow(data) {

+ 134 - 2
src/main/webapp/webpage/modules/workcontent/workFiveDirectionsAffirmListView.jsp

@@ -1,9 +1,10 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
 <%@ include file="/webpage/include/taglib.jsp"%>
+
 <form id="subForm"  action="#" onsubmit="return false;" method="post" class="form-horizontal">
     <c:forEach items="${signList}" var="sign">
         <c:if test="${sign =='fiveDirectionsAffirm'}">
-            <table id="contentTable" class="table table-bordered table-condensed">
+            <table id="contentTable" class="table table-bordered table-condensed can-edit">
                 <thead>
                 <tr>
                     <th colspan="20" style="font-size: 20px">输变电工程甲供物资五方确认表</th>
@@ -112,7 +113,138 @@
                     </tr>
                 </c:forEach>
                 </tbody>
+                <tfoot id="preliminaryFootList">
+                </tfoot>
             </table>
         </c:if>
     </c:forEach>
-</form>
+</form>
+
+<script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="preliminaryList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            </td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td id="ownerTenderNum" style="text-align: center"></td>
+
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td id="designAffirmTotal" style="text-align: center"></td>
+
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td id="roadworkDemandDosage" style="text-align: center"></td>
+
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td style="text-align: center"></td>
+            <td id="consultAuditTotal" style="text-align: center"></td>
+            <td style="text-align: center"></td>
+        </tr>//-->
+</script>
+
+
+<script type="text/javascript">
+    var recordInt = 0;
+    var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+    var validateForm2;
+    $(function(){
+        validateForm2 = $("#subForm").validate({
+            errorContainer: "#messageBox",
+            errorPlacement: function(error, element) {
+                $("#messageBox").text("输入有误,请先更正。");
+                if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    error.appendTo(element.parent().parent());
+                } else {
+                    error.insertAfter(element);
+                }
+            }
+        });
+        addRowCost('#preliminaryFootList', preliminaryFootIdx, preliminaryFootTpl,"");
+        $(":input.money").change();
+    })
+
+    function addRowCost(list, idx, tpl, row){
+        idx = idx+1;
+        if(recordInt ==0){
+            bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+        }
+        recordInt+=1;
+    }
+
+    function bornTemplete(list, idx, tpl, row, idx1){
+        var idx1 = $("#preliminaryList tr").length +1;
+        $(list).append(Mustache.render(tpl, {
+            idx: idx, delBtn: true, row: row,
+            order:idx1 + 1, idx1:idx1
+        }));
+        $(list+idx).find("select").each(function(){
+            $(this).val($(this).attr("data-value"));
+        });
+        $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+            var ss = $(this).attr("data-value").split(',');
+            for (var i=0; i<ss.length; i++){
+                if($(this).val() == ss[i]){
+                    $(this).attr("checked","checked");
+                }
+            }
+        });
+    }
+
+    function ownerTenderNum() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(5)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function designAffirmTotal() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(9)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function roadworkDemandDosage() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(13)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function consultAuditTotal() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(18)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    if(document.readyState=="complete"){
+        var ownerTenderNum = ownerTenderNum();
+        var designAffirmTotal = designAffirmTotal();
+        var roadworkDemandDosage = roadworkDemandDosage();
+        var consultAuditTotal = consultAuditTotal();
+
+        document.getElementById('ownerTenderNum').innerHTML=ownerTenderNum;
+        document.getElementById('designAffirmTotal').innerHTML=designAffirmTotal;
+        document.getElementById('roadworkDemandDosage').innerHTML=roadworkDemandDosage;
+        document.getElementById('consultAuditTotal').innerHTML=consultAuditTotal;
+
+    }
+</script>

+ 105 - 7
src/main/webapp/webpage/modules/workcontent/workPreliminaryDesignEstimateList.jsp

@@ -17,7 +17,10 @@
         }
         var total=(parseFloat(jiananAfterArchitectureCost) + parseFloat(jiananAfterInstallCost)+parseFloat(jiananAfterOtherCost)).toFixed(2);
         $("#preliminaryList"+index+"_jiananAfterTotalCost").val(total);
-
+        updateSum("jiananAfterArchitectureCost")
+        updateSum("jiananAfterInstallCost")
+        updateSum("jiananAfterOtherCost")
+        updateSum("jiananAfterTotalCost")
         if(!isNumber(val))return;
     }
     function formatOtherNumMoney(obj,index) {
@@ -37,8 +40,35 @@
         var total=(parseFloat(otherAfterArchitectureCost) + parseFloat(otherAfterClearCost)+parseFloat(otherAfterOtherCost)).toFixed(2);
         $("#preliminaryList"+index+"_otherAfterTotalCost").val(total);
 
+        updateSum("otherAfterArchitectureCost")
+        updateSum("otherAfterClearCost")
+        updateSum("otherAfterOtherCost")
+        updateSum("otherAfterTotalCost")
         if(!isNumber(val))return;
     }
+
+    function beforeCost(obj,index) {
+        updateSum("otherBeforeCost")
+        updateSum("jiananBeforeCost")
+    }
+
+    function updateSum(name) {
+        var totalSum = 0;
+        for(var i = 1; i<100; i++){
+            //判断是否是隐藏行,如果是隐藏行则不进行运算
+            if(!$("#preliminaryList"+i).is(":hidden")){
+                var reult = parseFloat($("#preliminaryList"+i+"_"+name).val());
+                if(!isNaN(reult)){
+                    totalSum += reult;
+                }
+            }
+        }
+        if(0 == totalSum){
+            document.getElementById(name).innerHTML='';
+        }else{
+            document.getElementById(name).innerHTML=totalSum.toFixed(2);;
+        }
+    }
 </script>
 <form id="subForm"  action="#" onsubmit="return false;" method="post" class="form-horizontal">
     <c:forEach items="${signList}" var="sign">
@@ -82,6 +112,8 @@
                 </thead>
                 <tbody id="preliminaryList">
                 </tbody>
+                <tfoot id="preliminaryFootList">
+                </tfoot>
             </table>
         </c:if>
     </c:forEach>
@@ -100,10 +132,10 @@
                 <input id="preliminaryList{{idx}}_costName" subName="costName" value="{{row.costName}}" type="text" class="form-control contentDetail"/>
             </td>
             <td>
-                <input id="preliminaryList{{idx}}_jiananBeforeCost" subName="jiananBeforeCost" type="text" value="{{row.jiananBeforeCost}}"  class="form-control number contentDetail money"/>
+                <input id="preliminaryList{{idx}}_jiananBeforeCost" subName="jiananBeforeCost" onchange="beforeCost(this,{{idx}});" type="text" value="{{row.jiananBeforeCost}}"  class="form-control number contentDetail money"/>
             </td>
             <td>
-                <input id="preliminaryList{{idx}}_jiananAfterArchitectureCost" subName="jiananAfterArchitectureCost" type="text" value="{{row.jiananAfterArchitectureCost}}"   onchange="formatJiananNumMoney(this,{{idx}});" class="form-control number contentDetail money"/>
+                <input id="preliminaryList{{idx}}_jiananAfterArchitectureCost" subName="jiananAfterArchitectureCost" type="text"  value="{{row.jiananAfterArchitectureCost}}"   onchange="formatJiananNumMoney(this,{{idx}});" class="form-control number contentDetail money"/>
             </td>
             <td>
                 <input id="preliminaryList{{idx}}_jiananAfterInstallCost" subName="jiananAfterInstallCost" type="text" value="{{row.jiananAfterInstallCost}}"  onchange="formatJiananNumMoney(this,{{idx}});"  class="form-control number contentDetail money"/>
@@ -118,16 +150,16 @@
                 <input id="preliminaryList{{idx}}_jiananRemark" subName="jiananRemark" type="text"  value="{{row.jiananRemark}}" class="form-control contentDetail"/>
             </td>
             <td>
-                <input id="preliminaryList{{idx}}_otherBeforeCost" subName="otherBeforeCost" type="text"  value="{{row.otherBeforeCost}}" class="form-control number contentDetail"/>
+                <input id="preliminaryList{{idx}}_otherBeforeCost" subName="otherBeforeCost" type="text"  onchange="beforeCost(this,{{idx}});"  value="{{row.otherBeforeCost}}" class="form-control number contentDetail"/>
             </td>
             <td>
-                <input id="preliminaryList{{idx}}_otherAfterArchitectureCost" subName="otherAfterArchitectureCost" type="text"  value="{{row.otherAfterArchitectureCost}}" onchange="formatOtherNumMoney(this,{{idx}});" class="form-control number contentDetail"/>
+                <input id="preliminaryList{{idx}}_otherAfterArchitectureCost" subName="otherAfterArchitectureCost" type="text"  value="{{row.otherAfterArchitectureCost}}" onchange="formatOtherNumMoney(this,{{idx}});" class="form-control number contentDetail money"/>
             </td>
             <td>
-                <input id="preliminaryList{{idx}}_otherAfterClearCost" subName="otherAfterClearCost" type="text"  value="{{row.otherAfterClearCost}}" onchange="formatOtherNumMoney(this,{{idx}});" class="form-control number contentDetail"/>
+                <input id="preliminaryList{{idx}}_otherAfterClearCost" subName="otherAfterClearCost" type="text"  value="{{row.otherAfterClearCost}}" onchange="formatOtherNumMoney(this,{{idx}});" class="form-control number contentDetail money"/>
             </td>
             <td>
-                <input id="preliminaryList{{idx}}_otherAfterOtherCost" subName="otherAfterOtherCost" type="text"  value="{{row.otherAfterOtherCost}}" onchange="formatOtherNumMoney(this,{{idx}});" class="form-control  contentDetail"/>
+                <input id="preliminaryList{{idx}}_otherAfterOtherCost" subName="otherAfterOtherCost" type="text"  value="{{row.otherAfterOtherCost}}" onchange="formatOtherNumMoney(this,{{idx}});" class="form-control  contentDetail money"/>
             </td>
             <td>
                 <input id="preliminaryList{{idx}}_otherAfterTotalCost" readonly="readonly" subName="otherAfterTotalCost" type="text"  value="{{row.otherAfterTotalCost}}" class="form-control  contentDetail"/>
@@ -140,8 +172,59 @@
             </td>
         </tr>//-->
     </script>
+
+    <script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="preliminaryFootList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="jiananBeforeCost">
+
+            </td>
+            <td id="jiananAfterArchitectureCost">
+
+            </td>
+            <td id="jiananAfterInstallCost">
+
+            </td>
+            <td id = "jiananAfterOtherCost">
+
+            </td>
+            <td id="jiananAfterTotalCost">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="otherBeforeCost">
+
+            </td>
+            <td id="otherAfterArchitectureCost">
+
+            </td>
+            <td id= "otherAfterClearCost">
+
+            </td>
+            <td id="otherAfterOtherCost">
+            </td>
+            <td id="otherAfterTotalCost">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td class="text-center op-td" style="text-align: center">
+
+            </td>
+        </tr>//-->
+    </script>
     <script type="text/javascript">
+        var recordInt = 0;
         var preliminaryIdx = 0, preliminaryTpl = $("#preliminaryTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+        var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
         var validateForm2;
         $(function(){
             validateForm2 = $("#subForm").validate({
@@ -170,6 +253,10 @@
             idx = idx+1;
             bornTemplete(list, idx, tpl, row, idx);
             preliminaryIdx +=1;
+            if(recordInt ==0){
+                bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+            }
+            recordInt+=1;
         }
 
         function bornTemplete(list, idx, tpl, row, idx1){
@@ -199,6 +286,17 @@
                 delFlag.val("1");
                 $(obj).parent().parent().hide();
             }
+
+            updateSum("jiananAfterArchitectureCost")
+            updateSum("jiananAfterInstallCost")
+            updateSum("jiananAfterOtherCost")
+            updateSum("jiananAfterTotalCost")
+            updateSum("otherAfterArchitectureCost")
+            updateSum("otherAfterClearCost")
+            updateSum("otherAfterOtherCost")
+            updateSum("otherAfterTotalCost")
+            updateSum("otherBeforeCost")
+            updateSum("jiananBeforeCost")
         }
 
         function genRow(data) {

+ 226 - 1
src/main/webapp/webpage/modules/workcontent/workPreliminaryDesignEstimateListView.jsp

@@ -82,7 +82,232 @@
                     </tr>
                 </c:forEach>
                 </tbody>
+                <tfoot id="preliminaryFootList">
+                </tfoot>
             </table>
         </c:if>
     </c:forEach>
-</form>
+</form>
+
+<script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="preliminaryFootList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="jiananBeforeCost" style='text-align:center;'>
+
+            </td>
+            <td id="jiananAfterArchitectureCost" style='text-align:center;'>
+
+            </td>
+            <td id="jiananAfterInstallCost" style='text-align:center;'>
+
+            </td>
+            <td id = "jiananAfterOtherCost" style='text-align:center;'>
+
+            </td>
+            <td id="jiananAfterTotalCost" style='text-align:center;'>
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="otherBeforeCost" style='text-align:center;'>
+
+            </td>
+            <td id="otherAfterArchitectureCost" style='text-align:center;'>
+
+            </td>
+            <td id= "otherAfterClearCost" style='text-align:center;'>
+
+            </td>
+            <td id="otherAfterOtherCost" style='text-align:center;'>
+            </td>
+            <td id="otherAfterTotalCost" style='text-align:center;'>
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+        </tr>//-->
+</script>
+
+<script type="text/javascript">
+    var recordInt = 0;
+    var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+    var validateForm2;
+    $(function(){
+        validateForm2 = $("#subForm").validate({
+            errorContainer: "#messageBox",
+            errorPlacement: function(error, element) {
+                $("#messageBox").text("输入有误,请先更正。");
+                if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    error.appendTo(element.parent().parent());
+                } else {
+                    error.insertAfter(element);
+                }
+            }
+        });
+        addRowCost('#preliminaryFootList', preliminaryFootIdx, preliminaryFootTpl,"");
+        $(":input.money").change();
+    })
+
+    function addRowCost(list, idx, tpl, row){
+        idx = idx+1;
+        if(recordInt ==0){
+            bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+        }
+        recordInt+=1;
+    }
+
+    function bornTemplete(list, idx, tpl, row, idx1){
+        var idx1 = $("#preliminaryList tr").length +1;
+        $(list).append(Mustache.render(tpl, {
+            idx: idx, delBtn: true, row: row,
+            order:idx1 + 1, idx1:idx1
+        }));
+        $(list+idx).find("select").each(function(){
+            $(this).val($(this).attr("data-value"));
+        });
+        $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+            var ss = $(this).attr("data-value").split(',');
+            for (var i=0; i<ss.length; i++){
+                if($(this).val() == ss[i]){
+                    $(this).attr("checked","checked");
+                }
+            }
+        });
+    }
+
+    function jiananBeforeCost() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(2)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function jiananAfterArchitectureCost() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(3)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function jiananAfterInstallCost() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(4)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function jiananAfterOtherCost() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(5)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function jiananAfterTotalCost() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(6)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+
+    function otherBeforeCost() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(8)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function otherAfterArchitectureCost() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(9)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function otherAfterClearCost() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(10)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function otherAfterOtherCost() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(11)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    function otherAfterTotalCost() {
+        var totalSum = 0
+        $('#preliminaryList tr').each(function() {
+            $(this).find('td:eq(12)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum;
+    }
+    if(document.readyState=="complete"){
+        var jiananBeforeCost = jiananBeforeCost();
+        var jiananAfterArchitectureCost = jiananAfterArchitectureCost();
+        var jiananAfterInstallCost = jiananAfterInstallCost();
+        var jiananAfterOtherCost = jiananAfterOtherCost();
+        var jiananAfterTotalCost = jiananAfterTotalCost();
+
+        var otherBeforeCost = otherBeforeCost();
+        var otherAfterArchitectureCost = otherAfterArchitectureCost();
+        var otherAfterClearCost = otherAfterClearCost();
+        var otherAfterOtherCost = otherAfterOtherCost();
+        var otherAfterTotalCost = otherAfterTotalCost();
+
+        jiananBeforeCost = jiananBeforeCost.toFixed(2);
+        jiananAfterArchitectureCost = jiananAfterArchitectureCost.toFixed(2);
+        jiananAfterInstallCost = jiananAfterInstallCost.toFixed(2);
+        jiananAfterOtherCost = jiananAfterOtherCost.toFixed(2);
+        jiananAfterTotalCost = jiananAfterTotalCost.toFixed(2);
+
+        otherBeforeCost = otherBeforeCost.toFixed(2);
+        otherAfterArchitectureCost = otherAfterArchitectureCost.toFixed(2);
+        otherAfterClearCost = otherAfterClearCost.toFixed(2);
+        otherAfterOtherCost = otherAfterOtherCost.toFixed(2);
+        otherAfterTotalCost = otherAfterTotalCost.toFixed(2);
+
+        document.getElementById('jiananBeforeCost').innerHTML=jiananBeforeCost;
+        document.getElementById('jiananAfterArchitectureCost').innerHTML=jiananAfterArchitectureCost;
+        document.getElementById('jiananAfterInstallCost').innerHTML=jiananAfterInstallCost;
+        document.getElementById('jiananAfterOtherCost').innerHTML=jiananAfterOtherCost;
+        document.getElementById('jiananAfterTotalCost').innerHTML=jiananAfterTotalCost;
+
+        document.getElementById('otherBeforeCost').innerHTML=otherBeforeCost;
+        document.getElementById('otherAfterArchitectureCost').innerHTML=otherAfterArchitectureCost;
+        document.getElementById('otherAfterClearCost').innerHTML=otherAfterClearCost;
+        document.getElementById('otherAfterOtherCost').innerHTML=otherAfterOtherCost;
+        document.getElementById('otherAfterTotalCost').innerHTML=otherAfterTotalCost;
+    }
+</script>

+ 64 - 2
src/main/webapp/webpage/modules/workcontent/workSiteVisaList.jsp

@@ -1,6 +1,29 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
 <%@ include file="/webpage/include/taglib.jsp"%>
+<script type="text/javascript">
+    function beforeCostSum(obj,index) {
+        updateSum("sendMoney")
+        updateSum("confirmMoney")
+    }
 
+    function updateSum(name) {
+        var totalSum = 0;
+        for(var i = 1; i<100; i++){
+            //判断是否是隐藏行,如果是隐藏行则不进行运算
+            if(!$("#investmentCostList"+i).is(":hidden")){
+                var reult = parseFloat($("#investmentCostList"+i+"_"+name).val());
+                if(!isNaN(reult)){
+                    totalSum += reult;
+                }
+            }
+        }
+        if(0 == totalSum){
+            document.getElementById(name).innerHTML='';
+        }else{
+            document.getElementById(name).innerHTML=totalSum.toFixed(2);;
+        }
+    }
+</script>
 <form id="subForm"  action="#" onsubmit="return false;" method="post" class="form-horizontal">
     <div class="layui-item nav-btns" style="padding-left:0px;">
         <a class="nav-btn nav-btn-add" onclick="addRowCost('#investmentCostList',investmentCostIdx,investmentCostTpl)" title="新增"><i class="fa fa-plus"></i> 新增</a>
@@ -26,6 +49,8 @@
         </thead>
         <tbody id="investmentCostList">
         </tbody>
+        <tfoot id="preliminaryFootList">
+        </tfoot>
     </table>
 	<script type="text/template" id="investmentCostTpl">//<!--
         <tr id="investmentCostList{{idx}}">
@@ -48,21 +73,52 @@
                 <input id="investmentCostList{{idx}}_content" subName="content" type="text" value="{{row.content}}"   class="form-control contentDetail"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_sendMoney" subName="sendMoney" type="text" value="{{row.sendMoney}}"   class="form-control number required contentDetail"/>
+                <input id="investmentCostList{{idx}}_sendMoney" subName="sendMoney" onchange="beforeCostSum(this,{{idx}});" type="text" value="{{row.sendMoney}}"   class="form-control number money required contentDetail"/>
             </td>
             <td>
                 <input id="investmentCostList{{idx}}_procedure" subName="procedure" type="text"  value="{{row.procedure}}"  class="form-control required contentDetail"/>
             </td>
             <td>
-                <input id="investmentCostList{{idx}}_confirmMoney" subName="confirmMoney" type="text"    value="{{row.confirmMoney}}"  class="form-control number required contentDetail"/>
+                <input id="investmentCostList{{idx}}_confirmMoney" subName="confirmMoney" onchange="beforeCostSum(this,{{idx}});" type="text"    value="{{row.confirmMoney}}"  class="form-control number money required contentDetail"/>
             </td>
             <td class="text-center op-td">
                         <a href="#" onclick="delRow(this, '#investmentCostList{{idx}}')"   class="op-btn op-btn-delete"><i class="fa fa-trash"></i>取消</a>
             </td>
         </tr>//-->
     </script>
+
+    <script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="sendMoney">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="confirmMoney">
+
+            </td>
+            <td class="text-center op-td" style="text-align: center">
+
+            </td>
+        </tr>//-->
+    </script>
     <script type="text/javascript">
+        var recordInt = 0;
         var investmentCostIdx = 0, investmentCostTpl = $("#investmentCostTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+        var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
         var validateForm2;
         $(function(){
             validateForm2 = $("#subForm").validate({
@@ -95,6 +151,10 @@
             idx = idx+1;
             bornTemplete(list, idx, tpl, row, idx);
             investmentCostIdx +=1;
+            if(recordInt ==0){
+                bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+            }
+            recordInt+=1;
         }
 
         function bornTemplete(list, idx, tpl, row, idx1){
@@ -130,6 +190,8 @@
                 delFlag.val("1");
                 $(obj).parent().parent().hide();
             }
+            updateSum("sendMoney")
+            updateSum("confirmMoney")
         }
 
         function genRow(data) {

+ 103 - 1
src/main/webapp/webpage/modules/workcontent/workSiteVisaListView.jsp

@@ -45,5 +45,107 @@
                 </tr>
             </c:forEach>
         </tbody>
+        <tfoot id="preliminaryFootList">
+        </tfoot>
     </table>
-</form>
+</form>
+
+<script type="text/template" id="preliminaryFootTpl">//<!--
+        <tr id="investmentCostList{{idx}}">
+            <td style="text-align: center">
+                合计
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="sendMoney" style="text-align: center">
+
+            </td>
+            <td style="text-align: center">
+
+            </td>
+            <td id="confirmMoney" style="text-align: center">
+
+            </td>
+        </tr>//-->
+</script>
+
+<script type="text/javascript">
+    var recordInt = 0;
+    var preliminaryFootIdx = 0, preliminaryFootTpl = $("#preliminaryFootTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
+    var validateForm2;
+    $(function(){
+        validateForm2 = $("#subForm").validate({
+            errorContainer: "#messageBox",
+            errorPlacement: function(error, element) {
+                $("#messageBox").text("输入有误,请先更正。");
+                if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    error.appendTo(element.parent().parent());
+                } else {
+                    error.insertAfter(element);
+                }
+            }
+        });
+        addRowCost('#preliminaryFootList', preliminaryFootIdx, preliminaryFootTpl,"");
+        $(":input.money").change();
+    })
+
+    function addRowCost(list, idx, tpl, row){
+        idx = idx+1;
+        if(recordInt ==0){
+            bornTemplete('#preliminaryFootList',preliminaryFootIdx,preliminaryFootTpl, row, idx);
+        }
+        recordInt+=1;
+    }
+
+    function bornTemplete(list, idx, tpl, row, idx1){
+        var idx1 = $("#investmentCostList tr").length +1;
+        $(list).append(Mustache.render(tpl, {
+            idx: idx, delBtn: true, row: row,
+            order:idx1 + 1, idx1:idx1
+        }));
+        $(list+idx).find("select").each(function(){
+            $(this).val($(this).attr("data-value"));
+        });
+        $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+            var ss = $(this).attr("data-value").split(',');
+            for (var i=0; i<ss.length; i++){
+                if($(this).val() == ss[i]){
+                    $(this).attr("checked","checked");
+                }
+            }
+        });
+    }
+    function sendMoney() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(4)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    function confirmMoney() {
+        var totalSum = 0
+        $('#investmentCostList tr').each(function() {
+            $(this).find('td:eq(6)').each(function(){
+                totalSum += parseFloat($(this).text());
+            });
+        });
+        return totalSum.toFixed(2);
+    }
+    if(document.readyState=="complete"){
+        var sendMoney = sendMoney();
+        var confirmMoney = confirmMoney();
+
+        document.getElementById('sendMoney').innerHTML=sendMoney;
+        document.getElementById('confirmMoney').innerHTML=confirmMoney;
+
+    }
+</script>