瀏覽代碼

报表,期汇总-合同支付数据问题

MaiXinRong 4 年之前
父節點
當前提交
4c98e83bd5
共有 1 個文件被更改,包括 8 次插入6 次删除
  1. 8 6
      app/service/rpt_stage_sum_memory.js

+ 8 - 6
app/service/rpt_stage_sum_memory.js

@@ -226,29 +226,31 @@ module.exports = app => {
 
                 const dealPay = await this.ctx.service.stagePay.getStagePays(stage);
                 await this._checkStagePayCalc(tender, stage, dealPay);
-                this.ctx.helper.assignRelaData(billsData, [
-                    {data: dealPay, fields: ['tp'], prefix: 's_' + stage.order + '_', relaId: 'pid'}
+                this.ctx.helper.assignRelaData(payData, [
+                    {data: dealPay, fields: ['tp'], prefix: 's_' + stage.order + '_', relaId: 'pid'},
+                    {data: dealPay, fields: ['name'], prefix:'', relaId: 'pid'},
                 ]);
             }
         }
 
         async getStageSumPay(tid, memFieldKeys, gsDefine, gsCustom) {
             if (!gsDefine || !gsDefine.enable) return [];
-            if (!gsCustom || !gsCustom.tenders || gsCustom.tenders.length === 0) return [];
+            if (!gsCustom || !gsCustom.stages || gsCustom.stages.length === 0) return [];
 
             await this.ctx.service.tender.checkTender(tid);
             const payData = await this.ctx.service.pay.getAllDataByCondition({
-                where: {tid: tid},
+                where: {tid: tid, valid: true},
                 order: [['order', 'ASC']],
             });
 
             const gsSetting = JSON.parse(gsDefine.setting);
             for (const s of gsCustom.stages) {
-                const stage = this.getSelectStage(gsSetting, s);
+                const stage = await this.db.get(this.ctx.service.stage.tableName, { tid: this.ctx.tender.id, order: s });
+                if (!stage) continue;
                 await this.ctx.service.stage.doCheckStage(stage);
                 await this._gatherStagePay(this.ctx.tender, stage, payData);
-
             }
+            return payData;
         }
     }