|
@@ -208,12 +208,13 @@ module.exports = app => {
|
|
|
const materialInfo = await this.ctx.service.material.getDataById(materialId);
|
|
|
const tp_data = {
|
|
|
m_tp: materialInfo.m_tp !== null ? this.ctx.helper.round(materialInfo.m_tp, this.ctx.material.decimal.tp) : null,
|
|
|
- m_tax_tp: materialInfo.m_tp !== null ? this.ctx.helper.round(ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), this.ctx.material.decimal.tp) : null,
|
|
|
+ tax_tp: materialInfo.material_tax ? (materialInfo.m_tax_tp ? materialInfo.m_tax_tp : materialInfo.m_tp) :
|
|
|
+ (materialInfo.m_tp !== null ? this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), this.ctx.material.decimal.tp) : null),
|
|
|
ex_tp: materialInfo.ex_tp !== null ? this.ctx.helper.round(materialInfo.ex_tp, this.ctx.material.decimal.tp) : null,
|
|
|
ex_tax_tp: materialInfo.ex_tp !== null ? this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.exponent_rate/100), this.ctx.material.decimal.tp) : null,
|
|
|
}
|
|
|
tp_data.total_tp = this.ctx.helper.add(tp_data.m_tp, tp_data.ex_tp);
|
|
|
- tp_data.total_tax_tp = this.ctx.helper.add(tp_data.m_tax_tp, tp_data.ex_tax_tp);
|
|
|
+ tp_data.total_tax_tp = !materialInfo.material_tax ? this.ctx.helper.add(tp_data.tax_tp, tp_data.ex_tax_tp) : tp_data.ex_tax_tp;
|
|
|
if (materialInfo.is_stage_self) {
|
|
|
const materialStageList = await this.ctx.service.materialStage.getAllDataByCondition({ where: { mid: materialId }});
|
|
|
const stage_tp = [];
|