Browse Source

1. 资金划拨,资金支付,分页显示
2. 部位台账,计算相关

MaiXinRong 1 week ago
parent
commit
0aafc321bd

+ 27 - 1
app/controller/financial_controller.js

@@ -126,12 +126,25 @@ module.exports = app => {
                     throw '没有查看权限';
                 }
                 const transferList = await ctx.service.financialTransfer.getList(ctx.subProject.id);
+                const total = await ctx.service.financialTransfer.count({ spid: ctx.subProject.id });
+                // 分页相关
+                const page = ctx.page;
+                const pageSize = ctx.pageSize;
+                const pageInfo = {
+                    page,
+                    pageSizeSelect: 1,
+                    pageSize,
+                    total_num: total,
+                    total: Math.ceil(total / pageSize),
+                    queryData: JSON.stringify(ctx.urlInfo.query),
+                };
                 const renderData = {
                     financialPermission,
                     transferList,
                     moment,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.financial.transfer),
                     whiteList: ctx.app.config.multipart.whitelist,
+                    pageInfo,
                 };
                 await this.layout('financial/transfer.ejs', renderData, 'financial/transfer_modal.ejs');
             } catch (err) {
@@ -614,7 +627,19 @@ module.exports = app => {
             filter.count[filter.status.uncheck] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, filter.status.uncheck, filterTids, used);// await ctx.service.change.checkingDatas(tender.id, ctx.session.sessionUser.accountId);
             filter.count[filter.status.checking] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, filter.status.checking, filterTids, used);// await ctx.service.change.checkedDatas(tender.id, ctx.session.sessionUser.accountId);
             filter.count[filter.status.checked] = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, filter.status.checked, filterTids, used);// await ctx.service.change.pendingDatas(tender.id, ctx.session.sessionUser.accountId);
-            const payList = await ctx.service.financialPay.getListByStatus(ctx.subProject.id, status, filterTids, used);
+            const payList = await ctx.service.financialPay.getListByStatus(ctx.subProject.id, status, filterTids, used, 1);
+            const total = await ctx.service.financialPay.getCountByStatus(ctx.subProject.id, status, filterTids, used);
+            // 分页相关
+            const page = ctx.page;
+            const pageSize = ctx.pageSize;
+            const pageInfo = {
+                page,
+                pageSizeSelect: 1,
+                pageSize,
+                total_num: total,
+                total: Math.ceil(total / pageSize),
+                queryData: JSON.stringify(ctx.urlInfo.query),
+            };
             // 获取所有项目参与者
             const accountList = await ctx.service.projectAccount.getAllSubProjectAccount(ctx.subProject, ['id', 'account', 'name', 'company', 'role', 'enable', 'is_admin', 'account_group', 'mobile']);
             const payTenders = await ctx.service.financialPayTender.getAllDataByCondition({ where: { spid: ctx.subProject.id } });
@@ -673,6 +698,7 @@ module.exports = app => {
                 auditType: auditConst.auditType,
                 // preUrl: '/financial',
                 jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.financial.pay),
+                pageInfo,
             };
             if (ctx.session.sessionUser.is_admin) {
                 const unitList = await ctx.service.constructionUnit.getAllDataByCondition({ where: { pid: ctx.session.sessionProject.id } });

+ 9 - 3
app/controller/stage_controller.js

@@ -518,9 +518,15 @@ module.exports = app => {
                 if (projRela.banOver && ctx.tender.info.ledger_check.over) {
                     checkData.checkOverRange(ctx.tender.info.checkOverInfo);
                 }
-                checkData.checkBillsTp([
-                    { qty: 'contract_qty', tp: 'contract_tp' }, { qty: 'qc_qty', tp: 'qc_tp' },
-                ], this.ctx.tender.info.decimal, x => { return x.is_tp; });
+                if (this.ctx.tender.info.calc_type === 'up') {
+                    checkData.checkBillsTp([
+                        { qty: 'contract_qty', tp: 'contract_tp' }, { qty: 'qc_qty', tp: 'qc_tp' },
+                    ], this.ctx.tender.info.decimal, x => { return x.is_tp; });
+                } else {
+                    checkData.checkBillsTp([
+                        { qty: 'qc_qty', tp: 'qc_tp' },
+                    ], this.ctx.tender.info.decimal, x => { return x.is_tp; });
+                }
                 checkData.checkBillsQty(['contract_qty', 'qc_qty']);
                 if (projRela.banMinusChangeBills && ctx.tender.info.ledger_check.banMinusChangeBills) {
                     const change = await this.ctx.service.change.getAllChangeHasMinus(ctx.tender.id);

+ 17 - 2
app/lib/bills_pos_convert.js

@@ -79,16 +79,29 @@ class BillsPosConvert {
             if (fields.indexOf(prop) >= 0) node[prop] = data[prop];
         }
     }
+    _calcContractTp(node, data) {
+        const info = this.ctx.tender.info;
+        if (info.calc_type === 'tp') {
+            let activeQty = this.ctx.helper.add(data.quantity, data.qc_minus_qty);
+            let end_contract_qty = data.contract_qty;
+            activeQty = this.ctx.helper.add(activeQty, data.pre_qc_minus_qty);
+            end_contract_qty = this.ctx.helper.add(end_contract_qty, data.pre_contract_qty);
+            const end_contract_tp = this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), data.total_price, info.decimal.tp);
+            return this.ctx.helper.sub(end_contract_tp, data.pre_contract_tp);
+        } else {
+            return this.ctx.helper.mul(node.unit_price, data.contract_qty, info.decimal.tp);
+        }
+    }
     // v2
     _loadPosCalcFields(node, data) {
         const tpDecimal = this.ctx.tender.info.decimal.tp;
         node.quantity = this.ctx.helper.add(node.quantity, data.quantity);
-        node.total_price = this.ctx.helper.add(node.total_price, this.ctx.helper.mul(node.unit_price, data.quantity, tpDecimal));
+        data.total_price = this.ctx.helper.mul(node.unit_price, data.quantity, tpDecimal);
+        node.total_price = this.ctx.helper.add(node.total_price, data.total_price);
 
         const org_price = node.org_price || node.unit_price;
 
         node.contract_qty = this.ctx.helper.add(node.contract_qty, data.contract_qty);
-        node.contract_tp = this.ctx.helper.add(node.contract_tp, this.ctx.helper.mul(node.unit_price, data.contract_qty, tpDecimal));
         node.qc_qty = this.ctx.helper.add(node.qc_qty, data.qc_qty);
         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);
@@ -103,6 +116,8 @@ class BillsPosConvert {
 
         node.qc_minus_qty = this.ctx.helper.add(node.qc_minus_qty, data.qc_minus_qty);
         node.pre_qc_minus_qty = this.ctx.helper.add(node.pre_qc_minus_qty, data.pre_qc_minus_qty);
+
+        node.contract_tp = this.ctx.helper.add(node.contract_tp, this._calcContractTp(node, data));
     }
     _loadBillsCalcFields(node, data) {
         node.quantity = this.ctx.helper.add(node.quantity, data.quantity);

+ 3 - 4
app/public/js/stage.js

@@ -232,6 +232,8 @@ $(document).ready(() => {
         font: '10px 微软雅黑'
     };
     let detail, searchLedger, checkedChanges;
+    const tpCalcFields = [{qty: 'qc_qty', tp: 'qc_tp'}];
+    if (tenderInfo.calc_type === 'up') tpCalcFields.shift({qty: 'contract_qty', tp: 'contract_tp'});
     const checkOption = {
         sibling: { enable: 0 },
         empty_code: { enable: 0 },
@@ -242,10 +244,7 @@ $(document).ready(() => {
         zero: { enable: 0 },
         tp: {
             enable: 1,
-            fields: [
-                {qty: 'contract_qty', tp: 'contract_tp'},
-                {qty: 'qc_qty', tp: 'qc_tp'},
-            ],
+            fields: tpCalcFields,
             filter: function (node) {
                 return node.is_tp;
             }

+ 7 - 1
app/service/financial_pay.js

@@ -38,7 +38,7 @@ module.exports = app => {
          * @param {int} hadlimit - 分页
          * @return {object} list - 列表
          */
-        async getListByStatus(spid, status = 0, tid = null, used = null) {
+        async getListByStatus(spid, status = 0, tid = null, used = null, pageLimit = 0) {
             let addSql = '';
             if (tid !== null) {
                 if (tid.length === 0) {
@@ -86,6 +86,12 @@ module.exports = app => {
                     break;
             }
             sql += ' ORDER BY a.create_time DESC';
+            if (pageLimit) {
+                const limit = this.ctx.pageSize ? this.ctx.pageSize : this.app.config.pageSize;
+                const offset = limit * (this.ctx.page - 1);
+                const limitString = offset >= 0 ? offset + ',' + limit : limit;
+                sql += ' LIMIT ' + limitString;
+            }
             const list = await this.db.query(sql, sqlParam);
             return list;
         }

+ 8 - 2
app/service/financial_transfer.js

@@ -21,8 +21,14 @@ module.exports = app => {
             this.tableName = 'financial_transfer';
         }
 
-        async getList(spid) {
-            const sql = 'SELECT ft.*, pa.`name` as username, pa.`company` FROM ?? as ft LEFT JOIN ?? as pa ON ft.`uid` = pa.`id` WHERE ft.`spid` = ? ORDER BY ft.`id` DESC';
+        async getList(spid, pageLimit = 0) {
+            let sql = 'SELECT ft.*, pa.`name` as username, pa.`company` FROM ?? as ft LEFT JOIN ?? as pa ON ft.`uid` = pa.`id` WHERE ft.`spid` = ? ORDER BY ft.`id` DESC';
+            if (pageLimit) {
+                const limit = this.ctx.pageSize ? this.ctx.pageSize : this.app.config.pageSize;
+                const offset = limit * (this.ctx.page - 1);
+                const limitString = offset >= 0 ? offset + ',' + limit : limit;
+                sql += ' LIMIT ' + limitString;
+            }
             const sqlParams = [this.tableName, this.ctx.service.projectAccount.tableName, spid];
             const list = await this.db.query(sql, sqlParams);
             for (const l of list) {

+ 22 - 6
app/service/stage_change.js

@@ -16,6 +16,7 @@ const changeConst = require('../const/change');
 class autoUseChange {
     constructor(helper, info, settleStatus) {
         this.helper = helper;
+        this.info = info;
         this.precision = info.precision;
         this.decimal = info.decimal;
         this.settleStatus = settleStatus;
@@ -46,6 +47,7 @@ class autoUseChange {
         this.stageBills = source.stageBills;
         this.stagePos = source.stagePos;
         this.stageChange = source.stageChange || [];
+        this.preStageBills = source.preStageBills || [];
     }
 
     findBillsPos(changeBills){
@@ -154,7 +156,17 @@ class autoUseChange {
             this._calculateQty(cb, minus, bills);
         }
     }
-
+    calcContractTp(bills, contract_qty, qc_minus_qty) {
+        const preSb = this.preStageBills.find(x => { return x.lid === bills.id; });
+        let activeQty = this.helper.add(bills.quantity, qc_minus_qty);
+        let end_contract_qty = contract_qty;
+        if (preSb) {
+            activeQty = this.helper.add(activeQty, preSb.qc_minus_qty);
+            end_contract_qty = this.helper.add(end_contract_qty, preSb.contract_qty);
+        }
+        const end_contract_tp = this.helper.mul(this.helper.div(end_contract_qty, activeQty), bills.total_price, this.decimal.tp);
+        return preSb ? this.helper.sub(end_contract_tp, preSb.pre_contract_tp) : end_contract_tp;
+    }
     calculateAll() {
         for (const cd of this.changeDetail) {
             const sci = this.stageChange.findIndex(x => {
@@ -218,8 +230,10 @@ class autoUseChange {
             const negative_qc_tp = this.helper.mul(negative_qc_qty, cb.bills.unit_price, this.decimal.tp);
             const qc_minus_qty = this.helper.round(cb.qc_minus_qty || 0, precision.value);
             const sb = this.stageBills.find(x => {return x.lid === lid});
+
             if (sb) {
-                this.updateBills.push({ id: sb.id, qc_qty, qc_tp, positive_qc_qty, positive_qc_tp, negative_qc_qty, negative_qc_tp, qc_minus_qty });
+                const contract_tp = qc_minus_qty && this.info.calc_type === 'tp' && sb.contract_qty ? this.calcContractTp(cb.bills, sb.contract_qty, qc_minus_qty) : 0;
+                this.updateBills.push({ id: sb.id, qc_qty, qc_tp, positive_qc_qty, positive_qc_tp, negative_qc_qty, negative_qc_tp, qc_minus_qty, contract_tp });
             } else {
                 this.insertBills.push({
                     tid: this.default.tid, sid: this.default.sid, said: this.default.said,
@@ -815,7 +829,7 @@ module.exports = app => {
                 x.billsPos = data.find(y => { return x.id === y.cbid; });
             });
             const ledgerData = await this.ctx.service.ledger.getAllDataByCondition({
-                columns: ['id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf', 'code', 'b_code', 'name', 'unit', 'unit_price'],
+                columns: ['id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf', 'code', 'b_code', 'name', 'unit', 'unit_price', 'quantity', 'total_price'],
                 where: { id: lid },
             });
             const extraData = await this.ctx.service.ledgerExtra.getData(this.ctx.tender.id, ['is_tp']);
@@ -829,11 +843,12 @@ module.exports = app => {
             const stageBills = await this.ctx.service.stageBills.getAllDataByCondition({ where: { sid: stage.id } });
             const stagePos = await this.ctx.service.stagePos.getAllDataByCondition({ where: { sid: stage.id } });
             const stageChange = await this.ctx.service.stageChange.getAllDataByCondition({ where: { sid: stage.id, lid }});
+            const preStageBills = stage.preCheckedStage ? await this.ctx.service.stageBillsFinal.getFinalData(stage.tid, stage.preCheckedStage.order) : [];
 
             const useModal = new autoUseChange(this.ctx.helper, tender.info);
             const projectFunInfo = this.ctx.subProject.fun_rela;
             const minusNoValue = projectFunInfo.minusNoValue && tender.info.fun_rela.stage_change.minusNoValue;
-            useModal.use({ledgerData, posData, stageBills, stagePos, stageChange, default: { tid: stage.tid, sid: stage.id, said: this.ctx.session.sessionUser.accountId } }, validChangeBills, minusNoValue);
+            useModal.use({ledgerData, posData, stageBills, stagePos, stageChange, preStageBills, default: { tid: stage.tid, sid: stage.id, said: this.ctx.session.sessionUser.accountId } }, validChangeBills, minusNoValue);
 
             const conn = await this.db.beginTransaction();
             try {
@@ -859,7 +874,7 @@ module.exports = app => {
         async autoUseAllChange(tender, stage) {
             const validChangeBills = await this.ctx.service.stageChangeFinal.getAllChangeBillsValidQty(tender.id);
             const ledgerData = await this.ctx.service.ledger.getAllDataByCondition({
-                columns: ['id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf', 'code', 'b_code', 'name', 'unit', 'unit_price'],
+                columns: ['id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf', 'code', 'b_code', 'name', 'unit', 'unit_price', 'quantity', 'total_price'],
                 where: { tender_id: stage.tid },
             });
             const extraData = await this.ctx.service.ledgerExtra.getData(this.ctx.tender.id, ['is_tp']);
@@ -879,10 +894,11 @@ module.exports = app => {
             ]);
             const stageBills = await this.ctx.service.stageBills.getAllDataByCondition({ where: { sid: stage.id } });
             const stagePos = await this.ctx.service.stagePos.getAllDataByCondition({ where: { sid: stage.id } });
+            const preStageBills = stage.preCheckedStage ? await this.ctx.service.stageBillsFinal.getFinalData(stage.tid, stage.preCheckedStage.order) : [];
             const useModal = new autoUseChange(this.ctx.helper, tender.info, this.ctx.service.settle.settleStatus);
             const projectFunInfo = this.ctx.subProject.fun_rela;
             const minusNoValue = projectFunInfo.minusNoValue && tender.info.fun_rela.stage_change.minusNoValue;
-            useModal.use({ledgerData, posData, stageBills, stagePos, default: { tid: stage.tid, sid: stage.id, said: this.ctx.session.sessionUser.accountId } }, validChangeBills, minusNoValue);
+            useModal.use({ledgerData, posData, stageBills, stagePos, preStageBills, default: { tid: stage.tid, sid: stage.id, said: this.ctx.session.sessionUser.accountId } }, validChangeBills, minusNoValue);
 
             // if (useModal.insertChange.length === 0) return '无可调用的清单或计量单元';
 

+ 43 - 8
app/service/stage_stash.js

@@ -14,6 +14,7 @@ class loadStageExcelTree {
     constructor(ctx) {
         this.ctx = ctx;
 
+        this.info = ctx.tender.info;
         this.decimal = ctx.tender.info.decimal;
         this.settleStatus = ctx.service.settle.settleStatus;
 
@@ -39,6 +40,8 @@ class loadStageExcelTree {
         this.stagePos = source.stagePos;
 
         this.stageBillsDgn = source.stageBillsDgn;
+
+        this.preStageBills = source.preStageBills;
     }
     findNode(node, parent) {
         const _ = this.ctx.helper._;
@@ -59,6 +62,21 @@ class loadStageExcelTree {
             }
         });
     }
+    calcContractTp(node, contract_qty, qc_minus_qty) {
+        if (this.info.calc_type === 'tp') {
+            const preSb = this.preStageBills.find(x => { return x.lid === node.id; });
+            let activeQty = this.ctx.helper.add(node.quantity, qc_minus_qty);
+            let end_contract_qty = contract_qty;
+            if (preSb) {
+                activeQty = this.ctx.helper.add(activeQty, preSb.qc_minus_qty);
+                end_contract_qty = this.ctx.helper.add(end_contract_qty, preSb.contract_qty);
+            }
+            const end_contract_tp = this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), node.total_price, this.decimal.tp);
+            return preSb ? this.ctx.helper.sub(end_contract_tp, preSb.pre_contract_tp) : end_contract_tp;
+        } else if (this.info.calc_type === 'up') {
+            return this.ctx.helper.mul(contract_qty, node.unit_price, this.decimal.tp);
+        }
+    }
     loadLeaf(node, source) {
         const curStageBills = this.stageBills.find(csb => { return csb.lid === source.id; });
         if (node.has_pos) {
@@ -86,7 +104,7 @@ class loadStageExcelTree {
             for (const ssp of sourceStagePos) {
                 contract_qty = this.ctx.helper.add(contract_qty, ssp.contract_qty);
             }
-            const contract_tp = this.ctx.helper.mul(contract_qty, source.unit_price, this.decimal.tp);
+            const contract_tp = this.calcContractTp(source, contract_qty, curStageBills ? curStageBills.qc_minus_qty : 0);
             if (curStageBills) {
                 this.updateBills.push({ id: curStageBills.id, contract_qty, contract_tp, postil: node.postil || curStageBills.postil || '' });
             } else {
@@ -99,7 +117,7 @@ class loadStageExcelTree {
             if (!node.contract_qty && !node.contract_tp) return;
             const contract_qty = source.is_tp ? 0 : node.contract_qty;
             const contract_tp = contract_qty
-                ? this.ctx.helper.mul(contract_qty, source.unit_price, this.decimal.tp)
+                ? this.calcContractTp(source, contract_qty, curStageBills ? curStageBills.qc_minus_qty : 0)
                 : source.is_tp ? this.ctx.helper.round(node.contract_tp, this.decimal.tp) : 0;
 
             if (curStageBills) {
@@ -249,7 +267,20 @@ module.exports = app => {
             return data.bills;
         }
 
+
         async reCalcStashData(stage, data) {
+            const calcContractTp = function(helper, info, stageBills, bills) {
+                if (info.calc_type === 'tp') {
+                    let activeQty = helper.add(bills.quantity, stageBills.qc_minus_qty);
+                    let end_contract_qty = stageBills.contract_qty;
+                    activeQty = helper.add(activeQty, bills.pre_qc_minus_qty);
+                    end_contract_qty = helper.add(end_contract_qty, bills.pre_contract_qty);
+                    const end_contract_tp = helper.mul(helper.div(end_contract_qty, activeQty), bills.total_price, decimal.tp);
+                    return helper.sub(end_contract_tp, bills.pre_contract_tp);
+                } else if (info.calc_type === 'up') {
+                    return helper.mul(bills.unit_price, stageBills.contract_qty, info.decimal.tp);
+                }
+            };
             const decimal = this.ctx.tender.info.decimal;
             const insertBillsData = [], insertPosData = [], insertChangeData = [];
             const settleStatus = this.ctx.service.settle.settleStatus;
@@ -257,9 +288,11 @@ module.exports = app => {
             const bills = await this.ctx.service.ledger.getAllDataByCondition({ where: { tender_id: stage.tid, is_leaf: true } });
             const extraData = await this.ctx.service.ledgerExtra.getData(stage.tid, ['id', 'is_tp']);
             const settleStatusBills = stage.readySettle ? await this.ctx.service.settleBills.getAllDataByCondition({ where: { settle_id: stage.readySettle.id }}) : [];
+            const preStageBills = stage.preCheckedStage ? await this.ctx.service.stageBillsFinal.getFinalData(stage.tid, this.ctx.stage.preCheckedStage.order) : [];
             this.ctx.helper.assignRelaData(bills, [
                 { data: extraData, fields: ['is_tp'], prefix: '', relaId: 'id' },
                 { data: settleStatusBills, fields: ['settle_status'], prefix: '', relaId: 'lid' },
+                { data: preStageBills, field: ['contract_qty', 'contract_tp', 'qc_minus_qty'], prefix: 'pre_', relaId: 'lid'},
             ]);
             const pos = await this.ctx.service.pos.getAllDataByCondition({ where: { tid: stage.tid } });
             const settleStatusPos = stage.readySettle ? await this.ctx.service.settlePos.getAllDataByCondition({ where: { settle_id: stage.readySettle.id }}) : [];
@@ -324,7 +357,7 @@ module.exports = app => {
                         nbs.positive_qc_qty = this.ctx.helper.add(nbs.positive_qc_qty, nps.positive_qc_qty);
                         nbs.negative_qc_qty = this.ctx.helper.add(nbs.negative_qc_qty, nps.negative_qc_qty);
                     }
-                    nbs.contract_tp = this.ctx.helper.mul(nbs.contract_qty, b.unit_price, decimal.tp);
+                    nbs.contract_tp = calcContractTp(this.ctx.helper, this.ctx.tender.info, nbs, b);
                     nbs.qc_tp = this.ctx.helper.mul(nbs.qc_qty, b.unit_price, decimal.tp);
                     nbs.positive_qc_tp = this.ctx.helper.mul(nbs.positive_qc_qty, b.unit_price, decimal.tp);
                     nbs.negative_qc_tp = this.ctx.helper.mul(nbs.negative_qc_qty, b.unit_price, decimal.tp);
@@ -333,7 +366,6 @@ module.exports = app => {
                         nbs.contract_tp = this.ctx.helper.round(d.contract_tp, decimal.tp);
                     } else {
                         nbs.contract_qty = this.ctx.helper.round(d.contract_qty, decimal.qty);
-                        nbs.contract_tp = this.ctx.helper.mul(nbs.contract_qty, b.unit_price, decimal.tp);
                         if (d.change) {
                             for (const c of d.change) {
                                 if (!c.qty) continue;
@@ -353,6 +385,7 @@ module.exports = app => {
                                 }
                             }
                         }
+                        nbs.contract_tp = calcContractTp(this.ctx.helper, this.ctx.tender.info, nbs, b);
                         nbs.qc_tp = this.ctx.helper.mul(nbs.qc_qty, b.unit_price, decimal.tp);
                         nbs.positive_qc_tp = this.ctx.helper.mul(nbs.positive_qc_qty, b.unit_price, decimal.tp);
                         nbs.negative_qc_tp = this.ctx.helper.mul(nbs.negative_qc_qty, b.unit_price, decimal.tp);
@@ -405,7 +438,7 @@ module.exports = app => {
                 const cacheTree = analysisExcel.analysisData(excelData, tempData, { filterZeroGcl: false });
 
                 const ledgerData = await this.ctx.service.ledger.getAllDataByCondition({
-                    columns: ['id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf', 'code', 'b_code', 'name', 'unit', 'unit_price'],
+                    columns: ['id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf', 'code', 'b_code', 'name', 'unit', 'unit_price', 'quantity', 'total_price'],
                     where: { tender_id: stage.tid},
                 });
                 const extraData = await this.ctx.service.ledgerExtra.getData(this.ctx.tender.id, ['is_tp']);
@@ -425,9 +458,10 @@ module.exports = app => {
                 const stageBills = await this.ctx.service.stageBills.getAllDataByCondition({ where: { sid: stage.id } });
                 const stagePos = await this.ctx.service.stagePos.getAllDataByCondition({ where: { sid: stage.id } });
                 const stageBillsDgn = await this.ctx.service.stageBillsDgn.getAllDataByCondition({ where: { tid: stage.tid } });
+                const preStageBills = stage.preCheckedStage ? await this.ctx.service.stageBillsFinal.getFinalData(stage.tid, this.ctx.stage.preCheckedStage.order) : [];
 
                 const loadModal = new loadStageExcelTree(this.ctx);
-                loadModal.load(cacheTree, { ledgerData, posData, stageBills, stagePos, stageBillsDgn, default: { tid: stage.tid, sid: stage.id, said: this.ctx.session.sessionUser.accountId } });
+                loadModal.load(cacheTree, { ledgerData, posData, stageBills, stagePos, stageBillsDgn, preStageBills, default: { tid: stage.tid, sid: stage.id, said: this.ctx.session.sessionUser.accountId } });
 
                 const conn = await this.db.beginTransaction();
                 try {
@@ -463,7 +497,7 @@ module.exports = app => {
                 dealPos.loadDatas(dealData.pos);
 
                 const ledgerData = await this.ctx.service.ledger.getAllDataByCondition({
-                    columns: ['id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf', 'code', 'b_code', 'name', 'unit', 'unit_price'],
+                    columns: ['id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf', 'code', 'b_code', 'name', 'unit', 'unit_price', 'quantity', 'total_price'],
                     where: { tender_id: stage.tid},
                 });
                 const extraData = await this.ctx.service.ledgerExtra.getData(this.ctx.tender.id, ['is_tp']);
@@ -483,9 +517,10 @@ module.exports = app => {
                 const stageBills = await this.ctx.service.stageBills.getAllDataByCondition({ where: { sid: stage.id } });
                 const stagePos = await this.ctx.service.stagePos.getAllDataByCondition({ where: { sid: stage.id } });
                 const stageBillsDgn = await this.ctx.service.stageBillsDgn.getAllDataByCondition({ where: { tid: stage.tid } });
+                const preStageBills = stage.preCheckedStage ? await this.ctx.service.stageBillsFinal.getFinalData(stage.tid, this.ctx.stage.preCheckedStage.order) : [];
 
                 const loadModal = new loadStageExcelTree(this.ctx);
-                loadModal.loadDeal(dealTree, dealPos, { ledgerData, posData, stageBills, stagePos, stageBillsDgn, default: { tid: stage.tid, sid: stage.id, said: this.ctx.session.sessionUser.accountId } });
+                loadModal.loadDeal(dealTree, dealPos, { ledgerData, posData, stageBills, stagePos, stageBillsDgn, preStageBills, default: { tid: stage.tid, sid: stage.id, said: this.ctx.session.sessionUser.accountId } });
 
                 const conn = await this.db.beginTransaction();
                 try {

+ 2 - 0
app/view/financial/pay.ejs

@@ -119,6 +119,8 @@
                     <% } %>
                     </tbody>
                 </table>
+                <!--翻页-->
+                <% include ../layout/page.ejs %>
             </div>
         </div>
     </div>

+ 2 - 0
app/view/financial/transfer.ejs

@@ -46,6 +46,8 @@
                     <% } %>
                     </tbody>
                 </table>
+                <!--翻页-->
+                <% include ../layout/page.ejs %>
             </div>
         </div>
     </div>

+ 3 - 1
app/view/stage/bwtz.ejs

@@ -236,6 +236,7 @@
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'contract_tp', hAlign: 2, width: 60, type: 'Number'},
             {title: '本期数量变更|数量', colSpan: '3|1', rowSpan: '1|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'qc_tp', hAlign: 2, width: 60, type: 'Number'},
+            {title: '|不计价', colSpan: '|1', rowSpan: '|1', field: 'qc_minus_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|变更令', colSpan: '|1', rowSpan: '|1', field: 'bgl_code', hAlign: 2, width: 60, formatter: '@', cellType: 'ellipsisAutoTip'},
             <% if ( ctx.tender.info.display.stage.priceDiff ) { %>
             { title: '本期补差|原单价', colSpan: '2|1', rowSpan: '1|1', field: 'org_price', hAlign: 2, width: 60, type: 'Number', getValue(data) { return data.pc_tp ? data.org_price : null},  },
@@ -245,8 +246,9 @@
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'gather_tp', hAlign: 2, width: 60, type: 'Number'},
             {title: '截止本期合同计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_contract_qty', hAlign: 2, width: 60, type: 'Number'},
             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_contract_tp', hAlign: 2, width: 60, type: 'Number'},
-            {title: '截止本期数量变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_qc_qty', 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'},
             {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'},