Просмотр исходного кода

1. 合同支付,起扣金额,扣款限额相关
2. 报表,计算问题

MaiXinRong 7 месяцев назад
Родитель
Сommit
9e112c0c19
3 измененных файлов с 33 добавлено и 23 удалено
  1. 25 17
      app/public/js/phase_pay_detail.js
  2. 3 3
      app/service/phase_pay_detail.js
  3. 5 3
      app/service/report_memory.js

+ 25 - 17
app/public/js/phase_pay_detail.js

@@ -263,9 +263,9 @@ $(document).ready(() => {
             checkRangeExpr(payNode, text, data) {
             checkRangeExpr(payNode, text, data) {
                 if (!payNode) return [false, '数据错误'];
                 if (!payNode) return [false, '数据错误'];
 
 
-                const num = text ? _.toNumber(text) : null;
-                let expr = text ? (num ? null : text) : null;
-                expr = expr ? $.trim(expr).replace('\t', '').replace('=', '').toLowerCase(): null;
+                const num = text ? _.toNumber(text) : 0;
+                let expr = text ? (num ? '' : text) : '';
+                expr = expr ? $.trim(expr).replace('\t', '').replace('=', '').toLowerCase() : '';
                 const [valid, msg] = this.checkExprValid(expr, ['bqwc', 'ybbqwc', 'bqht', 'bqbg', 'bqyf']);
                 const [valid, msg] = this.checkExprValid(expr, ['bqwc', 'ybbqwc', 'bqht', 'bqbg', 'bqyf']);
                 if (!valid) return [valid, msg];
                 if (!valid) return [valid, msg];
 
 
@@ -273,8 +273,8 @@ $(document).ready(() => {
                     if (payUtils.check.isSf(payNode)) {
                     if (payUtils.check.isSf(payNode)) {
                         const value = expr ? payCalc.calculateExpr(expr) : num;
                         const value = expr ? payCalc.calculateExpr(expr) : num;
                         if (payNode.pre_tp && value < payNode.pre_tp) return [false, '截止上期已计量' + payNode.pre_tp + ',扣款限额请勿少于改值'];
                         if (payNode.pre_tp && value < payNode.pre_tp) return [false, '截止上期已计量' + payNode.pre_tp + ',扣款限额请勿少于改值'];
-                        data.rprice = num;
-                        data.rexpr = expr;
+                        data.range_tp = num;
+                        data.range_expr = expr;
                         return [true, ''];
                         return [true, ''];
                     } else {
                     } else {
                         // if (payNode.pre_finish) return [false, '已达扣款限额,请勿修改'];
                         // if (payNode.pre_finish) return [false, '已达扣款限额,请勿修改'];
@@ -285,17 +285,17 @@ $(document).ready(() => {
                         return [false, '已经开始使用,请勿修改扣款限额'];
                         return [false, '已经开始使用,请勿修改扣款限额'];
                     }
                     }
                 } else {
                 } else {
-                    data.rprice = num;
-                    data.rexpr = expr;
+                    data.range_tp = num;
+                    data.range_expr = expr;
                     return [true, ''];
                     return [true, ''];
                 }
                 }
             }
             }
             checkStartExpr(payNode, text, data) {
             checkStartExpr(payNode, text, data) {
                 if (!payNode) return [false, '数据错误'];
                 if (!payNode) return [false, '数据错误'];
 
 
-                const num = text ? _.toNumber(text) : null;
-                let expr = text ? (num ? null : text) : null;
-                expr = expr ? $.trim(expr).replace('\t', '').replace('=', '').toLowerCase(): null;
+                const num = text ? _.toNumber(text) : 0;
+                let expr = text ? (num ? '' : text) : '';
+                expr = expr ? $.trim(expr).replace('\t', '').replace('=', '').toLowerCase() : '';
                 const [valid, msg] = this.checkExprValid(expr, ['bqwc', 'ybbqwc', 'bqht', 'bqbg', 'bqyf']);
                 const [valid, msg] = this.checkExprValid(expr, ['bqwc', 'ybbqwc', 'bqht', 'bqbg', 'bqyf']);
                 if (!valid) return [valid, msg];
                 if (!valid) return [valid, msg];
 
 
@@ -306,12 +306,12 @@ $(document).ready(() => {
                         const value = expr ? payCalc.calculateExpr(expr) : num;
                         const value = expr ? payCalc.calculateExpr(expr) : num;
                         if (this.addBase.pre_gather_tp && value < this.addBase.pre_gather_tp)
                         if (this.addBase.pre_gather_tp && value < this.addBase.pre_gather_tp)
                             return [false, '起扣金额请勿少于本期完成截止上期计量金额' + this.addBase.pre_gather_tp];
                             return [false, '起扣金额请勿少于本期完成截止上期计量金额' + this.addBase.pre_gather_tp];
-                        data.sprice = num;
-                        data.sexpr = expr;
+                        data.start_tp = num;
+                        data.start_expr = expr;
                         return [true, ''];
                         return [true, ''];
                     } else {
                     } else {
-                        data.sprice = num;
-                        data.sexpr = expr;
+                        data.start_tp = num;
+                        data.start_expr = expr;
                         return [true, ''];
                         return [true, ''];
                     }
                     }
                 }
                 }
@@ -420,12 +420,19 @@ $(document).ready(() => {
                     }
                     }
                 };
                 };
                 const select = SpreadJsObj.getSelectObject(sheet);
                 const select = SpreadJsObj.getSelectObject(sheet);
+                if (!select) {
+                    setObjEnable($('a[name=base-opr][type=add]'), false);
+                    setObjEnable($('a[name=base-opr][type=del]'), false);
+                    setObjEnable($('a[name=base-opr][type=up-move]'), false);
+                    setObjEnable($('a[name=base-opr][type=down-move]'), false);
+                    return;
+                }
                 const preNode = payTree.getPreSiblingNode(select);
                 const preNode = payTree.getPreSiblingNode(select);
                 setObjEnable($('a[name=base-opr][type=add]'), !readOnly && !payUtils.check.isSf(select) && !payUtils.check.isYf(select));
                 setObjEnable($('a[name=base-opr][type=add]'), !readOnly && !payUtils.check.isSf(select) && !payUtils.check.isYf(select));
                 const delValid = !payUtils.check.isFixed(select) && !payUtils.check.isStarted(select);
                 const delValid = !payUtils.check.isFixed(select) && !payUtils.check.isStarted(select);
-                setObjEnable($('a[name=base-opr][type=del]'), !readOnly && select && delValid);
-                setObjEnable($('a[name=base-opr][type=up-move]'), !readOnly && select && !payUtils.check.isFixed(select) && preNode);
-                setObjEnable($('a[name=base-opr][type=down-move]'), !readOnly && select && !payUtils.check.isFixed(select) && !payTree.isLastSibling(select));
+                setObjEnable($('a[name=base-opr][type=del]'), !readOnly && delValid);
+                setObjEnable($('a[name=base-opr][type=up-move]'), !readOnly && !payUtils.check.isFixed(select) && preNode);
+                setObjEnable($('a[name=base-opr][type=down-move]'), !readOnly && !payUtils.check.isFixed(select) && !payTree.isLastSibling(select));
             },
             },
             loadExprToInput: function() {
             loadExprToInput: function() {
                 const sel = sheet.getSelections()[0];
                 const sel = sheet.getSelections()[0];
@@ -634,6 +641,7 @@ $(document).ready(() => {
             $('a[name="base-opr"]').click(function () {
             $('a[name="base-opr"]').click(function () {
                 payEvent.baseOpr(this.getAttribute('type'));
                 payEvent.baseOpr(this.getAttribute('type'));
             });
             });
+            $('')
         }
         }
 
 
         return { spread, sheet, payTree, loadDatas: payEvent.reloadPays }
         return { spread, sheet, payTree, loadDatas: payEvent.reloadPays }

+ 3 - 3
app/service/phase_pay_detail.js

@@ -149,12 +149,12 @@ class PayCalculator {
             // 上一期已计量的合同支付项,不予计算起扣金额、扣款限额
             // 上一期已计量的合同支付项,不予计算起扣金额、扣款限额
             if (p.pre_used) continue;
             if (p.pre_used) continue;
 
 
-            if (p.start_expr && p.start_expr !== '') {
+            if (p.start_expr) {
                 p.start_tp = this.ctx.helper.round(this._calculateExpr(p.start_expr), this.decimal);
                 p.start_tp = this.ctx.helper.round(this._calculateExpr(p.start_expr), this.decimal);
             } else if (p.start_tp && !p.start_expr) {
             } else if (p.start_tp && !p.start_expr) {
                 p.start_tp = this.ctx.helper.round(p.start_tp, this.decimal);
                 p.start_tp = this.ctx.helper.round(p.start_tp, this.decimal);
             }
             }
-            if (p.range_expr && p.range_expr !== '') {
+            if (p.range_expr) {
                 p.range_price = this.ctx.helper.round(this._calculateExpr(p.range_expr), this.decimal);
                 p.range_price = this.ctx.helper.round(this._calculateExpr(p.range_expr), this.decimal);
             } else if (p.range_price && !p.range_expr) {
             } else if (p.range_price && !p.range_expr) {
                 p.range_price = this.ctx.helper.round(p.range_price, this.decimal);
                 p.range_price = this.ctx.helper.round(p.range_price, this.decimal);
@@ -403,7 +403,7 @@ class PhasePayDetail extends TreeService {
 
 
         const calcResult = this.calculate(phasePay, details);
         const calcResult = this.calculate(phasePay, details);
         const updateData = calcResult.filter(x => { return x.calcUpdate; }).map(x => {
         const updateData = calcResult.filter(x => { return x.calcUpdate; }).map(x => {
-            return { id: x.id, tp: x.tp, start_tp: x.start_tp, range_tp: x.range_tp };
+            return { id: x.id, tp: x.tp, start_tp: x.start_tp, range_tp: x.range_tp, end_tp: x.end_tp };
         });
         });
         if (updateData.length === 0) return false;
         if (updateData.length === 0) return false;
 
 

+ 5 - 3
app/service/report_memory.js

@@ -652,14 +652,15 @@ module.exports = app => {
             if (!this.ctx.stage) throw '期数据错误,请重试';
             if (!this.ctx.stage) throw '期数据错误,请重试';
             if (this.stageValidRole && this.stageValidRole.length > 0) return;
             if (this.stageValidRole && this.stageValidRole.length > 0) return;
 
 
-            const result = [{dataOrder: 0, flowOrder: 0, uid: this.ctx.stage.user_id}];
+            const result = [{dataOrder: 0, flowOrder: 0, uid: this.ctx.stage.user_id, audit_type: 0}];
             for (const auditorGroup of this.ctx.stage.auditorGroups) {
             for (const auditorGroup of this.ctx.stage.auditorGroups) {
                 const hasChecked = auditorGroup.find(x => { return x.status === audit.stage.status.checked });
                 const hasChecked = auditorGroup.find(x => { return x.status === audit.stage.status.checked });
                 const hasOtherStatus = auditorGroup.find(x => { return x.status === audit.stage.status.checkNo || x.status === audit.stage.status.checkNoPre || x.status === audit.stage.status.checkAgain || x.status === audit.stage.status.checkCancel });
                 const hasOtherStatus = auditorGroup.find(x => { return x.status === audit.stage.status.checkNo || x.status === audit.stage.status.checkNoPre || x.status === audit.stage.status.checkAgain || x.status === audit.stage.status.checkCancel });
                 const isCur = auditorGroup.find(x => { return x.status === audit.stage.status.checking}) && (!this.ctx.stage.readOnly || this.ctx.stage.canCheck);
                 const isCur = auditorGroup.find(x => { return x.status === audit.stage.status.checking}) && (!this.ctx.stage.readOnly || this.ctx.stage.canCheck);
                 if ((hasChecked && !hasOtherStatus) || isCur) {
                 if ((hasChecked && !hasOtherStatus) || isCur) {
+                    const uid = auditorGroup.map(x => { return x.aid }).sort((x, y) => { return x - y; });
                     const role = result.find(function (r) {
                     const role = result.find(function (r) {
-                        return r.uid === auditorGroup.map(x => { return x.aid }).join(',');
+                        return r.uid === uid.join(',') && r.audit_type === auditorGroup[0].audit_type;
                     });
                     });
                     if (role) {
                     if (role) {
                         role.dataOrder = auditorGroup[0].order;
                         role.dataOrder = auditorGroup[0].order;
@@ -667,7 +668,8 @@ module.exports = app => {
                         result.push({
                         result.push({
                             dataOrder: auditorGroup[0].order,
                             dataOrder: auditorGroup[0].order,
                             flowOrder: auditorGroup[0].audit_order,
                             flowOrder: auditorGroup[0].audit_order,
-                            uid: auditorGroup.map(x => { return x.aid }).join(',')
+                            uid: uid.join(','),
+                            audit_type: auditorGroup.audit_type,
                         })
                         })
                     }
                     }
                 }
                 }