浏览代码

1. 计量台账,使用数量矫正完成率
2. 金额概况,预付款列向上汇总
3. 清单对比,清单汇总,台账修订--清单对比,章级合计调整

MaiXinRong 4 年之前
父节点
当前提交
3553b3eaf7

+ 11 - 0
app/const/standard.js

@@ -26,6 +26,17 @@ const nodeType = [
     {text: '其他建安工程', value: 14},
     {text: '其他建安工程', value: 14},
 ];
 ];
 
 
+const chapterFilter = [];
+const jrg = nodeType.find(x => {
+    return x.text === '计日工';
+});
+if (jrg) {
+    chapterFilter.push({node_type: jrg.value});
+    chapterFilter.push({field: 'name', part: jrg.text});
+}
+
+
 module.exports = {
 module.exports = {
     nodeType,
     nodeType,
+    chapterFilter,
 };
 };

+ 2 - 0
app/controller/ledger_controller.js

@@ -27,6 +27,7 @@ const path = require('path');
 const exportExcel = require('../lib/export_excel');
 const exportExcel = require('../lib/export_excel');
 const billsPosConvert = require('../lib/bills_pos_convert');
 const billsPosConvert = require('../lib/bills_pos_convert');
 const xlsx = require('js-xlsx');
 const xlsx = require('js-xlsx');
+const stdConst = require('../const/standard');
 
 
 module.exports = app => {
 module.exports = app => {
 
 
@@ -697,6 +698,7 @@ module.exports = app => {
                 const renderData = {
                 const renderData = {
                     tender: ctx.tender.data,
                     tender: ctx.tender.data,
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.ledger.gather),
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.ledger.gather),
+                    chapterFilter: stdConst.chapterFilter,
                 };
                 };
 
 
                 await this.layout('ledger/gather.ejs', renderData);
                 await this.layout('ledger/gather.ejs', renderData);

+ 2 - 0
app/controller/revise_controller.js

@@ -21,6 +21,7 @@ const spreadConst = require('../const/spread');
 const shenpiConst = require('../const/shenpi');
 const shenpiConst = require('../const/shenpi');
 const fs = require('fs');
 const fs = require('fs');
 const LzString = require('lz-string');
 const LzString = require('lz-string');
+const stdConst = require('../const/standard');
 
 
 module.exports = app => {
 module.exports = app => {
     class ReviseController extends app.BaseController {
     class ReviseController extends app.BaseController {
@@ -1019,6 +1020,7 @@ module.exports = app => {
             const renderData = {
             const renderData = {
                 revise,
                 revise,
                 jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.revise.gclCompare),
                 jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.revise.gclCompare),
+                chapterFilter: stdConst.chapterFilter,
             };
             };
             await this.layout('revise/gcl_compare.ejs', renderData);
             await this.layout('revise/gcl_compare.ejs', renderData);
         }
         }

+ 2 - 0
app/controller/stage_controller.js

@@ -24,6 +24,7 @@ const accountGroup = require('../const/account_group').group;
 const sendToWormhole = require('stream-wormhole');
 const sendToWormhole = require('stream-wormhole');
 const billsPosConvert = require('../lib/bills_pos_convert');
 const billsPosConvert = require('../lib/bills_pos_convert');
 const fs = require('fs');
 const fs = require('fs');
+const stdConst = require('../const/standard');
 
 
 module.exports = app => {
 module.exports = app => {
     class StageController extends app.BaseController {
     class StageController extends app.BaseController {
@@ -1171,6 +1172,7 @@ module.exports = app => {
                 [renderData.gclSpread, renderData.leafXmjSpread] = this._getGatherSpreadSetting();
                 [renderData.gclSpread, renderData.leafXmjSpread] = this._getGatherSpreadSetting();
 
 
                 renderData.jsFiles = this.app.jsFiles.common.concat(this.app.jsFiles.stage.gather);
                 renderData.jsFiles = this.app.jsFiles.common.concat(this.app.jsFiles.stage.gather);
+                renderData.chapterFilter = stdConst.chapterFilter;
                 await this.layout('stage/gather.ejs', renderData, 'stage/gather_modal.ejs');
                 await this.layout('stage/gather.ejs', renderData, 'stage/gather_modal.ejs');
             } catch (err) {
             } catch (err) {
                 this.log(err);
                 this.log(err);

+ 34 - 6
app/public/js/gcl_gather.js

@@ -452,22 +452,50 @@ const gclGatherModel = (function () {
         }
         }
     }
     }
 
 
-    function gatherChapterData(chapter, fields) {
-        const [gclChapter, otherChapter] = _getCalcChapter(chapter);
-        for (const d of gsTree.datas) {
+    function _checkFilter(d, filter) {
+        for (const f of filter) {
+            if (f.node_type && f.node_type === d.node_type) return true;
+            if (f.field) {
+                if (f.part && d[f.field] && d[f.field].indexOf(f.part) >= 0) return true;
+                if (f.all && d[f.all] && d[f.all] === f.all) return true;
+            }
+        }
+        return false;
+    }
+
+    function gatherChapterData(chapter, fields, filter = []) {
+        const filterPath = [];
+        const checkFilterPath = function (data) {
+            for (const fp of filterPath) {
+                if (data.full_path.indexOf(fp + '-') === 0 || data.full_path === fp) return true;
+            }
+            return false;
+        };
+
+        const [gclChapter, otherChapter] = _getCalcChapter(chapter, filter);
+        for (const d of gsTree.nodes) {
+            if (_checkFilter(d, filter)) {
+                filterPath.push(d.full_path);
+            }
             if (d.children && d.children.length > 0) continue;
             if (d.children && d.children.length > 0) continue;
 
 
             for (const c of otherChapter) {
             for (const c of otherChapter) {
                 if (c.cType === 41) {
                 if (c.cType === 41) {
                     gatherfields(c, d, fields);
                     gatherfields(c, d, fields);
-                } else if (c.cType === 31 && (!d.b_code || d.b_code === '')) {
+                }
+                if (c.cType === 11 && (d.b_code)) {
                     gatherfields(c, d, fields);
                     gatherfields(c, d, fields);
-                } else if (c.cType === 11 && (d.b_code)) {
+                }
+                if (!checkFilterPath(d)) continue;
+                if (c.cType === 31 && (!d.b_code || d.b_code === '')) {
                     gatherfields(c, d, fields);
                     gatherfields(c, d, fields);
                 }
                 }
             }
             }
+
             if (d.b_code) {
             if (d.b_code) {
-                const c = _getGclChapter(gclChapter, d);
+                const c = checkFilterPath(d)
+                    ? gclChapter.find(x => { return x.cType === 21})
+                    : _getGclChapter(gclChapter, d);
                 gatherfields(c, d, fields);
                 gatherfields(c, d, fields);
             }
             }
         }
         }

+ 1 - 1
app/public/js/ledger_gather.js

@@ -176,7 +176,7 @@ $(document).ready(() => {
         checkCompareData();
         checkCompareData();
         loadLeafXmjData(0);
         loadLeafXmjData(0);
 
 
-        const chapterData = gclGatherModel.gatherChapterData(chapter, ['total_price']);
+        const chapterData = gclGatherModel.gatherChapterData(chapter, ['total_price'], filter);
         for (const c of chapterData) {
         for (const c of chapterData) {
             c.compare_tp = ZhCalc.sub(c.deal_bills_tp, c.total_price);
             c.compare_tp = ZhCalc.sub(c.deal_bills_tp, c.total_price);
         }
         }

+ 1 - 1
app/public/js/revise_gcl_compare.js

@@ -165,7 +165,7 @@ $(document).ready(() => {
             posFields: ['quantity'],
             posFields: ['quantity'],
             chapterFields: ['total_price'],
             chapterFields: ['total_price'],
         };
         };
-        gclCompareModel.init(gclData, chapter);
+        gclCompareModel.init(gclData, chapter, filter);
         setting.prefix = 'new_';
         setting.prefix = 'new_';
         gclCompareModel.gatherLedgerData(data.reviseBills, data.revisePos, setting);
         gclCompareModel.gatherLedgerData(data.reviseBills, data.revisePos, setting);
         setting.prefix = 'org_';
         setting.prefix = 'org_';

+ 37 - 6
app/public/js/shares/gcl_gather_compare.js

@@ -11,7 +11,7 @@
 
 
 const gclCompareModel = (function () {
 const gclCompareModel = (function () {
     const leafXmjs = [], mergeChar = ';';
     const leafXmjs = [], mergeChar = ';';
-    let gclList, gclChapter, otherChapter;
+    let gclList, gclChapter, otherChapter, chapterfilter;
     let ledgerSetting, gsTree;
     let ledgerSetting, gsTree;
 
 
     function gatherfields(obj, src, fields, prefix = '') {
     function gatherfields(obj, src, fields, prefix = '') {
@@ -292,29 +292,60 @@ const gclCompareModel = (function () {
         }
         }
     }
     }
 
 
+    function _checkFilter(d, filter) {
+        for (const f of filter) {
+            if (f.node_type && f.node_type === d.node_type) return true;
+            if (f.field) {
+                if (f.part && d[f.field] && d[f.field].indexOf(f.part) >= 0) return true;
+                if (f.all && d[f.all] && d[f.all] === f.all) return true;
+            }
+        }
+        return false;
+    }
+
     function _gatherChapter() {
     function _gatherChapter() {
-        for (const d of gsTree.datas) {
+        const filterPath = [];
+        const checkFilterPath = function (data) {
+            for (const fp of filterPath) {
+                if (data.full_path.indexOf(fp + '-') === 0 || data.full_path === fp) return true;
+            }
+            return false;
+        };
+
+        for (const d of gsTree.nodes) {
+            if (_checkFilter(d, chapterfilter)) {
+                filterPath.push(d.full_path);
+            }
             if (d.children && d.children.length > 0) continue;
             if (d.children && d.children.length > 0) continue;
 
 
             for (const c of otherChapter) {
             for (const c of otherChapter) {
                 if (c.cType === 41) {
                 if (c.cType === 41) {
                     gatherfields(c, d, ledgerSetting.chapterFields, ledgerSetting.prefix);
                     gatherfields(c, d, ledgerSetting.chapterFields, ledgerSetting.prefix);
-                } else if (c.cType === 31 && (!d.b_code || d.b_code === '')) {
+                }
+                if (c.cType === 11 && (d.b_code)) {
                     gatherfields(c, d, ledgerSetting.chapterFields, ledgerSetting.prefix);
                     gatherfields(c, d, ledgerSetting.chapterFields, ledgerSetting.prefix);
-                } else if (c.cType === 11 && (d.b_code)) {
+                }
+                if (!checkFilterPath(d)) continue;
+                if (c.cType === 31 && (!d.b_code || d.b_code === '')) {
                     gatherfields(c, d, ledgerSetting.chapterFields, ledgerSetting.prefix);
                     gatherfields(c, d, ledgerSetting.chapterFields, ledgerSetting.prefix);
                 }
                 }
             }
             }
+            for (const fp of filterPath) {
+                if (d.full_path.indexOf(fp + '-') === 0 || d.full_path === fp) continue;
+            }
             if (d.b_code) {
             if (d.b_code) {
-                const c = _getGclChapter(gclChapter, d);
+                const c = checkFilterPath(d)
+                    ? gclChapter.find(x => { return x.cType === 21})
+                    : _getGclChapter(gclChapter, d);
                 gatherfields(c, d, ledgerSetting.chapterFields, ledgerSetting.prefix);
                 gatherfields(c, d, ledgerSetting.chapterFields, ledgerSetting.prefix);
             }
             }
         }
         }
     }
     }
 
 
-    function init (gclData, chapter) {
+    function init (gclData, chapter, filter) {
         gclList = gclData;
         gclList = gclData;
         [gclChapter, otherChapter] = _getCalcChapter(chapter);
         [gclChapter, otherChapter] = _getCalcChapter(chapter);
+        chapterfilter = filter || [];
     }
     }
 
 
     /**
     /**

+ 2 - 1
app/public/js/spreadjs_rela/spreadjs_zh.js

@@ -796,7 +796,8 @@ const SpreadJsObj = {
 
 
         this.beginMassOperation(sheet);
         this.beginMassOperation(sheet);
         try {
         try {
-            for (const iCol of cols) {
+            for (const col of cols) {
+                const iCol = sheet.zh_setting.cols.indexOf(col);
                 // 清空原单元格数据
                 // 清空原单元格数据
                 sheet.clear(-1, iCol, -1, 1, spreadNS.SheetArea.viewport, spreadNS.StorageType.data);
                 sheet.clear(-1, iCol, -1, 1, spreadNS.SheetArea.viewport, spreadNS.StorageType.data);
 
 

+ 10 - 2
app/public/js/stage.js

@@ -185,14 +185,15 @@ $(document).ready(() => {
     // 台账树结构计算相关设置
     // 台账树结构计算相关设置
     stageTreeSetting.updateFields = ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'postil', 'used', 'contract_expr'];
     stageTreeSetting.updateFields = ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'postil', 'used', 'contract_expr'];
     stageTreeSetting.calcFields = ['deal_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp',
     stageTreeSetting.calcFields = ['deal_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp',
-        'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp'];
+        'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp', 'end_correct_tp'];
     stageTreeSetting.calcFun = function (node) {
     stageTreeSetting.calcFun = function (node) {
-        if (node.children && node.children.length === 0) {
+        if (!node.children || node.children.length === 0) {
             node.pre_gather_qty = ZhCalc.add(node.pre_contract_qty, node.pre_qc_qty);
             node.pre_gather_qty = ZhCalc.add(node.pre_contract_qty, node.pre_qc_qty);
             node.gather_qty = ZhCalc.add(node.contract_qty, node.qc_qty);
             node.gather_qty = ZhCalc.add(node.contract_qty, node.qc_qty);
             node.end_contract_qty = ZhCalc.add(node.pre_contract_qty, node.contract_qty);
             node.end_contract_qty = ZhCalc.add(node.pre_contract_qty, node.contract_qty);
             node.end_qc_qty = ZhCalc.add(node.pre_qc_qty, node.qc_qty);
             node.end_qc_qty = ZhCalc.add(node.pre_qc_qty, node.qc_qty);
             node.end_gather_qty = ZhCalc.add(node.pre_gather_qty, node.gather_qty);
             node.end_gather_qty = ZhCalc.add(node.pre_gather_qty, node.gather_qty);
+            node.end_correct_tp = ZhCalc.add(node.end_qc_tp, ZhCalc.mul(node.end_contract_qty, node.unit_price, tenderInfo.decimal.tp));
         }
         }
         node.pre_gather_tp = ZhCalc.add(node.pre_contract_tp, node.pre_qc_tp);
         node.pre_gather_tp = ZhCalc.add(node.pre_contract_tp, node.pre_qc_tp);
         node.gather_tp = ZhCalc.add(node.contract_tp, node.qc_tp);
         node.gather_tp = ZhCalc.add(node.contract_tp, node.qc_tp);
@@ -201,6 +202,7 @@ $(document).ready(() => {
         node.end_gather_tp = ZhCalc.add(node.pre_gather_tp, node.gather_tp);
         node.end_gather_tp = ZhCalc.add(node.pre_gather_tp, node.gather_tp);
         node.end_final_tp = ZhCalc.add(node.end_qc_tp, node.total_price);
         node.end_final_tp = ZhCalc.add(node.end_qc_tp, node.total_price);
         node.end_gather_percent = ZhCalc.mul(ZhCalc.div(node.end_gather_tp, node.end_final_tp), 100, 2);
         node.end_gather_percent = ZhCalc.mul(ZhCalc.div(node.end_gather_tp, node.end_final_tp), 100, 2);
+        node.end_correct_percent = ZhCalc.mul(ZhCalc.div(node.end_correct_tp, node.end_final_tp), 100, 2);
         node.final_dgn_price = ZhCalc.round(ZhCalc.div(node.end_gather_tp, ZhCalc.add(node.deal_dgn_qty1, node.c_dgn_qty1)), tenderInfo.decimal.up);
         node.final_dgn_price = ZhCalc.round(ZhCalc.div(node.end_gather_tp, ZhCalc.add(node.deal_dgn_qty1, node.c_dgn_qty1)), tenderInfo.decimal.up);
     };
     };
     const stageTree = createNewPathTree('stage', stageTreeSetting);
     const stageTree = createNewPathTree('stage', stageTreeSetting);
@@ -3774,5 +3776,11 @@ $(document).ready(() => {
             return;
             return;
         }
         }
         stageTreeSpreadObj.measureByBatch(posName, ratio, apply2sibling);
         stageTreeSpreadObj.measureByBatch(posName, ratio, apply2sibling);
+    });
+    $('#correct_percent').click(function () {
+        const sheet = slSpread.getActiveSheet();
+        const col = sheet.zh_setting.cols.find(x => {return x.field === 'end_gather_percent' || x.field === 'end_correct_percent'});
+        col.field = this.checked ? 'end_correct_percent' : 'end_gather_percent';
+        SpreadJsObj.reLoadColsData(sheet, [col]);
     })
     })
 });
 });

+ 1 - 1
app/public/js/stage_gather.js

@@ -126,7 +126,7 @@ $(document).ready(function () {
         SpreadJsObj.loadSheetData(gclSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gclGatherData);
         SpreadJsObj.loadSheetData(gclSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gclGatherData);
         loadLeafXmjData(0);
         loadLeafXmjData(0);
         // 章节合计
         // 章节合计
-        const chapterData = gclGatherModel.gatherChapterData(chapter, ['total_price', 'contract_tp', 'qc_tp', 'pre_contract_tp', 'pre_qc_tp']);
+        const chapterData = gclGatherModel.gatherChapterData(chapter, ['total_price', 'contract_tp', 'qc_tp', 'pre_contract_tp', 'pre_qc_tp'], filter);
         for (const c of chapterData) {
         for (const c of chapterData) {
             c.gather_tp = ZhCalc.add(c.contract_tp, c.qc_tp);
             c.gather_tp = ZhCalc.add(c.contract_tp, c.qc_tp);
             c.end_contract_tp = ZhCalc.add(c.contract_tp, c.pre_contract_tp);
             c.end_contract_tp = ZhCalc.add(c.contract_tp, c.pre_contract_tp);

+ 2 - 0
app/public/js/tender_list_info.js

@@ -200,6 +200,7 @@ function calculateParent(node) {
         node.pre_gather_tp = 0;
         node.pre_gather_tp = 0;
         node.yf_tp = 0;
         node.yf_tp = 0;
         node.end_yf_tp = 0;
         node.end_yf_tp = 0;
+        node.advance_tp = 0;
         for (const c of node.children) {
         for (const c of node.children) {
             calculateParent(c);
             calculateParent(c);
             node.total_price = ZhCalc.add(node.total_price, c.total_price);
             node.total_price = ZhCalc.add(node.total_price, c.total_price);
@@ -210,6 +211,7 @@ function calculateParent(node) {
             node.pre_gather_tp = ZhCalc.add(node.pre_gather_tp, c.pre_gather_tp);
             node.pre_gather_tp = ZhCalc.add(node.pre_gather_tp, c.pre_gather_tp);
             node.yf_tp = ZhCalc.add(node.yf_tp, c.yf_tp);
             node.yf_tp = ZhCalc.add(node.yf_tp, c.yf_tp);
             node.end_yf_tp = ZhCalc.add(node.end_yf_tp, c.end_yf_tp);
             node.end_yf_tp = ZhCalc.add(node.end_yf_tp, c.end_yf_tp);
+            node.advance_tp = ZhCalc.add(node.advance_tp, c.advance_tp);
         }
         }
     }
     }
 }
 }

+ 1 - 0
app/view/ledger/gather.ejs

@@ -68,4 +68,5 @@
 <script>
 <script>
     const chapter = JSON.parse('<%- JSON.stringify(ctx.tender.info.chapter) %>');
     const chapter = JSON.parse('<%- JSON.stringify(ctx.tender.info.chapter) %>');
     const thousandth = <%- ctx.tender.info.display.thousandth %>;
     const thousandth = <%- ctx.tender.info.display.thousandth %>;
+    const filter = JSON.parse('<%- JSON.stringify(chapterFilter) %>');
 </script>
 </script>

+ 1 - 0
app/view/revise/gcl_compare.ejs

@@ -76,4 +76,5 @@
 <script>
 <script>
     const chapter = JSON.parse('<%- JSON.stringify(ctx.tender.info.chapter) %>');
     const chapter = JSON.parse('<%- JSON.stringify(ctx.tender.info.chapter) %>');
     const thousandth = <%- ctx.tender.info.display.thousandth %>;
     const thousandth = <%- ctx.tender.info.display.thousandth %>;
+    const filter = JSON.parse('<%- JSON.stringify(chapterFilter) %>');
 </script>
 </script>

+ 1 - 0
app/view/stage/gather.ejs

@@ -103,4 +103,5 @@
     }
     }
     const chapter = JSON.parse('<%- JSON.stringify(ctx.tender.info.chapter) %>');
     const chapter = JSON.parse('<%- JSON.stringify(ctx.tender.info.chapter) %>');
     const thousandth = <%- ctx.tender.info.display.thousandth %>;
     const thousandth = <%- ctx.tender.info.display.thousandth %>;
+    const filter = JSON.parse('<%- JSON.stringify(chapterFilter) %>');
 </script>
 </script>

+ 8 - 0
app/view/stage/index.ejs

@@ -36,6 +36,14 @@
                     <a id="exportExcel" class="btn btn-primary btn-sm" href="javascript: void(0)">导出计量台账Excel</a>
                     <a id="exportExcel" class="btn btn-primary btn-sm" href="javascript: void(0)">导出计量台账Excel</a>
                     <a class="btn btn-sm btn-primary" href="#ledger-check-modal" data-toggle="modal" data-target="#ledger-check-modal">数据检查</a>
                     <a class="btn btn-sm btn-primary" href="#ledger-check-modal" data-toggle="modal" data-target="#ledger-check-modal">数据检查</a>
                 </div>
                 </div>
+                <div class="d-inline-block ml-1">
+                    <a class="btn btn-sm btn-light">
+                        <div class="custom-control custom-checkbox">
+                            <input type="checkbox" class="custom-control-input" id="correct_percent">
+                            <label class="custom-control-label text-primary" for="correct_percent">使用数量矫正完成率</label>
+                        </div>
+                    </a>
+                </div>
             </div>
             </div>
             <div class="ml-auto">
             <div class="ml-auto">
             </div>
             </div>