<?xml version="1.0" encoding="UTF-8"?> <!-- $Author: Guoxuezhao $Date: 2013-5-27 下午3:43:19 $Revision: 1.0 $Purpose: 授信额度维护 --> <a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true"> <a:init-procedure/> <a:view> <script type="text/javascript"><![CDATA[ function tre501_manage_query() { $('bank_credit_contract_ds').query(); } function tre501_manage_add() { $('bank_credit_contract_ds').create(); } function tre501_manage_reset() { $('bank_credit_contract_query_ds').reset(); } function tre501_manage_clear() { $('bccd_grid').clear(); } function lock_current_window() { Leaf.Masker.mask(document.documentElement, '${l:HLS.EXECUTING}'); } function unlock_current_window() { Leaf.Masker.unmask(document.documentElement); } function tre501_manage_save() { lock_current_window(); if ($('bank_credit_contract_ds').validate()) { $('bank_credit_contract_ds').submit(); } else { unlock_current_window(); } } function on_bank_credit_contract_submitsuccess(ds, res) { tre501_manage_query(); ds.query(ds.currentPage); unlock_current_window(); } function on_bank_credit_contract_submitfailed(ds, res) { unlock_current_window(); } function viewDetails(value, record, name) { if (record.isNew) { return ''; } else { return '<a href="javascript:openDetailWindow(' + record.get('bp_id') + ',\'' + record.get('credit_contract_id') + '\');">${l:TRE501.TRE_BANK_CREDIT_CONTRACT.DETAIL}</a>'; } } function openDetailWindow(bp_id,id) { var win = new Leaf.Window({ id: 'tre_credit_amt_detail_winid', url: 'tre_credit_amt_detail.lview', params: { credit_contract_id: id, bp_id: bp_id }, width: '900', height: '500', title: '明细', fullScreen: true }); win.on('close', function() { var result_ds = $('bank_credit_contract_ds'); result_ds.query(result_ds.currentPage); }); } function dateValidator(record, name, value) { //日期校验方法 if (name == 'credit_date_from' || name == 'credit_date_to') { var start_date = Leaf.formatDate(record.get('credit_date_from')); var end_date = Leaf.formatDate(record.get('credit_date_to')); if ( !! end_date) { //由于结束日期非必填,只有在结束日期填了才进行比较 if (!compareDate(start_date, end_date)) { return '${l:TRE501.CREDIT_DATE_FROM_BEYOND_TO}'; //校验不通过返回字符串 } } return true; //校验通过返回true } } function compareDate(start, end) { if (start > end) { return false; } return true; } function tre501_manage_excel() { $('bccd_grid')._export('xls', '授信额度'); } function on_bank_credit_contract_update(dataset, record, name, value, oldvalue) { var credit_limit_type = record.get('credit_limit_type'); if (name == 'credit_amount') { //非循环授信:可用额度=授信额度-借款额度 if (credit_limit_type == 'UNREVOLVING_CREDIT') { var loan_amount = record.get('loan_amount'); var available_amount = value - loan_amount; record.set('available_amount', available_amount); } //循环授信:可用额度=授信额度-借款额度+已还本金 if (credit_limit_type == 'REVOLVING_CREDIT') { loan_amount = record.get('loan_amount'); var repayment_principal = record.get('repayment_principal'); available_amount = value - loan_amount + repayment_principal; record.set('available_amount', available_amount); } } if (name == 'credit_limit_type_desc') { //非循环授信:可用额度=授信额度-借款额度 if (value == '非循环授信') { loan_amount = record.get('loan_amount'); var credit_amount = record.get('credit_amount'); available_amount = credit_amount - loan_amount; record.set('available_amount', available_amount); } //循环授信:可用额度=授信额度-借款额度+已还本金 if (value == '循环授信') { loan_amount = record.get('loan_amount'); credit_amount = record.get('credit_amount'); repayment_principal = record.get('repayment_principal'); available_amount = credit_amount - loan_amount + repayment_principal; record.set('available_amount', available_amount); } } } ]]></script> <a:dataSets> <a:dataSet id="TRE501_BUSINESS_TERM_ds" lookupCode="TRE501_BUSINESS_TERM"/> <a:dataSet id="TRE501_PURPOSE_ds" lookupCode="TRE501_PURPOSE"/> <a:dataSet id="TRE501_DIRECTOR_RESOLUTION_ds" lookupCode="TRE501_DIRECTOR_RESOLUTION"/> <a:dataSet id="credit_limit_type_ds" lookupCode="TRE501_CREDIT_LIMIT_TYPE"/> <a:dataSet id="credit_class_ds" lookupCode="CREDIT_CONTRACT_CREDIT_TYPE"/> <a:dataSet id="credit_category_ds" lookupCode="CREDIT_CONTRACT_CREDIT_CATEGORY"/> <a:dataSet id="bank_credit_contract_query_ds" autoCreate="true"> <a:fields> <a:field name="credit_class_desc" displayField="code_value_name" options="credit_class_ds" returnField="credit_class" valueField="code_value"/> <a:field name="credit_limit_type_desc" displayField="code_value_name" options="credit_limit_type_ds" returnField="credit_limit_type" valueField="code_value"/> <a:field name="bp_id"/> <a:field name="bank_full_name" lovHeight="500" lovService="basic.csh_bank_for_lov" lovWidth="500"> <a:mapping> <a:map from="bank_id" to="bank_id"/> <a:map from="bank_full_name" to="bank_full_name"/> </a:mapping> </a:field> <a:field name="bank_branch_name" lovGridHeight="350" lovHeight="510" lovLabelWidth="90" lovService="tre.tre501.tre501_bank_branch_name_lov" lovWidth="580" title="HLS.BANK_BRANCH_NAME"> <a:mapping> <a:map from="bp_id" to="bp_id"/> <a:map from="bp_name" to="bank_branch_name"/> </a:mapping> </a:field> <a:field name="currency"/> <a:field name="currency_name" lovAutoQuery="true" lovGridHeight="250" lovHeight="400" lovService="gld.gld_currency_lov" lovWidth="600"> <a:mapping> <a:map from="currency_name" to="currency_name"/> <a:map from="currency_code" to="currency"/> </a:mapping> </a:field> </a:fields> </a:dataSet> <a:dataSet id="bank_credit_contract_ds" autoPageSize="true" autoQuery="true" model="tre.tre501.tre_bank_credit_contract" queryDataSet="bank_credit_contract_query_ds" selectable="true" selectionModel="single" submitUrl="${/request/@context_path}/modules/tre/tre501/tre_credit_contract_save.lsc"> <a:fields> <a:field name="business_term_desc" displayField="code_value_name" options="TRE501_BUSINESS_TERM_ds" returnField="business_term" valueField="code_value"/> <a:field name="purpose_desc" displayField="code_value_name" options="TRE501_PURPOSE_ds" returnField="purpose" valueField="code_value"/> <a:field name="director_resolution_desc" displayField="code_value_name" options="TRE501_DIRECTOR_RESOLUTION_ds" returnField="director_resolution" valueField="code_value"/> <a:field name="credit_limit_category_desc" displayField="code_value_name" options="credit_category_ds" returnField="credit_limit_category" valueField="code_value"/> <a:field name="credit_class_desc" displayField="code_value_name" options="credit_class_ds" returnField="credit_class" valueField="code_value"/> <a:field name="credit_limit_type_desc" displayField="code_value_name" options="credit_limit_type_ds" required="true" returnField="credit_limit_type" valueField="code_value"/> <a:field name="bp_id"/> <a:field name="bp_id_desc" lovGridHeight="350" lovHeight="510" lovLabelWidth="90" lovService="basic.hls_bp_master_v_all_lov?bp_category=FUNDS_SIDE" lovWidth="580" title="融资对象"> <a:mapping> <a:map from="bp_id" to="bp_id"/> <a:map from="bp_name" to="bp_id_desc"/> </a:mapping> </a:field> <a:field name="bank_branch_name" lovGridHeight="350" lovHeight="510" lovLabelWidth="90" lovService="tre.tre501.tre501_bank_branch_name_lov" lovWidth="580" title="HLS.BANK_BRANCH_NAME"> <a:mapping> <a:map from="bp_id" to="bp_id"/> <a:map from="bp_name" to="bank_branch_name"/> </a:mapping> </a:field> <a:field name="currency_name" lovAutoQuery="true" lovGridHeight="250" lovHeight="400" lovService="gld.gld_currency_lov" lovWidth="600"> <a:mapping> <a:map from="currency_name" to="currency_name"/> <a:map from="currency_code" to="currency"/> </a:mapping> </a:field> <a:field name="credit_amount" required="true"/> <a:field name="available_amount"/> <a:field name="credit_date_from" required="true" validator="dateValidator"/> <a:field name="credit_date_to" required="true" validator="dateValidator"/> </a:fields> <a:events> <a:event name="update" handler="on_bank_credit_contract_update"/> <a:event name="submitsuccess" handler="on_bank_credit_contract_submitsuccess"/> <a:event name="submitfailed" handler="on_bank_credit_contract_submitfailed"/> </a:events> </a:dataSet> </a:dataSets> <a:screenBody> <a:screenTopToolbar> <a:screenTitle/> <a:gridButton click="tre501_manage_add" text="HLS.NEW"/> <a:gridButton click="tre501_manage_save" text="HLS.SAVE"/> <a:gridButton click="tre501_manage_clear" text="HLS.CLEAR"/> <a:gridButton click="tre501_manage_query" text="HLS.QUERY"/> <a:gridButton click="tre501_manage_reset" text="重置"/> <a:gridButton click="tre501_manage_excel" text="导出"/> <!-- <a:gridButton click="tre501_manage_query" text="HLS.QUERY"/> <a:gridButton click="tre501_manage_add" text="HLS.NEW"/> <a:gridButton click="tre501_manage_clear" text="HLS.CLEAR"/> <a:gridButton click="tre501_manage_save" text="HLS.SAVE"/> --> <!-- <a:gridButton text="TRE501.RESET_CREDIT"/> --> </a:screenTopToolbar> <a:form column="2" labelWidth="150" marginWidth="100" title="HLS.QUERY_TITLE"> <!-- <a:comboBox name="credit_class_desc" bindTarget="bank_credit_contract_query_ds" prompt="授信种类"/> --> <a:comboBox name="credit_limit_type_desc" bindTarget="bank_credit_contract_query_ds" prompt="授信额度类型"/> <!-- <a:lov name="bank_full_name" bindTarget="bank_credit_contract_query_ds" prompt="授信总行"/> --> <!-- <a:lov name="bank_branch_name" bindTarget="bank_credit_contract_query_ds" prompt="借款机构"/> --> <a:textField name="credit_contract_number" bindTarget="bank_credit_contract_query_ds" prompt="TRE501.TRE_BANK_CREDIT_CONTRACT.CREDIT_CONTRACT_NUMBER"/> <!-- <a:lov name="currency_name" bindTarget="bank_credit_contract_query_ds" prompt="TRE501.TRE_BANK_CREDIT_CONTRACT.CURRENCY"/> --> <a:datePicker name="credit_date_from" bindTarget="bank_credit_contract_query_ds" prompt="授信期限从"/> <a:datePicker name="credit_date_to" bindTarget="bank_credit_contract_query_ds" prompt="授信期限到"/> </a:form> <a:grid id="bccd_grid" bindTarget="bank_credit_contract_ds" marginHeight="200" marginWidth="100" navBar="true"> <a:columns> <!-- <a:column name="credit_limit_category_desc" editor="bccd_grid_cb" prompt="授信类别"/> --> <!-- <a:column name="credit_class_desc" editor="bccd_grid_cb" prompt="授信类型"/> --> <a:column name="credit_limit_type_desc" editor="bccd_grid_cb" prompt="授信额度类型"/> <a:column name="bp_id_desc" editor="bccd_grid_lov" prompt="融资对象" width="200"/> <!-- <a:column name="bank_full_name" prompt="授信总行" width="120"/> --> <!-- <a:column name="bank_branch_name" editor="bccd_grid_lov" prompt="借款机构" width="150"/> --> <a:column name="credit_contract_number" editor="bccd_grid_tf" prompt="授信合同号"/> <a:column name="credit_amount" align="right" editor="bccd_grid_nf" prompt="授信额度" renderer="Leaf.formatMoney"/> <a:column name="available_amount" align="right" prompt="可用额度" renderer="Leaf.formatMoney"/> <a:column align="center" forExport="false" prompt="明细" renderer="viewDetails"/> <!-- <a:column name="currency_name" editor="bccd_grid_lov" prompt="TRE501.TRE_BANK_CREDIT_CONTRACT.CURRENCY"/> --> <a:column name="credit_date_from" editor="bccd_grid_dp" prompt="授信期限从" renderer="Leaf.formatDate"/> <a:column name="credit_date_to" editor="bccd_grid_dp" prompt="授信期限到" renderer="Leaf.formatDate"/> <!-- <a:column name="business_term_desc" align="center" editor="bccd_grid_cb" prompt="业务期限" width="100"/> --> <!-- <a:column name="purpose_desc" align="center" editor="bccd_grid_cb" prompt="用途" width="100"/> --> <!-- <a:column name="director_resolution_desc" editor="bccd_grid_cb" prompt="董事会决议是否出具决议" width="170"/> --> <a:column name="notes" editor="bccd_grid_tf" prompt="备注" width="200"/> </a:columns> <a:editors> <a:comboBox id="bccd_grid_cb"/> <a:lov id="bccd_grid_lov"/> <a:textField id="bccd_grid_tf"/> <a:numberField id="bccd_grid_nf" allowFormat="true" allowNegative="false"/> <a:datePicker id="bccd_grid_dp"/> </a:editors> </a:grid> </a:screenBody> </a:view> </a:screen>