<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hc  
    $Date: 2015-10-10 上午10:30:25  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure><![CDATA[
    ]]></a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
            function con303_con_contract_return() {
                history.go(-1);
            }
            
            function con303_con_contract_query() {
                $('con303_contract_result_ds').query();
            }
            
            function con303_con_contract_reset() {
                $('con303_contract_query_ds').reset();
            }
            
             function sumFunction_foot(data, name) {
                 if (name == 'row_num') {
                     return '<font color=red>' + '合计' + '</font>';
                   } else if(name == 'deposit'){
                       return colum_caculateTotal(data,name);
                   }else if(name == 'finance_amount'){
                       return colum_caculateTotal(data,name); 
                   }
            }
            
            function colum_caculateTotal(data,name){
                var total=0;
                var length=data.length;
                var value=0;
                for(var i=0;i<length;i++){
                    if(Ext.isEmpty(data[i].get(name))){
                        value=0;
                    }else{
                        value=data[i].get(name);
                    }
                    total=plus(total,value);
                }
                 return '<font color=red>' +Leaf.formatMoney(total)+ '</font>';
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="con303_project_status_ds" lookupCode="PRJ303_PROJECT_STATUS"/>
            <a:dataSet id="con_bp_adress_type_ds" lookupCode="CON_BP_ADRESS_TYPE"/>
            <a:dataSet id="bp_scale_type_ds" lookupCode="BP_SCALE_TYPE"/>
            <a:dataSet id="pre_rental_business_options" lookupCode="YES_NO"/>
            <a:dataSet id="con303_contract_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="project_status" displayField="code_value_name" options="con303_project_status_ds" returnField="project_status" valueField="code_value_name"/>
                    <a:field name="contract_number"/>
                    <a:field name="bp_name" autoComplete="true" lovGridHeight="350" lovHeight="500" lovService="basic.hls_bp_master_v_for_lov?bp_category=TENANT" lovWidth="500" title="HLS.BP_TITLE">
                        <a:mapping>
                            <a:map from="bp_name" to="bp_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_industry_big" lovGridHeight="350" lovHeight="500" lovService="cont.CON305N.con_industry_big_query_lov" lovWidth="500" title="行业查询">
                        <a:mapping>
                            <a:map from="description" to="bp_industry_big"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="con_bp_scale" displayField="code_value_name" options="bp_scale_type_ds" returnField="con_bp_scale" valueField="code_value_name"/>
                    <a:field name="con_bp_adress" displayField="code_value_name" options="con_bp_adress_type_ds" returnField="con_bp_adress" valueField="code_value_name"/>
                    <a:field name="bp_scale_n" displayField="code_value_name" options="bp_scale_combox_ds" returnField="bp_scale_n" valueField="code_value_name"/>
                    <a:field name="pre_rental_business" displayField="code_value_name" options="pre_rental_business_options" returnField="pre_rental_business" valueField="code_value_name"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="con303_contract_result_ds" autoPageSize="true" autoQuery="true" fetchAll="true" model="cont.CON303.prj_info_step_v" queryDataSet="con303_contract_query_ds" queryUrl="${/request/@context_path}/autocrud/cont.CON303.prj_info_step_v/query"><![CDATA[
            ]]></a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <!-- <a:gridButton click="con303_con_contract_return" text="HLS.RETURN"/> -->
                <a:gridButton click="con303_con_contract_query" text="HLS.QUERY"/>
                <a:gridButton click="con303_con_contract_reset" text="HLS.RESET"/>
                <a:gridButton bind="con303_con_contract_grid_ds" type="excel"/>
            </a:screenTopToolbar>
            <a:form column="4" labelSeparator=" " labelWidth="100" marginWidth="30" title="CON301.CONTRACT_QUERY">
                <a:comboBox name="project_status" bindTarget="con303_contract_query_ds" prompt="项目状态"/>
                <a:lov name="bp_name" bindTarget="con303_contract_query_ds" prompt="HLS.TENANT_NAME"/>
                <a:lov name="bp_industry_big" bindTarget="con303_contract_query_ds" prompt="行业"/>
                <a:comboBox name="con_bp_adress" bindTarget="con303_contract_query_ds" prompt="注册地类型"/>
                <a:comboBox name="con_bp_scale" bindTarget="con303_contract_query_ds" prompt="客户规模类型"/>
                <a:comboBox name="pre_rental_business" bindTarget="con303_contract_query_ds" prompt="租前期项目"/>
            </a:form>
            <a:grid id="con303_con_contract_grid_ds" bindTarget="con303_contract_result_ds" marginHeight="200" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="row_num" align="center" footerRenderer="sumFunction_foot" lock="true" prompt="序号" width="40"/>
                    <a:column name="project_status" prompt="项目状态" width="100"/>
                    <a:column name="project_name" prompt="项目名称" width="200"/>
                    <a:column name="bp_name" prompt="承租人名称" width="200"/>
                    <a:column name="bp_business" prompt="承租人简介"/>
                    <a:column name="bp_industry_big" prompt="行业"/>
                    <a:column name="pre_rental_business" align="center" prompt="租前期项目"/>
                    <a:column name="con_bp_adress" prompt="注册地" width="100"/>
                    <a:column name="con_bp_scale" prompt="客户规模" width="100"/>
                    <a:column name="contract_number" prompt="单据编号" width="150"/>
                    <a:column name="business_desc" align="center" prompt="租赁方式" width="100"/>
                    <a:column name="lease_item_short_name" prompt="租赁物" width="120"/>
                    <a:column name="finance_amount" align="right" footerRenderer="sumFunction_foot" prompt="租赁本金" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="lease_times" prompt="租赁期数" width="80"/>
                    <a:column name="lease_term" prompt="期限(月)" width="80"/>
                    <a:column name="irr_n" prompt="内部收益率"/>
                    <a:column name="guarantor_bp" prompt="保证人" width="70"/>
                    <a:column name="notes" prompt="备注" width="150"/>
                    <a:column name="prj_status_name" align="center" prompt="项目报告状态" width="100"/>
                    <a:column name="con_status_name" align="center" prompt="合同状态" width="80"/>
                    <a:column name="inception_of_lease" prompt="投放时间" renderer="Leaf.formatDate" width="90"/>
                    <a:column name="org_name" prompt="责任部门" width="70"/>
                    <a:column name="sponsor" prompt="主办人" width="60"/>
                    <a:column name="assist" prompt="协办人" width="60"/>
                    <a:column name="deposit" align="right" footerRenderer="sumFunction_foot" prompt="保证金" renderer="Leaf.formatMoney"/>
                    <a:column name="deposit_ratio_n" prompt="保证金比例" width="70"/>
                    <a:column name="int_rate_n" prompt="租赁利率" width="70"/>
                    <a:column name="commission_charge" align="right" footerRenderer="colum_caculateTotal" prompt="手续费" renderer="Leaf.formatMoney"/>
                    <a:column name="commission_charge_n" prompt="手续费/年(含税)" width="120"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>