Browse Source

报表,变更清单获取数据调整

MaiXinRong 3 years ago
parent
commit
2b92afa24b

+ 0 - 1
app/controller/report_controller.js

@@ -1015,7 +1015,6 @@ async function getMultiRptsCommon(ctx, params, outputType, baseDir) {
             let customSelect = rptTpl[JV.NODE_CUSTOM_DEFINE] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_AUDIT_SELECT].enable
             let customSelect = rptTpl[JV.NODE_CUSTOM_DEFINE] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_AUDIT_SELECT].enable
                 ? await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, rptTpl.id)
                 ? await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, params.stage_id, rptTpl.id)
                 : await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, -1, rptTpl.id);
                 : await ctx.service.rptCustomDefine.getCustomDefine(params.tender_id, -1, rptTpl.id);
-            console.log(rptTpl[JV.NODE_CUSTOM_DEFINE],customSelect);
             if (rptTpl[JV.NODE_CUSTOM_DEFINE] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_CHANGE_SELECT] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_CHANGE_SELECT].enable) {
             if (rptTpl[JV.NODE_CUSTOM_DEFINE] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_CHANGE_SELECT] && rptTpl[JV.NODE_CUSTOM_DEFINE][JV.NODE_CUS_CHANGE_SELECT].enable) {
                 customSelect = { tid: params.tender_id, rid: params.rpt_tpl_id, sid: -1, change_select: params.customSelect[tplIdx].change_select };
                 customSelect = { tid: params.tender_id, rid: params.rpt_tpl_id, sid: -1, change_select: params.customSelect[tplIdx].change_select };
             }
             }

+ 2 - 2
app/service/change_audit_list.js

@@ -367,11 +367,11 @@ module.exports = app => {
          * @param {tid} tid - 标段id
          * @param {tid} tid - 标段id
          * @return {void}
          * @return {void}
          */
          */
-        async getChangeAuditBills(tid) {
+        async getChangeAuditBills(tid, onlyChecked) {
             const sql = 'SELECT cb.*' +
             const sql = 'SELECT cb.*' +
                 '  FROM ' + this.tableName + ' cb' +
                 '  FROM ' + this.tableName + ' cb' +
                 '  LEFT JOIN ' + this.ctx.service.change.tableName + ' c ON cb.cid = c.cid' +
                 '  LEFT JOIN ' + this.ctx.service.change.tableName + ' c ON cb.cid = c.cid' +
-                '  WHERE c.tid = ? and c.status = 3' +
+                '  WHERE c.tid = ? ' + (onlyChecked ? 'and c.status = 3' : '') +
                 '  ORDER BY cb.cid, cb.code';
                 '  ORDER BY cb.cid, cb.code';
             const param = [tid];
             const param = [tid];
             const result = await this.db.query(sql, param);
             const result = await this.db.query(sql, param);

+ 2 - 2
app/service/report_memory.js

@@ -751,7 +751,7 @@ module.exports = app => {
                     });
                     });
                     c.attNames = names.join('\n');
                     c.attNames = names.join('\n');
                 }
                 }
-                const changeBills = await this.ctx.service.changeAuditList.getChangeAuditBills(tid);
+                const changeBills = await this.ctx.service.changeAuditList.getChangeAuditBills(tid, this.ctx.session.sessionProject.page_show.isOnlyChecked);
                 for (const d of changeBills) {
                 for (const d of changeBills) {
                     d.o_qty = d.oamount;
                     d.o_qty = d.oamount;
                     d.o_tp = this.ctx.helper.mul(d.o_qty, d.unit_price, decimal.tp);
                     d.o_tp = this.ctx.helper.mul(d.o_qty, d.unit_price, decimal.tp);
@@ -760,7 +760,7 @@ module.exports = app => {
                     d.s_qty = d.samount ? parseFloat(d.samount) : 0;
                     d.s_qty = d.samount ? parseFloat(d.samount) : 0;
                     d.s_tp = this.ctx.helper.mul(d.s_qty, d.unit_price, decimal.tp);
                     d.s_tp = this.ctx.helper.mul(d.s_qty, d.unit_price, decimal.tp);
 
 
-                    const auditAmount = d.audit_amount.split(',');
+                    const auditAmount = d.audit_amount ? d.audit_amount.split(',') : [];
                     const relaChange = ctx.helper._.find(change, {cid: d.cid});
                     const relaChange = ctx.helper._.find(change, {cid: d.cid});
                     for (const [i, aa] of auditAmount.entries()) {
                     for (const [i, aa] of auditAmount.entries()) {
                         const amountField = 'qty_' + (i+1), tpField = 'tp_' + (i+1);
                         const amountField = 'qty_' + (i+1), tpField = 'tp_' + (i+1);