瀏覽代碼

报表数据源,提供合同支付指标&数据

MaiXinRong 1 周之前
父節點
當前提交
f20dc3ba77
共有 4 個文件被更改,包括 48 次插入2 次删除
  1. 2 2
      app/lib/revise_price.js
  2. 14 0
      app/service/phase_pay.js
  3. 8 0
      app/service/report.js
  4. 24 0
      app/service/report_memory.js

+ 2 - 2
app/lib/revise_price.js

@@ -399,7 +399,7 @@ class revisePriceCalc {
         const self = this;
         billsTree.calculateAll(node => {
             if (node.children && node.children.length > 0) return;
-            if (node.cur_id && (node.cur_contract_qty || node.cur_qc_qty || node.cur_ex_stage_qty1)) {
+            if (node.cur_id && (node.cur_contract_qty || node.cur_qc_qty || node.cur_ex_stage_qty1 || node.cur_qc_minus_qty)) {
                 const cur_contract_tp = calcType === 'up'
                     ? helper.mul(node.cur_contract_qty, node.unit_price, decimal.tp)
                     : self._calcContractTpByTp(node, decimal);
@@ -488,7 +488,7 @@ class revisePriceCalc {
         const self = this;
         billsTree.calculateAll(node => {
             if (node.children && node.children.length > 0) return;
-            if (node.cur_id && (node.cur_contract_qty || node.cur_qc_qty)) {
+            if (node.cur_id && (node.cur_contract_qty || node.cur_qc_qty || node.cur_qc_minus_qty || node.cur_ex_stage_qty1)) {
                 const cur_contract_tp = calcType === 'up'
                     ? helper.mul(node.cur_contract_qty, node.unit_price, decimal.tp)
                     : self._calcContractTpByTp(node, decimal);

+ 14 - 0
app/service/phase_pay.js

@@ -512,6 +512,20 @@ module.exports = app => {
                 }
             }
         }
+
+        async checkStageRelaPhasePay(tid, sid) {
+            if (this.ctx.stageRelaPhasePay === undefined) return;
+
+            const allPhase = await this.getAllPhasePay(tid);
+            for (const phase of allPhase) {
+                if (phase.rela_stage.find(x => { return x.id === sid; })) {
+                    await this.doCheckPhase(phase);
+                    this.ctx.stageRelaPhasePay = phase;
+                    return;
+                }
+            }
+            this.ctx.stageRelaPhasePay = null;
+        }
     }
 
     return PhasePay;

+ 8 - 0
app/service/report.js

@@ -509,6 +509,14 @@ module.exports = app => {
                             runnableRst.push(service.reportMemory.getSpContractPay(params.tender_id, 2));
                             runnableKey.push(filter);
                             break;
+                        case 'mem_phase_pay':
+                            runnableRst.push(service.reportMemory.getPhasePay(params.stage_id));
+                            runnableKey.push(filter);
+                            break;
+                        case 'mem_phase_pay_detail':
+                            runnableRst.push(service.reportMemory.getPhasePayDetail(params.stage_id));
+                            runnableKey.push(filter);
+                            break;
                         default:
                             break;
                     }

+ 24 - 0
app/service/report_memory.js

@@ -1736,6 +1736,30 @@ module.exports = app => {
             await this.ctx.service.tender.checkTender(tid);
             return await this._getContractPay({ spid: this.ctx.tender.spid, contract_type });
         }
+
+        async getPhasePay(tid, sid) {
+            await this.ctx.service.tender.checkTender(tid);
+            await this.ctx.service.stage.checkStage(sid);
+            await this.ctx.service.phasePay.checkStageRelaPhasePay(sid);
+
+            return this.ctx.stageRelaPhasePay || {};
+        }
+
+        async getPhasePayDetail(tid, sid) {
+            await this.ctx.service.tender.checkTender(tid);
+            await this.ctx.service.stage.checkStage(sid);
+            await this.ctx.service.phasePay.checkStageRelaPhasePay(sid);
+
+            if (!this.ctx.stageRelaPhasePay) return [];
+            const data = this.ctx.service.phasePayDetail.getDetailData(this.ctx.stageRelaPhasePay);
+            const payTree = new Ledger.baseTree(this.ctx, {
+                id: 'tree_id', pid: 'tree_pid', order: 'tree_order',
+                level: 'tree_level', isLeaf: 'tree_is_leaf', fullPath: 'tree_full_path',
+                rootId: -1, calcField: [],
+            });
+            payTree.loadDatas(data);
+            return payTree.getDefaultDatas();
+        }
     }
 
     return ReportMemory;