Browse Source

汇总表,签约清单,计算问题

MaiXinRong 5 years ago
parent
commit
96cc0ede7d

+ 3 - 2
app/service/rpt_gather_memory.js

@@ -752,6 +752,7 @@ module.exports = app => {
         }
 
         async _gatherCommonDealBills(sTender, completeData) {
+            const self = this;
             const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
             completeData.id = tender.id;
             completeData.name = tender.name;
@@ -762,8 +763,8 @@ module.exports = app => {
                 gatherData[completeData.prefix + 'qty'] = sourceData.quantity;
                 gatherData[completeData.prefix + 'tp'] = sourceData.total_price;
 
-                gatherData['s_' + 'qty'] = sourceData.quantity;
-                gatherData['s_' + 'tp'] = sourceData.total_price;
+                gatherData['s_' + 'qty'] = self.ctx.helper.add(gatherData['s_' + 'qty'], sourceData.quantity);
+                gatherData['s_' + 'tp'] = self.ctx.helper.add(gatherData['s_' + 'tp'], sourceData.total_price);
             });
         }
 

+ 5 - 5
builder_report_index_define.js

@@ -834,13 +834,13 @@ const gather_deal_bills = {
         { name: '标段id', field: 't_id', type: dataType.int },
         { name: '标段-名称', field: 't_name', type: dataType.str },
 
-        { name: '(标段)本期-金额', field: 't_tp', type: dataType.currency },
+        { name: '(标段)金额', field: 't_tp', type: dataType.currency },
 
-        { name: '(合计)本期-金额', field: 's_tp', type: dataType.currency },
+        { name: '(合计)金额', field: 's_tp', type: dataType.currency },
 
-        { name: '(特殊1)本期-金额', field: 'ts_key1_tp', type: dataType.currency },
-        { name: '(特殊2)本期-金额', field: 'ts_key2_tp', type: dataType.currency },
-        { name: '(特殊3)本期-金额', field: 'ts_key3_tp', type: dataType.currency },
+        { name: '(特殊1)金额', field: 'ts_key1_tp', type: dataType.currency },
+        { name: '(特殊2)金额', field: 'ts_key2_tp', type: dataType.currency },
+        { name: '(特殊3)金额', field: 'ts_key3_tp', type: dataType.currency },
     ],
 };
 

+ 35 - 5
test/app/service/report_memory_temp.test.js

@@ -25,6 +25,12 @@ describe('test/app/service/report_memory.test.js', () => {
         //     project: 'T201711273363',
         //     project_password: 'mai654321',
         // };
+        ctx.session = {};
+        mockData.session = ctx.session;
+    });
+    // 汇总合同支付
+    it('test getGatherStagePay', function* () {
+        const ctx = app.mockContext();
         const postData = {
             account: 'fuqingqing',
             project: 'P0505',
@@ -33,11 +39,7 @@ describe('test/app/service/report_memory.test.js', () => {
         ctx.session = {};
         const loginResult = yield ctx.service.projectAccount.accountLogin(postData, 2);
         assert(loginResult);
-        mockData.session = ctx.session;
-    });
-    // 期部位明细数据
-    it('test getStagePos', function* () {
-        const ctx = app.mockContext(mockData);
+
         const select = {
             tenders: [{tid: 2283}, {tid: 2281}],
             type: 'final',
@@ -57,4 +59,32 @@ describe('test/app/service/report_memory.test.js', () => {
             tplDefine: {gather_select: define}, cDefine: {gather_select: select}});
         yield ctx.helper.saveBufferFile(JSON.stringify(data.mem_gather_stage_pay, "", "\t"), path.join(savePath, 'mem_gather_stage_pay_converse.json'));
     });
+    // 汇总签约清单
+    it('test getGatherStagePay', function* () {
+        const ctx = app.mockContext();
+        const postData = {
+            account: 'zengpeiwen',
+            project: 'P1201',
+            project_password: '123456',
+        };
+        ctx.session = {};
+        const loginResult = yield ctx.service.projectAccount.accountLogin(postData, 2);
+        assert(loginResult);
+
+        const select = {
+            tenders: [{tid: 2046}, {tid: 1942}, {tid: 2217}],
+            type: 'final',
+        };
+        const define = {
+            enable: true,
+            setting: JSON.stringify({
+                title: '请选择汇总的标段',
+                type: 'final',
+            })
+        };
+
+        const data = {};
+        data.mem_gather_deal_bills = yield ctx.service.rptGatherMemory.getGatherDealBills([], define, select);
+        yield ctx.helper.saveBufferFile(JSON.stringify(data.mem_gather_deal_bills, "", "\t"), path.join(savePath, 'mem_gather_deal_bills.json'));
+    });
 });