فهرست منبع

甲供材料,添加统计信息

MaiXinRong 5 سال پیش
والد
کامیت
f110434680
2فایلهای تغییر یافته به همراه50 افزوده شده و 3 حذف شده
  1. 37 1
      app/public/js/se_jgcl.js
  2. 13 2
      app/view/stage_extra/jgcl.ejs

+ 37 - 1
app/public/js/se_jgcl.js

@@ -16,7 +16,7 @@ $(document).ready(() => {
             {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', cellType: 'unit'},
             {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
             {title: '本期到场|数量',  colSpan: '2|1', rowSpan: '1|1', field: 'arrive_qty', hAlign: 2, width: 60, type: 'Number'},
-            {title: '|金额',  colSpan: '|1', rowSpan: '|1', field: 'arrive_tp', hAlign: 2, width: 60, type: 'Number'},
+            {title: '|金额',  colSpan: '|1', rowSpan: '|1', field: 'arrive_tp', hAlign: 2, width: 60, type: 'Number', readOnly: true},
             {title: '截止本期到场|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_arrive_qty', hAlign: 2, width: 60, type: 'Number', readOnly: true},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_arrive_tp', hAlign: 2, width: 60, type: 'Number', readOnly: true},
             {title: '本期扣回|数量', colSpan: '2|1', rowSpan: '1|1', field: 'deduct_qty', hAlign: 2, width: 60, type: 'Number'},
@@ -105,12 +105,44 @@ $(document).ready(() => {
             this.calculateAll();
             this.resortData();
         }
+        sum () {
+            const result = {
+                arrive_tp: 0,
+                end_arrive_tp: 0,
+                deduct_tp: 0,
+                end_deduct_tp: 0,
+            };
+            for (const d of this.data) {
+                result.arrive_tp = ZhCalc.add(result.arrive_tp, d.arrive_tp);
+                result.end_arrive_tp = ZhCalc.add(result.end_arrive_tp, d.end_arrive_tp);
+                result.deduct_tp = ZhCalc.add(result.deduct_tp, d.deduct_tp);
+                result.end_deduct_tp = ZhCalc.add(result.end_deduct_tp, d.end_deduct_tp);
+            }
+            return result;
+        }
     }
     const jgclObj = new Jgcl();
+    const refreshSum = function () {
+        const sum = jgclObj.sum();
+        const html = [];
+        const getTrHtml = function (name, value) {
+            return '<tr><td>' + name + '</td><td class="text-right">' + value + '</td></tr>';
+        };
+        html.push(getTrHtml('本期到场', sum.arrive_tp));
+        html.push(getTrHtml('截止本期到场', sum.end_arrive_tp));
+        html.push(getTrHtml('本期扣回', sum.deduct_tp));
+        html.push(getTrHtml('截止本期扣回', sum.end_deduct_tp));
+        /*html.push('本期到场:' + sum.arrive_tp + ';');
+        html.push('截止本期到场:' + sum.end_arrive_tp + ';');
+        html.push('本期扣回:' + sum.deduct_tp + ';');
+        html.push('截止本期扣回:' + sum.end_deduct_tp + ';');*/
+        $('#sum').html(html.join(' '));
+    };
 
     postData(window.location.pathname + '/load', null, function (result) {
         jgclObj.loadDatas(result);
         SpreadJsObj.loadSheetData(jgclSheet, SpreadJsObj.DataType.Data, jgclObj.data);
+        refreshSum();
     });
 
     if (!readOnly) {
@@ -154,6 +186,7 @@ $(document).ready(() => {
                     postData(window.location.pathname + '/update', {updateType: 'update', updateData: datas}, function (result) {
                         jgclObj.loadUpdateData(result);
                         SpreadJsObj.reLoadSheetData(jgclSheet);
+                        refreshSum();
                     }, function () {
                         SpreadJsObj.reLoadSheetData(jgclSheet);
                     });
@@ -188,6 +221,7 @@ $(document).ready(() => {
                     postData(window.location.pathname + '/update', {del: datas}, function (result) {
                         jgclObj.loadUpdateData(result);
                         SpreadJsObj.reLoadSheetData(jgclSheet);
+                        refreshSum();
                     }, function () {
                         SpreadJsObj.reLoadSheetData(jgclSheet);
                     });
@@ -225,6 +259,7 @@ $(document).ready(() => {
                 postData(window.location.pathname + '/update', data, function (result) {
                     jgclObj.loadUpdateData(result);
                     SpreadJsObj.reLoadSheetData(info.sheet);
+                    refreshSum();
                 }, function () {
                     SpreadJsObj.reLoadRowData(info.sheet, info.row);
                 });
@@ -308,6 +343,7 @@ $(document).ready(() => {
                     postData(window.location.pathname + '/update', updateData, function (result) {
                         jgclObj.loadUpdateData(result);
                         SpreadJsObj.reLoadSheetData(info.sheet);
+                        refreshSum();
                     });
                 } else {
                     SpreadJsObj.reLoadSheetData(info.sheet);

+ 13 - 2
app/view/stage_extra/jgcl.ejs

@@ -6,13 +6,24 @@
             <div>
                 甲供材料
             </div>
+            <!--<div id="sum" class="ml-3">
+            </div>-->
             <div class="ml-auto"></div>
         </div>
     </div>
     <div class="content-wrap">
         <div class="c-header p-0"></div>
-        <div class="c-body">
-            <div class="sjs-height-0" id="jgcl-spread">
+        <div class="w-100 sub-content row">
+            <div class="c-body col-8">
+                <div class="sjs-height-0" id="jgcl-spread">
+                </div>
+            </div>
+            <div class="c-body col-4">
+                <table class="table table-bordered">
+                    <tr><th class="text-center" width="50%">名称</th><th class="text-center">金额</th></tr>
+                    <tbody id="sum">
+                    </tbody>
+                </table>
             </div>
         </div>
     </div>