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

自动调用变更令、导入计量台账、导入暂存计量,总价合同,本期合同金额计算问题

MaiXinRong 1 день назад
Родитель
Сommit
c8d30039b3
3 измененных файлов с 6 добавлено и 4 удалено
  1. 1 1
      app/lib/sum_load.js
  2. 3 1
      app/service/stage_change.js
  3. 2 2
      app/service/stage_stash.js

+ 1 - 1
app/lib/sum_load.js

@@ -411,7 +411,7 @@ class gatherStageGclTree extends loadGclBaseTree {
             let end_contract_qty = node.contract_qty;
             activeQty = this.ctx.helper.add(activeQty, node.pre_qc_minus_qty);
             end_contract_qty = this.ctx.helper.add(end_contract_qty, node.pre_contract_qty);
-            const end_contract_tp = activeQty ? node.total_price : this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), node.total_price, info.decimal.tp);
+            const end_contract_tp = activeQty ? this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), node.total_price, info.decimal.tp) : node.total_price;
             return this.ctx.helper.sub(end_contract_tp, node.pre_contract_tp);
         } else if (info.calc_type === 'up') {
             if (correct) {

+ 3 - 1
app/service/stage_change.js

@@ -166,7 +166,7 @@ class autoUseChange {
                 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 = activeQty ? bills.total_price : this.helper.mul(this.helper.div(end_contract_qty, activeQty), bills.total_price, this.decimal.tp);
+            const end_contract_tp = activeQty ? this.helper.mul(this.helper.div(end_contract_qty, activeQty), bills.total_price, this.decimal.tp) : bills.total_price;
             return preSb ? this.helper.sub(end_contract_tp, preSb.contract_tp) : end_contract_tp;
         } else if (info.calc_type === 'up') {
             if (this.correct) {
@@ -250,9 +250,11 @@ class autoUseChange {
 
             if (sb) {
                 const contract_tp = qc_minus_qty ? this.calcContractTp(this.info, cb.bills, sb.contract_qty || 0, qc_minus_qty) : sb.contract_tp;
+                console.log(qc_minus_qty, contract_tp);
                 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 {
                 const contract_tp = qc_minus_qty ? this.calcContractTp(this.info, cb.bills, 0, qc_minus_qty) : 0;
+                console.log(qc_minus_qty, contract_tp);
                 this.insertBills.push({
                     tid: this.default.tid, sid: this.default.sid, said: this.default.said,
                     lid, contract_tp, qc_qty, qc_tp, positive_qc_qty, positive_qc_tp, negative_qc_qty, negative_qc_tp, qc_minus_qty, times: 1, order: 0

+ 2 - 2
app/service/stage_stash.js

@@ -72,7 +72,7 @@ class loadStageExcelTree {
                 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 = activeQty ? node.total_price : this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), node.total_price, this.decimal.tp);
+            const end_contract_tp = activeQty ? this.ctx.helper.mul(this.ctx.helper.div(end_contract_qty, activeQty), node.total_price, this.decimal.tp) : node.total_price;
             return preSb ? this.ctx.helper.sub(end_contract_tp, preSb.contract_tp) : end_contract_tp;
         } else if (this.info.calc_type === 'up') {
             if (correct) {
@@ -289,7 +289,7 @@ module.exports = app => {
                     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 = activeQty ? bills.total_price : helper.mul(helper.div(end_contract_qty, activeQty), bills.total_price, decimal.tp);
+                    const end_contract_tp = activeQty ? helper.mul(helper.div(end_contract_qty, activeQty), bills.total_price, decimal.tp) : bills.total_price;
                     return helper.sub(end_contract_tp, bills.pre_contract_tp);
                 } else if (info.calc_type === 'up') {
                     if (correct) {