瀏覽代碼

投资进度金额增加补差

laiguoran 2 年之前
父節點
當前提交
4ebd5411b9
共有 2 個文件被更改,包括 10 次插入3 次删除
  1. 7 0
      app/controller/schedule_controller.js
  2. 3 3
      app/public/js/schedule_stage_tp.js

+ 7 - 0
app/controller/schedule_controller.js

@@ -284,9 +284,11 @@ module.exports = app => {
             } else {
                 preStageData = [];
             }
+            const pcData = await ctx.service.stageBillsPc.getAllDataByCondition({ where: { sid: stageInfo.id } });
             this.ctx.helper.assignRelaData(ledgerData, [
                 { data: curStageData, fields: ['contract_qty', 'contract_expr', 'contract_tp', 'qc_qty', 'qc_tp', 'postil'], prefix: '', relaId: 'lid' },
                 { data: preStageData, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'used'], prefix: 'pre_', relaId: 'lid' },
+                { data: pcData, fields: ['contract_pc_tp', 'qc_pc_tp', 'pc_tp', 'org_price'], prefix: '', relaId: 'lid' },
             ]);
             // 获取进度最新期的数据
             ledgerData = await this._addFinalStageData(ctx, ledgerData);
@@ -368,6 +370,11 @@ module.exports = app => {
                 // }), 'id');
                 const stageIdList = _.map(stageList, 'id');
                 curYearStageData = await ctx.service.stageBills.getStagesData(tender.id, stageIdList.join(','));
+                const curYearStagePcData = await ctx.service.stageBillsPc.getStagesData(tender.id, stageIdList.join(','));
+                for (const cys of curYearStageData) {
+                    const cyspc = ctx.helper._.find(curYearStagePcData, { lid: cys.lid });
+                    if (cyspc) ctx.helper._.assign(cys, cyspc);
+                }
             }
             return { slmList, nextSlmList, endSlmList, yearSlmList, curYearStageData, scheduleMonth, stageOrderList, scheduleStage, curScheduleStage };
         }

+ 3 - 3
app/public/js/schedule_stage_tp.js

@@ -86,7 +86,7 @@ $(function () {
     if (curScheduleStage && curScheduleStage.order) {
         postData('/tender/' + getTenderId() + '/schedule/stage/' + curScheduleStage.order + '/load', {}, function (data) {
             const calcList = ['year_gather_tp',
-                'contract_tp', 'qc_qty', 'qc_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp',
+                'qc_qty', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp', 'contract_pc_tp', 'qc_pc_tp', 'pc_tp',
                 'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp', 'end_correct_tp',
                 'final_contract_tp', 'final_qc_tp', 'pre_final_contract_tp', 'pre_final_qc_tp', 'pre_final_gather_tp', 'final_gather_tp', 'end_final_gather_tp'];
             const showList = ['plan_gcl', 'plan_tp', 'next_plan_gcl', 'next_plan_tp', 'end_plan_gcl', 'end_plan_tp', 'year_plan_gcl', 'year_plan_tp',
@@ -114,7 +114,7 @@ $(function () {
                     node.end_gather_qty = ZhCalc.add(node.pre_gather_qty, node.gather_qty);
                 }
                 node.pre_gather_tp = ZhCalc.add(node.pre_contract_tp, node.pre_qc_tp);
-                node.gather_tp = ZhCalc.add(node.contract_tp, node.qc_tp);
+                node.gather_tp = ZhCalc.sum([node.contract_tp, node.qc_tp, node.pc_tp]);
                 node.end_contract_tp = ZhCalc.add(node.pre_contract_tp, node.contract_tp);
                 node.end_qc_tp = ZhCalc.add(node.pre_qc_tp, node.qc_tp);
                 node.end_gather_tp = ZhCalc.add(node.pre_gather_tp, node.gather_tp);
@@ -294,7 +294,7 @@ function setMonthToLedger(ledgerList, slm, nextSlm, endSlm, yearSlm, yearLedgerD
             });
             if (index !== undefined && index !== -1) {
                 ledgerList[index].year_contract_qty = ZhCalc.add(yl.contract_qty, yl.qc_qty);
-                ledgerList[index].year_gather_tp = ZhCalc.add(yl.contract_tp, yl.qc_tp);
+                ledgerList[index].year_gather_tp = ZhCalc.sum([yl.contract_tp, yl.qc_tp, yl.pc_tp]);
             }
         }
     }