ソースを参照

实付比例,计算问题

MaiXinRong 2 日 前
コミット
c08553a29a
1 ファイル変更3 行追加2 行削除
  1. 3 2
      app/service/cost_stage_analysis.js

+ 3 - 2
app/service/cost_stage_analysis.js

@@ -275,7 +275,6 @@ module.exports = app => {
                     for (const prop of costFields.selfCalcFields) {
                     for (const prop of costFields.selfCalcFields) {
                         ln[prop] = preSource ? preSource[prop] : 0;
                         ln[prop] = preSource ? preSource[prop] : 0;
                     }
                     }
-                    this.ctx.service.calcTmpl.calcByTemplate(ln, ln, ln, stage.calcTemplate.calc_expr);
                 } else {
                 } else {
                     for (const prop of costFields.sumFields) {
                     for (const prop of costFields.sumFields) {
                         ln[prop] = 0;
                         ln[prop] = 0;
@@ -298,13 +297,15 @@ module.exports = app => {
                             ld[prop] = preDetailSource ? preDetailSource[prop] || 0 : 0;
                             ld[prop] = preDetailSource ? preDetailSource[prop] || 0 : 0;
                         }
                         }
                         this.ctx.service.calcTmpl.calcByTemplate(ld, ld, ld, stage.calcTemplate.calc_expr);
                         this.ctx.service.calcTmpl.calcByTemplate(ld, ld, ld, stage.calcTemplate.calc_expr);
+                        ld.sf_percent = ld.yf_excl_tax_tp ? this.ctx.helper.mul(this.ctx.helper.div(ld.sf_excl_tax_tp, ld.yf_excl_tax_tp), 100, 2) : 0;
                         for (const prop of costFields.sumFields) {
                         for (const prop of costFields.sumFields) {
                             ln[prop] = this.ctx.helper.add(ln[prop], ld[prop]);
                             ln[prop] = this.ctx.helper.add(ln[prop], ld[prop]);
                         }
                         }
                         insertDetailData.push(ld);
                         insertDetailData.push(ld);
                     }
                     }
-                    this.ctx.service.calcTmpl.calcByTemplate(ln, ln, ln, stage.calcTemplate.calc_expr);
                 }
                 }
+                this.ctx.service.calcTmpl.calcByTemplate(ln, ln, ln, stage.calcTemplate.calc_expr);
+                ln.sf_percent = ln.yf_excl_tax_tp ? this.ctx.helper.mul(this.ctx.helper.div(ln.sf_excl_tax_tp, ln.yf_excl_tax_tp), 100, 2) : 0;
             }
             }
 
 
             await transaction.insert(this.tableName, insertData);
             await transaction.insert(this.tableName, insertData);