浏览代码

部位台账计算调整

MaiXinRong 3 周之前
父节点
当前提交
bf4af8f727
共有 3 个文件被更改,包括 17 次插入6 次删除
  1. 1 2
      app/controller/file_controller.js
  2. 14 2
      app/lib/bills_pos_convert.js
  3. 2 2
      app/view/stage/bwtz.ejs

+ 1 - 2
app/controller/file_controller.js

@@ -311,8 +311,7 @@ module.exports = app => {
                     ? JSON.parse(accountInfo.permission) : null;
                 const tenderList = await ctx.service.tender.getList('', userPermission, ctx.session.sessionUser.is_admin);
 
-                const rela_tender = await ctx.subProject.rela_tender.split(',');
-                const result = tenderList.filter(x => { return rela_tender.indexOf(x.id + '') >= 0});
+                const result = tenderList;
                 for (const r of result) {
                     r.advance = await ctx.service.advance.getAllDataByCondition({ columns: ['id', 'order', 'type'], where: { tid: r.id }});
                     r.advance.forEach(a => {

+ 14 - 2
app/lib/bills_pos_convert.js

@@ -102,6 +102,17 @@ class BillsPosConvert {
             }
         }
     }
+    _calcPreContractTp(node, data) {
+        const info = this.ctx.tender.info;
+        const org_price = node.org_price || node.unit_price;
+        if (info.calc_type === 'tp') {
+            const activeQty = this.ctx.helper.add(data.quantity, data.pre_qc_minus_qty);
+            const orgTotalPrice = this.ctx.helper.mul(data.quantity, org_price, info.decimal.tp);
+            return this.ctx.helper.mul(this.ctx.helper.div(data.pre_contract_qty, activeQty), orgTotalPrice, info.decimal.tp);
+        } else if (info.calc_type === 'up') {
+            return this.ctx.helper.mul(org_price, data.pre_contract_qty, info.decimal.tp);
+        }
+    }
     // v2
     _loadPosCalcFields(node, data) {
         const tpDecimal = this.ctx.tender.info.decimal.tp;
@@ -116,8 +127,9 @@ class BillsPosConvert {
         node.qc_tp = this.ctx.helper.add(node.qc_tp, this.ctx.helper.mul(node.unit_price, data.qc_qty, tpDecimal));
         node.gather_qty = this.ctx.helper.add(node.gather_qty, data.gather_qty);
 
+        data.pre_contract_tp = this._calcPreContractTp(node, data);
         node.pre_contract_qty = this.ctx.helper.add(node.pre_contract_qty, data.pre_contract_qty);
-        node.pre_contract_tp = this.ctx.helper.add(node.pre_contract_tp, this.ctx.helper.mul(org_price, data.pre_contract_qty, tpDecimal));
+        node.pre_contract_tp = this.ctx.helper.add(node.pre_contract_tp, data.pre_contract_tp);
         node.pre_qc_qty = this.ctx.helper.add(node.pre_qc_qty, data.pre_qc_qty);
         node.pre_qc_tp = this.ctx.helper.add(node.pre_qc_tp, this.ctx.helper.mul(org_price, data.pre_qc_qty, tpDecimal));
         node.pre_gather_qty = this.ctx.helper.add(node.pre_gather_qty, data.pre_gather_qty);
@@ -279,7 +291,7 @@ class BillsPosConvert {
 
         const priceDiff = child.org_price ? this.ctx.helper.sub(child.unit_price, child.org_price) : 0;
         if (priceDiff && (child.pre_contract_qty || child.pre_qc_qty)) {
-            child.contract_pc_tp = this.ctx.helper.sub(this.ctx.helper.mul(child.unit_price, child.pre_contract_qty, this.ctx.tender.info.decimal.tp), child.pre_contract_tp);
+            if (this.ctx.tender.info.calc_type === 'up') child.contract_pc_tp = this.ctx.helper.sub(this.ctx.helper.mul(child.unit_price, child.pre_contract_qty, this.ctx.tender.info.decimal.tp), child.pre_contract_tp);
             child.qc_pc_tp = this.ctx.helper.sub(this.ctx.helper.mul(child.unit_price, child.pre_qc_qty, this.ctx.tender.info.decimal.tp), child.pre_qc_tp);
             child.pc_tp = this.ctx.helper.add(child.contract_pc_tp, child.qc_pc_tp);
             child.gather_tp = this.ctx.helper.add(child.gather_tp, child.pc_tp);

+ 2 - 2
app/view/stage/bwtz.ejs

@@ -36,7 +36,7 @@
                     <a id="exportBwtz" class="btn btn-primary btn-sm" href="javascript: void(0)">导出部位台账Excel</a>
                 </div>
                 <div class="d-inline-block ml-2">
-                    <div class="alert alert-warning p-1"><i class="fa Example of exclamation-circle fa-exclamation-circle "></i> 计量台账与部位台账金额,会存在数学误差,属正常现象。软件以计量台账金额为准。</div>
+                    <div class="alert alert-warning p-1"><i class="fa Example of exclamation-circle fa-exclamation-circle "></i> 计量台账与部位台账金额,会存在数学误差,属正常现象。软件以计量台账金额为准。(此页面的金额数据,不适用于“总价合同”的标段)</div>
                 </div>
             </div>
             <div class="ml-auto">
@@ -248,7 +248,7 @@
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_contract_tp', hAlign: 2, width: 60, type: 'Number'},
             {title: '截止本期数量变更|数量', colSpan: '3|1', rowSpan: '1|1', field: 'end_qc_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_qc_tp', hAlign: 2, width: 60, type: 'Number'},
-            {title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 60, type: 'Number', visible: <%- minusNoValue %>},
+            {title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'end_qc_minus_qty', hAlign: 2, width: 60, type: 'Number', visible: <%- minusNoValue %>},
             {title: '截止本期完成计量|数量', colSpan: '3|1', rowSpan: '1|1', field: 'end_gather_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 60, type: 'Number'},
             {title: '|完成率(%)', colSpan: '|1', rowSpan: '|1', field: 'end_final_1_percent', hAlign: 2, width: 80, type: 'Number'},