|
@@ -342,8 +342,8 @@ module.exports = app => {
|
|
|
cl.detail,
|
|
|
cl.lid,
|
|
|
];
|
|
|
- ototalCost += ctx.helper.mul(cl.unit_price, cl.oamount, ctx.tender.info.decimal.tp);
|
|
|
- ctotalCost += ctx.helper.mul(cl.unit_price, cl.camount, ctx.tender.info.decimal.tp);
|
|
|
+ ototalCost += cl.unit_price === null ? 0 : ctx.helper.mul(cl.unit_price, cl.oamount, ctx.tender.info.decimal.tp);
|
|
|
+ ctotalCost += cl.unit_price === null ? 0 : ctx.helper.mul(cl.unit_price, cl.camount, ctx.tender.info.decimal.tp);
|
|
|
if (cl.lid !== 0) {
|
|
|
changeListData.push(cLArray.join(';'));
|
|
|
} else {
|
|
@@ -388,11 +388,12 @@ module.exports = app => {
|
|
|
let stotalCost = 0;
|
|
|
const auditTotalCost = [];
|
|
|
for (const cl of changeList) {
|
|
|
- ototalCost += parseFloat(ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.oamount), renderData.tpUnit));
|
|
|
- ctotalCost += parseFloat(ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.camount), renderData.tpUnit));
|
|
|
- stotalCost += cl.samount !== '' ? parseFloat(ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.samount), renderData.tpUnit)) : 0;
|
|
|
+ ototalCost += cl.unit_price === null ? 0 : parseFloat(ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.oamount), renderData.tpUnit));
|
|
|
+ ctotalCost += cl.unit_price === null ? 0 : parseFloat(ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.camount), renderData.tpUnit));
|
|
|
+ stotalCost += cl.samount !== '' && cl.unit_price !== null ? parseFloat(ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.samount), renderData.tpUnit)) : 0;
|
|
|
const audit_amount = cl.audit_amount !== null && cl.audit_amount !== '' ? cl.audit_amount.split(',') : '';
|
|
|
auditTotalCost.push(audit_amount);
|
|
|
+ console.log(cl.unit_price, ototalCost, ctotalCost);
|
|
|
}
|
|
|
renderData.ototalCost = ototalCost;
|
|
|
renderData.ctotalCost = ctotalCost;
|
|
@@ -405,7 +406,7 @@ module.exports = app => {
|
|
|
au.totalCost = 0;
|
|
|
for (const [auindex, at] of auditTotalCost.entries()) {
|
|
|
au.list_amount.push(at[index - 1]);
|
|
|
- au.totalCost += at[index - 1] !== undefined ? parseFloat(ctx.helper.roundNum(ctx.helper.accMul(changeList[auindex].unit_price, at[index - 1]), renderData.tpUnit)) : 0;
|
|
|
+ au.totalCost += at[index - 1] !== undefined && changeList[auindex].unit_price !== null ? parseFloat(ctx.helper.roundNum(ctx.helper.accMul(changeList[auindex].unit_price, at[index - 1]), renderData.tpUnit)) : 0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -425,8 +426,8 @@ module.exports = app => {
|
|
|
const auditTotalCost = [];
|
|
|
const auditUnit = [];
|
|
|
for (const cl of changeList) {
|
|
|
- ototalCost += parseFloat(ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.oamount), renderData.tpUnit));
|
|
|
- ctotalCost += parseFloat(ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.camount), renderData.tpUnit));
|
|
|
+ ototalCost += cl.unit_price === null ? 0 : parseFloat(ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.oamount), renderData.tpUnit));
|
|
|
+ ctotalCost += cl.unit_price === null ? 0 : parseFloat(ctx.helper.roundNum(ctx.helper.accMul(cl.unit_price, cl.camount), renderData.tpUnit));
|
|
|
const audit_amount = cl.audit_amount !== null && cl.audit_amount !== '' ? cl.audit_amount.split(',') : '';
|
|
|
auditTotalCost.push(audit_amount);
|
|
|
}
|
|
@@ -448,12 +449,12 @@ module.exports = app => {
|
|
|
// au.totalCost += parseFloat(ctx.helper.roundNum(ctx.helper.accMul(changeList[auindex].unit_price, changeList[auindex].camount), renderData.tpUnit));
|
|
|
// }
|
|
|
au.list_amount.push(changeList[auindex].spamount);
|
|
|
- au.totalCost += parseFloat(ctx.helper.roundNum(ctx.helper.accMul(changeList[auindex].unit_price, changeList[auindex].spamount), renderData.tpUnit));
|
|
|
+ au.totalCost += changeList[auindex].unit_price === null ? 0 : parseFloat(ctx.helper.roundNum(ctx.helper.accMul(changeList[auindex].unit_price, changeList[auindex].spamount), renderData.tpUnit));
|
|
|
}
|
|
|
} else {
|
|
|
for (const [auindex, at] of auditTotalCost.entries()) {
|
|
|
au.list_amount.push(at[index - 1]);
|
|
|
- au.totalCost += at[index - 1] !== undefined ? parseFloat(ctx.helper.roundNum(ctx.helper.accMul(changeList[auindex].unit_price, at[index - 1]), renderData.tpUnit)) : 0;
|
|
|
+ au.totalCost += at[index - 1] !== undefined && changeList[auindex].unit_price !== null ? parseFloat(ctx.helper.roundNum(ctx.helper.accMul(changeList[auindex].unit_price, at[index - 1]), renderData.tpUnit)) : 0;
|
|
|
}
|
|
|
}
|
|
|
}
|