|
@@ -121,7 +121,7 @@ class jhHelper {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- _loadMergeResult(bills, prefixes) {
|
|
|
+ _loadMergeResult(bills, prefixes, decimal) {
|
|
|
const rst = {
|
|
|
id: bills.id,
|
|
|
tid: bills.tender_id,
|
|
@@ -139,18 +139,18 @@ class jhHelper {
|
|
|
}
|
|
|
if (gather) {
|
|
|
rst.qc_qty = this.ctx.helper.add(rst.qc_qty, p.qc_qty);
|
|
|
- rst.qc_tp = this.ctx.helper.add(rst.qc_qty, p.qc_tp);
|
|
|
rst.pre_qc_qty = this.ctx.helper.add(rst.pre_qc_qty, p.pre_qc_qty);
|
|
|
- rst.pre_qc_tp = this.ctx.helper.add(rst.pre_qc_tp, p.pre_qc_tp);
|
|
|
rst.end_qc_qty = this.ctx.helper.add(rst.end_qc_qty, p.end_qc_qty);
|
|
|
- rst.end_qc_tp = this.ctx.helper.add(rst.end_qc_tp, p.end_qc_tp);
|
|
|
for (const prefix of prefixes) {
|
|
|
rst[prefix + 'qc_qty'] = this.ctx.helper.add(rst[prefix + 'qc_qty'], p[prefix + 'qc_qty']);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ rst.qc_tp = this.ctx.helper.mul(rst.unit_price, rst.qc_qty, decimal.tp);
|
|
|
+ rst.pre_qc_tp = this.ctx.helper.mul(rst.unit_price, rst.pre_qc_qty, decimal.tp);
|
|
|
+ rst.end_qc_tp = this.ctx.helper.add(rst.pre_qc_tp, rst.qc_tp);
|
|
|
for (const prefix of prefixes) {
|
|
|
- rst[prefix + 'qc_tp'] = this.ctx.helper.mul(rst.unit_price, rst[prefix + 'qc_qty'], 2);
|
|
|
+ rst[prefix + 'qc_tp'] = this.ctx.helper.mul(rst.unit_price, rst[prefix + 'qc_qty'], decimal.tp);
|
|
|
}
|
|
|
} else {
|
|
|
rst.qc_qty = bills.qc_qty;
|
|
@@ -167,7 +167,7 @@ class jhHelper {
|
|
|
this.result.push(rst);
|
|
|
}
|
|
|
|
|
|
- _loadResult(bills, prefixes) {
|
|
|
+ _loadResult(bills, prefixes, decimal) {
|
|
|
if (bills.pos) {
|
|
|
for (const p of bills.pos) {
|
|
|
let load = false;
|
|
@@ -184,14 +184,14 @@ class jhHelper {
|
|
|
unit_price: bills.unit_price,
|
|
|
};
|
|
|
rst.qc_qty = p.qc_qty;
|
|
|
- rst.qc_tp = p.qc_tp;
|
|
|
+ rst.qc_tp = this.ctx.helper.mul(bills.unit_price, p.qc_qty, decimal.tp);
|
|
|
rst.pre_qc_qty = p.pre_qc_qty;
|
|
|
- rst.pre_qc_tp = p.pre_qc_tp;
|
|
|
+ rst.pre_qc_tp = this.ctx.helper.mul(bills.unit_price, p.pre_qc_qty, decimal.tp);
|
|
|
rst.end_qc_qty = p.end_qc_qty;
|
|
|
- rst.end_qc_tp = p.end_qc_tp;
|
|
|
+ rst.end_qc_tp = this.ctx.helper.add(rst.qc_tp, p.pre_qc_tp);
|
|
|
for (const prefix of prefixes) {
|
|
|
rst[prefix + 'qc_qty'] = p[prefix + 'qc_qty'];
|
|
|
- rst[prefix + 'qc_tp'] = p[prefix + 'qc_tp'];
|
|
|
+ rst[prefix + 'qc_tp'] = this.ctx.helper.mul(bills.unit_price, p[prefix + 'qc_qty'], decimal.tp);
|
|
|
}
|
|
|
this.result.push(rst);
|
|
|
}
|
|
@@ -216,7 +216,7 @@ class jhHelper {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- _generateResult(billsData, gsDefine) {
|
|
|
+ _generateResult(billsData, gsDefine, decimal) {
|
|
|
for (const bills of billsData) {
|
|
|
let load = false;
|
|
|
if (bills.pre_cd && bills.pre_cd.length > 0) load = true;
|
|
@@ -224,7 +224,7 @@ class jhHelper {
|
|
|
if (bills['r' + dc + '_cd'] && bills['r' + dc + '_cd'].length > 0) load = true;
|
|
|
}
|
|
|
if (!load) continue;
|
|
|
- gsDefine.merge ? this._loadMergeResult(bills, this.prefixes) : this._loadResult(bills, this.prefixes);
|
|
|
+ gsDefine.merge ? this._loadMergeResult(bills, this.prefixes, decimal) : this._loadResult(bills, this.prefixes, decimal);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -293,11 +293,6 @@ class jhHelper {
|
|
|
for (const b of billsData) {
|
|
|
billsIndex[b.id] = b;
|
|
|
b.pos = posData.filter(x => { return x.lid === b.id; });
|
|
|
- b.pos.forEach(x => {
|
|
|
- x.qc_tp = helper.mul(b.unit_price, x.qc_qty, 2);
|
|
|
- x.pre_qc_tp = helper.mul(b.unit_price, x.pre_qc_qty, 2);
|
|
|
- x.end_qc_tp = helper.add(x.qc_tp, x.pre_qc_tp);
|
|
|
- })
|
|
|
}
|
|
|
|
|
|
// 查询比较人数据
|
|
@@ -311,7 +306,7 @@ class jhHelper {
|
|
|
}
|
|
|
const finalChangeData = await this.getPreChangeDetailData(tender.id, stage.order);
|
|
|
this._loadChangeDetail(billsIndex, finalChangeData, gsDefine, 'pre_');
|
|
|
- this._generateResult(billsData, gsDefine);
|
|
|
+ this._generateResult(billsData, gsDefine, tender.info.decimal);
|
|
|
}
|
|
|
|
|
|
async _gatherMonthData(tender, month, defaultCompare) {
|