MaiXinRong 2 月之前
父節點
當前提交
561a9c6bd6
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      app/lib/revise_price.js

+ 5 - 2
app/lib/revise_price.js

@@ -253,19 +253,22 @@ class revisePriceCalc {
                 sb.uv_qty = this.ctx.helper.add(sb.uv_qty, b.spamount);
             }
         }
-        let positive_tp = 0, negative_tp = 0, valuation_tp = 0, unvaluation_tp = 0;
+        let total_price = 0, positive_tp = 0, negative_tp = 0, valuation_tp = 0, unvaluation_tp = 0;
         for (const sb of sumBills) {
+            cb.qty = this.ctx.helper.add(sb.v_qty, sb.uv_qty);
+            sb.tp = this.ctx.helper.mul(sb.qty, sb.unit_price, change.tp_decimal || decimal.tp);
             sb.v_tp = this.ctx.helper.mul(sb.v_qty, sb.unit_price, change.tp_decimal || decimal.tp);
             sb.uv_tp = this.ctx.helper.mul(sb.uv_qty, sb.unit_price, change.tp_decimal || decimal.tp);
             sb.p_tp = this.ctx.helper.mul(sb.p_qty, sb.unit_price, change.tp_decimal || decimal.tp);
             sb.n_tp = this.ctx.helper.mul(sb.n_qty, sb.unit_price, change.tp_decimal || decimal.tp);
 
+            total_price = this.ctx.helper.add(sb.tp, total_price);
             valuation_tp = this.ctx.helper.add(sb.v_tp, valuation_tp);
             unvaluation_tp = this.ctx.helper.add(sb.uv_tp, unvaluation_tp);
             positive_tp = this.ctx.helper.add(sb.p_tp, positive_tp);
             negative_tp = this.ctx.helper.add(sb.n_tp, negative_tp);
         }
-        const total_price = this.ctx.helper.add(valuation_tp, unvaluation_tp);
+        // const total_price = this.ctx.helper.add(valuation_tp, unvaluation_tp);
         if (updateBills.length > 0) {
             await transaction.updateRows(this.ctx.service.changeAuditList.tableName, updateBills);
             await transaction.update(this.ctx.service.change.tableName, { total_price, positive_tp, negative_tp, valuation_tp, unvaluation_tp }, { where: { cid: change.cid } });