<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query model="acr.ACR516.acr_vat_import_batch_id" rootPath="batch_id"/>
        <a:model-query defaultWhereClause="t1.function_code = ${/parameter/@function_code}" model="cus.CUS100.cus_default_function_name" rootPath="default_function_name"/>
    </a:init-procedure>
    <a:view>
        <a:link id="con643_submit_link" model="db.cus_rpt_con_dunning_enter_pkg.submit_rpt" modelaction="execute"/>
        <a:link id="con643_get_control_id_link" model="db.rpt_report_control_pkg.checkin_rpt" modelaction="execute"/>
        <a:link id="con643_refresh_link" model="db.rpt_report_control_pkg.refresh_rpt" modelaction="execute"/>
        <a:link id="con620n_dunning_record_link_id" model="cont.CON620N.cus_dun_email" 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_lawyer_letter_print_link_id" url="${/request/@context_path}/modules/cont/CON620/con_contract_lawyer_letter_print.lview"/>
        <a:link id="con_contract_legal_letter_create_link_id" url="${/request/@context_path}/modules/leg/LEG600/legal_opinion_letter_create.lview"/>
        <a:link id="con_contract_rent_dun_link_id" url="${/request/@context_path}/modules/cont/CON621/con_contract_rent_dun_modify.lview"/>
        <a:link id="con_dunning_letter_create_link_id" url="${/request/@context_path}/modules/cont/CON625/con_dunning_letter_create.lview"/>
        <a:link id="con_contract_update_link_id" url="${/request/@context_path}/modules/cont/CON301/con_contract_query_n.lview"/>
        <a:link id="con602_excel_export_link" url="${/request/@context_path}/modules/cont/CON620N/con_dun_word_export.lview"/>
        <a:link id="con620_excel_export_id" url="${/request/@context_path}/modules/cont/CON620N/con_export_excel_sheets.lsc"/>
        <a:link id="con602_import_link_id" url="${/request/@context_path}/modules/cont/CON620N/con_dun_import_upload.lview"/>
        <a:link id="con_dunning_letter_modify_link_id" url="${/request/@context_path}/modules/cont/CON627/con_dunning_letter_modify.lview"/>
        <a:link id="con643_gps_service_link_id" url="${/request/@context_path}/modules/cus/CUS100/cus_contract_gps_create.lview"/>
        <a:link id="con620_excel_export_visit_id" url="${/request/@context_path}/modules/cont/CON620N/con_export_excel_visit_sheets.lsc"/>
        <a:link id="con602_visit_import_link_id" url="${/request/@context_path}/modules/cont/CON620N/con_visit_import_upload.lview"/>
        <script type="text/javascript"><![CDATA[
			function eg_rpt100_status_find(control_id){
			    Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
                Leaf.request({
                    url: $('con643_refresh_link').getUrl(),
                    para: {'control_id':control_id},
                    success: function(res) {
                        Leaf.Masker.unmask(Ext.getBody());
                        if (res.result.job_stauts == 'FINISH'){
                            $('con643_result_ds').query();
                        }
                        eg_rpt100_head_query();
                    },
                    failure: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
			}
			function eg_rpt100_query(){
			    var control_id = $('con643_head_ds').getAt(0).get('control_id');
			    var status  = $('con643_head_ds').getAt(0).get('status');
			    
			    if (status == 'FINISH'){
			         $('con643_result_ds').query();
			    }else{
			        eg_rpt100_status_find(control_id);
			    }
			    $('con643_result_ds').query();
			    
			}
			
			
			function eg_rpt100_submit(){
			    var control_id = $('con643_head_ds').getAt(0).get('control_id');
			    Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
                Leaf.request({
                    url: $('con643_submit_link').getUrl(),
                    para: {'control_id':control_id},
                    success: function(res) {
                        Leaf.Masker.unmask(Ext.getBody());
                        eg_rpt100_head_query();
                    },
                    failure: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                }); 
			}
			
			function eg_rpt100_head_query(){
                $('con643_head_ds').query();
			}
		]]></script>
        <a:dataSets>
            <a:dataSet id="con643_head_ds" model="example.eg_rpt100.rpt_report_control"/>
            <a:dataSet id="con643_result_ds" model="cont.CON643N.cus_rpt_con643_o"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:toolbarButton click="eg_rpt100_query" text="HLS.QUERY"/>
                <a:toolbarButton click="eg_rpt100_submit" text="计算"/>
            </a:screenTopToolbar>
            <a:hBox labelWidth="120">
                <a:label name="last_submit_date" bindTarget="con643_head_ds" prompt="上次刷新时间" renderer="Leaf.formatDate"/>
                <a:label name="status" bindTarget="con643_head_ds" prompt="状态"/>
            </a:hBox>
            <a:grid id="con643_result_gd" bindTarget="con643_result_ds" marginHeight="200" marginWidth="100" navBar="true">
                <a:columns>
                    <a:column name="risk_flag_n" prompt="危险标志"/>
                    <a:column name="contract_number" prompt="合同序号"/>
                    <a:column name="search_term_1" prompt="合同号"/>
                    <a:column name="bp_id_tenant_n" prompt="承租人名称"/>
                    <a:column name="contract_status_n" prompt="合同状态"/>
                    <a:column name="legal_status" prompt="法务状态"/>
                    <a:column name="serial_number" prompt="机编号"/>
                    <a:column name="phone" prompt="联系电话"/>
                    <a:column name="collector_user_id" prompt="客户服务专员"/>
                    <a:column name="lease_start_date" prompt="起租日"/>
                    <a:column name="gps_type" prompt="GPS型号"/>
                    <a:column name="specification" prompt="设备类型"/>
                    <a:column name="business_type_n" prompt="业务类型"/>
                    <a:column name="direct_debit_bank_id" prompt="银行类别"/>
                    <a:column name="dd_bank_account_num" prompt="银行账号"/>
                    <a:column name="overdue_times" prompt="逾期期数"/>
                    <a:column name="overdue_max_days" prompt="逾期天数"/>
                    <a:column name="overdue_amount" prompt="逾期总金额"/>
                    <a:column name="penalty" prompt="违约金"/>
                    <a:column name="annual_pay_times" prompt="支付频率"/>
                    <a:column name="due_amount" prompt="当期还款金额"/>
                    <a:column name="pay_times_rental" prompt="已还款期数/剩余租金"/>
                    <a:column name="last_payment_date" prompt="最近一次付款金额/时间"/>
                    <a:column name="due_time" prompt="期数"/>
                    <a:column name="payment_method_id_n" prompt="付款方式"/>
                    <a:column name="bp_id_vender" prompt="分公司"/>
                    <a:column name="employee_id_n" prompt="业务员"/>
                    <a:column name="province_id_n" prompt="省份"/>
                    <a:column name="city_id_n" prompt="市"/>
                    <a:column name="district_id_n" prompt="区/县"/>
                    <a:column name="address" prompt="详细地址"/>
                    <a:column name="zipcode" prompt="邮编"/>
                    <a:column name="info_g" prompt="担保人信息"/>
                    <a:column name="lease_end_date" prompt="到期日"/>
                    <a:column name="legal_letter_amount" prompt="律师函金额"/>
                    <a:column name="legal_letter_date" prompt="律师函发送日期"/>
                    <a:column name="gps_last_date" prompt="GPS最新报告时间"/>
                    <a:column name="longitude" prompt="经度"/>
                    <a:column name="latitude" prompt="纬度"/>
                    <a:column name="gps_address" prompt="地理位置"/>
                    <a:column name="gps_letter_flag" prompt="GPS维修函发送"/>
                    <a:column name="gps_letter_date" prompt="发送日期"/>
                    <a:column name="send_feedback" prompt="催款函是否妥投"/>
                    <a:column name="feedback_reason" prompt="妥投原因"/>
                    <a:column name="dunning_flag" prompt="催收标志"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
        	    Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
                Leaf.request({
                    url: $('con643_get_control_id_link').getUrl(),
                    para: {'report_name':'CON643N'},
                    success: function(res) {
                        Leaf.Masker.unmask(Ext.getBody());
                        $('con643_head_ds').setQueryParameter('control_id',res.result.control_id);
                        $('con643_result_ds').setQueryParameter('control_id',res.result.control_id);
                        eg_rpt100_status_find(res.result.control_id);
                    },
                    failure: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                }); 
		]]></script>
    </a:view>
</a:screen>
