<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hand  
    $Date: 2016-5-13 上午10:52:55  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="problem_flag_update_link" model="cont.CON557.reg_settlement_lv" modelaction="update"/>
        <a:link id="con_settle_list_link" url="${/request/@context_path}/modules/cont/CON557/con_settle_list.lview"/>
        <a:link id="con_application_archive_link" url="${/request/@context_path}/modules/cont/CON558/con_contract_archive.lview"/>
        <a:link id="courier_number_query_link" url="${/request/@context_path}/modules/cont/CON555A/courier_number_query.lview"/>
        <script type="text/javascript"><![CDATA[
            function query_reg_settlement_lv_result_ds() {
                $('reg_settlement_lv_result_ds').query();
            }
            
            function reset_reg_settlement_lv_query_ds() {
                $('reg_settlement_lv_query_ds').reset();
            }
            
            function application_archive() {
                var recodes = $('reg_settlement_lv_result_ds').getSelected();
                if (recodes.length < 1) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请选择合同后进行邮寄操作!');
                    return;
                }
                var invoice_agent = recodes[0].get('invoice_agent');
                var invoice_agent_desc = recodes[0].get('invoice_agent_desc');
                var url = $('con_application_archive_link').getUrl();
                var win = new Leaf.Window({
                    id: 'application_archive_mail_window',
                    url: url,
                    params: {
                        invoice_agent_desc: invoice_agent_desc,
                        invoice_agent : invoice_agent
                    },
                    title: '资料收集',
                    fullScreen: true
                });
                win.on('close', function() {
                    $('reg_settlement_lv_result_ds').query();
                });
            
            }
            
            function mail_query() {
                var url = $('courier_number_query_link').getUrl();
                var win = new Leaf.Window({
                    id: 'courier_number_query_window',
                    url: url,
                    params: {
                        express_type: 'REG'
                    },
                    title: '资料收集',
                    fullScreen: true
                });
            }
            
        ]]></script>
        <a:dataSets>
            <a:dataSet id="archive_status_ds" lookupCode="ARCHIVE_STATUS"/>
            <a:dataSet id="reg_status_ds" lookupCode="REG_STATUS"/>
            <a:dataSet id="contract_status_ds" lookupCode="CONTRACT_STATUS_CON557"/>
            <a:dataSet id="problem_flag_ds" lookupCode="FINISH_FLAG"/>
            <a:dataSet id="reg_settlement_lv_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="contract_number"/>
                    <a:field name="project_number"/>
                    <a:field name="bp_name"/>
                    <a:field name="invoice_agent"/>
                    <a:field name="invoice_agent_n" lovHeight="400" lovService="cont.CON555A.hls_bp_master" lovWidth="600">
                        <a:mapping>
                            <a:map from="bp_id" to="invoice_agent"/>
                            <a:map from="bp_name" to="invoice_agent_n"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="archive_status_n" displayField="code_value_name" options="archive_status_ds" returnField="archive_status" valueField="code_value"/>
                    <a:field name="archive_status"/>
                    <a:field name="reg_status_n" displayField="code_value_name" options="reg_status_ds" returnField="reg_status" valueField="code_value"/>
                    <a:field name="reg_status"/>
                    <a:field name="contract_status"/>
                    <a:field name="contract_status_n" displayField="code_value_name" options="contract_status_ds" returnField="contract_status" valueField="code_value"/>
                    <a:field name="problem_flag"/>
                    <a:field name="problem_flag_n" displayField="code_value_name" options="problem_flag_ds" returnField="problem_flag" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="reg_settlement_lv_result_ds" autoQuery="true" model="cont.CON558.reg_settlement_lv" queryDataSet="reg_settlement_lv_query_ds" selectable="true">
                <a:fields>
                    <a:field name="contract_number"/>
                    <a:field name="project_number"/>
                    <a:field name="contract_id"/>
                    <a:field name="project_id"/>
                    <a:field name="contract_name"/>
                    <a:field name="bp_name"/>
                    <a:field name="business_type"/>
                    <a:field name="business_type_desc"/>
                    <a:field name="invoice_agent"/>
                    <a:field name="invoice_agent_desc"/>
                    <a:field name="division"/>
                    <a:field name="division_desc"/>
                    <a:field name="bp_class_desc"/>
                    <a:field name="contract_status"/>
                    <a:field name="contract_status_n"/>
                    <a:field name="archive_status"/>
                    <a:field name="archive_status_n"/>
                    <a:field name="reg_status"/>
                    <a:field name="reg_status_n"/>
                    <a:field name="docu_number_reg"/>
                    <a:field name="docu_number_archive"/>
                    <a:field name="storage_archive"/>
                    <a:field name="storage_reg"/>
                    <a:field name="problem_flag"/>
                    <a:field name="problem_flag_n"/>
                    <a:field name="express_reg_falg"/>
                    <a:field name="express_reg_falg_n"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="query_reg_settlement_lv_result_ds" text="查询"/>
                <a:gridButton click="reset_reg_settlement_lv_query_ds" text="重置"/>
                <a:gridButton click="application_archive" text="邮寄"/>
                <a:gridButton click="mail_query" text="邮寄查询"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="100" marginWidth="30" title="贷后资料管理查询">
                <a:textField name="contract_number" bindTarget="reg_settlement_lv_query_ds" prompt="合同编号"/>
                <a:textField name="project_number" bindTarget="reg_settlement_lv_query_ds" prompt="项目编号"/>
                <a:textField name="bp_name" bindTarget="reg_settlement_lv_query_ds" prompt="承租人"/>
                <a:textField name="id_card_no" bindTarget="reg_settlement_lv_query_ds" prompt="承租人身份证"/>
                <a:lov name="invoice_agent_n" bindTarget="reg_settlement_lv_query_ds" prompt="经销商"/>
                <a:comboBox name="archive_status_n" bindTarget="reg_settlement_lv_query_ds" prompt="合同归档状态"/>
                <a:comboBox name="reg_status_n" bindTarget="reg_settlement_lv_query_ds" prompt="登记证归档状态"/>
                <a:comboBox name="contract_status_n" bindTarget="reg_settlement_lv_query_ds" prompt="合同状态"/>
                <!--  <a:comboBox name="problem_flag_n" bindTarget="reg_settlement_lv_query_ds" prompt="问题件"/> -->
            </a:form>
            <a:grid id="grid_id" bindTarget="reg_settlement_lv_result_ds" marginHeight="180" marginWidth="30" navBar="true">
                <a:toolBar>
                    <a:button type="excel"/>
                    <!--   <a:button type="clear"/> -->
                </a:toolBar>
                <a:columns>
                    <a:column name="contract_number" prompt="合同编号" width="160"/>
                    <a:column name="project_number" prompt="项目编号" width="100"/>
                    <a:column name="bp_name" prompt="承租人" width="80"/>
                    <a:column name="business_type_desc" prompt="业务类型" width="80"/>
                    <a:column name="invoice_agent_desc" prompt="代理商" width="80"/>
                    <a:column name="division_desc" prompt="产品线" width="80"/>
                    <a:column name="bp_class_desc" prompt="客户类别" width="80"/>
                    <a:column name="contract_status_n" prompt="合同状态" width="80"/>
                    <a:column name="archive_status_n" prompt="合同归档" width="80"/>
                    <a:column name="docu_number_archive" prompt="合同归档编号" width="100"/>
                    <a:column name="storage_archive" prompt="仓库" width="60"/>
                    <a:column name="reg_status_n" prompt="登记证归档" width="90"/>
                    <a:column name="docu_number_reg" prompt="登记证归档编号" width="100"/>
                    <a:column name="storage_reg" prompt="仓库" width="60"/>
                    <a:column name="express_reg_falg_n" prompt="是否邮寄" width="80"/>
                </a:columns>
            </a:grid>
            <a:hBox/>
        </a:screenBody>
    </a:view>
</a:screen>