Commit 2d1e99ba authored by Darming's avatar Darming

[fix]核销js小数精度问题

parent 72d3db5f
Pipeline #4553 canceled with stages
...@@ -376,21 +376,21 @@ ...@@ -376,21 +376,21 @@
for (var i = 0; i < write_off_recs.length; i++) { for (var i = 0; i < write_off_recs.length; i++) {
var t = parseFloat(write_off_recs[i].get('write_off_amount')); var t = parseFloat(write_off_recs[i].get('write_off_amount'));
if (!isNaN(t)) { if (!isNaN(t)) {
sum += t; sum = plus(sum,t);
} }
} }
var deposit_recs = $('csh_transaction_deposit_ds').getAll(); var deposit_recs = $('csh_transaction_deposit_ds').getAll();
for (var i = 0; i < deposit_recs.length; i++) { for (var i = 0; i < deposit_recs.length; i++) {
var t = parseFloat(deposit_recs[i].get('write_off_amount')); var t = parseFloat(deposit_recs[i].get('write_off_amount'));
if (!isNaN(t)) { if (!isNaN(t)) {
sum += t; sum = plus(sum,t);
} }
} }
var advanced_recs = $('csh_transaction_advanced_ds').getAll(); var advanced_recs = $('csh_transaction_advanced_ds').getAll();
for (var i = 0; i < advanced_recs.length; i++) { for (var i = 0; i < advanced_recs.length; i++) {
var t = parseFloat(advanced_recs[i].get('write_off_amount')); var t = parseFloat(advanced_recs[i].get('write_off_amount'));
if (!isNaN(t)) { if (!isNaN(t)) {
sum += t; sum = plus(sum,t);
} }
} }
var h_record = $('csh_transaction_receipt_write_off_detail_ds').getCurrentRecord(); var h_record = $('csh_transaction_receipt_write_off_detail_ds').getCurrentRecord();
...@@ -539,23 +539,24 @@ ...@@ -539,23 +539,24 @@
for (var i = 0; i < write_off_recs.length; i++) { for (var i = 0; i < write_off_recs.length; i++) {
var t = parseFloat(write_off_recs[i].get('write_off_amount')); var t = parseFloat(write_off_recs[i].get('write_off_amount'));
if (!isNaN(t)) { if (!isNaN(t)) {
sum += t; sum = plus(sum,t);
} }
} }
var deposit_recs = $('csh_transaction_deposit_ds').getAll(); var deposit_recs = $('csh_transaction_deposit_ds').getAll();
for (var i = 0; i < deposit_recs.length; i++) { for (var i = 0; i < deposit_recs.length; i++) {
var t = parseFloat(deposit_recs[i].get('write_off_amount')); var t = parseFloat(deposit_recs[i].get('write_off_amount'));
if (!isNaN(t)) { if (!isNaN(t)) {
sum += t; sum = plus(sum,t);
} }
} }
var advanced_recs = $('csh_transaction_advanced_ds').getAll(); var advanced_recs = $('csh_transaction_advanced_ds').getAll();
for (var i = 0; i < advanced_recs.length; i++) { for (var i = 0; i < advanced_recs.length; i++) {
var t = parseFloat(advanced_recs[i].get('write_off_amount')); var t = parseFloat(advanced_recs[i].get('write_off_amount'));
if (!isNaN(t)) { if (!isNaN(t)) {
sum += t; sum = plus(sum,t);
} }
} }
debugger;
var header_rec = $('csh_transaction_receipt_write_off_detail_ds').getCurrentRecord(); var header_rec = $('csh_transaction_receipt_write_off_detail_ds').getCurrentRecord();
if (sum > header_rec.get('unwrite_off_amount')) { if (sum > header_rec.get('unwrite_off_amount')) {
Leaf.showInfoMessage('提示', '核销总金额不能大于剩余可核销金额'); Leaf.showInfoMessage('提示', '核销总金额不能大于剩余可核销金额');
...@@ -644,7 +645,7 @@ ...@@ -644,7 +645,7 @@
// Leaf.showInfoMessage("提示", "存在未保存数据,请先保存再进行提交操作!"); // Leaf.showInfoMessage("提示", "存在未保存数据,请先保存再进行提交操作!");
// return; // return;
// } // }
sum += allRs[i].get('write_off_amount') || 0; sum = plus(sum,allRs[i].get('write_off_amount') || 0);
} }
if (sum == 0) { if (sum == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment