MaiXinRong hace 3 semanas
padre
commit
ada3763863
Se han modificado 2 ficheros con 6 adiciones y 5 borrados
  1. 5 4
      app/lib/pay_calc.js
  2. 1 1
      app/service/stage_bills.js

+ 5 - 4
app/lib/pay_calc.js

@@ -159,13 +159,14 @@ class PayCalculate {
 
         this.pre = this.stage.preCheckedStage ? await this.ctx.service.stageBillsFinal.getSumTotalPrice(this.stage.tid, this.stage.preCheckedStage.order) : {};
         this.cur = await this.ctx.service.stageBills.getSumTotalPrice(this.stage);
+        const pcSum = await this.ctx.service.stageBillsPc.getSumTotalPrice(stage);
         this.add = {};
         if (this.pre) {
-            this.add.contract_tp = this.ctx.helper.sum([this.pre.contract_tp, this.cur.contract_tp, this.cur.contract_pc_tp]);
-            this.add.qc_tp = this.ctx.helper.sum([this.pre.qc_tp, this.cur.qc_tp, this.cur.qc_pc_tp]);
+            this.add.contract_tp = this.ctx.helper.sum([this.pre.contract_tp, this.cur.contract_tp, pcSum.contract_pc_tp]);
+            this.add.qc_tp = this.ctx.helper.sum([this.pre.qc_tp, this.cur.qc_tp, pcSum.qc_pc_tp]);
         } else {
-            this.add.contract_tp = this.ctx.helper.add(this.cur.contract_tp, this.cur.contract_pc_tp);
-            this.add.qc_tp = this.ctx.helper.add(this.cur.qc_tp, this.cur.qc_pc_tp);
+            this.add.contract_tp = this.ctx.helper.add(this.cur.contract_tp, pcSum.contract_pc_tp);
+            this.add.qc_tp = this.ctx.helper.add(this.cur.qc_tp, pcSum.qc_pc_tp);
         }
         this.add.gather_tp = this.ctx.helper.add(this.add.contract_tp, this.add.qc_tp);
     }

+ 1 - 1
app/service/stage_bills.js

@@ -457,7 +457,7 @@ module.exports = app => {
         }
 
         async getSumTotalPrice(stage) {
-            const sql = 'SELECT Sum(`contract_tp`) As `contract_tp`, Sum(`qc_tp`) As `qc_tp`, Sum(`positive_qc_tp`) As positive_qc_tp, Sum(`negative_qc_tp`) As negative_qc_tp, Sum(`contract_pc_tp`) As contract_qc_tp, Sum(`qc_pc_tp`) As qc_pc_tp FROM ' + this.departTableName(stage.tid) + ' As Bills ' +
+            const sql = 'SELECT Sum(`contract_tp`) As `contract_tp`, Sum(`qc_tp`) As `qc_tp`, Sum(`positive_qc_tp`) As positive_qc_tp, Sum(`negative_qc_tp`) As negative_qc_tp FROM ' + this.departTableName(stage.tid) + ' As Bills ' +
                 '  INNER JOIN ( ' +
                 '    SELECT MAX(`times` * ' + timesLen + ' + `order`) As `flow`, `lid`, `sid` From ' + this.departTableName(stage.tid) +
                 '      WHERE (`times` < ? OR (`times` = ? AND `order` <= ?)) AND `sid` = ?' +