|
@@ -125,8 +125,8 @@ module.exports = app => {
|
|
|
if (isLastage) await this.ctx.service.stage.checkStageGatherData(audit);
|
|
|
}
|
|
|
audit.gather_tp = ctx.helper.sum([audit.contract_tp, audit.qc_tp, audit.pc_tp]);
|
|
|
- // audit.end_contract_tp = ctx.helper.add(audit.contract_tp, audit.pre_contract_tp);
|
|
|
- // audit.end_qc_tp = ctx.helper.add(audit.qc_tp, audit.pre_qc_tp);
|
|
|
+ audit.end_contract_tp = ctx.helper.sum([audit.contract_tp, audit.pre_contract_tp, audit.contract_pc_tp]);
|
|
|
+ audit.end_qc_tp = ctx.helper.sum([audit.qc_tp, audit.pre_qc_tp, audit.qc_pc_tp]);
|
|
|
audit.pre_gather_tp = ctx.helper.add(audit.pre_contract_tp, audit.pre_qc_tp);
|
|
|
audit.end_gather_tp = ctx.helper.add(audit.gather_tp, audit.pre_gather_tp);
|
|
|
}
|
|
@@ -223,18 +223,22 @@ module.exports = app => {
|
|
|
tender.total_price = sum.total_price;
|
|
|
tender.deal_tp = sum.deal_tp;
|
|
|
}
|
|
|
+ const [change_tp, change_p_tp, change_n_tp] = await ctx.service.change.getChangeTp(ctx.tender.id);
|
|
|
+ tender.change_tp = change_tp;
|
|
|
+ tender.change_p_tp = change_p_tp;
|
|
|
+ tender.change_n_tp = change_n_tp;
|
|
|
const stages = await ctx.service.stage.getValidStages(ctx.tender.id);
|
|
|
const lastStage = stages.length > 0 ? stages[0] : null; //await ctx.service.stage.getLastestStage(ctx.tender.id);
|
|
|
if (lastStage) {
|
|
|
await this.ctx.service.stage.checkStageGatherData(lastStage);
|
|
|
- tender.gather_tp = ctx.helper.add(lastStage.contract_tp, lastStage.qc_tp);
|
|
|
- tender.end_contract_tp = ctx.helper.add(lastStage.contract_tp, lastStage.pre_contract_tp);
|
|
|
- tender.end_qc_tp = ctx.helper.add(lastStage.qc_tp, lastStage.pre_qc_tp);
|
|
|
- tender.end_gather_tp = ctx.helper.add(tender.end_contract_tp, tender.end_qc_tp);
|
|
|
+ tender.gather_tp = ctx.helper.sum([lastStage.contract_tp, lastStage.qc_tp, lastStage.pc_tp]);
|
|
|
+ tender.end_contract_tp = ctx.helper.sum([lastStage.contract_tp, lastStage.pre_contract_tp, lastStage.contract_pc_tp]);
|
|
|
+ tender.end_qc_tp = ctx.helper.sum([lastStage.qc_tp, lastStage.pre_qc_tp, lastStage.qc_pc_tp]);
|
|
|
tender.pre_gather_tp = ctx.helper.add(lastStage.pre_contract_tp, lastStage.pre_qc_tp);
|
|
|
+ tender.end_gather_tp = ctx.helper.add(tender.gather_tp, tender.pre_gather_tp);
|
|
|
tender.yf_tp = lastStage.yf_tp;
|
|
|
tender.qc_ratio = ctx.helper.mul(ctx.helper.div(tender.end_qc_tp, ctx.tender.info.deal_param.contractPrice, 2), 100);
|
|
|
- tender.sum = ctx.helper.add(tender.total_price, tender.end_qc_tp);
|
|
|
+ tender.sum = ctx.helper.add(tender.total_price, tender.change_tp);
|
|
|
tender.pre_ratio = ctx.helper.mul(ctx.helper.div(tender.pre_gather_tp, tender.sum, 2), 100);
|
|
|
tender.cur_ratio = ctx.helper.mul(ctx.helper.div(tender.gather_tp, tender.sum, 2), 100);
|
|
|
tender.other_tp = ctx.helper.sub(ctx.helper.sub(tender.sum, tender.pre_gather_tp), tender.gather_tp);
|