Commit 5891b570 authored by 陆正友's avatar 陆正友

发票优化

parent 074f6433
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
</a:init-procedure> </a:init-procedure>
<a:view> <a:view>
<a:link id="acp_invoice_inf_import_link" model="acp.ACP522.acp_invoice_inf_import" modelaction="update"/> <a:link id="acp_invoice_inf_import_link" model="acp.ACP522.acp_invoice_inf_import" modelaction="update"/>
<a:link id="acp_invoice_inf_import_total_link" model="acp.ACP522.acp_invoice_inf_import_total" modelaction="update"/>
<a:link id="acp_invoice_inf_import_submit_link" model="acp.ACP522.acp_invoice_inf_import" modelaction="execute"/> <a:link id="acp_invoice_inf_import_submit_link" model="acp.ACP522.acp_invoice_inf_import" modelaction="execute"/>
<script src="${/request/@context_path}/javascripts/calculate.js" type="text/javascript"/> <script src="${/request/@context_path}/javascripts/calculate.js" type="text/javascript"/>
<script><![CDATA[ <script><![CDATA[
...@@ -42,7 +43,6 @@ ...@@ -42,7 +43,6 @@
var hd_record = $(hd_id).getAt(0); var hd_record = $(hd_id).getAt(0);
var lease_item_amount=hd_record.get('lease_item_amount'); var lease_item_amount=hd_record.get('lease_item_amount');
if($(ds_id).getAll().dirty){ if($(ds_id).getAll().dirty){
alert(111);
return; return;
} }
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
// } // }
// } // }
// 营业外收入或营业外支出科目金额超过0.5,请联系系统管理员! // 营业外收入或营业外支出科目金额超过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));
} }
...@@ -99,8 +99,8 @@ ...@@ -99,8 +99,8 @@
} }
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 = ((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));
if(diff > 0.5){ if(diff >1){
Leaf.showMessage('提示', '营业外收入或营业外支出科目金额超过0.5,请联系系统管理员!'); Leaf.showMessage('提示', '营业外收入或营业外支出科目金额超过1,请联系系统管理员!');
return; return;
} }
Leaf.showConfirm('${l:HLS.PROMPT}', '确定提交审批吗?', function() { Leaf.showConfirm('${l:HLS.PROMPT}', '确定提交审批吗?', function() {
...@@ -139,6 +139,7 @@ ...@@ -139,6 +139,7 @@
var invoice_number = strs[3]; var invoice_number = strs[3];
var net_amount = strs[4]; var net_amount = strs[4];
var invoice_date = strs[5]; var invoice_date = strs[5];
var total_amount =strs[4];
//检验设备价格需要大于不含税金额 //检验设备价格需要大于不含税金额
if (strs.length ==9) { if (strs.length ==9) {
//校验重复发票号码 add by 26887cz 2021-09-07 //校验重复发票号码 add by 26887cz 2021-09-07
...@@ -162,24 +163,70 @@ ...@@ -162,24 +163,70 @@
invoice_date: invoice_date, invoice_date: invoice_date,
contract_id: contract_id contract_id: contract_id
}, },
success: function () { success: function () {
Leaf.SideBar.show({ Leaf.SideBar.show({
msg: '导入成功', msg: '导入成功',
duration: 2000 duration: 2000
} }
); );
setTimeout(function() { setTimeout(function () {
record.set('invoice', ''); record.set('invoice', '');
}, 50); }, 50);
$(acp_ds_id).setQueryParameter('contract_id', '${/parameter/@contract_id}'); $(acp_ds_id).setQueryParameter('contract_id', '${/parameter/@contract_id}');
$(acp_ds_id).query(); $(acp_ds_id).query();
},failure: function() { }, failure: function () {
setTimeout(function() { setTimeout(function () {
record.set('invoice', ''); record.set('invoice', '');
}, 50); }, 50);
}, },
error: function() { error: function () {
setTimeout(function() { setTimeout(function () {
record.set('invoice', '');
}, 50);
},
scope: this
});
} else if (strs.length == 8) {
//校验重复发票号码 add by 26887cz 2021-09-07
var acr_records = $(acp_ds_id).getAll();
for (var i = 0; i < acr_records.length; i++) {
if (acr_records[i].get("invoice_number") == invoice_number) {
Leaf.showMessage('提示', '发票号码重复,请重新扫描!');
setTimeout(function () {
record.set('invoice', '');
}, 50);
return;
}
}
Leaf.request({
url: $('acp_invoice_inf_import_total_link').getUrl(),
para: {
invoice_type: invoice_type,
invoice_code: invoice_code,
invoice_number: invoice_number,
total_amount: total_amount,
invoice_date: invoice_date,
contract_id: contract_id
},
success: function () {
Leaf.SideBar.show({
msg: '导入成功',
duration: 2000
}
);
setTimeout(function () {
record.set('invoice', '');
}, 50);
$(acp_ds_id).setQueryParameter('contract_id', '${/parameter/@contract_id}');
$(acp_ds_id).query();
}, failure: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
error: function () {
setTimeout(function () {
record.set('invoice', ''); record.set('invoice', '');
}, 50); }, 50);
}, },
...@@ -187,7 +234,7 @@ ...@@ -187,7 +234,7 @@
}); });
} else { } else {
Leaf.showMessage('提示', '发票信息有错误,请重新扫描!'); Leaf.showMessage('提示', '发票信息有错误,请重新扫描!');
setTimeout(function() { setTimeout(function () {
record.set('invoice', ''); record.set('invoice', '');
}, 50); }, 50);
} }
......
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