Commit 0731752d authored by 38823's avatar 38823

I-20927 【建机】核销时选择到重名商业伙伴时提示

parent b7857a10
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:s="leaf.plugin.script" xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select count(*) as con_sum from con_contract_bp ccb where ccb.bp_id=${@bp_id} and ccb.contract_id =${@contract_id} #WHERE_CLAUSE#
]]></bm:query-sql>
<bm:parameters>
<bm:parameter name="con_sum" dataType="java.lang.Long" input="false" output="true" outputPath="@con_sum"/>
</bm:parameters>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true"> <a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
<a:view> <a:view>
<a:link id="contract_bp_link" model="csh.CSH531N.contract_bp" modelaction="query"/>
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
function csh_write_off_query() { function csh_write_off_query() {
$('csh_lov_con_contract_ds').query(); $('csh_lov_con_contract_ds').query();
...@@ -50,6 +51,17 @@ ...@@ -50,6 +51,17 @@
Leaf.showInfoMessage("提示", "请选择要核销的现金流!"); Leaf.showInfoMessage("提示", "请选择要核销的现金流!");
return; return;
} }
Leaf.request({
url: $('contract_bp_link').getUrl(),
para: {
bp_id: '${/parameter/@bp_id}',
contract_id:con_rec.get('contract_id')
},
success: function(res) {
debugger;
if(res.result.record.con_sum == 0){
Leaf.showConfirm('${l:HLS.PROMPT}', '当前选择合同的商业伙伴和现金事务不一致,您确认吗?', function() {
debugger;
var rec = ds.getCurrentRecord(); var rec = ds.getCurrentRecord();
rec.set('contract_id', con_rec.get('contract_id')); rec.set('contract_id', con_rec.get('contract_id'));
rec.set('contract_number', con_rec.get('contract_number')); rec.set('contract_number', con_rec.get('contract_number'));
...@@ -106,6 +118,74 @@ ...@@ -106,6 +118,74 @@
ds.add(newRecord); ds.add(newRecord);
} }
$('${/parameter/@lovid}').win.close(); $('${/parameter/@lovid}').win.close();
});
}else {
var rec = ds.getCurrentRecord();
rec.set('contract_id', con_rec.get('contract_id'));
rec.set('contract_number', con_rec.get('contract_number'));
rec.set('division', con_rec.get('division'));
rec.set('bp_tenant_name', con_rec.get('bp_name'));
rec.set('write_off_bp_name', con_rec.get('bp_name'));
rec.set('write_off_bp_id', con_rec.get('bp_id_tenant'));
rec.set('bp_id_tenant', con_rec.get('bp_id_tenant'));
rec.set('write_off_cf_item_desc', cf_recs[0].get('cf_item_desc'));
rec.set('write_off_cashflow_id', cf_recs[0].get('cashflow_id'));
rec.set('write_off_cf_item', cf_recs[0].get('cf_item'));
rec.set('write_off_times', cf_recs[0].get('times'));
rec.set('left_principal', cf_recs[0].get('unreceived_principal'));
rec.set('left_interest', cf_recs[0].get('unreceived_interest'));
rec.set('left_amount', cf_recs[0].get('unreceived_amount'));
rec.set('due_amount', cf_recs[0].get('due_amount'));
rec.set('principal', cf_recs[0].get('principal'));
rec.set('interest', cf_recs[0].get('interest'));
rec.set('due_date', cf_recs[0].get('due_date'));
rec.set('write_off_principal', cf_recs[0].get('unreceived_principal'));
rec.set('write_off_interest', cf_recs[0].get('unreceived_interest'));
rec.set('unreceived_amount', cf_recs[0].get('unreceived_amount'));
rec.set('write_off_date',new Date().format('yyyy-mm-dd'));
rec.set('journal_date',new Date().format('yyyy-mm-dd'));
rec.set('payment_deduction', con_rec.get('payment_deduction'));
// rec.set('write_off_amount', cf_recs[0].get('unreceived_amount'));
for (var i = 1; i < cf_recs.length; i++) {
//copy...
// var newRecord = new Leaf.Record({...rec.data});
//IE不支持ES6扩展
var obj = JSON.parse(JSON.stringify(rec.data));
var newRecord = new Leaf.Record(obj);
newRecord.ds = rec.ds;
newRecord.set('write_off_cf_item_desc', cf_recs[i].get('cf_item_desc'));
newRecord.set('write_off_cf_item', cf_recs[i].get('cf_item'));
newRecord.set('write_off_times', cf_recs[i].get('times'));
newRecord.set('due_date', cf_recs[i].get('due_date'));
newRecord.set('write_off_cashflow_id', cf_recs[i].get('cashflow_id'));
newRecord.set('unreceived_amount', cf_recs[i].get('unreceived_amount'));
newRecord.set('interest', cf_recs[i].get('interest'));
newRecord.set('principal', cf_recs[i].get('principal'));
newRecord.set('due_amount', cf_recs[i].get('due_amount'));
newRecord.set('left_principal', cf_recs[i].get('unreceived_principal'));
newRecord.set('left_interest', cf_recs[i].get('unreceived_interest'));
newRecord.set('left_amount', cf_recs[i].get('unreceived_amount'));
newRecord.set('write_off_principal', cf_recs[i].get('unreceived_principal'));
newRecord.set('write_off_interest', cf_recs[i].get('unreceived_interest'));
newRecord.set('write_off_date',new Date().format('yyyy-mm-dd'));
newRecord.set('journal_date',new Date().format('yyyy-mm-dd'));
// newRecord.set('write_off_amount', cf_recs[i].get('unreceived_amount'));
ds.add(newRecord);
}
$('${/parameter/@lovid}').win.close();
}
},
failure: function() {
Leaf.Masker.unFmask(Ext.getBody());
},
error: function() {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
} }
function setBankAccount() { function setBankAccount() {
......
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