|
@@ -207,9 +207,13 @@ module.exports = app => {
|
|
|
async getTpData(materialId) {
|
|
|
const materialInfo = await this.ctx.service.material.getDataById(materialId);
|
|
|
const tp_data = {
|
|
|
- m_tp: materialInfo.m_tp,
|
|
|
- m_tax_tp: materialInfo.m_tax_tp,
|
|
|
+ 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,
|
|
|
+ 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);
|
|
|
if (materialInfo.is_stage_self) {
|
|
|
const materialStageList = await this.ctx.service.materialStage.getAllDataByCondition({ where: { mid: materialId }});
|
|
|
const stage_tp = [];
|
|
@@ -218,8 +222,8 @@ module.exports = app => {
|
|
|
id: ms.id,
|
|
|
sid: ms.sid,
|
|
|
order: ms.order,
|
|
|
- m_tp: ms.m_tp,
|
|
|
- m_tax_tp: ms.m_tax_tp,
|
|
|
+ m_tp: this.ctx.helper.round(ms.m_tp, this.ctx.material.decimal.tp),
|
|
|
+ m_tax_tp: this.ctx.helper.round(ms.m_tax_tp, this.ctx.material.decimal.tp),
|
|
|
});
|
|
|
}
|
|
|
tp_data.stage_tp = stage_tp;
|