<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: xuls $Date: 2015-1-19 下午4:27:02 $Revision: 1.0 $Purpose: --> <a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true"> <a:init-procedure> <a:model-query autoCount="false" defaultWhereClause=" document_category='PAYMENT_REQ' and enabled_flag='Y' and business_type='PREPAYMENT'" fetchAll="true" model="hls.HLS003.hls_document_type" rootPath="csh504_prepayment_document_type"/> </a:init-procedure> <a:view> <a:link id="csh_payment_req_create" url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_update.lsc"/> <a:link id="csh_payment_req_selected" url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_selected.lview"/> <a:link id="csh_payment_req_amount_check" model="csh.CSH501.csh_payment_req_amount_check" modelaction="execute"/> <a:link id="csh_payment_req_ln_del_link" model="csh.CSH504.csh_payment_req_ln_del" modelaction="batch_update"/> <a:link id="csh_req_ddct_link" url="${/request/@context_path}/modules/csh/CSH504/csh_payment_req_ln_ddct.lview"/> <script type="text/javascript"><![CDATA[ function onUpdate_payment_req_hd(dataSet, record, name, value, oldValue) { var line_ds = $('csh_payment_req_ln_ds'); var lineRecords = line_ds.getAll(); if (name == 'apply_pay_date') { for (var i = 0;i < lineRecords.length;i++) { lineRecords[i].set('apply_pay_date', value); } } else if (name == 'bp_id') { for (var j = 0;j < lineRecords.length;j++) { lineRecords[j].set('bp_code', record.get('bp_code')); lineRecords[j].set('bp_name', record.get('bp_name')); lineRecords[j].set('bp_id', record.get('bp_id')); } } } function onUpdate_payment_req_ln(dataSet, record, name, value, oldValue) { var header_ds = $('csh_payment_req_create_ds'); var line_ds = $('csh_payment_req_ln_ds'); var lineRecords = line_ds.getAll(); var hrecord = header_ds.getAt(0); var currency_code; if (name == 'amount') { var amount = 0; for (var i = 0;i < lineRecords.length;i++) { var lineRecord = lineRecords[i]; currency_code = lineRecord.get('currency_code'); if (record.get('currency_code') != currency_code) { hrecord.set('amount', null); hrecord.set('currency_code', null); return; } else { current_amount = lineRecord.get('amount'); if (current_amount == 'NAN' || current_amount == 'undefined' || current_amount == null || current_amount == '') { current_amount = 0; } amount = amount + current_amount; } } hrecord.set('amount', amount); hrecord.set('currency_code', currency_code); } } function csh501_payment_create(value) { if ($('csh_payment_req_create_ds').validate() && $('csh_payment_req_ln_ds').validate()) { var headerds = $('csh_payment_req_create_ds'); var hrecord = headerds.getAt(0); var headRecordData = hrecord.data; var lineds = $('csh_payment_req_ln_ds'); var lrecord = lineds.getAll(); var datas = []; for (var i = 0;i < lrecord.length;i++) { var data = lrecord[i].data; datas.push(data); } var req_date = hrecord.get('req_date'); req_date = Leaf.formatDate(req_date); var queryParams = new Object(); queryParams['details'] = datas; queryParams['document_type'] = hrecord.get('document_type'); queryParams['req_date'] = req_date; queryParams['amount'] = hrecord.get('amount'); queryParams['currency_code'] = hrecord.get('currency_code'); queryParams['description'] = hrecord.get('description'); queryParams['bp_id'] = hrecord.get('bp_id'); queryParams['bp_category'] = hrecord.get('bp_category'); queryParams['apply_pay_date'] = hrecord.get('apply_pay_date'); queryParams['payment_req_id'] = hrecord.get('payment_req_id'); Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}'); Leaf.request({ url: $('csh_payment_req_create').getUrl(), para: queryParams, success: function(args) { // payment_req_id = args.result.payment_req_id; hrecord.set('payment_req_id',payment_req_id); var r_record = args.result.details.record; for (var i = 0;i < r_record.length;i++) { lineds.getAt(i).set('payment_req_ln_id', r_record[i].payment_req_ln_id); } $('csh_payment_req_ln_ds').setQueryUrl('${/request/@context_path}/autocrud/csh.CSH504.csh_payment_req_ln_upd_query/query?payment_req_id=' + payment_req_id); if (value == 'sub') { csh501_payment_submit(); } else { Leaf.SideBar.show({ msg: '${l:HLS.SUBMIT_SUCCESS}', duration: 2000 }); Leaf.Masker.unmask(Ext.getBody()); } }, failure: function() { Leaf.Masker.unmask(Ext.getBody()); }, error: function() { Leaf.Masker.unmask(Ext.getBody()); }, scope: this }); } } function csh501_payment_save_submit() { csh501_payment_create('sub'); } function csh501_payment_back() { $('${/parameter/@winId}').close(); } function csh501_payment_submit() { var ds = $('csh_payment_req_create_ds'); var record = $('csh_payment_req_create_ds').getAt(0); if (ds.validate()) { /* var saveData = []; record.set('_status', 'update'); saveData.push(record.data); */ var queryParams = new Object(); Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}'); Leaf.showConfirm('提示', '确定提交?', function okFun() { Leaf.request({ url: '${/request/@context_path}/autocrud/csh.CSH501.upd_csh_payment_sub_flag/execute', para: { payment_req_id: record.get('payment_req_id'), _status: 'execute' }, success: function(res) { Leaf.SideBar.show({ msg: '${l:HLS.SUBMIT_SUCCESS}', duration: 2000 }); //window.location.href = $('csh_payment_update_link').getUrl(); //window.location.href = $('csh_payment_req_selected').getUrl(); $('${/parameter/@winId}').close(); if ($('csh_payment_req_queryDs')){ $('csh_payment_req_queryDs').query(); } }, failure: function() { Leaf.Masker.unmask(Ext.getBody()); }, error: function() { Leaf.Masker.unmask(Ext.getBody()); }, scope: this }, Leaf.Masker.unmask(Ext.getBody())); }); } } function csh501_payment_delete() { /* var Array = $('csh_payment_req_ln_ds').getSelected(); if (Array.length < 1) { Leaf.showMessage('${l:PROMPT}', '${l:CHOOSE_ONE_RECORD}'); } var param = $('csh_payment_req_ln_ds').getJsonData(true); // Leaf.showConfirm('${l:HLS.PROMPT}', '${l:HLS.DELETE_CONFIRM}', function okFun() { Leaf.request({ url: $('csh_payment_req_ln_del_link').getUrl(), para: param, success: function() { $('csh_payment_req_ln_ds').query(); }, scope: this }); }); */ $('csh_payment_req_create_grid_ds').remove(); } /* function csh501_payment_print() { var records_l = $('csh_payment_req_ln_ds').getAll(); if (records_l.length > 0) { var ds = $('csh_payment_req_create_ds'); var record = $('csh_payment_req_create_ds').getAt(0); var url_1 = 'http://199.10.10.65:8180/reportapp/frameset?__report=reports/req/' + 'con_payment_req.rptdesign' + '&&__format=pdf'; var url_1_param = '&&payment_req_id=' + record.get('payment_req_id'); window.open(url_1 + url_1_param); } } */ function csh504_act_amount(value, record, name) { var amount = record.get('amount'); var sum_ddct_amount = record.get('sum_ddct_amount'); if (!sum_ddct_amount) { sum_ddct_amount = 0; } var act_amount = amount - sum_ddct_amount; return Leaf.formatMoney(act_amount); } function payment_req_ln_add(ds,record,index){ var head_record = $('csh_payment_req_create_ds').getAt(0); record.set('bp_name',head_record.get('bp_name')); record.set('bp_code',head_record.get('bp_code')); record.set('bp_id',head_record.get('bp_id')); } function csh501_payment_add(){ $('csh_payment_req_create_grid_ds').showEditorByRecord($('csh_payment_req_ln_ds').create()); } function csh504_trx_lov_fun(lov){ var record = this.record; record.getField(lov.binder.name).setLovPara('bp_id',record.get('bp_id')); } ]]></script> <a:dataSets> <a:dataSet id="document_type_ds"> <a:datas dataSource="/model/csh504_prepayment_document_type"/> </a:dataSet> <a:dataSet id="csh_payment_req_create_ds" autoCreate="true" model="csh.CSH504.csh_payment_req_hd_upd_query" submitUrl="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_update.lsc"> <a:fields> <a:field name="business_type" defaultValue="PREPAYMENT"/> <a:field name="document_type_dis" displayField="description" options="document_type_ds" required="true" returnField="document_type" valueField="document_type"/> <a:field name="bp_code" lovGridHeight="300" lovHeight="500" lovLabelWidth="100" lovService="basic.hls_bp_master_v_for_lov" lovWidth="530" required="true" title="付款对象"> <a:mapping> <a:map from="bp_code" to="bp_code"/> <a:map from="bp_name" to="bp_name"/> <a:map from="bp_id" to="bp_id"/> <a:map from="bp_category" to="bp_category"/> </a:mapping> </a:field> <a:field name="bp_name" readOnly="true"/> <a:field name="amount" readOnly="true"/> <a:field name="currency_code" defaultValue="CNY" readOnly="true"/> <a:field name="req_date" required="true"/> </a:fields> <a:events> <a:event name="update" handler="onUpdate_payment_req_hd"/> </a:events> </a:dataSet> <a:dataSet id="csh_payment_req_ln_ds" autoQuery="true" bindName="detail" bindTarget="csh_payment_req_create_ds" model="csh.CSH504.csh_payment_req_ln_upd_query" queryUrl="${/request/@context_path}/autocrud/csh.CSH504.csh_payment_req_ln_upd_query/query?payment_req_id=${/parameter/@payment_req_id}" selectable="true"> <a:fields> <a:field name="apply_pay_date" required="true"/> <a:field name="due_date"/> <a:field name="amount" required="true"/> <a:field name="bp_code" lovGridHeight="300" lovHeight="500" lovLabelWidth="100" lovService="basic.hls_bp_master_v_for_lov" lovWidth="530" required="true" title="付款对象"> <a:mapping> <a:map from="bp_code" to="bp_code"/> <a:map from="bp_name" to="bp_name"/> <a:map from="bp_id" to="bp_id"/> <a:map from="bp_category" to="bp_category"/> </a:mapping> </a:field> <a:field name="payment_req_ln_type" defaultValue="PREPAYMENT"/> <a:field name="currency_code" defaultValue="CNY"/> <a:field name="bp_bank_account_code" autoComplete="true" autoCompleteField="bank_account_num" lovGridHeight="350" lovHeight="550" lovLabelWidth="90" lovService="basic.hls_bp_master_bank_account_v_for_lov?enabled_flag=Y&bp_enabled_flag=Y" lovWidth="580" title="CSH511.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="bp_bank_account_name"/> <a:map from="bank_account_code" to="bp_bank_account_code"/> </a:mapping> </a:field> </a:fields> <a:events> <a:event name="update" handler="onUpdate_payment_req_ln"/> <a:event name="add" handler="payment_req_ln_add"/> </a:events> </a:dataSet> </a:dataSets> <a:screenBody> <a:screenTopToolbar> <a:gridButton click="csh501_payment_add" text="HLS.NEW"/> <a:gridButton click="csh501_payment_create" text="HLS.SAVE"/> <a:gridButton click="csh501_payment_submit" text="CSH501.CSH_REQ_POST"/> <a:gridButton click="csh501_payment_delete" text="HLS.REMOVE"/> <a:gridButton click="csh501_payment_back" text="HLS.BACK"/> </a:screenTopToolbar> <a:form title="CSH501.CSH_REQ_MAINTAIN" width="1250"> <a:box column="4" labelWidth="120"> <a:datePicker name="req_date" bindTarget="csh_payment_req_create_ds" prompt="CSH501.CSH_REQ_DATE" width="150"/> <a:comboBox name="document_type_dis" bindTarget="csh_payment_req_create_ds" prompt="CSH501.CSH_REQ_TYPE" typeCase="upper" width="150"/> <a:lov name="bp_code" bindTarget="csh_payment_req_create_ds" prompt="CSH501.CSH_PAYMENT_OBJ" width="150"> <a:events> <a:event name="focus" handler="function(object){on_std_focus(object,'BP')}"/> </a:events> </a:lov> <a:textField name="bp_name" bindTarget="csh_payment_req_create_ds" prompt="CSH501.CSH_PAYMENT_OBJ_NAME" width="150"/> </a:box> <a:box column="4" labelWidth="120"> <a:numberField name="amount" bindTarget="csh_payment_req_create_ds" prompt="CSH501.CSH_PAYMENT_AMOUNT" renderer="Leaf.formatMoney" typeCase="upper" width="150"/> <!-- <a:textField name="currency_code" bindTarget="csh_payment_req_create_ds" prompt="HLS.CURRENCY" width="150"/> --> <a:textField name="description" bindTarget="csh_payment_req_create_ds" prompt="HLS.COMMENT" width="428"/> </a:box> </a:form> <a:grid id="csh_payment_req_create_grid_ds" bindTarget="csh_payment_req_ln_ds" marginHeight="220" marginWidth="30" navBar="true"> <a:columns> <a:column name="bp_code" editor="create_grid_bp_lov" prompt="CSH501.CSH_PAYMENT_OBJ"/> <a:column name="bp_name" prompt="CSH501.CSH_PAYMENT_OBJ_NAME" width="250"/> <a:column name="amount" align="right" editor="numberField" prompt="CSH501.CSH_REQ_AMOUNT" renderer="Leaf.formatMoney"/> <a:column name="act_amount" align="right" prompt="实际申请金额" renderer="csh504_act_amount"/> <a:column name="apply_pay_date" editor="datepicker" prompt="CSH501.CSH_REQ_PAY_DATE" renderer="Leaf.formatDate"/> <a:column name="bp_bank_account_code" editor="csh504_loved" prompt="CSH511.BP_BANK_ACCOUNT_CODE"/> <!-- <a:column name="currency_code" prompt="HLS.CURRENCY"/> --> </a:columns> <a:editors> <a:datePicker id="datepicker"/> <a:numberField id="numberField" allowFormat="true" allowNegative="false" decimalPrecision="2"/> <a:lov id="create_grid_bp_lov"> <a:events> <a:event name="focus" handler="function(object){on_std_focus(object,'BP')}"/> </a:events> </a:lov> <a:lov id="csh504_loved"> <a:events> <a:event name="focus" handler="csh504_trx_lov_fun"/> </a:events> </a:lov> </a:editors> </a:grid> </a:screenBody> <script type="text/javascript"><![CDATA[ var record = $('csh_payment_req_create_ds').getAt(0); if (!record.get('document_type_dis')){ record.set('req_date', new Date()); record.set('document_type_dis', '${/model/csh504_prepayment_document_type/record/@description}'); record.set('document_type', '${/model/csh504_prepayment_document_type/record/@document_type}'); } ]]></script> </a:view> </a:screen>