<?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="con632_collection_maintain_link_id" url="${/request/@context_path}/modules/cont/CON632/con_collection_maintain.lview"/>
        <a:link id="con634_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[
            function con634_query() {
                $('con634_collection_result_ds').query();
            }
            
            function con634_back() {
                location.href = $('con634_welcome_link').getUrl();
            }
            
            function open_collection_win(staff_id, overdue_status_type, overdue_date) {
                var win = new Leaf.Window({
                    url: $('con632_collection_maintain_link_id').getUrl(),
                    title: '催收任务查询',
                    params: {
                        staff_id: staff_id,
                        overdue_status_type: overdue_status_type,
                        assign_time: overdue_date,
                        winid: 'collection_maintain_winid'
                    },
                    id: 'collection_maintain_winid',
                    fullScreen: true
                });
            }
            
            function renderer_open(value, record, name) {
                if (name == 'ptp_count') {
                    if (value != 0) {
                        return '<a href="javascript:open_collection_win(\'' + record.get('staff_id') + '\',\'' + 'PTP' + '\',\'' + record.get('overdue_date') + '\')">' + value + '</a>';
                    } else {
                        return value;
                    }
                }
                if (name == 'pool_count' ) {
                    if (value != 0) {
                        return '<a href="javascript:open_collection_win(\'' + record.get('staff_id') + '\',\'' + 'POOL' + '\',\'' + record.get('overdue_date') + '\')">' + value + '</a>';
                    } else {
                        return value;
                    }
                }
                if (name == 'other_count') {
                    if (value != 0) {
                        return '<a href="javascript:open_collection_win(\'' + record.get('staff_id') + '\',\'' + 'OTHER' + '\',\'' + record.get('overdue_date') + '\')">' + value + '</a>';
                    } else {
                        return value;
                    }
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="con634_overdue_status_ds" lookupCode="CON_OVERDUE_STATUS"/>
            <a:dataSet id="con634_overdue_status_type_ds" lookupCode="OVERDUE_STATUS_TYPE"/>
            <a:dataSet id="con634_con_collection_persons_ds" loadData="true" model="cont.CON632.con_collection_persons_query_lov"/>
            <a:dataSet id="con634_con_collection_query_ds">
                <a:fields>
                    <a:field name="staff_name" displayField="staff_name" options="con634_con_collection_persons_ds" returnField="staff_id" valueField="staff_id"/>
                    <a:field name="time" required="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="con634_collection_result_ds" model="cont.CON634.con_collection_base" queryDataSet="con634_con_collection_query_ds"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="con634_back" text="退出"/>
                <a:gridButton click="con634_query" text="查询"/>
            </a:screenTopToolbar>
            <a:form column="4" marginWidth="20" title="电话催收台账">
                <a:comboBox name="staff_name" bindTarget="con634_con_collection_query_ds" prompt="电催人员"/>
                <a:datePicker name="time" bindTarget="con634_con_collection_query_ds" prompt="日期"/>
            </a:form>
            <a:grid bindTarget="con634_collection_result_ds" marginHeight="200" marginWidth="20" navBar="true">
                <a:toolBar>
                    <a:button type="excel"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="staff_name" align="center" prompt="电催人员" width="100"/>
                    <a:column name="overdue_date" align="center" prompt="日期" width="100"/>
                    <a:column name="succ_count" align="center" prompt="昨日成功数" width="100"/>
                    <a:column name="succ_total" align="center" prompt="催收成功率" width="100"/>
                    <a:column name="payment_total" align="center" prompt="扣款成功率" width="100"/>
                    <a:column name="over_total" align="center" prompt="覆盖率" width="100"/>
                    <a:column name="wastage_total" align="center" prompt="流失率" width="100"/>
                    <a:column name="new_count" align="center" prompt="新进数" width="100"/>
                    <a:column name="old_count" align="center" prompt="存量数" width="100"/>
                    <a:column name="flow_count" align="center" prompt="流失数" width="100"/>
                    <a:column name="ptp_count" align="center" prompt="承诺还款" renderer="renderer_open" width="100"/>
                    <a:column name="pool_count" align="center" prompt="贫穷" renderer="renderer_open" width="100"/>
                    <a:column name="other_count" align="center" prompt="其他" renderer="renderer_open" width="100"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
