浏览代码

合同支付,记住行引用公式

MaiXinRong 2 年之前
父节点
当前提交
a556eeb0b7
共有 3 个文件被更改,包括 20 次插入3 次删除
  1. 2 2
      app/public/report/js/rpt_custom.js
  2. 16 0
      app/service/rpt_gather_memory.js
  3. 2 1
      app/service/stage_pay.js

+ 2 - 2
app/public/report/js/rpt_custom.js

@@ -306,7 +306,7 @@ const rptCustomObj = (function () {
         gatherSelectSpreadObj.initSelectTenders(gsSelect ? gsSelect.tenders : []);
 
         $('[name=gather-type]').hide();
-        if (gsObj.setting.type === 'month') $('#gather-by-month').show();
+        if (gsObj.setting.type === 'month' || gsObj.setting.type === 'months') $('#gather-by-month').show();
         if (gsObj.setting.type === 'zone') $('#gather-by-zone').show();
         if (gsObj.setting.type === 'stage') $('#gather-by-stage').show();
         if (gsObj.setting.type === 'stage-zone') $('#gather-by-stage-zone').show();
@@ -573,7 +573,7 @@ const rptCustomObj = (function () {
                 return;
             }
         }
-        if (gsObj.setting.type === 'month') {
+        if (gsObj.setting.type === 'month' || gsObj.setting.type === 'months') {
             data[sGatherSelect].month = $('#gather-month').val();
             if (data[sGatherSelect].month === '') {
                 hintObj.html('请选择 汇总年月').show();

+ 16 - 0
app/service/rpt_gather_memory.js

@@ -339,6 +339,15 @@ module.exports = app => {
             }
             return [validStages, preStage, endStage];
         }
+        async _getMonthStages(tender, month) {
+            const stages = await this._getValidStages(tender.id, 'asc'), validStages = [];
+            for (const stage of stages) {
+                if (stage.s_time === month) validStages.push(stage);
+            }
+            const preStage = stages.length > 0 ? stages.find(x => { return x.order === stages[0].order - 1; }) : null;
+            const endStage = stages.length > 0 ? stages.find(x => { return x.order === stages[stages.length - 1].order + 1; }) : null;
+            return [validStages, preStage, endStage];
+        }
 
         /**
          * 台账数据
@@ -478,6 +487,10 @@ module.exports = app => {
             const [stages, preStage, endStage] = await this._getCheckedZoneStages(tender, zone);
             await this._gatherStagesData(completeData, tender, stages, preStage);
         }
+        async _gatherMonthsData(tender, completeData, month) {
+            const [stages, preStage, endStage] = await this._getMonthStages(tender, month);
+            await this._gatherStagesData(completeData, tender, stages, preStage);
+        }
 
         async _gatherStageData(completeData, tender, stage, hasPre) {
             const helper = this.ctx.helper;
@@ -664,6 +677,9 @@ module.exports = app => {
                         case 'month':
                             await this._gatherMonthData(tender, completeData, gsCustom.month, gsSetting.hasPre);
                             break;
+                        case 'months':
+                            await this._gatherMonthsData(tender, completeData, gsCustom.months);
+                            break;
                         case 'zone':
                             await this._gatherZoneData(tender, completeData, gsCustom.zone);
                             break;

+ 2 - 1
app/service/stage_pay.js

@@ -80,6 +80,7 @@ module.exports = app => {
          */
         async addInitialStageData(stage, transaction) {
             const basesReg = new RegExp(payConst.calcBase.map(x => {return '(' + x.code + ')'}).join('|'));
+            const orderReg = /f\d+/ig;
             if (!stage) {
                 throw '初始化期合同支付数据失败';
             }
@@ -107,7 +108,7 @@ module.exports = app => {
                         stimes: stage.times, sorder: 0,
                         name: pp.name,
                         expr: (p.ptype === payConst.payType.normal || p.ptype === payConst.payType.sf)
-                            ? (basesReg.test(pp.expr) ? pp.expr : null)
+                            ? (basesReg.test(pp.expr) || orderReg.test(pp.expr) ? pp.expr : null)
                             : (p.type === payConst.wc ? pp.expr : null),
                         pause: pp.pause,
                         pre_tp: pp.end_tp,