<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-1-16 下午1:12:54  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <!-- <a:init-procedure>
        <model-query fetchAll="true" model="cont.CON440.con_prj_agent_record_sysdate" rootpath="sysdate_path"/>
    </a:init-procedure> -->
    <a:view>
        <a:link id="con_workday_query_link" model="cont.CON440.con_insert_workday_query" modelaction="update"/>
        <script type="text/javascript"><![CDATA[
            function con440_lock_current_window() {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
            }
            
            function con440_unlock_current_window() {
                Leaf.Masker.unmask(Ext.getBody());
            }
            
            
            function con_contract_info_query() {
                $('risk_approved_record_ds').query();
            }
            
            
            function con_contract_calu() {
                con440_lock_current_window();
                var records = $('for_query_ds').getCurrentRecord();
                var date_from = records.get('date_from');
                var date_to = records.get('date_to');
                Leaf.showConfirm('${l:PROMPT}', '计算将清除上次运行结果，并且执行时间较长，是否确认提交？', function() {
                    Leaf.request({
                        url: $('con_workday_query_link').getUrl(),
                        para: {
                            'date_from': date_from,
                            'date_to': date_to
                        },
                        success: function() {
                            Leaf.SideBar.show({
                                msg: '操作成功',
                                duration: 2000
                            });
                            con440_unlock_current_window();
                        },
                        failure: function() {
                            con440_unlock_current_window();
                        },
                        error: function() {
                            con440_unlock_current_window();
                        },
                        scope: this
                    });
                });
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="for_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="bp_id"/>
                    <a:field name="bp_name" lovGridHeight="300" lovHeight="500" lovService="cont.CON440.con_prj_agent_record_agent_lov" lovWidth="900">
                        <a:mapping>
                            <a:map from="bp_name" to="bp_name"/>
                            <a:map from="bp_id" to="bp_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="date_from"/>
                    <a:field name="date_to"/>
                </a:fields>
                <!-- <a:events>
            <a:event name="upadte" handler="date_to_limit"/>
            </a:events> -->
            </a:dataSet>
            <a:dataSet id="risk_approved_record_ds" autoPageSize="true" model="cont.CON440.con_workday_record_query" queryDataSet="for_query_ds">
                <a:fields>
                    <a:field name="bp_name"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:toolbarButton click="con_contract_calu" text="计算"/>
                <a:toolbarButton click="con_contract_info_query" text="查询"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="150" marginWidth="80" title="查询条件">
                <a:lov name="bp_name" bindTarget="for_query_ds" prompt="经销商名称"/>
                <a:dateTimePicker name="date_from" bindTarget="for_query_ds" prompt="起始日期从"/>
                <a:dateTimePicker name="date_to" bindTarget="for_query_ds" prompt="起始日期到"/>
            </a:form>
            <a:grid bindTarget="risk_approved_record_ds" marginHeight="180" marginWidth="80" navBar="true">
                <a:toolBar>
                    <a:button type="excel"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="bp_code" prompt="经销商编码" width="160"/>
                    <a:column name="bp_name" prompt="经销商名称" width="160"/>
                    <a:column name="agent_sub_num" prompt="提交审批量" width="160"/>
                    <a:column name="sp_num" prompt="CC岗审批量" width="160"/>
                    <a:column name="th_num" prompt="退回量" width="160"/>
                    <a:column name="prj_approving_num" prompt="正在审批量" width="160"/>
                    <a:column name="ytjpf_num" prompt="有条件批复通过量" width="160"/>
                    <a:column name="zjty_num" prompt="直接同意通过量" width="160"/>
                    <a:column name="sptg_num" prompt="审批通过量" width="160"/>
                    <a:column name="rej_num" prompt="拒绝量" width="160"/>
                    <a:column name="sp_total" prompt="审批总量" width="160"/>
                    <a:column name="sphs_avg_num" prompt="审批用时(TAD)" width="160"/>
                    <a:column name="closed_num" prompt="合同取消量" width="160"/>
                    <a:column name="qy_num" prompt="合同生成量" width="160"/>
                    <a:column name="tj_num" prompt="提交合同审批量" width="160"/>
                    <a:column name="qk_num" prompt="请款量" width="160"/>
                    <a:column name="qkze_num" prompt="请款总额" width="160"/>
                    <a:column name="fk_num" prompt="实际放款量" width="160"/>
                    <a:column name="fkze_num" prompt="放款总额" width="160"/>
                    <a:column name="htsp_avg_num" prompt="合同审批用时(TAP)" width="160"/>
                </a:columns>
                <!-- <a:editors>
                    <a:textArea id="tex_area_e" height="100" width="300"/>
                </a:editors> -->
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
