Browse Source

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

Tony Kang 2 years ago
parent
commit
f8afc0119f

+ 1 - 0
app/controller/payment_controller.js

@@ -299,6 +299,7 @@ module.exports = app => {
                 renderData.rptAudit = rptAudit;
                 renderData.content = content;
                 renderData.report_json = report_json;
+                renderData.nextDetail = await ctx.service.paymentDetail.getDataByCondition({ tr_id: ctx.trInfo.id, order: ctx.detail.order + 1 });
                 if ((ctx.detail.status === auditConst.status.uncheck || ctx.detail.status === auditConst.status.checkNo) && ctx.session.sessionUser.accountId === ctx.detail.uid) {
                     // data.accountGroup = accountGroup;
                     // 获取所有项目参与者

+ 0 - 2
app/lib/gcl_gather.js

@@ -245,8 +245,6 @@ const gclGatherModel = class {
             const dx = helper._.assign({}, cacheLeafXmj);
             dx.gcl_id = gcl.id;
             dx.org_gcl_id = node.id;
-            // dx.org_gcl_id = gcl.id;
-            // dx.gcl_id = node.id;
             if (detail.name !== node.name) {
                 dx.bwmx = detail.name;
                 dx.mx_id = detail.id;

+ 2 - 1
app/lib/rm/material.js

@@ -330,13 +330,14 @@ class ReportMemoryMaterial {
                     return gl.gcl_id === x.org_gcl_id && gl.xmj_id === x.id && (x.mx_id && x.mx_id !== x.id ? x.mx_id === gl.mx_id : true);
                 });
                 for (const l of list) {
+                    x.gather_gcl_id = x.gcl_id;
                     x.jiacha = helper.add(x.jiacha, helper.mul(helper.mul(x.gather_qty, l.quantity), l.m_spread));
                 }
                 x.jiacha = helper.round(x.jiacha, decimal.tp);
                 g.jiacha = helper.add(g.jiacha, x.jiacha);
             }
         }
-        return [gatherUtil.gclList, gatherUtil.leafXmjs ];
+        return [gatherUtil.gclList, gatherUtil.leafXmjs];
     }
 
     async getMaterialGatherBills(tender_id, material_order) {

+ 63 - 0
app/lib/rpt_data_analysis.js

@@ -1900,6 +1900,68 @@ const gatherMaterialGl = {
         data.mem_material_gl_detail = result;
     }
 };
+const masterCross = {
+    name: '主从交叉(汇总)数据-通用',
+    hint: '此版本,要求表必须是主从关系',
+    defaultSetting: {
+        main: {
+            tableName: 'mem_material_gather_bills',
+            prefix: 'm_',
+            fields: ['b_code', 'name', 'units', 'unit_price', 'quantity', 'total_price', 'gather_qty', 'gather_tp', 'jiacha'],
+        },
+        sub: {
+            tableName: 'mem_material_gather_gl',
+            masterKey: 'id', subKey: 'gather_gcl_id', gatherKey: 'mb_id',
+            prefix: 's_',
+            fields: ['code', 'name', 'units'],
+            gatherFields: ['quantity'],
+        },
+        target: 'master_converse'
+    },
+    _converse: function(ctx, options, mainTable, subTable) {
+        const data = [];
+        const converseData = [];
+        subTable.forEach(x => {
+            let cd = converseData.find(y => { return x[options.sub.gatherKey] === y[options.sub.gatherKey]});
+            if (cd) return;
+
+            cd = {};
+            cd[options.sub.gatherKey] = x[options.sub.gatherKey];
+            for (const f of options.sub.fields) {
+                cd[f] = x[f];
+            }
+            converseData.push(cd);
+        });
+        for (const [i, m] of mainTable.entries()) {
+            const temp = { cross_index: i+1 };
+            for (const f of options.main.fields) {
+                temp[options.main.prefix + f] = m[f];
+            }
+            const rela = subTable.filter(x => { return x[options.sub.subKey] === m[options.masterKey]; });
+            for (const cd of converseData) {
+                const nd = JSON.parse(JSON.stringify(temp));
+                for (const prop in cd) {
+                    nd[options.sub.prefix + prop] = cd[prop];
+                }
+                rela.forEach(x => {
+                    if (x[options.sub.gatherKey] !== cd[options.sub.gatherKey]) return;
+                    for (const f of options.sub.gatherFields) {
+                        nd[options.sub.prefix + f] = ctx.helper.add(nd[options.sub.prefix + f], x[f]);
+                    }
+                });
+                data.push(nd);
+            }
+        }
+        return data;
+    },
+    fun(ctx, data, fieldsKey, options, csRela) {
+        if (!options || !options.main || !options.sub || !options.target) return;
+        const mainTable = data[options.main.tableName], subTable = data[options.sub.tableName];
+        if (!mainTable || !subTable) return;
+
+        data[options.target] = this._converse(ctx, options, mainTable, subTable);
+    },
+};
 
 const analysisObj = {
     changeSort,
@@ -1925,6 +1987,7 @@ const analysisObj = {
     treeFilter,
     gatherGcl2,
     gatherMaterialGl,
+    masterCross
 };
 const analysisDefine = (function(obj) {
     const result = [];

+ 2 - 1
app/public/js/change_information_set.js

@@ -1911,7 +1911,8 @@ function remakeChangeSpread(cOrder = changeOrder) {
                 mx_id,
             };
             const radionInfo = changeList.find(function (info) {
-                return info.code === code && (info.lid == lid || parseInt(info.lid) === parseInt(lindex)) && gcl_id == info.gcl_id && (info.bwmx === bwmx || (info.bwmx === xmj_jldy && info.mx_id && info.mx_id === mx_id)) && parseInt(info.oamount) === parseInt(oamount);
+                // return info.code === code && (info.lid == lid || parseInt(info.lid) === parseInt(lindex)) && gcl_id == info.gcl_id && (info.bwmx === bwmx || (info.bwmx === xmj_jldy && info.mx_id && info.mx_id === mx_id)) && parseInt(info.oamount) === parseInt(oamount);
+                return (info.lid == lid || parseInt(info.lid) === parseInt(lindex)) && gcl_id == info.gcl_id && (info.bwmx === bwmx || (info.bwmx === xmj_jldy && info.mx_id && info.mx_id === mx_id));
             });
             if (radionInfo) {
                 trlist.camount = radionInfo.camount;

+ 1 - 1
app/service/change_audit_list.js

@@ -324,7 +324,7 @@ module.exports = app => {
                         const newList = await transaction.query(sql2, sqlParam2);
                         // const newList = await transaction.select(this.tableName, { where: { cid: this.ctx.change.cid } });
                         for (const used of usedList) {
-                            const newone = this._.find(newList, { code: used.code, lid: used.lid, gcl_id: used.gcl_id, bwmx: used.bwmx });
+                            const newone = this._.find(newList, { lid: used.lid, gcl_id: used.gcl_id, bwmx: used.bwmx, mx_id: used.mx_id });
                             if (newone) {
                                 updateList.push({
                                     row: {

+ 7 - 3
app/view/payment/detail.ejs

@@ -16,7 +16,11 @@
                 <span class="text-danger pull-right">报表内容已发生变化,请删除并重新生成详情</span>
                 <% } else { %>
                 <% include ./audit_btn.ejs %>
-                <% if (ctx.detail.status !== auditConst.status.checked && rptAudit) { %>
+                <% if (rptAudit &&
+                        ((ctx.detail.status !== auditConst.status.checkNo && ctx.detail.status !== auditConst.status.checked) ||
+                        (ctx.detail.status === auditConst.status.checked && !nextDetail) ||
+                        (ctx.detail.status === auditConst.status.checkNo && ctx.detail.uid === ctx.session.sessionUser.accountId))
+                ) { %>
                 <a href="#sub-sp5" data-toggle="modal" data-target="#sub-sp5" class="btn btn-sm btn-primary pull-right mr-2">签字意见</a>
                 <% } %>
                 <% } %>
@@ -177,7 +181,7 @@
         auditRptPrintHelper.showPage();
         iniPage();
     });
-    
+
     function _getAdhocDummyCells(srcCell, rstCells) {
         if (typeof srcCell.path === 'string') {
             let paths = srcCell.path.split('!;!');
@@ -190,7 +194,7 @@
                         path: dtlPath,
                         isStamp: true,
                         area: srcCell.area,
-                    };                
+                    };
                     rstCells.push(newStampCell);
                 }
             }

+ 5 - 1
app/view/payment/detail_modal.ejs

@@ -1,4 +1,8 @@
-<% if (ctx.detail.status !== auditConst.status.checked && rptAudit) { %>
+<% if (rptAudit &&
+        ((ctx.detail.status !== auditConst.status.checkNo && ctx.detail.status !== auditConst.status.checked) ||
+        (ctx.detail.status === auditConst.status.checked && !nextDetail) ||
+        (ctx.detail.status === auditConst.status.checkNo && ctx.detail.uid === ctx.session.sessionUser.accountId))
+) { %>
 <!--签字意见-->
 <div class="modal fade" id="sub-sp5" data-backdrop="static">
     <div class="modal-dialog" role="document">

+ 4 - 4
app/view/stage/audit_modal.ejs

@@ -88,7 +88,7 @@
                             <a class="sp-list-item" href="#sub-sp2" data-toggle="modal" data-target="#sub-sp2"
                                id="hideSp">修改审批流程</a>
                             <% } %>
-                            <div class="card mt-3">
+                            <div class="card modal-height-500 mt-3" style="overflow: auto">
                                 <ul class="list-group list-group-flush auditors-list" id="auditors-list">
                                     <% ctx.stage.auditors2.forEach((item, idx) => { %>
                                     <% if (idx === 0) { %>
@@ -275,7 +275,7 @@
                             <a class="sp-list-item" href="#sub-sp2" data-toggle="modal" data-target="#sub-sp2"
                                id="hideSp">修改审批流程</a>
                             <% } %>
-                            <div class="card mt-3">
+                            <div class="card modal-height-500 mt-3" style="overflow: auto">
                                 <ul class="list-group list-group-flush auditors-list">
                                     <% ctx.stage.auditors2.forEach((item, idx) => { %>
                                     <% if (idx === 0) { %>
@@ -469,7 +469,7 @@
                             <a class="sp-list-item" href="#sub-sp2" data-toggle="modal" data-target="#sub-sp2"
                                id="hideSp">修改审批流程</a>
                             <% } %>
-                            <div class="card mt-3">
+                            <div class="card modal-height-500 mt-3" style="overflow: auto">
                                 <ul class="list-group list-group-flush auditors-list">
                                     <% ctx.stage.auditors2.forEach((item, idx) => { %>
                                     <% if (idx === 0) { %>
@@ -830,7 +830,7 @@
             </div>
             <div class="modal-body">
                 <div class="card mt-1">
-                    <div class="modal-height-500" style="overflow: visible">
+                    <div class="modal-height-500" style="overflow: auto">
                         <style>
                             #admin-edit-shenpi thead th {
                                 border-bottom: 0;