<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: gaoyang $Date: 2013-5-9 下午03:19:57 $Revision: 1.0 $Purpose: --> <a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" customizationEnabled="true" trace="true"> <a:init-procedure> <!-- <s:server-script import="contract_print_path.js"><![CDATA[ $ctx.parameter.file_path = con_print_path['con_print_path']; $ctx.parameter.tomcat_source = con_print_path['tomcat_source']; ]]></s:server-script> --> <a:model-query defaultWhereClause="t1.enabled_flag='Y'" fetchAll="true" model="basic.csh_payment_method_for_lov" rootPath="payment_method_path"/> <a:model-query fetchAll="true" model="gld.gld_currency_vl" rootPath="currency"/> <a:model-query fetchAll="true" model="gld.gld_exchangerate_type_lov" rootPath="exchangerate_type_path"/> <a:model-query fetchAll="true" model="csh.CSH511.fnd_financial_option" rootPath="fnd_financial_option_path"/> <a:model-query fetchAll="true" model="csh.CSH511.csh_transaction_default_exchange_rate_type" rootPath="default_exchange_rate_type_path"/> </a:init-procedure> <a:view> <a:link id="get_exchange_rate_link_id" model="csh.CSH511.csh_transaction_get_exchange_rate" modelaction="query"/> <a:link id="get_period_name_id" model="csh.CSH511.csh_transaction_get_period_name" modelaction="query"/> <a:link id="csh_transaction_receipt_post_query_link" url="${/request/@context_path}/modules/csh/CSH510/csh_transaction_receipt_post_query.lview"/> <a:link id="transaction_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/> <script type="text/javascript"><![CDATA[ // Ext.ux.Lightbox.register('a[ref=img]', true); function csh511_receipt_save(nextStep) { if ($('csh_transaction_receipt_head_ds').validate()) { var record = $('csh_transaction_receipt_head_ds').getAt(0); if (record.get('posted_flag') != 'Y') { Leaf.Masker.mask($('${/parameter/@winId}').wrap, '${l:HLS.SAVING}'); } var saveData = []; record.set('_status', 'update'); saveData.push(record.data); Leaf.request({ url: '${/request/@context_path}/autocrud/csh.CSH511.csh_transaction_receipt_save/batch_update', para: saveData, success: function (res) { if (typeof(nextStep) == 'function') { nextStep('${/parameter/@transaction_id}'); } else { Leaf.SideBar.show({ msg: '${l:HLS.SUBMIT_SUCCESS}', duration: 2000 }); $('csh_transaction_receipt_maintain_result_ds').query(); Leaf.Masker.unmask($('${/parameter/@winId}').wrap); } }, failure: function () { Leaf.Masker.unmask($('${/parameter/@winId}').wrap); }, error: function () { Leaf.Masker.unmask($('${/parameter/@winId}').wrap); }, scope: this }); } } function csh511_receipt_posted() { if ($('csh_transaction_receipt_head_ds').validate()) { Leaf.Masker.mask($('${/parameter/@winId}').wrap, '${l:CSH511.SAVE_AND_POST}'); var head_record = $('csh_transaction_receipt_head_ds').getAt(0); csh511_receipt_save(csh511_receipt_posted_execute); } } function csh511_receipt_posted_execute(transaction_id) { Leaf.request({ url: '${/request/@context_path}/autocrud/csh.CSH511.csh_transaction_post/execute', para: { transaction_id: transaction_id }, success: function (res) { Leaf.SideBar.show({ msg: '${l:HLS.SUBMIT_SUCCESS}', duration: 2000 }); $('csh_transaction_receipt_maintain_result_ds').query(); Leaf.Masker.unmask($('${/parameter/@winId}').wrap); //var url = $('csh_transaction_receipt_post_query_link').getUrl(); $('${/parameter/@winId}').close(); /* new Leaf.Window({ id: 'csh_transaction_receipt_post_query_winid', params: { transaction_id: transaction_id, winId: 'csh_transaction_receipt_post_query_winid' }, url: url, title: '${l:CSH510.CSH_RECEIPT_UPDATE}', fullScreen: true }); */ }, failure: function () { Leaf.Masker.unmask(Ext.getBody()); }, error: function () { Leaf.Masker.unmask(Ext.getBody()); }, scope: this }); } function csh511_receipt_back() { $('${/parameter/@winId}').close(); } function onUpdate_csh511_receipt(ds, record, name, value, oldvalue) { /*if (name == 'bp_id') { //SAP银行流水导入不做修改 if (value != oldvalue && record.get('source_doc_category') != 'SAP_EAI' && record.get('source_doc_type') != 'BANK_FLOW') { record.set('bp_bank_account_id', ''); record.set('bp_bank_account_code', ''); record.set('', ''); record.set('bp_bank_account_num', ''); } record.getField('bp_bank_account_code').setLovPara('bp_id', value); } else*/ if (name == 'currency_code') { if (value != oldvalue) { record.set('exchange_rate', ''); record.set('exchange_rate_type', ''); record.set('rate_method_code', ''); record.set('exchange_rate_type_display', ''); record.set('exchange_rate_quotation', ''); if (oldvalue != null && oldvalue != '') { record.set('transaction_amount', ''); record.set('transaction_functional_amount', ''); } } if (value == record.get('functional_currency_code')) { record.getField('exchange_rate_type_display').setRequired(false); record.getField('exchange_rate_type_display').setReadOnly(true); record.getField('exchange_rate').setReadOnly(true); record.set('exchange_rate', 1); } else { record.set('exchange_rate_type', '${/model/fnd_financial_option_path/record/@default_exchange_rate_type}'); record.set('rate_method_code', '${/model/fnd_financial_option_path/record/@rate_method_code}'); record.set('exchange_rate_type_display', '${/model/fnd_financial_option_path/record/@exchange_rate_type_display}'); record.getField('exchange_rate_type_display').setRequired(true); record.getField('exchange_rate_type_display').setReadOnly(false); } } else if (name == 'rate_method_code' || name == 'period_name') { if (record.get('currency_code') != record.get('functional_currency_code')) { var rate_method_code = record.get('rate_method_code'); record.set('exchange_rate_quotation', ''); record.set('exchange_rate', ''); if (rate_method_code == 'PERIOD' || rate_method_code == 'DAILY' || rate_method_code == 'FIXED') { record.getField('exchange_rate').setReadOnly(true); record.set('exchange_rate', ''); getExchangeRate({ fromCur: record.get('functional_currency_code'), toCur: record.get('currency_code'), exchangeRateType: record.get('exchange_rate_type'), exchangeDate: record.get('transaction_date'), periodName: record.get('period_name') }); } else { record.getField('exchange_rate').setReadOnly(false); record.set('exchange_rate', ''); } } } else if (name == 'exchange_rate') { if (record.get('exchange_rate') != null && record.get('exchange_rate') != '') { setfunctionamount(record); } else { record.set('transaction_functional_amount', ''); } } else if (name == 'transaction_amount') { if (value === 0 && record.get('zero_amounts_allowed') == 'N') { Leaf.showMessage('${l:PROMPT}', '${l:CSH510.ZERO_AMOUNTS_ALLOWED}'); } if (record.get('currency_code') == record.get('functional_currency_code')) { record.set('transaction_functional_amount', value); } else { setfunctionamount(record); } } else if (name == 'transaction_date') { showPeriod(record); } else if (name == 'precision') { record.getField('transaction_amount').setPropertity('decimalprecision', value); record.getField('transaction_functional_amount').setPropertity('decimalprecision', value); if (record.get('transaction_amount') || record.get('transaction_amount') == 0) { setfunctionamount(record); } } else if (name == 'bank_account_id') { if (record.get('zero_amounts_allowed') == 'N' && record.get('transaction_amount') === 0) { Leaf.showMessage('${l:PROMPT}', '${l:CSH510.ZERO_AMOUNTS_ALLOWED}'); } } } function setfunctionamount(record) { var quotation = record.get('exchange_rate_quotation'); var a = record.get('transaction_amount'); var b = record.get('exchange_rate'); if (Ext.isDefined(a) && Ext.isDefined(b) && !Ext.isEmpty(a) && !Ext.isEmpty(b)) { if (quotation == 'DIRECT QUOTATION') { record.set('transaction_functional_amount', parseFloat((a / b).toFixed(record.get('precision')))); } else { record.set('transaction_functional_amount', parseFloat((a * b).toFixed(record.get('precision')))); } } } function showPeriod(record) { var r_date = record.get('transaction_date'); r_date = Leaf.formatDate(r_date); Leaf.request({ url: $('get_period_name_id').getUrl(), para: { p_date: r_date }, success: periodname, scope: this }); } function periodname(res) { var head_record = $('csh_transaction_receipt_head_ds').getAt(0); if (res) { var period_name = res.result.record.period_name, internal_period_num = res.result.record.internal_period_num; if (period_name) { head_record.set('period_name', period_name); head_record.set('internal_period_num', internal_period_num); } else { head_record.set('period_name', ''); head_record.set('internal_period_num', ''); if (head_record.get('transaction_date')) { $('csh_transaction_receipt_head_ds').getAt(0).set('transaction_date', ''); Leaf.showMessage('${l:PROMPT}', '${l:CSH511.PERIOD_ERROR}'); } } } } function getExchangeRate(param) { Leaf.request({ url: $('get_exchange_rate_link_id').getUrl(), para: { from_currency: param.fromCur, to_currency: param.toCur, exchange_date: param.exchangeDate, exchange_period_name: param.periodName, exchange_rate_type: param.exchangeRateType }, success: setRateAndQuotation, scope: this }); } function setRateAndQuotation(res) { var record = $('csh_transaction_receipt_head_ds').getAt(0); if (Ext.isDefined(res.result.record.exchange_rate)) { record.set('exchange_rate', res.result.record.exchange_rate); } if (Ext.isDefined(res.result.record.exchange_rate_quotation)) { record.set('exchange_rate_quotation', res.result.record.exchange_rate_quotation); } else { record.set('exchange_rate_quotation', 'DIRECT QUOTATION'); } } function onLoad_csh511_receipt(ds) { var record = ds.getAt(0); if (record.get('currency_code') == record.get('functional_currency_code')) { record.getField('exchange_rate_type_display').setRequired(false); record.getField('exchange_rate_type_display').setReadOnly(true); record.getField('exchange_rate').setReadOnly(true); } else { record.getField('exchange_rate_type_display').setRequired(true); record.getField('exchange_rate_type_display').setReadOnly(false); if (record.get('rate_method_code') == 'PERIOD' || record.get('rate_method_code') == 'DAILY' || record.get('rate_method_code') == 'FIXED') { record.getField('exchange_rate').setReadOnly(true); } else { record.getField('exchange_rate').setReadOnly(false); record.getField('exchange_rate').setRequired(true); } } record.getField('bp_bank_account_code').setLovPara('bp_id', record.get('bp_id')); if (record.get('receipt_type')=='IMPORT'){ record.getField('transaction_date').setReadOnly(true); record.getField('transaction_amount').setReadOnly(true); record.getField('currency_name').setReadOnly(true); // record.getField('collection_classes_desc').setReadOnly(true); record.getField('bank_account_name').setReadOnly(true); record.getField('banka').setReadOnly(true); record.getField('bank_account_num').setReadOnly(true); record.getField('description').setReadOnly(true); record.getField('purpose').setReadOnly(true); record.getField('bank_slip_num').setReadOnly(true); record.getField('gsber').setReadOnly(true); record.getField('sus_belnr').setReadOnly(true); //record.getField('').setReadOnly(true); record.getField('opposite_band_na').setReadOnly(true); //record.getField('bp_bank_account_num').setReadOnly(true); } } // function view_pdf(attachment_id) { // Leaf.request({ // url: '${/request/@context_path}/autocrud/fnd.fnd_atm_attachment/query', // para: { // attachment_id: attachment_id // }, // success: function(res) { // // var path = res.result.record.file_path; // path = path.substr(path.indexOf('hls_attachment')); // var tomcat_source = '${/parameter/@tomcat_source}'; // var source_path = 'http://' + window.location.host + '/' + tomcat_source + '/' + path; // var oWin = window.open(source_path); // }, // scope: this // }); // } function attachment_upload() { if ('${/parameter/@transaction_id}') { // // ds = $('csh_transaction_receipt_head_ds'); // record = ds.getCurrentRecord(); // var header_id = record.get('transaction_id'); var header_id = '${/parameter/@transaction_id}'; var url = $('transaction_uploadFile_id').getUrl() + '?table_name=CSH_TRANSACTION&header_id=' + header_id; var win = new Leaf.Window({ url: url, title: '${l:HLS.SUPPORTING_DOCUMENT}', id: 'transaction_uploadFile_winid', width: 850, height: 400 }); win.on('close', function () { window.location.href = $('csh_transaction_receipt_id').getUrl(); // var url = $('csh_transaction_receipt_id').getUrl(); // Leaf.go(url); }); } else { Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!'); return; } } ]]></script> <a:dataSets> <a:dataSet id="csh510_update_payment_method_ds"> <a:datas dataSource="/model/payment_method_path"/> </a:dataSet> <a:dataSet id="csh510_update_currency_ds"> <a:datas dataSource="/model/currency"/> </a:dataSet> <a:dataSet id="exchangerate_type_ds"> <a:datas dataSource="/model/exchangerate_type_path"/> </a:dataSet> <a:dataSet id="csh_ds_collection_classes_ds" lookupCode="DS_COLLECTION_CLASSES"/> <a:dataSet id="csh_transaction_receipt_head_ds" loadData="true" model="csh.CSH511.csh_transaction"> <a:fields> <a:field readonly="true" name="transaction_date" required="true"/> <a:field readonly="true" name="period_name" lovGridHeight="300" lovHeight="500" lovService="gld.gld_period_lov" lovWidth="500" readOnly="true" required="true" title="GLD_PERIODS.PERIOD_NAME"> <a:mapping> <a:map from="period_name" to="period_name"/> </a:mapping> </a:field> <a:field readonly="true" name="internal_period_num"/> <a:field readonly="true" name="payment_method_display" displayField="description" options="csh510_update_payment_method_ds" returnField="payment_method_id" valueField="payment_method_id"/> <a:field readonly="true" name="currency_name" displayField="currency_name" options="csh510_update_currency_ds" readOnly="true" required="true" returnField="currency_code" valueField="currency_code"> <a:mapping> <a:map from="precision" to="precision"/> </a:mapping> </a:field> <a:field readonly="true" name="currency_code"/> <a:field readonly="true" name="precision"/> <a:field readonly="true" name="functional_currency_code"/> <a:field readonly="true" name="bp_name" lovGridHeight="350" lovHeight="500" lovLabelWidth="90" lovService="basic.hls_bp_master_v_for_lov" lovWidth="550" title="HLS.BP_TITLE"> <a:mapping> <a:map from="bp_id" to="bp_id"/> <a:map from="bp_name" to="bp_name"/> <a:map from="bp_name" to="csh_bp_name"/> <a:map from="bp_category" to="bp_category"/> <a:map from="bp_category_name" to="bp_category_display"/> </a:mapping> </a:field> <a:field readonly="true" name="bp_id"/> <a:field readonly="true" name="bp_category_display" readOnly="true"/> <a:field readonly="true" name="transaction_num" readOnly="true"/> <a:field readonly="true" name="exchange_rate_type_display" displayField="type_name" options="exchangerate_type_ds" returnField="exchange_rate_type" valueField="type_code"> <a:mapping> <a:map from="type_code" to="exchange_rate_type"/> <a:map from="rate_method_code" to="rate_method_code"/> </a:mapping> </a:field> <a:field readonly="true" name="exchange_rate" readOnly="true" required="true"/> <a:field readonly="true" name="exchange_rate_type"/> <a:field readonly="true" name="rate_method_code"/> <a:field readonly="true" name="transaction_amount" required="true"/> <a:field readonly="true" name="transaction_functional_amount" readOnly="true" required="true"/> <a:field readonly="true" name="bank_account_code" autoComplete="true" lovGridHeight="350" lovHeight="550" lovLabelWidth="90" lovService="csh.CSH101.csh_bank_account_lov" lovWidth="580" required="true" title="CSH511.BANK_ACCOUNT_CODE"> <a:mapping> <a:map from="zero_amounts_allowed" to="zero_amounts_allowed"/> <a:map from="precision" to="precision"/> <a:map from="bank_account_id" to="bank_account_id"/> <a:map from="bank_account_num" to="bank_account_num"/> <a:map from="bank_account_name" to="bank_account_name"/> <a:map from="bank_account_code" to="bank_account_code"/> <a:map from="currency_code" to="currency_code"/> <a:map from="currency_name" to="currency_name"/> </a:mapping> </a:field> <a:field readonly="true" name="bank_account_num" readOnly="true"/> <a:field readonly="true" name="bank_account_name" readOnly="true"/> <a:field readonly="true" name="bp_bank_account_code" autoComplete="true" lovGridHeight="350" lovHeight="550" lovLabelWidth="90" lovService="basic.hls_bp_master_bank_account_v_for_lov?enabled_flag=Y" lovWidth="580" title="CSH511.BP_BANK_ACCOUNT_CODE"> <a:mapping> <a:map from="bank_account_id" to="bp_bank_account_id"/> <a:map from="bank_account_num" to="bp_bank_account_num"/> <a:map from="bank_account_name" to=""/> <a:map from="bank_account_code" to="bp_bank_account_code"/> <a:map from="bank_branch_name" to="bp_bank_branch_name"/> <a:map from="bank_full_name" to="bp_bank_name"/> </a:mapping> </a:field> <a:field name="bp_bank_account_name" required="true" prompt="账户名称"/> <a:field name="bp_bank_account_num" required="true" prompt="账号"/> <a:field readonly="true" name="ref_contract_num" autoComplete="true" lovGridHeight="350" lovHeight="550" lovLabelWidth="90" lovService="csh.CSH511.csh_con_contract_lov" lovWidth="580" title="CON301.CONTRACT_QUERY"> <a:mapping> <a:map from="contract_number" to="ref_contract_num"/> <a:map from="contract_id" to="ref_contract_id"/> </a:mapping> </a:field> <a:field readonly="true" name="bp_bank_name"/> <a:field readonly="true" name="bp_bank_branch_name"/> <a:field name="collection_classes_desc" required="true" options="csh_ds_collection_classes_ds" displayField="code_value_name" returnField="collection_classes" valueField="code_value"/> </a:fields> <a:events> <a:event name="update" handler="onUpdate_csh511_receipt"/> <a:event name="load" handler="onLoad_csh511_receipt"/> </a:events> </a:dataSet> </a:dataSets> <a:screenBody> <a:screenTopToolbar> <a:gridButton id="csh511_receipt_save_id" click="csh511_receipt_save" text="HLS.SAVE"/> <a:gridButton id="csh511_receipt_posted_id" click="csh511_receipt_posted" text="HLS.POST"/> <!--<a:gridButton id="csh511_receipt_upload_id" click="attachment_upload" text="附件上传"/>--> <a:gridButton id="csh511_receipt_back_id" click="csh511_receipt_back" text="HLS.EXIT"/> </a:screenTopToolbar> <!--<a:form title="CSH511.CSH_RECEIPT">--> <!--<a:box column="4">--> <!--<a:datePicker name="transaction_date" bindTarget="csh_transaction_receipt_head_ds"/>--> <!--<a:lov name="period_name" bindTarget="csh_transaction_receipt_head_ds"/>--> <!--<a:comboBox name="currency_name" bindTarget="csh_transaction_receipt_head_ds"/>--> <!--<!– <a:comboBox name="exchange_rate_type_display" bindTarget="csh_transaction_receipt_head_ds"/> –>--> <!--</a:box>--> <!--<a:box column="4">--> <!--<a:lov name="ref_contract_num" bindTarget="csh_transaction_receipt_head_ds" prompt="合同编号"/>--> <!--<a:comboBox name="payment_method_display" bindTarget="csh_transaction_receipt_head_ds"/>--> <!--<a:textField name="bank_slip_num" bindTarget="csh_transaction_receipt_head_ds" prompt="银行凭证号"/>--> <!--<a:numberField name="exchange_rate" allowNegative="false" bindTarget="csh_transaction_receipt_head_ds" decimalPrecision="-1"/>--> <!--</a:box>--> <!--<a:box column="4">--> <!--<a:numberField name="transaction_amount" allowDecimals="true" allowFormat="true" allowNegative="false" bindTarget="csh_transaction_receipt_head_ds"/>--> <!--<a:numberField name="ref_n01" allowDecimals="true" allowFormat="true" allowNegative="false" bindTarget="csh_transaction_receipt_head_ds" prompt="税额"/>--> <!--<!– <a:numberField name="transaction_functional_amount" allowDecimals="true" allowFormat="true" allowNegative="false" bindTarget="csh_transaction_receipt_head_ds"/> –>--> <!----> <!--<a:lov name="bp_name" bindTarget="csh_transaction_receipt_head_ds"/>--> <!--<a:textField name="bp_category_display" bindTarget="csh_transaction_receipt_head_ds"/>--> <!--</a:box>--> <!--<a:box column="4">--> <!--<a:lov name="bank_account_code" bindTarget="csh_transaction_receipt_head_ds"/>--> <!--<a:textField name="bank_account_num" bindTarget="csh_transaction_receipt_head_ds"/>--> <!--<a:lov name="bp_bank_account_code" bindTarget="csh_transaction_receipt_head_ds"/>--> <!--<a:textField name="bp_bank_account_num" bindTarget="csh_transaction_receipt_head_ds"/>--> <!--</a:box>--> <!--<a:box column="2">--> <!--<a:textField name="bank_account_name" bindTarget="csh_transaction_receipt_head_ds" width="383"/>--> <!--<a:textField name="" bindTarget="csh_transaction_receipt_head_ds" width="383"/>--> <!--</a:box>--> <!--<a:box column="4">--> <!--<a:textArea name="description" bindTarget="csh_transaction_receipt_head_ds" width="383"/>--> <!--</a:box>--> <!--</a:form>--> <a:form title="收款信息" width="1200"> <a:box column="4"> <a:datePicker name="transaction_date" bindTarget="csh_transaction_receipt_head_ds"/> <!--<a:lov name="period_name" bindTarget="csh_transaction_receipt_head_ds"/>--> <a:numberField name="transaction_amount" allowDecimals="true" allowFormat="true" allowNegative="false" bindTarget="csh_transaction_receipt_head_ds"/> <a:comboBox name="currency_name" bindTarget="csh_transaction_receipt_head_ds"/> <a:comboBox name="collection_classes_desc" bindTarget="csh_transaction_receipt_head_ds" prompt="款项分类"/> <a:lov name="bank_account_name" bindTarget="csh_transaction_receipt_head_ds"/> <!--<a:textField name="banka" bindTarget="csh_transaction_receipt_head_ds" prompt="账户类型"/>--> <a:textField name="bank_branch_name" bindTarget="csh_transaction_receipt_head_ds" readOnly="true" prompt="分行名称"/> <a:textField name="bank_account_num" bindTarget="csh_transaction_receipt_head_ds" readOnly="true"/> <a:textField name="bank_account_type_name" bindTarget="csh_transaction_receipt_head_ds" readOnly="true" prompt="账户类型"/> <!-- <a:comboBox name="exchange_rate_type_display" bindTarget="csh_transaction_receipt_head_ds"/> --> </a:box> <a:box column="4"> <a:textField name="description" bindTarget="csh_transaction_receipt_head_ds" /> <a:textField name="purpose" bindTarget="csh_transaction_receipt_head_ds" prompt="用途" /> </a:box> <a:box column="4"> <a:textField name="bank_slip_num" bindTarget="csh_transaction_receipt_head_ds" prompt="银行流水号"/> <a:textField name="gsber" bindTarget="csh_transaction_receipt_head_ds" prompt="业务范围"/> <a:textField name="sus_belnr" bindTarget="csh_transaction_receipt_head_ds" prompt="SAP凭证号"/> </a:box> </a:form> <a:form title="对方账户信息" width="1200"> <a:box column="4"> <a:textField name="bp_bank_account_name" bindTarget="csh_transaction_receipt_head_ds" prompt="账户名称"/> <a:textField name="opposite_band_na" bindTarget="csh_transaction_receipt_head_ds" prompt="账户类型"/> <a:textField name="bp_bank_account_num" bindTarget="csh_transaction_receipt_head_ds" prompt="对方账号(分配参数)"/> <a:textField name="bp_virtual_bank_account" bindTarget="csh_transaction_receipt_head_ds" prompt="对方账号(虚拟卡号)"/> </a:box> </a:form> </a:screenBody> </a:view> </a:screen>