|
@@ -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);
|