<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="prj_project_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="con632_col_detail" url="${/request/@context_path}/modules/cont/CON632/con_collection_maintain_detail.lview"/>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[
            function con632_query() {
                $('con_collection_result_ds').query();
            }
            
            function con632_back() {
                if ('${/parameter/@winid}') {
                    $('${/parameter/@winid}').close();
                } else {
                    location.href = $('sys_service_welcome_link').getUrl();
                }
            }
            
            function open_con_collection_Detail(ds_id, record_id) {
                var record = $(ds_id).findById(record_id);
                param = record.data;
                param['project_id'] = record.get('project_id');
                param['function_code'] = 'CON632D';
                param['function_usage'] = 'MODIFY';
                param['staff_name'] = record.get('staff_name');
                param['maintain_type'] = 'UPDATE';
                param['url_title'] = '催收任务明细';
                hls_doc_get_layout_code('prj_project_get_layout_code_link_id', param, 'con632_col_detail');
            }
            
            function renderer_function(value, record, name) {
                if (name == 'project_number') {
                    if (record.get('contract_status') == 'INCEPT' || record.get('contract_status') == 'PAID') {
                        return '<a href="javascript:open_con_collection_Detail(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
                    } else {
                        return '<a href="javascript:open_con_collection_Detail(\'' + record.ds.id + '\',\'' + record.id + '\')">' + "<font color='red'>" + value + "</font>" + '</a>';
                    }
                }
                if (name == 'contract_number') {
                    if (record.get('contract_status') == 'INCEPT' || record.get('contract_status') == 'PAID') {
                        return value;
                    } else {
                        return "<font color='red'>" + value + "</font>";
                    }
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="overdue_status_ds" lookupCode="CON_OVERDUE_STATUS"/>
            <a:dataSet id="overdue_status_type_ds" lookupCode="OVERDUE_STATUS_TYPE"/>
            <a:dataSet id="con_collection_persons_ds" loadData="true" model="cont.CON632.con_collection_persons_query_lov"/>
            <a:dataSet id="con_collection_query_ds">
                <a:fields>
                    <a:field name="contract_number"/>
                    <a:field name="project_number"/>
                    <a:field name="bp_name"/>
                    <a:field name="bp_phone"/>
                    <a:field name="license_number"/>
                    <a:field name="staff_name" displayField="staff_name" options="con_collection_persons_ds" returnField="staff_id" valueField="staff_id"/>
                    <a:field name="overdue_status_type"/>
                    <a:field name="overdue_status_type_n" displayField="code_value_name" options="overdue_status_type_ds" returnField="overdue_status_type" valueField="code_value"/>
                    <a:field name="province"/>
                    <a:field name="creation_date_from"/>
                    <a:field name="creation_date_to"/>
                    <a:field name="item_frame_number"/>
                    <a:field name="id_card_no"/>
                    <a:field name="staff_id"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="con_collection_result_ds" autoPageSize="true" autoQuery="true" queryDataSet="con_collection_query_ds" queryUrl="${/request/@context_path}/autocrud/cont.CON632.con_collection_query/query"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="con632_back" text="退出"/>
                <a:gridButton click="con632_query" text="查询"/>
            </a:screenTopToolbar>
            <a:form column="4" marginWidth="30" title="催收任务查询">
                <a:textField name="contract_number" bindTarget="con_collection_query_ds" prompt="合同编号"/>
                <a:textField name="project_number" bindTarget="con_collection_query_ds" prompt="申请编号"/>
                <a:textField name="bp_name" bindTarget="con_collection_query_ds" prompt="承租人"/>
                <a:textField name="bp_phone" bindTarget="con_collection_query_ds" prompt="承租人电话"/>
                <a:textField name="id_card_no" bindTarget="con_collection_query_ds" prompt="身份证号"/>
                <a:textField name="license_number" bindTarget="con_collection_query_ds" prompt="车牌号"/>
                <a:textField name="item_frame_number" bindTarget="con_collection_query_ds" prompt="车架号"/>
                <a:comboBox name="staff_name" bindTarget="con_collection_query_ds" prompt="电催人员"/>
                <a:comboBox name="overdue_status_type_n" bindTarget="con_collection_query_ds" prompt="逾期状态"/>
                <a:textField name="province" bindTarget="con_collection_query_ds" prompt="省份"/>
                <a:datePicker name="creation_date_from" bindTarget="con_collection_query_ds" prompt="创建日期从"/>
                <a:datePicker name="creation_date_to" bindTarget="con_collection_query_ds" prompt="创建日期到"/>
            </a:form>
            <a:grid bindTarget="con_collection_result_ds" marginHeight="230" marginWidth="30" navBar="true">
                <a:toolBar>
                    <a:button type="excel"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="contract_number" align="left" prompt="合同编号" renderer="renderer_function" width="170"/>
                    <a:column name="project_number" align="center" prompt="申请编号" renderer="renderer_function" width="120"/>
                    <a:column name="bp_name" align="left" prompt="承租人" width="120"/>
                    <a:column name="bp_phone" align="left" prompt="承租人电话" width="120"/>
                    <a:column name="staff_name" align="left" prompt="电催人员" width="120"/>
                    <a:column name="overdue_status_type_n" align="center" prompt="逾期状态" width="100"/>
                    <a:column name="write_off_flag" align="center" prompt="扣款状态" width="80"/>
                    <a:column name="due_amount" align="right" prompt="扣款金额" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="overdue_max_days" align="right" prompt="逾期天数" width="80"/>
                    <a:column name="overdue_times" align="right" prompt="逾期期数" width="80"/>
                    <a:column name="overdue_amount_sum" align="right" prompt="逾期金额" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="province_description" align="left" prompt="省份" width="120"/>
                    <a:column name="id_card_no" align="left" prompt="身份证号" width="140"/>
                    <a:column name="license_number" align="left" prompt="车牌号" width="140"/>
                    <a:column name="item_frame_number" align="left" prompt="车架号" width="130"/>
                    <a:column name="assign_date" align="left" prompt="分配日期" width="130"/>
                    <a:column name="contract_status_n" align="center" prompt="合同状态" width="100"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
        <script type="text/javascript"><![CDATA[
            Leaf.onReady(init);
            
            function init() {
                $('con_collection_result_ds').setQueryParameter('staff_id', '${/parameter/@staff_id}');
                $('con_collection_result_ds').setQueryParameter('overdue_status_type', '${/parameter/@overdue_status_type}');
                /* $('con_collection_result_ds').setQueryParameter('assign_time', '${/parameter/@assign_time}'); */
                $('con_collection_result_ds').query();
            }
        ]]></script>
    </a:view>
</a:screen>
