Commit b2dde279 authored by 陆正友's avatar 陆正友

进项经租发票尾差校验

parent 9486d048
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
return; return;
} }
var sum = 0; var sum = 0;
var sum_net_amount = 0;
var sum_tax = 0; var sum_tax = 0;
var net_lease_item_amount = hd_record.get('net_lease_item_amount') || 0; var net_lease_item_amount = hd_record.get('net_lease_item_amount') || 0;
for (var i = 0; i < records.length; i++) { for (var i = 0; i < records.length; i++) {
...@@ -68,10 +69,14 @@ ...@@ -68,10 +69,14 @@
var r = records[i]; var r = records[i];
var d = r.get(name); var d = r.get(name);
var n = records[i].get('total_amount') || 0; var n = records[i].get('total_amount') || 0;
var m = records[i].get('net_amount') || 0;
if (!isNaN(n)) { if (!isNaN(n)) {
sum = plus(sum, n); sum = plus(sum, n);
} }
if (!isNaN(m)) {
sum_net_amount = plus(sum_net_amount, m);
}
console.log(sum_net_amount);
// 营业外收入或营业外支出科目金额超过1,请联系系统管理员! // 营业外收入或营业外支出科目金额超过1,请联系系统管理员!
if (!isNaN(records[i].get('tax_amount') || 0)) { if (!isNaN(records[i].get('tax_amount') || 0)) {
sum_tax = plus((records[i].get('tax_amount') || 0), (sum_tax || 0)); sum_tax = plus((records[i].get('tax_amount') || 0), (sum_tax || 0));
...@@ -88,8 +93,8 @@ ...@@ -88,8 +93,8 @@
Leaf.showMessage('提示', '本次发票明细含税总计不等于该合同设备价!'); Leaf.showMessage('提示', '本次发票明细含税总计不等于该合同设备价!');
return; return;
} }
var diff = ((net_lease_item_amount + sum_tax - lease_item_amount) > 0 ? (net_lease_item_amount + sum_tax - lease_item_amount) : (lease_item_amount - sum_tax - net_lease_item_amount)); var diff = ((sum_net_amount + sum_tax - lease_item_amount) > 0 ? (sum_net_amount + sum_tax - lease_item_amount) : (lease_item_amount - sum_tax - sum_net_amount));
console.log(diff);
if (diff > 1) { if (diff > 1) {
Leaf.showMessage('提示', '营业外收入或营业外支出科目金额超过1,请联系系统管理员!'); Leaf.showMessage('提示', '营业外收入或营业外支出科目金额超过1,请联系系统管理员!');
return; return;
......
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