<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-8-13 上午10:30:25  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
    <a:init-procedure><![CDATA[
       
    ]]></a:init-procedure>
    <a:view>
        <a:link id="pageLink_nanshan_all_layout" url="${/request/@context_path}/modules/nanshan_all_layout.lview"/>
        <a:link id="query_calDs_link" model="cont.CON110.con_dayend_floating_rate" modelaction="update"/>
        <!-- <a:link id="con_contract_update_link_id" url="${/request/@context_path}/modules/cont/CON500/con_contract_update.lview"/> -->
        <a:link id="con_contract_update_link_id" url="${/request/@context_path}/modules/cont/CON501N/con_contract_modify.lview"/>
        <a:link id="con_contract_interest_float_link" url="${/request/@context_path}/modules/cont/CON110/con_contract_change_info.lview"/>
        <!-- <a:link id="con_contract_update_print_detail_link_id" url="${/request/@context_path}/modules/cont/CON505/con_contract_update_print_detail.lview"/> -->
        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
            function con501_con_contract_return() {
                history.go(-1);
            }
            
            function con501_con_contract_query() {
                $('con501_contract_result_ds').query();
            }
            
            function con501_con_contract_reset() {
                $('con501_contract_query_ds').reset();
            }
            
            function lock_list_window() {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
            }
            
            function unlock_list_window() {
                Leaf.Masker.unmask(Ext.getBody());
            }
            
            
            //
            
            function con110_contractRenderer(value, record, name) {
                var contract_id = record.get('contract_id');
                if (name == 'contract_number') {
                    return '<a href="javascript:con110_contractMaintainDs_grid_update(' + contract_id + ');">' + value + '</a>';
                }
            }
            
            function con110_contractMaintainDs_grid_update(contract_id) {
            
               }
            
            
            
            
            function con501_con_contract_cal() {
            
                var record = $('con501_contract_result_ds').getCurrentRecord();
               Leaf.showConfirm('', '确定计算?', function okFun() {
                    Leaf.request({
                        url: $('query_calDs_link').getUrl(),
                        para: {
                            contract_id: record.get('contract_id'),
                            calc_date: record.get('flt_next_adj_date')
                        },
                        success: function(args) {
                            // $('con501_contract_result_ds').query();
                            Leaf.Masker.unmask(Ext.getBody());
                          if(args.result.change_req_id){
                            var param = record.data;
                            param['contract_id'] = record.get('contract_id');
                            param['document_id'] = record.get('contract_id');
                            param['change_req_id'] = args.result.change_req_id;
                            param['function_code'] = 'CON110'; //
                            param['function_usage'] = 'QUERY';
                            param['maintain_type'] = 'UPDATE';
                            param['url_title'] = '调息现金流对比';
                            hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'pageLink_nanshan_all_layout', 'con731contract_result_ds');
                            }
                        },
                        scope: this,
                        sync: true
                    });
               });
            
            }
          
            function con505_render_contractMaintainDs_grid(value, record, name) {
                if (name == 'contract_number') {
                    return '<a href="javascript:con505_contractMaintainDs_grid_update(' + record.id + ');">' + value + '</a>';
                }
            }
            
            function con505_contractMaintainDs_grid_update(id) {
                var current_record = $('con501_contract_result_ds').findById(id);
                var param = current_record.data;
                param['document_id'] = current_record.get('contract_id');
                con505_param_set_value(param);
            }
            
            function con505_param_set_value(param) {
                param['function_code'] = 'CON301';
                param['function_usage'] = 'QUERY';
                param['maintain_type'] = 'READONLY';
                param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
                hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_update_link_id');
            }
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
        <a:screen-include screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=CONTRACT&amp;function_code=CON505"/>
        <a:dataSets>
            <a:dataSet id="con501_employee_name_of_manager_ds">
                <a:datas dataSource="/model/con501_exp_org_unit_manager_path"/>
            </a:dataSet>
            <a:dataSet id="con501_unit_name_ds" loadData="true" model="basic.exp_org_unit_name_lov"/>
            <a:dataSet id="con501_lease_organization_name_ds" loadData="true" model="basic.hls_lease_organization_for_lov"/>
            <a:dataSet id="con501_division_name_ds" loadData="true" model="basic.hls_division_for_lov"/>
            <a:dataSet id="con501_lease_channel_name_ds" loadData="true" model="basic.hls_lease_channel_for_lov"/>
            <a:dataSet id="con501_status_name_ds" lookupCode="CON500_CONTRACT_STATUS"/>
            <a:dataSet id="con501_wfl_status_name_ds" lookupCode="CON500_MDY_STATUS"/>
            <a:dataSet id="con501_document_type_name_ds">
                <a:datas dataSource="/model/con501_document_type_path"/>
            </a:dataSet>
            <a:dataSet id="con501_business_type_ds">
                <a:datas dataSource="/model/con501_business_type_list"/>
            </a:dataSet>
            <a:dataSet id="con501_contract_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="contract_status_cancel" defaultValue="CANCEL"/>
                    <a:field name="bp_code" autoComplete="true" lovGridHeight="350" lovHeight="500" lovService="basic.hls_bp_master_v_for_lov?bp_category=TENANT" lovWidth="500" title="HLS.BP_TITLE">
                        <a:mapping>
                            <a:map from="bp_code" to="bp_code"/>
                            <a:map from="bp_id" to="bp_id_tenant"/>
                            <a:map from="bp_name" to="bp_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id_tenant"/>
                    <a:field name="project_number" autoComplete="true" lovGridHeight="300" lovHeight="450" lovService="prj.PRJ501.prj_project_for_lov" lovWidth="500" title="HLS.PROJECT_NUMBER">
                        <a:mapping>
                            <a:map from="project_number" to="project_number"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="project_employee_name" autoComplete="true" lovGridHeight="300" lovHeight="450" lovService="basic.hls_exp_employees_for_lov?sales_flag=Y" lovWidth="500" title="HLS.SALES_EMPLOYEE">
                        <a:mapping>
                            <a:map from="name" to="project_employee_name"/>
                            <a:map from="employee_id" to="employee_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="contract_number" autoComplete="true" lovGridHeight="300" lovHeight="450" lovService="cont.CON500.con_contract_number_lov" lovWidth="500" title="HLS.CONTRACT_NUMBER">
                        <a:mapping>
                            <a:map from="contract_number" to="contract_number"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="employee_id"/>
                    <a:field name="employee_name_of_manager" displayField="mgr_employee_name" options="con501_employee_name_of_manager_ds" returnField="employee_id_of_manager" valueField="mgr_employee_id"/>
                    <a:field name="unit_name" displayField="unit_name" options="con501_unit_name_ds" returnField="unit_id" valueField="unit_id"/>
                    <a:field name="lease_organization_name" displayField="description" options="con501_lease_organization_name_ds" returnField="lease_organization" valueField="lease_organization"/>
                    <a:field name="division_desc" displayField="description" options="con501_division_name_ds" returnField="division" valueField="division"/>
                    <a:field name="lease_channel_desc" displayField="description" options="con501_lease_channel_name_ds" returnField="lease_channel" valueField="lease_channel"/>
                    <a:field name="document_type_desc" displayField="description" options="con501_document_type_name_ds" returnField="document_type" valueField="document_type"/>
                    <a:field name="business_type_desc" displayField="business_type_desc" options="con501_business_type_ds" returnField="business_type" valueField="business_type"/>
                    <a:field name="contract_status_desc" displayField="code_value_name" options="con501_status_name_ds" readOnly="true" returnField="contract_status" valueField="code_value"/>
                    <a:field name="contract_status"/>
                    <a:field name="con_mdy_status_desc" displayField="code_value_name" options="con501_wfl_status_name_ds" returnField="con_mdy_status" valueField="code_value"/>
                    <a:field name="con_mdy_status"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="con501_contract_result_ds" autoPageSize="true" autoQuery="true" model="cont.CON110.con_contract_query" queryDataSet="con501_contract_query_ds" queryUrl="${/request/@context_path}/autocrud/cont.CON110.con_contract_query/query" selectable="true" selectionModel="single">
                <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="con501_con_contract_query" text="HLS.QUERY"/>
                <a:gridButton click="con501_con_contract_reset" text="HLS.RESET"/>
                <a:gridButton click="con501_con_contract_return" text="HLS.RETURN"/>
                <a:gridButton click="con501_con_contract_cal" text="调息"/>
            </a:screenTopToolbar>
            <a:form column="4" labelSeparator=" " labelWidth="100" marginWidth="30" title="CON301.CONTRACT_QUERY">
                <a:lov name="bp_code" bindTarget="con501_contract_query_ds" prompt="HLS.TENANT_CODE"><![CDATA[
                ]]></a:lov>
                <a:textField name="bp_name" bindTarget="con501_contract_query_ds" prompt="HLS.TENANT_NAME"/>
                <a:datePicker name="lease_start_date_from" bindTarget="con501_contract_query_ds" prompt="HLS.LEASE_START_DATE_FROM"/>
                <a:datePicker name="lease_start_date_to" bindTarget="con501_contract_query_ds" prompt="HLS.LEASE_START_DATE_TO"/>
                <a:lov name="project_number" bindTarget="con501_contract_query_ds" prompt="HLS.PROJECT_NUMBER"><![CDATA[
                ]]></a:lov>
                <a:textField name="project_name" bindTarget="con501_contract_query_ds" prompt="HLS.PROJECT_NAME"/>
                <a:lov name="project_employee_name" bindTarget="con501_contract_query_ds" prompt="HLS.SALES_EMPLOYEE"/>
                <a:comboBox name="lease_organization_name" bindTarget="con501_contract_query_ds" prompt="HLS.LEASE_ORGANIZATION"/>
                <a:lov name="contract_number" bindTarget="con501_contract_query_ds" prompt="HLS.CONTRACT_NUMBER"><![CDATA[
                ]]></a:lov>
                <a:textField name="contract_name" bindTarget="con501_contract_query_ds" prompt="HLS.CONTRACT_NAME"/>
                <a:comboBox name="employee_name_of_manager" bindTarget="con501_contract_query_ds" prompt="HLS.EMPLOYEE_OF_MANAGER"/>
                <!-- <a:comboBox name="lease_channel_desc" bindTarget="con501_contract_query_ds" prompt="HLS.LEASE_CHANNEL_NAME"/> -->
                <a:comboBox name="con_mdy_status_desc" bindTarget="con501_contract_query_ds" prompt="审批状态"/>
                <a:textField name="prj_search_term_1" bindTarget="con501_contract_query_ds" prompt="CON301.CON_CONTRACT_V.PRJ_SEARCH_TERM_1"/>
                <a:textField name="prj_search_term_2" bindTarget="con501_contract_query_ds" prompt="CON301.CON_CONTRACT_V.PRJ_SEARCH_TERM_2"/>
                <!-- <a:comboBox name="division_desc" bindTarget="con501_contract_query_ds" prompt="HLS.DIVISION_NAME"/> -->
                <a:textField name="con_search_term_1" bindTarget="con501_contract_query_ds" prompt="CON301.CON_CONTRACT_V.CON_SEARCH_TERM_1"/>
                <a:textField name="con_search_term_2" bindTarget="con501_contract_query_ds" prompt="CON301.CON_CONTRACT_V.CON_SEARCH_TERM_2"/>
                <!-- <a:comboBox name="document_type_desc" bindTarget="con501_contract_query_ds" prompt="HLS.CONTRACT_TYPE"/>
                <a:comboBox name="business_type_desc" bindTarget="con501_contract_query_ds" prompt="HLS.BUSINESS_TYPE_DESC"/>-->
            </a:form>
            <a:grid id="con501_con_contract_grid_ds" bindTarget="con501_contract_result_ds" marginHeight="265" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="contract_number" lock="true" prompt="HLS.CONTRACT_NUMBER" renderer="con505_render_contractMaintainDs_grid" width="160"/>
                    <!-- <a:column name="flt_next_adj_date" editor="date_edt" prompt="计算日期" renderer="Leaf.formatDate" width="120"/> -->
                    <a:column name="contract_name" prompt="HLS.CONTRACT_NAME" width="200"/>
                    <a:column name="lease_start_date" prompt="HLS.LEASE_START_DATE" renderer="Leaf.formatDate" width="80"/>
                    <a:column name="bp_name" prompt="HLS.TENANT_NAME" width="200"/>
                    <a:column name="project_number" prompt="HLS.PROJECT_NUMBER"/>
                    <a:column name="project_name" prompt="HLS.PROJECT_NAME" width="200"/>
                    <a:column name="employee_name" prompt="HLS.SALES_EMPLOYEE" width="70"/>
                    <a:column name="employee_name_of_manager" prompt="HLS.EMPLOYEE_OF_MANAGER" width="70"/>
                    <a:column name="lease_organization_desc" prompt="HLS.LEASE_ORGANIZATION"/>
                    <a:column name="lease_channel_desc" prompt="HLS.LEASE_CHANNEL_NAME" width="70"/>
                    <a:column name="document_type_desc" prompt="HLS.CONTRACT_TYPE" width="90"/>
                    <a:column name="req_status_desc" prompt="审批状态" width="60"/>
                    <a:column name="contract_status_desc" prompt="合同状态" width="60"/>
                </a:columns>
                <a:editors>
                    <a:datePicker id="date_edt"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
