فهرست منبع

调整正负变更清单计算方式

ellisran 1 ماه پیش
والد
کامیت
63d01b5bc9
2فایلهای تغییر یافته به همراه22 افزوده شده و 10 حذف شده
  1. 11 5
      app/public/js/change_information.js
  2. 11 5
      app/service/change_audit_list.js

+ 11 - 5
app/public/js/change_information.js

@@ -6194,6 +6194,12 @@ function calcChangePrice() {
                     } else {
                         unvaluation_amount = ZhCalc.add(unvaluation_amount, ZhCalc.round(c.spamount, findDecimal(c.unit)));
                     }
+                    const posOrNePrice = ZhCalc.round(ZhCalc.mul(ZhCalc.round(c.spamount, findDecimal(c.unit)), ZhCalc.round(c.unit_price, unitPriceUnit)), totalPriceUnit) || 0;
+                    if (posOrNePrice >= 0) {
+                        positive_tp = this.ctx.helper.accAdd(positive_tp, posOrNePrice);
+                    } else {
+                        negative_tp = this.ctx.helper.accAdd(negative_tp, posOrNePrice);
+                    }
                 }
             }
             const price = ZhCalc.round(ZhCalc.mul(spamount, ZhCalc.round(unitPrice, unitPriceUnit)), totalPriceUnit);
@@ -6202,11 +6208,11 @@ function calcChangePrice() {
             valuation_tp = ZhCalc.add(valuation_tp, valuation_price);
             unvaluation_tp = ZhCalc.add(unvaluation_tp, unvaluation_price);
             new_tp = ZhCalc.add(new_tp, price);
-            if (price >= 0) {
-                positive_tp = ZhCalc.add(positive_tp, price);
-            } else {
-                negative_tp = ZhCalc.add(negative_tp, price);
-            }
+            // if (price >= 0) {
+            //     positive_tp = ZhCalc.add(positive_tp, price);
+            // } else {
+            //     negative_tp = ZhCalc.add(negative_tp, price);
+            // }
         } else {
             const list = _.filter(changeList, { gcl_id: g });
             for (const c of list) {

+ 11 - 5
app/service/change_audit_list.js

@@ -516,6 +516,12 @@ module.exports = app => {
                             } else {
                                 unvaluation_amount = this.ctx.helper.accAdd(unvaluation_amount, cl.spamount);
                             }
+                            const posOrNePrice = this.ctx.helper.mul(cl.spamount, this.ctx.helper.round(cl.unit_price, up_decimal), tp_decimal);
+                            if (posOrNePrice >= 0) {
+                                positive_tp = this.ctx.helper.accAdd(positive_tp, posOrNePrice);
+                            } else {
+                                negative_tp = this.ctx.helper.accAdd(negative_tp, posOrNePrice);
+                            }
                         }
                     }
                     const price = this.ctx.helper.mul(spamount, this.ctx.helper.round(unitPrice, up_decimal), tp_decimal);
@@ -524,11 +530,11 @@ module.exports = app => {
                     valuation_tp = this.ctx.helper.accAdd(valuation_tp, valuation_price);
                     unvaluation_tp = this.ctx.helper.accAdd(unvaluation_tp, unvaluation_price);
                     total_price = this.ctx.helper.accAdd(total_price, price);
-                    if (price >= 0) {
-                        positive_tp = this.ctx.helper.accAdd(positive_tp, price);
-                    } else {
-                        negative_tp = this.ctx.helper.accAdd(negative_tp, price);
-                    }
+                    // if (price >= 0) {
+                    //     positive_tp = this.ctx.helper.accAdd(positive_tp, price);
+                    // } else {
+                    //     negative_tp = this.ctx.helper.accAdd(negative_tp, price);
+                    // }
                 } else {
                     const list = this._.filter(changeList, { gcl_id: g });
                     for (const cl of list) {