<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2013-10-26 上午10:14:51  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="basic.hls_sys_time_default_value" rootPath="parent_default_value_path"/>
    </a:init-procedure>
    <a:view>
        <a:link id="hls_bp_master_dynamic_update_link_id" url="${/request/@context_path}/modules/hls/HLS213/hls_bp_master_dynamic_update.lview"/>
        <a:link id="hls_bp_master_get_layout_code_link_id" model="hls.HLS213.hls_bp_master_get_layout_code" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
            function hls_hls217_query() {
                $('hls_mortgage_result_ds').query();
            }
            
            function hls_hls217_reset() {
                $('hls_mortgage_query_ds').reset();
            }
            
            
            
            function hls_hls217_next() {
                history.go(1);
            }
            
            function hls_hls217_back() {
                history.go(-1);
            }
            
            
            function winOpen_MortgageModifyScreen(id) {
                var current_record = $('hls_mortgage_result_ds').findById(id);
                var param = current_record.data;
                hls217_param_set_value(param);
            }
            
            function hls_hls217_modify() {
                var record = $('hls_mortgage_result_ds').getCurrentRecord();
                var param = record.data;
                hls217_param_set_value(param);
            }
            
            function hls217_param_set_value(param) {
                param['function_code'] = 'HLS217';
                param['function_usage'] = 'MODIFY';
                param['url_title'] = '${l:HLS209.WIN.MORTGAGE_MAINTAIN}';
                param['master_type'] = 'MORTGAGE';
                param['master_id'] = param['mortgage_id'];
                hls_doc_get_layout_code('hls_bp_master_get_layout_code_link_id', param, 'hls_bp_master_dynamic_update_link_id', 'hls_mortgage_result_ds');
            }
            
            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);
                    }
                }
            }
            
            function mortgageCodeRender(value, record, name) {
                return '<a href="javascript:winOpen_MortgageModifyScreen(' + record.id + ');">' + value + '</a>';
            }
        ]]></script>
        <a:screen-include screen="modules/hls/HLS213/hls_bp_master_get_layout_code.lview"/>
        <a:screen-include screen="modules/cont/CON500/con_contract_authority_list_validate.lview?master_type=MORTGAGE&amp;function_code=HLS217"/>
        <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_n" lovGridHeight="300" lovHeight="450" lovService="hls.HLS309.hls_bp_master_pledger_for_lov" lovWidth="600" title="HLS209.MORTGAGER_QUERY">
                        <a:mapping>
                            <a:map from="bp_name" to="bp_id_mortgagor_n"/>
                            <a:map from="bp_id" to="bp_id_mortgagor"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id_evaluator"/>
                    <a:field name="evaluator_name" 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.HLS217.hls_mortgage" queryDataSet="hls_mortgage_query_ds" selectable="true" selectionModel="single">
                <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: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="hls_hls217_back" text="HLS.BACK"/>
                <a:gridButton click="hls_hls217_next" text="HLS.FORWARD"/>
                <a:gridButton click="hls_hls217_query" text="HLS.QUERY"/>
                <a:gridButton click="hls_hls217_reset" text="HLS.RESET"/>
                <a:gridButton click="hls_hls217_modify" text="HLS.MODIFY"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="120" title="HLS.QUERY_TITLE">
                <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:events>
                        <a:event name="focus" handler="function(object){on_std_focus(object,&apos;PROJECT&apos;)}"/>
                    </a:events>
                </a:lov>
                <a:textField name="mortgage_register_no" bindTarget="hls_mortgage_query_ds" prompt="HLS_MORTGAGE.MORTGAGE_REGISTER_NO"/>
                <a:lov name="bp_id_mortgagor_n" bindTarget="hls_mortgage_query_ds" prompt="HLS_MORTGAGE.BP_ID_MORTGAGOR">
                    <a:events>
                        <a:event name="focus" handler="function(object){on_std_focus(object,&apos;BP&apos;)}"/>
                    </a:events>
                </a:lov>
                <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" marginHeight="220" marginWidth="70" navBar="true">
                <a:columns>
                    <a:column name="mortgage_code" prompt="HLS_MORTGAGE.MORTGAGE_CODE" renderer="mortgageCodeRender"/>
                    <a:column name="mortgage_name" prompt="HLS_MORTGAGE.MORTGAGE_NAME" width="200"/>
                    <a:column name="mortgage_type_desc" prompt="HLS_MORTGAGE.MORTGAGE_TYPE"/>
                    <a:column name="mortgage_ast_class_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="bp_id_mortgagor_n" prompt="HLS_MORTGAGE.BP_ID_MORTGAGOR" width="150"/>
                    <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" width="50"/>
                </a:columns>
                <a:editors>
                    <a:checkBox id="mortgage_grid_cb" checkedValue="Y" uncheckedValue="N"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
