Browse Source

合同支付,本期完成基数计算

MaiXinRong 2 years ago
parent
commit
085ec12423
1 changed files with 6 additions and 4 deletions
  1. 6 4
      app/service/stage.js

+ 6 - 4
app/service/stage.js

@@ -469,6 +469,7 @@ module.exports = app => {
             const calcBase = JSON.parse(JSON.stringify(payConst.calcBase));
             const param = tenderInfo.deal_param;
             const sum = await this.ctx.service.stageBills.getSumTotalPrice(stage);
+            const pcSum = await this.ctx.service.stageBillsPc.getSumTotalPrice(stage);
             const bg = await this.getChangeSubtotal(stage);
             for (const cb of calcBase) {
                 switch (cb.code) {
@@ -488,13 +489,13 @@ module.exports = app => {
                         cb.value = param.materialAdvance;
                         break;
                     case 'bqwc':
-                        cb.value = this.ctx.helper.add(sum.contract_tp, sum.qc_tp);
+                        cb.value = this.ctx.helper.sum([sum.contract_tp, sum.qc_tp, pcSum.pc_tp]);
                         break;
                     case 'bqht':
-                        cb.value = sum.contract_tp;
+                        cb.value = sum.contract_tp; //this.ctx.helper.add(sum.contract_tp, pcSum.contract_pc_tp);
                         break;
                     case 'bqbg':
-                        cb.value = sum.qc_tp;
+                        cb.value = sum.qc_tp; //this.ctx.helper.add(sum.qc_tp, pcSum.qc_pc_tp);
                         break;
                     case 'ybbqwc':
                         const sumGcl = await this.ctx.service.stageBills.getSumTotalPriceGcl(stage, '^[^0-9]*1[0-9]{2}(-|$)');
@@ -658,6 +659,7 @@ module.exports = app => {
             const calcBase = JSON.parse(JSON.stringify(payConst.calcBase));
             const param = tenderInfo.deal_param;
             const sum = await this.ctx.service.stageBills.getSumTotalPriceByMaterial(stage_list);
+            const pcSum = await this.ctx.service.stageBillsPc.getSumTotalPriceByMaterial(stage_list);
             for (const cb of calcBase) {
                 switch (cb.code) {
                     case 'htj':
@@ -676,7 +678,7 @@ module.exports = app => {
                         cb.value = param.materialAdvance;
                         break;
                     case 'bqwc':
-                        cb.value = this.ctx.helper.add(sum.contract_tp, sum.qc_tp);
+                        cb.value = this.ctx.helper.sum([sum.contract_tp, sum.qc_tp, pcSum.pc_tp]);
                         break;
                     case 'bqht':
                         cb.value = sum.contract_tp;