<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangyu  
    $Date: 2015-6-18 下午16:48:09  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="pageLink_bpCreditScreen_welcome" url="${/request/@context_path}/welcome.lview"/>
        <a:link id="hls219_bp_grant_credit_line_link" url="${/request/@context_path}/modules/hls/HLS219/hls_bp_master_grant_credit_line.lview"/>
        <script type="text/javascript"><![CDATA[
            function bpCreditScreen_query() {
                $('hls219_bp_credit_head_ds').query();
            }
            function bpCreditScreen_reset(){
                $('hls219_bp_credit_line_ds').reset();
            }
            function bpCreditScreen_credit(){
                
            }
            function bpCreditScreen_quit() {
                window.location.href = $('pageLink_bpCreditScreen_welcome').getUrl();
            }
            
            function bpCreditScreen_save(){
                $('hls219_bp_credit_head_ds').submit();
            }
            
            function openEditPage(credit_id){
                new Leaf.Window({
                    id: 'hls219_bp_grant_credit_line_window',
                    url: $('hls219_bp_grant_credit_line_link').getUrl(),
                    width:730,
                    height:400,
                    params:{
                    	credit_id : credit_id
                    },
                    title: '授信明细'
                }).on('close',bpCreditScreen_query);
            }
            
            function edit_details_link(value,record, name){
                if(record.isNew){
                    return '';
                }else{
                    return '<a href="javascript:openEditPage('+record.get('credit_id')+')">授信明细</a>';
                }
            }
            
            function edit_fun(record,name){
                if(record.isNew){
                    if(name == 'bp_code'){
                        return 'editor_lov';
                    }else if(name === 'credit_class_desc'){
                        return 'editor_combobox';
                    }
                }
				return '';
            }
		]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=BP"/>
        <a:dataSets>
            <a:dataSet id="hls219_enabled_flag_ds" lookupCode="YES_NO"/>
            <a:dataSet id="credit_class_ds" lookupCode="TRE501_CREDIT_LIMIT_TYPE"/>
            <a:dataSet id="hls219_bp_credit_line_ds">
                <a:fields>
                    <a:field name="bp_name" lovGridHeight="350" lovHeight="500" lovService="basic.hls_bp_master_v_for_lov" lovWidth="500" title="HLS.BP_TITLE">
                        <a:mapping>
                            <a:map from="bp_code" to="bp_code"/>
                            <a:map from="bp_id" to="bp_id"/>
                            <a:map from="bp_name" to="bp_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="enabled_flag_desc" displayField="code_value_name" options="hls219_enabled_flag_ds" returnField="enabled_flag" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls219_bp_credit_head_ds" autoPageSize="true" autoQuery="true" model="hls.HLS219.hls_bp_master_credit" queryDataSet="hls219_bp_credit_line_ds" selectable="true" selectionModel="single" submitUrl="${/request/@context_path}/autocrud/hls.HLS219.hls_bp_master_credit_save/batch_update">
                <a:fields>
                    <a:field name="bp_code" lovGridHeight="350" lovHeight="500" lovService="basic.hls_bp_master_v_for_lov" lovWidth="500" required="true" title="HLS.BP_TITLE">
                        <a:mapping>
                            <a:map from="bp_code" to="bp_code"/>
                            <a:map from="bp_id" to="bp_id"/>
                            <a:map from="bp_name" to="bp_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id"/>
                    <a:field name="credit_class" required="true"/>
                    <a:field name="credit_class_desc" displayField="code_value_name" options="credit_class_ds" required="true" returnField="credit_class" valueField="code_value"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="query" handler="aut_authority_list_validate_query"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="bpCreditScreen_query" text="HLS.QUERY"/>
                <a:gridButton click="bpCreditScreen_reset" text="HLS.RESET"/>
                <a:gridButton bind="hls219_bp_credit_list_grid" type="add"/>
                <a:gridButton bind="hls219_bp_credit_list_grid" type="clear"/>
                <a:gridButton bind="hls219_bp_credit_list_grid" type="save"/>
                <!-- <a:gridButton click="bpCreditScreen_credit" text="授信"/> -->
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="120" marginWidth="30" title="HLS.QUERY_TITLE">
                <a:lov name="bp_name" bindTarget="hls219_bp_credit_line_ds" prompt="商业伙伴名称">
                    <a:events>
                        <a:event name="focus" handler="function(object){on_std_focus(object,&apos;BP&apos;)}"/>
                    </a:events>
                </a:lov>
                <a:comboBox name="enabled_flag_desc" bindTarget="hls219_bp_credit_line_ds" prompt="是否启用"/>
                <a:textField name="inflow_line_from" bindTarget="hls219_bp_credit_line_ds" prompt="授信总额度从"/>
                <a:textField name="inflow_line_to" bindTarget="hls219_bp_credit_line_ds" prompt="授信总额度到"/>
                <a:textField name="warn_low_line_from" bindTarget="hls219_bp_credit_line_ds" prompt="授信最低警戒线从"/>
                <a:textField name="warn_low_line_to" bindTarget="hls219_bp_credit_line_ds" prompt="授信最低警戒线到"/>
                <a:textField name="warn_high_line_from" bindTarget="hls219_bp_credit_line_ds" prompt="授信最高警戒线从"/>
                <a:textField name="warn_high_line_to" bindTarget="hls219_bp_credit_line_ds" prompt="授信最高警戒线到"/>
                <a:textField name="available_line_from" bindTarget="hls219_bp_credit_line_ds" prompt="可用额度从"/>
                <a:textField name="available_line_to" bindTarget="hls219_bp_credit_line_ds" prompt="可用额度到"/>
                <a:textField name="advance_line_from" bindTarget="hls219_bp_credit_line_ds" prompt="预占用额度从"/>
                <a:textField name="advance_line_to" bindTarget="hls219_bp_credit_line_ds" prompt="预占用额度到"/>
                <a:textField name="used_line_from" bindTarget="hls219_bp_credit_line_ds" prompt="已使用额度从"/>
                <a:textField name="used_line_to" bindTarget="hls219_bp_credit_line_ds" prompt="已使用额度到"/>
                <a:textField name="take_back_line_from" bindTarget="hls219_bp_credit_line_ds" prompt="已收回额度从"/>
                <a:textField name="take_back_line_to" bindTarget="hls219_bp_credit_line_ds" prompt="已收回额度到"/>
            </a:form>
            <a:grid id="hls219_bp_credit_list_grid" bindTarget="hls219_bp_credit_head_ds" marginHeight="230" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="bp_code" align="left" editorFunction="edit_fun" lock="true" prompt="商业伙伴代码" width="100"/>
                    <a:column name="bp_name" align="left" lock="true" prompt="商业伙伴名称" showTitle="true" width="180"/>
                    <a:column name="credit_class_desc" align="center" editorFunction="edit_fun" prompt="授信分类" width="80"/>
                    <a:column name="edit_details" align="center" prompt="授信明细" renderer="edit_details_link" width="80"/>
                    <a:column name="inflow_line" align="right" prompt="授信总额度" renderer="Leaf.formatMoney" width="140"/>
                    <a:column name="available_line" align="right" prompt="当前可用额度" renderer="Leaf.formatMoney" width="140"/>
                    <a:column name="advance_line" align="right" prompt="预占用额度" renderer="Leaf.formatMoney" width="140"/>
                    <a:column name="used_line" align="right" prompt="已使用额度" renderer="Leaf.formatMoney" width="140"/>
                    <a:column name="take_back_line" align="right" prompt="已收回额度" renderer="Leaf.formatMoney" width="140"/>
                    <a:column name="warn_low_line" align="right" editor="editor_tf" prompt="授信最低警戒线" renderer="Leaf.formatMoney" width="140"/>
                    <a:column name="warn_high_line" align="right" editor="editor_tf" prompt="授信最高警戒线" renderer="Leaf.formatMoney" width="140"/>
                    <a:column name="enabled_flag" align="center" editor="editor_cb" prompt="启用" width="60"/>
                    <a:column name="description" align="left" editor="editor_tf" prompt="备注" showTitle="true" width="200"/>
                </a:columns>
                <a:editors>
                    <a:lov id="editor_lov">
                        <a:events>
                            <a:event name="focus" handler="function(object){on_std_focus(object,&apos;BP&apos;)}"/>
                        </a:events>
                    </a:lov>
                    <a:textField id="editor_tf"/>
                    <a:checkBox id="editor_cb"/>
                    <a:comboBox id="editor_combobox"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
