فهرست منبع

报表,本年数据相关

MaiXinRong 2 سال پیش
والد
کامیت
4518aa8cda
1فایلهای تغییر یافته به همراه17 افزوده شده و 2 حذف شده
  1. 17 2
      app/service/report_memory.js

+ 17 - 2
app/service/report_memory.js

@@ -24,6 +24,7 @@ const stageImVersion = '1.3';
 const PermissionCheck = require('../const/account_permission').PermissionCheck;
 
 const Ledger = require('../lib/ledger');
+const moment = require('moment');
 
 const billsFields = (function () {
     const cur = ['contract_qty', 'contract_tp', 'contract_expr', 'qc_qty', 'qc_tp', 'qc_minus_qty', 'qc_minus_tp', 'gather_qty', 'gather_tp', 'postil'];
@@ -383,6 +384,20 @@ module.exports = app => {
             }
         }
 
+        async _getValidStages(tenderId) {
+            const stages = await this.db.select(this.ctx.service.stage.tableName, {
+                where: { tid: tenderId },
+                orders: [['order', 'desc']],
+            });
+            if (stages.length !== 0) {
+                const lastStage = stages[0];
+                if (lastStage.status === auditConst.stage.status.uncheck && lastStage.user_id !== this.ctx.session.sessionUser.accountId) {
+                    stages.splice(0, 1);
+                }
+            }
+            return stages;
+        }
+
         async _getTimeZoneStages(tender, zone) {
             const times = zone.split(' - ');
             if (times.length !== 2) throw '选择的汇总周期无效';
@@ -482,8 +497,8 @@ module.exports = app => {
                 }
                 const bpcStage = await this.ctx.service.stageBillsPc.getAllDataByCondition({ where: { sid: this.ctx.stage.id } });
                 const endBpcStage = await this.ctx.service.stageBillsPc.getEndStageData(this.ctx.stage);
-                const yearStage = this._checkFieldsExistReg(fields, 'year_') && stage.s_time
-                    ? await this._loadStageBillsYear(this.ctx.service.tender, stage.s_time.split('-')[0])
+                const yearStage = this._checkFieldsExistReg(fields, 'year_') && this.ctx.stage.s_time
+                    ? await this._loadStageBillsYear(this.ctx.tender, this.ctx.stage.s_time.split('-')[0])
                     : [];
                 this.ctx.helper.assignRelaData(billsData, [
                     { data: curStage, fields: ['contract_qty', 'contract_tp', 'contract_expr', 'qc_qty', 'qc_tp', 'qc_minus_qty', 'postil'], prefix: '', relaId: 'lid' },