<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2014-12-24 
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="insert_contract_indicator_rep_link" model="cont.CON400.contract_indicator_rep" modelaction="insert"/>
        <script type="text/javascript"><![CDATA[
            function contract_indicator_rep_query() {
                record = $('for_query_ds').getAt(0);
                if (Ext.isEmpty(record.get('start_date'))) {
                    var start_date = '2000-01-01';
                } else {
                    start_date = record.get('start_date');
                }
                if (Ext.isEmpty(record.get('end_date'))) {
                    var end_date = '3000-01-01';
                } else {
                    end_date = record.get('end_date');
                }
                url = $('insert_contract_indicator_rep_link').getUrl();
                Leaf.request({
                    url: url,
                    para: {
                        start_date: start_date,
                        end_date: end_date,
                        user_id: '${/session/@user_id}'
                    },
                    success: function() {
                        $('contract_indicator_rep_ds').setQueryParameter('user_id', '${/session/@user_id}');
                        $('contract_indicator_rep_ds').query();
                    },
            
                    scope: this
                });
            }
            
            
            function render_line(record){
                if(record.get('show_level')==2){
                  return 'background-color:yellow;font-weight:700;'; 
                }
                if(record.get('show_level')==3){
                  return 'background-color:red;font-weight:900;'; 
                }
            }

        ]]></script>
        <a:dataSets>
            <a:dataSet id="for_query_ds" autoCreate="true">
                <a:fields name="start_date"/>
                <a:fields name="end_date"/>
            </a:dataSet>
            <a:dataSet id="contract_indicator_rep_ds" fetchAll="true" model="cont.CON400.contract_indicator_rep" queryDataSet="for_query_ds"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="contract_indicator_rep_query" text="查询"/>
            </a:screenTopToolbar>
            <a:form marginWidth="50" title="查询条件">
                <a:hBox>
                    <a:datePicker name="start_date" bindTarget="for_query_ds" prompt="起始时间"/>
                    <a:datePicker name="end_date" bindTarget="for_query_ds" prompt="结束时间"/>
                </a:hBox>
            </a:form>
            <a:grid bindTarget="contract_indicator_rep_ds" marginHeight="180" marginWidth="50" navBarType="true" rowRenderer="render_line">
                <a:toolBar>
                    <a:button type="excel"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="unit_name" lock="true" prompt="4S店名" width="200"/>
                    <a:column name="prj_complete" prompt="申请台数">
                        <a:column name="prj_complete_detail" prompt="申请明细（台）">
                            <a:column name="prj_lease_channel_01" align="center" prompt="外部业务"/>
                            <a:column name="prj_lease_channel_00" align="center" prompt="试驾车"/>
                            <a:column name="prj_lease_channel_02" align="center" prompt="管理人员"/>
                        </a:column>
                        <a:column name="prj_complete_number" align="center" prompt="小计"><![CDATA[
                         ]]></a:column>
                    </a:column>
                    <a:column name="con_complete" prompt="完成台数">
                        <a:column name="con_complete_detail" prompt="实际完成明细（台）">
                            <a:column name="incept_lease_channel_01" align="center" prompt="外部业务"/>
                            <a:column name="incept_lease_channel_00" align="center" prompt="试驾车"/>
                            <a:column name="incept_lease_channel_02" align="center" prompt="管理人员"/>
                        </a:column>
                        <a:column name="incept_complete_number" align="center" prompt="小计"><![CDATA[
                         ]]></a:column>
                    </a:column>
                    <a:column name="amount" prompt="完成生息规模">
                        <a:column name="amount_detail" prompt="实际完成明细（元）">
                            <a:column name="lease_channel_01_amount" align="right" prompt="外部业务" renderer="Leaf.formatMoney"/>
                            <a:column name="lease_channel_00_amount" align="right" prompt="试驾车" renderer="Leaf.formatMoney"/>
                            <a:column name="lease_channel_02_amount" align="right" prompt="管理人员" renderer="Leaf.formatMoney"/>
                        </a:column>
                        <a:column name="amount_count" align="right" prompt="小计" renderer="Leaf.formatMoney"><![CDATA[
                         ]]></a:column>
                    </a:column>
                    <a:column name="lease_amount_count" prompt="合同资产规模">
                        <a:column name="lease_amount_count_detail" prompt="实际完成明细（元）">
                            <a:column name="lease_channel_01_ls_amount" align="right" prompt="外部业务" renderer="Leaf.formatMoney"/>
                            <a:column name="lease_channel_00_ls_amount" align="right" prompt="试驾车" renderer="Leaf.formatMoney"/>
                            <a:column name="lease_channel_02_ls_amount" align="right" prompt="管理人员" renderer="Leaf.formatMoney"/>
                        </a:column>
                        <a:column name="lease_amount_count" align="right" prompt="小计" renderer="Leaf.formatMoney"><![CDATA[
                         ]]></a:column>
                    </a:column>
                </a:columns>
            </a:grid>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
             Leaf.onReady(function() {
                 url = $('insert_contract_indicator_rep_link').getUrl();
                 Leaf.request({
                     url: url,
                     para: {
                         user_id: '${/session/@user_id}'
                     },
                     success: function() {
                         $('contract_indicator_rep_ds').setQueryParameter('user_id', '${/session/@user_id}');
                         $('contract_indicator_rep_ds').query();
                     },
             
                     scope: this
                 });
             
             })
         ]]></script>
    </a:view>
</a:screen>
