فهرست منبع

增加变更后金额显示

laiguoran 2 سال پیش
والد
کامیت
f263c301f6
2فایلهای تغییر یافته به همراه31 افزوده شده و 8 حذف شده
  1. 17 5
      app/public/js/change_information_approval.js
  2. 14 3
      app/public/js/change_information_set.js

+ 17 - 5
app/public/js/change_information_approval.js

@@ -29,6 +29,8 @@ $(document).ready(() => {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'oa_tp', hAlign: 2, width: 80, type: 'Number', getValue: 'getValue.oa_tp', readOnly: true},
             {title: '申请变更增(+)减(-)|数量', colSpan: '2|1', rowSpan: '1|1', field: 'camount', hAlign: 2, width: 60, type: 'Number', getValue: 'getValue.camount', readOnly: true},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'ca_tp', hAlign: 2, width: 80, type: 'Number', getValue: 'getValue.ca_tp', readOnly: true},
+            {title: '变更后|数量', colSpan: '2|1', rowSpan: '1|1', field: 'samount', hAlign: 2, width: 60, type: 'Number', readOnly: true, getValue: 'getValue.changed_amount'},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'sa_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.changed_tp'},
         ],
         emptyRows: 0,
         headRows: 2,
@@ -96,6 +98,12 @@ $(document).ready(() => {
             camount: function (data) {
                 return ZhCalc.round(data.camount, findDecimal(data.unit));
             },
+            changed_amount: function (data) {
+                return ZhCalc.round(data.spamount, findDecimal(data.unit));
+            },
+            changed_tp: function (data) {
+                return ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), ZhCalc.round(data.spamount, findDecimal(data.unit))), totalPriceUnit);
+            },
         },
     };
 
@@ -143,8 +151,8 @@ $(document).ready(() => {
         },
         setRowValueAndSum: function (data, row, col) {
             for (const j in aidList) {
-                const sum = ZhCalc.round(ZhCalc.mul(data.unit_price, parseFloat(changeSpreadSheet.getValue(row, 10 + parseInt(j)*2))), totalPriceUnit);
-                changeSpreadSheet.setValue(row, 11 + j*2, sum !== 0 ? sum : null);
+                const sum = ZhCalc.round(ZhCalc.mul(data.unit_price, parseFloat(changeSpreadSheet.getValue(row, 12 + parseInt(j)*2))), totalPriceUnit);
+                changeSpreadSheet.setValue(row, 13 + j*2, sum !== 0 ? sum : null);
             }
             // const sum = ZhCalc.round(ZhCalc.mul(data.unit_price, data.spamount), totalPriceUnit);
             // changeSpreadSheet.setValue(row, col+1, sum !== 0 ? sum : null);
@@ -155,24 +163,28 @@ $(document).ready(() => {
                 audit_sum = ZhCalc.add(audit_sum, changeSpreadSheet.getValue(i, col+1));
             }
             changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, col+1, audit_sum !== 0 ? audit_sum : null);
+            changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 11, audit_sum !== 0 ? audit_sum : null);
         },
         countSum: function() {
             const rowCount = changeSpreadSheet.getRowCount();
             let oSum = 0,
-                cSum = 0;
+                cSum = 0,
+                cdSum = 0;
             for(let i = 0; i < rowCount - 1; i++){
                 oSum = ZhCalc.add(oSum, changeSpreadSheet.getValue(i, 7));
                 cSum = ZhCalc.add(cSum, changeSpreadSheet.getValue(i, 9));
+                cdSum = ZhCalc.add(cdSum, changeSpreadSheet.getValue(i, 11));
             }
             changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 7, oSum !== 0 ? oSum : null);
             changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 9, cSum !== 0 ? cSum : null);
+            changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 11, cdSum !== 0 ? cdSum : null);
             // 用户的数据合计
             for (const j in aidList) {
                 let audit_sum = 0;
                 for(let i = 0; i < rowCount - 1; i++){
-                    audit_sum = ZhCalc.add(audit_sum, changeSpreadSheet.getValue(i, 11 + j*2));
+                    audit_sum = ZhCalc.add(audit_sum, changeSpreadSheet.getValue(i, 13 + j*2));
                 }
-                changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 11 + j*2, audit_sum !== 0 ? audit_sum : null);
+                changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 13 + j*2, audit_sum !== 0 ? audit_sum : null);
             }
         },
         deletePress: function (sheet) {

+ 14 - 3
app/public/js/change_information_set.js

@@ -104,6 +104,8 @@ $(document).ready(() => {
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'oa_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.oa_tp'},
             {title: '申请变更增(+)减(-)|数量', colSpan: '2|1', rowSpan: '1|1', field: 'camount', hAlign: 2, width: 60, type: 'Number', readOnly: false, getValue: 'getValue.camount'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'ca_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.ca_tp'},
+            {title: '变更后|数量', colSpan: '2|1', rowSpan: '1|1', field: 'samount', hAlign: 2, width: 60, type: 'Number', readOnly: true, getValue: 'getValue.changed_amount'},
+            {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'sa_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.changed_tp'},
             {title: '操作', colSpan: '1', rowSpan: '2', field: 'del_list', hAlign: 1, width: 40, readOnly: true, cellType: 'mouseTouch', getValue: 'getValue.del_list'},
         ],
         emptyRows: 0,
@@ -153,6 +155,12 @@ $(document).ready(() => {
             camount: function (data) {
                 return ZhCalc.round(data.camount, findDecimal(data.unit));
             },
+            changed_amount: function (data) {
+                return ZhCalc.round(data.camount, findDecimal(data.unit));
+            },
+            changed_tp: function (data) {
+                return ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), ZhCalc.round(data.camount, findDecimal(data.unit))), totalPriceUnit);
+            },
             del_list: function (data) {
                 return !_.find(changeUsedData, { cbid: data.id }) ? '移除' : '';
             }
@@ -179,13 +187,16 @@ $(document).ready(() => {
         countSum: function() {
             const rowCount = changeSpreadSheet.getRowCount();
             let oSum = 0,
-                cSum = 0;
+                cSum = 0,
+                cdSum = 0;
             for(var i = 0; i < rowCount - 1; i++){
                 oSum = ZhCalc.add(oSum, changeSpreadSheet.getValue(i, 7));
                 cSum = ZhCalc.add(cSum, changeSpreadSheet.getValue(i, 9));
+                cdSum = ZhCalc.add(cdSum, changeSpreadSheet.getValue(i, 11));
             }
             changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 7, oSum !== 0 ? oSum : null);
             changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 9, cSum !== 0 ? cSum : null);
+            changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 11, cdSum !== 0 ? cdSum : null);
         },
         add: function () {
             let select = null;
@@ -725,14 +736,14 @@ $(document).ready(() => {
         changeSpread.bind(spreadNS.Events.ClipboardPasted, changeSpreadObj.clipboardPasted);
         changeSpread.bind(spreadNS.Events.ValueChanged, changeSpreadObj.valueChanged);
         SpreadJsObj.addDeleteBind(changeSpread, changeSpreadObj.deletePress);
-        changeSpreadSheet.getCell(-1, 10).foreColor('#dc3545');
+        changeSpreadSheet.getCell(-1, 12).foreColor('#dc3545');
         const delCommand = {
             canUndo: false,
             execute: function (context, options, isUndo) {
                 const Commands = GC.Spread.Sheets.Commands;
                 const sel = changeSpreadSheet.getSelections()[0];
                 const col = changeSpreadSheet.zh_setting.cols[sel.col];
-                if (col && col.field !== 'ca_tp') {
+                if (col && col.field !== 'changed_tp') {
                     isUndo = true;
                 }
                 if (isUndo) {