Przeglądaj źródła

报表,中间计量,计量单元-清单模式,计算补差相关

MaiXinRong 2 lat temu
rodzic
commit
c5dc2d9ff3
3 zmienionych plików z 17 dodań i 5 usunięć
  1. 16 3
      app/lib/stage_im.js
  2. 0 1
      app/public/js/stage_im.js
  3. 1 1
      app/service/report.js

+ 16 - 3
app/lib/stage_im.js

@@ -81,7 +81,7 @@ class StageIm {
         this.ctx.helper.assignRelaData(billsData, [
             { data: curStage, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty'], prefix: '', relaId: 'lid' },
             { data: preStage, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty'], prefix: 'pre_', relaId: 'lid' },
-            { data: bpcStage, fields: ['contract_pc_tp', 'qc_pc_tp', 'pc_tp'], prefix: '', relaId: 'lid' },
+            { data: bpcStage, fields: ['contract_pc_tp', 'qc_pc_tp', 'pc_tp', 'org_price'], prefix: '', relaId: 'lid' },
         ]);
         this.billsTree.loadDatas(billsData);
         this.billsTree.calculateAll();
@@ -575,7 +575,7 @@ class StageIm {
                 helper.checkZero(helper.sub(bills.unit_price, x.unit_price));
         });
         if (!gcl) {
-            gcl = {b_code: bills.b_code, name: bills.name, unit: bills.unit, unit_price: bills.unit_price};
+            gcl = { b_code: bills.b_code, name: bills.name, unit: bills.unit, unit_price: bills.unit_price, org_price: bills.org_price };
             im.gclBills.push(gcl);
         }
         if (pos) {
@@ -641,6 +641,7 @@ class StageIm {
         }
     }
     _calculateBwBillsIm(im) {
+        const helper = this.ctx.helper;
         const tp_decimal = this.ctx.tender.info.decimal.tp;
         im.contract_jl = 0;
         im.qc_jl = 0;
@@ -652,8 +653,20 @@ class StageIm {
             im.qc_jl = this.ctx.helper.add(im.qc_jl, this.ctx.helper.mul(b.qc_jl, b.unit_price, tp_decimal));
             im.pre_qc_jl = this.ctx.helper.add(im.pre_qc_jl, this.ctx.helper.mul(b.pre_qc_jl, b.unit_price, tp_decimal));
             im.end_qc_jl = this.ctx.helper.add(im.end_qc_jl, this.ctx.helper.mul(b.end_qc_jl, b.unit_price, tp_decimal));
+
+            const priceDiff = b.org_price ? helper.sub(b.unit_price, b.org_price) : 0;
+            if (priceDiff) {
+                const contract_pc_tp = helper.sub(helper.mul(b.unit_price, b.pre_contract_jl, tp_decimal), helper.mul(b.org_price, b.pre_contract_jl, tp_decimal));
+                const qc_pc_tp = helper.sub(helper.mul(b.unit_price, b.pre_qc_jl, tp_decimal), helper.mul(b.org_price, b.pre_qc_jl, tp_decimal));
+                const pc_tp = helper.add(contract_pc_tp, qc_pc_tp);
+                im.contract_pc_jl = helper.add(contract_pc_tp, im.contract_pc_jl);
+                im.qc_pc_jl = helper.add(qc_pc_tp, im.qc_pc_jl);
+                im.pc_jl = helper.add(pc_tp, im.pc_jl);
+                im.end_contract_jl = helper.add(contract_pc_tp, im.end_contract_jl);
+                im.end_qc_jl = helper.add(qc_pc_tp, im.end_qc_jl);
+            }
         }
-        im.jl = this.ctx.helper.add(im.contract_jl, im.qc_jl);
+        im.jl = this.ctx.helper.sum([im.contract_jl, im.qc_jl, im.pc_jl]);
         im.pre_jl = this.ctx.helper.add(im.pre_contract_jl, im.pre_qc_jl);
         im.end_jl = this.ctx.helper.add(im.end_contract_jl, im.end_qc_jl);
     }

+ 0 - 1
app/public/js/stage_im.js

@@ -644,7 +644,6 @@ const stageIm = (function () {
             if (priceDiff) {
                 const pc_jl = ZhCalc.sub(ZhCalc.mul(b.unit_price, b.pre_jl, decimal.tp), ZhCalc.mul(b.org_price, b.pre_jl, decimal.tp));
                 im.pc_jl = ZhCalc.add(im.pc_jl, pc_jl);
-
             }
         }
         im.jl = ZhCalc.sum([im.contract_jl, im.qc_jl, im.pc_jl]);

+ 1 - 1
app/service/report.js

@@ -315,7 +315,7 @@ module.exports = app => {
                         rst[filter] = customSelect;
                         break;
                     case 'mem_stage_im_tz':
-                        rst[filter] = await service.reportMemory.getStageImTzData(params.tender_id, params.stage_id, memFieldKeys[filter]);
+                        rst[filter] = await service.reportMemory.getStageImTzData(params.tender_id, params.stage_id, memFieldKeys[filter], false);
                         break;
                     case 'mem_stage_im_tz_bills':
                         rst[filter] = await service.reportMemory.getStageImTzBillsData(params.tender_id, params.stage_id, memFieldKeys[filter]);