<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hand  
    $Date: 2013-1-9 下午02:01:53  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="mortgage_create_link" url="${/request/@context_path}/modules/hls/HLS209/hls_mortgage_create.lview"/>
        <a:link id="mortgage_maintain_link" url="${/request/@context_path}/modules/hls/HLS209/hls_mortgage_maintain.lview"/>
        <script type="text/javascript"><![CDATA[
        	function hls_hls209_query() {
                $('hls_mortgage_result_ds').query();
            }
            
            function hls_hls209_reset() {
                $('hls_mortgage_query_ds').reset();
            }
            
            function hls_hls209_next() {
                history.go(1);
            }
            
            function hls_hls209_back() {
                history.go(-1);
            }
        
        	function hls_hls209_add() {
                var url = $('mortgage_create_link').getUrl();
                new Leaf.Window({
                    url: url,
                    title: '${l:HLS209.WIN.MORTGAGE_CREATE}',
                    id: 'hls_mortgage_create_winId',
                    width: 1000,
                    height: 540,
                    fullScreen:true
                });
            }
            
            function hls_hls209_clear() {
                $('hls_mortgage_grid_id').remove();
            }
            
            function mortgageCodeRender(value,record,name){
                return '<a href="javascript:openMortgageMaintain('+record.get('mortgage_id')+');">'+value+'</a>';
            }
            function openMortgageMaintain(mid){
                var url = $('mortgage_maintain_link').getUrl();
                new Leaf.Window({
                    url: url+'?mortgage_id='+mid,
                    title: '${l:HLS209.WIN.MORTGAGE_MAINTAIN}',
                    id: 'hls_mortgage_maintain_winId',
                    width: 1000,
                    height: 540,
                    fullScreen:true
                });
            }
            function mortgageQueryDsUpdate(ds, record, name, value, oldvalue){
                var field;
                if(name=='mortgage_type'){
                    field = record.getField('mortgage_ast_classfication_desc');
                    if(value=='MORTGAGE'){
                        field.setOptions('asset_mortgage_ds');
                    }else{
                        field.setOptions('asset_pledge_ds');
                    }
                }else if(name=='mortgage_ast_classfication'){
                    field = record.getField('mortgage_asset_detail_desc');
                    //field.setReadOnly(false);
                    if(value=='RIGHT_P'){
                        field.setOptions('asset_detail_right_p_ds');
                    }else if(value=='MOVABLE_PROPERTY_M'){
                        field.setOptions('asset_detail_movable_property_m_ds');
                    }else if(value=='IMMOVABLE_PROPERTY_M'){
                        field.setOptions('asset_detail_immovable_property_m_ds');
                    }else{
                        //field.setReadOnly(true);
                    }
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="mortgage_type_ds" lookupCode="HLS209_MORTGAGE_TYPE"/>
            <a:dataSet id="asset_mortgage_ds" lookupCode="HLS209_ASSET_MORTGAGE"/>
            <a:dataSet id="asset_pledge_ds" lookupCode="HLS209_ASSET_PLEDGE"/>
            <a:dataSet id="asset_detail_right_p_ds" lookupCode="HLS209_ASSET_DETAIL_RIGHT_P"/>
            <a:dataSet id="asset_detail_movable_property_m_ds" lookupCode="HLS209_ASSET_DETAIL_MOVABLE_PROPERTY_M"/>
            <a:dataSet id="asset_detail_immovable_property_m_ds" lookupCode="HLS209_ASSET_DETAIL_IMMOVABLE_PROPERTY_M"/>
            <a:dataSet id="mortgage_status_ds" lookupCode="HLS209_MORTGAGE_STATUS"/>
            <a:dataSet id="hls_mortgage_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="mortgage_type_desc" displayField="code_value_name" options="mortgage_type_ds" returnField="mortgage_type" valueField="code_value"/>
                    <a:field name="mortgage_ast_classfication_desc" displayField="code_value_name" options="asset_mortgage_ds" returnField="mortgage_ast_classfication" valueField="code_value"><![CDATA[
                    ]]></a:field>
                    <a:field name="mortgage_asset_detail_desc" displayField="code_value_name" options="asset_detail_right_p_ds" returnField="mortgage_asset_detail" valueField="code_value"/>
                    <a:field name="project_id"/>
                    <a:field name="project_number" lovGridHeight="300" lovHeight="450" lovService="prj.PRJ501.prj_project_for_lov" lovWidth="600">
                        <a:mapping>
                            <a:map from="project_id" to="project_id"/>
                            <a:map from="project_number" to="project_number"/>
                            <a:map from="project_name" to="project_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id_mortgagor"/>
                    <a:field name="mortgagor_name" fetchRemote="false" lovGridHeight="300" lovHeight="450" lovService="basic.hls_bp_master_v_for_lov?bp_category=PLEDGER" lovWidth="600" title="HLS209.MORTGAGER_QUERY">
                        <a:mapping>
                            <a:map from="bp_name" to="mortgagor_name"/>
                            <a:map from="bp_id" to="bp_id_mortgagor"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id_evaluator"/>
                    <a:field name="evaluator_name" fetchRemote="false" lovGridHeight="300" lovHeight="450" lovService="basic.hls_bp_master_v_for_lov?bp_category=EVALUATOR" lovWidth="600" title="HLS209.EVALUATOR_QUERY">
                        <a:mapping>
                            <a:map from="bp_name" to="evaluator_name"/>
                            <a:map from="bp_id" to="bp_id_evaluator"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="mortgageQueryDsUpdate"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="hls_mortgage_result_ds" autoQuery="true" model="hls.HLS209.hls_mortgage" queryDataSet="hls_mortgage_query_ds" selectable="true">
                <a:fields>
                    <a:field name="mortgage_type_desc" displayField="code_value_name" options="mortgage_type_ds" returnField="mortgage_type" valueField="code_value"/>
                    <a:field name="mortgage_ast_classfication_desc" displayField="code_value_name" options="asset_mortgage_ds" returnField="mortgage_ast_classfication" valueField="code_value"/>
                    <a:field name="mortgage_asset_detail_desc" displayField="code_value_name" options="asset_detail_right_p_ds" returnField="mortgage_asset_detail" valueField="code_value"/>
                    <a:field name="mortgage_status_desc" displayField="code_value_name" options="mortgage_status_ds" returnField="mortgage_status" valueField="code_value"/>
                    <a:field name="enabled_flag" checkedValue="Y" readOnly="true" uncheckedValue="N"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="hls_hls209_back" text="HLS.BACK"/>
                <a:gridButton click="hls_hls209_next" text="HLS.FORWARD"/>
                <a:gridButton click="hls_hls209_add" text="HLS.NEW"/>
                <a:gridButton click="hls_hls209_clear" text="HLS.CLEAR"/>
                <a:gridButton click="hls_hls209_query" text="HLS.QUERY"/>
                <a:gridButton click="hls_hls209_reset" text="HLS.RESET"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="200" title="HLS.QUERY_TITLE" width="1100">
                <a:textField name="mortgage_code" bindTarget="hls_mortgage_query_ds" prompt="HLS_MORTGAGE.MORTGAGE_CODE"/>
                <a:textField name="mortgage_name" bindTarget="hls_mortgage_query_ds" prompt="HLS_MORTGAGE.MORTGAGE_NAME"/>
                <a:comboBox name="mortgage_type_desc" bindTarget="hls_mortgage_query_ds" prompt="HLS_MORTGAGE.MORTGAGE_TYPE"/>
                <a:comboBox name="mortgage_ast_classfication_desc" bindTarget="hls_mortgage_query_ds" prompt="HLS_MORTGAGE.MORTGAGE_AST_CLASSFICATION"/>
                <a:comboBox name="mortgage_asset_detail_desc" bindTarget="hls_mortgage_query_ds" prompt="HLS_MORTGAGE.MORTGAGE_ASSET_DETAIL"/>
                <a:textField name="mortgage_contract_no" bindTarget="hls_mortgage_query_ds" prompt="HLS_MORTGAGE.MORTGAGE_CONTRACT_NO"/>
                <a:lov name="project_number" bindTarget="hls_mortgage_query_ds" prompt="HLS_MORTGAGE.PROJECT_ID"/>
                <a:textField name="mortgage_register_no" bindTarget="hls_mortgage_query_ds" prompt="HLS_MORTGAGE.MORTGAGE_REGISTER_NO"/>
                <a:lov name="mortgagor_name" bindTarget="hls_mortgage_query_ds" prompt="HLS_MORTGAGE.BP_ID_MORTGAGOR"/>
                <a:lov name="evaluator_name" bindTarget="hls_mortgage_query_ds" prompt="HLS_MORTGAGE.BP_ID_EVALUATOR"/>
            </a:form>
            <a:grid id="hls_mortgage_grid_id" bindTarget="hls_mortgage_result_ds" height="400" navBar="true" width="1100">
                <a:columns>
                    <a:column name="mortgage_code" prompt="HLS_MORTGAGE.MORTGAGE_CODE" renderer="mortgageCodeRender"/>
                    <a:column name="mortgage_name" prompt="HLS_MORTGAGE.MORTGAGE_NAME"/>
                    <a:column name="mortgage_type_desc" prompt="HLS_MORTGAGE.MORTGAGE_TYPE"/>
                    <a:column name="mortgage_ast_classfication_desc" prompt="HLS_MORTGAGE.MORTGAGE_AST_CLASSFICATION"/>
                    <a:column name="mortgage_asset_detail_desc" prompt="HLS_MORTGAGE.MORTGAGE_ASSET_TYPE"/>
                    <a:column name="mortgage_contract_no" prompt="HLS_MORTGAGE.MORTGAGE_CONTRACT_NO"/>
                    <a:column name="project_number" prompt="HLS_MORTGAGE.PROJECT_ID"/>
                    <a:column name="mortgage_register_no" prompt="HLS_MORTGAGE.MORTGAGE_REGISTER_NO"/>
                    <a:column name="mortgagor_name" prompt="HLS_MORTGAGE.BP_ID_MORTGAGOR"/>
                    <a:column name="mortgage_status_desc" prompt="HLS_MORTGAGE.MORTGAGE_STATUS"/>
                    <a:column name="enabled_flag" editor="mortgage_grid_cb" prompt="HLS_MORTGAGE.ENABLED_FLAG"/>
                </a:columns>
                <a:editors>
                    <a:checkBox id="mortgage_grid_cb" checkedValue="Y" uncheckedValue="N"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>