Browse Source

调差修改

laiguoran 4 years ago
parent
commit
d8ca8efcdb

+ 5 - 4
app/controller/material_controller.js

@@ -400,12 +400,13 @@ module.exports = app => {
                             return bq.code === item.code;
                         });
                         bq.value = calc.value;
-                        if (calc.code === 'bqwc') {
-                            ctx.material.ex_expr = calc.value.toString() + '*[0-1]';
-                        }
+                        // if (calc.code === 'bqwc') {
+                        //     ctx.material.ex_expr = calc.value.toString() + '*[0-1]';
+                        //     ctx.material.ex_tp = this.ctx.helper.round(this.ctx.helper.mul(calc.value, -1), 2);
+                        // }
                     }
                     // 并更新至调差表中
-                    await ctx.service.material.update({ ex_calc: JSON.stringify(renderData.ex_calc), ex_expr: ctx.material.ex_expr }, { id: ctx.material.id });
+                    await ctx.service.material.update({ ex_calc: JSON.stringify(renderData.ex_calc) }, { id: ctx.material.id });
                 } else {
                     renderData.ex_calc = JSON.parse(ctx.material.ex_calc);
                 }

+ 9 - 9
app/public/js/material_list.js

@@ -131,15 +131,15 @@ $(document).ready(() => {
     const ledgerSpread = SpreadJsObj.createNewSpread($('#ledger-spread')[0]);
     const ledgerSpreadSetting = {
         cols: [
-            {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 150, formatter: '@'},
-            {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 250, formatter: '@'},
-            {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 120, formatter: '@'},
-            {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 120, type: 'Number'},
-            {title: '本期计量数量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 120, type: 'Number'},
-            {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 120, type: 'Number'},
-            {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 120, type: 'Number'},
-            {title: '本期完成金额', colSpan: '1', rowSpan: '2', field: 'gather_tp', hAlign: 2, width: 150, type: 'Number'},
-            {title: '本期价差', colSpan: '1', rowSpan: '2', field: 'total_jiacha', hAlign:3, width: 150, type: 'Number'}
+            {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 90, formatter: '@'},
+            {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 220, formatter: '@'},
+            {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 80, formatter: '@'},
+            {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 110, type: 'Number'},
+            {title: '本期计量数量|合同', colSpan: '3|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 110, type: 'Number'},
+            {title: '|数量变更', colSpan: '|1', rowSpan: '|1', field: 'qc_qty', hAlign: 2, width: 110, type: 'Number'},
+            {title: '|小计', colSpan: '|1', rowSpan: '|1', field: 'gather_qty', hAlign: 2, width: 110, type: 'Number'},
+            {title: '本期完成金额', colSpan: '1', rowSpan: '2', field: 'gather_tp', hAlign: 2, width: 110, type: 'Number'},
+            {title: '本期价差', colSpan: '1', rowSpan: '2', field: 'total_jiacha', hAlign:3, width: 110, type: 'Number'}
         ],
         emptyRows: 0,
         headRows: 2,

+ 2 - 1
app/service/material_exponent.js

@@ -212,7 +212,8 @@ module.exports = app => {
                 }
             }
             expr += '-1]';
-            const ex_tp = this.ctx.helper.round(this.ctx.helper.mul(basic_calc, this.ctx.helper.sub(this.ctx.helper.add(constant, sumByChange), 1)), 2);
+            expr = constant !== 0 ? expr : null;
+            const ex_tp = constant !== 0 ? this.ctx.helper.round(this.ctx.helper.mul(basic_calc, this.ctx.helper.sub(this.ctx.helper.add(constant, sumByChange), 1)), 2) : null;
             await transaction.update(this.ctx.service.material.tableName, {
                 id: mid ? mid : this.ctx.material.id,
                 ex_tp,