|
@@ -233,10 +233,10 @@ $(document).ready(() => {
|
|
|
return ZhCalc.round(data.unit_price, unitPriceUnit);
|
|
|
},
|
|
|
oa_tp: function (data) {
|
|
|
- return ZhCalc.round(ZhCalc.mul(data.unit_price, data.oamount), totalPriceUnit);
|
|
|
+ return ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), data.oamount), totalPriceUnit);
|
|
|
},
|
|
|
ca_tp: function (data) {
|
|
|
- return ZhCalc.round(ZhCalc.mul(data.unit_price, data.camount), totalPriceUnit);
|
|
|
+ return ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), data.camount), totalPriceUnit);
|
|
|
},
|
|
|
oamount: function (data) {
|
|
|
return ZhCalc.round(data.oamount, findDecimal(data.unit));
|
|
@@ -248,7 +248,7 @@ $(document).ready(() => {
|
|
|
return ZhCalc.round(data.samount, findDecimal(data.unit));
|
|
|
},
|
|
|
sa_tp: function (data) {
|
|
|
- return ZhCalc.round(ZhCalc.mul(data.unit_price, data.samount), totalPriceUnit);
|
|
|
+ return ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), data.samount), totalPriceUnit);
|
|
|
},
|
|
|
},
|
|
|
readOnly: {
|
|
@@ -268,13 +268,13 @@ $(document).ready(() => {
|
|
|
setAuditValue: function () {
|
|
|
for (const c of changeList) {
|
|
|
for (const audit of change.listAudits) {
|
|
|
- c['sa_tp_' + audit.aid] = ZhCalc.round(ZhCalc.mul(c['audit_amount_' + audit.aid], c.unit_price), totalPriceUnit);
|
|
|
+ c['sa_tp_' + audit.aid] = ZhCalc.round(ZhCalc.mul(c['audit_amount_' + audit.aid], ZhCalc.round(c.unit_price, unitPriceUnit)), totalPriceUnit);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
setRowValueAndSum: function (data, row, col) {
|
|
|
for (const j in change.listAudits) {
|
|
|
- const sum = ZhCalc.round(ZhCalc.mul(data.unit_price, parseFloat(changeSpreadSheet.getValue(row, 10 + parseInt(j)*2))), totalPriceUnit);
|
|
|
+ const sum = ZhCalc.round(ZhCalc.mul(ZhCalc.round(data.unit_price, unitPriceUnit), parseFloat(changeSpreadSheet.getValue(row, 10 + parseInt(j)*2))), totalPriceUnit);
|
|
|
changeSpreadSheet.setValue(row, 11 + j*2, sum !== 0 ? sum : null);
|
|
|
}
|
|
|
// const sum = ZhCalc.round(ZhCalc.mul(data.unit_price, data.spamount), totalPriceUnit);
|
|
@@ -838,6 +838,15 @@ $(document).ready(() => {
|
|
|
} else {
|
|
|
changeSpreadObj.showHideAudit(true);
|
|
|
}
|
|
|
+
|
|
|
+ // 计算最新的变更总额和change的total_price是否一致,不一致则更新
|
|
|
+ let new_tp = 0;
|
|
|
+ for (const c of changeList) {
|
|
|
+ new_tp = ZhCalc.add(new_tp, ZhCalc.round(ZhCalc.mul(c.spamount, ZhCalc.round(c.unit_price, unitPriceUnit)), totalPriceUnit));
|
|
|
+ }
|
|
|
+ if (change.total_price && change.total_price !== new_tp) {
|
|
|
+ postData(preUrl + '/list/save', { type:'update_tp', updateData: new_tp }, function (result) {});
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// 审批流程展示与隐藏
|