<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <script type="text/javascript"><![CDATA[
         function contract_info_result_ds(){
				$('contract_info_query_result_ds').query();
			}
			 function onUpdate_contract_info(ds, record, name, value, oldvalue) {
                   if (name == 'inception_of_lease_from') {
                    if (record.get('inception_of_lease_to') == 'undefined' || record.get('inception_of_lease_to') == null || record.get('inception_of_lease_to') == '') {
                        record.set('inception_of_lease_to', value);
                    }
                } else if (name == 'inception_of_lease_to') {
                    if (record.get('inception_of_lease_from') == 'undefined' || record.get('inception_of_lease_from') == null || record.get('creation_date_from') == '') {
                        record.set('inception_of_lease_from', value);
                    }
              }
			 }
			 function insurance_flag_renderer(value, record, name){
			    if(value=='否'){
			        record.set('insurance_amount',null);
			        return value;
			    }
			    return value;
			 }
		]]></script>
        <a:dataSets>
            <a:dataSet id="contract_status_ds" lookupCode="CON390_CONTRACT_STATUS"/>
            <a:dataSet id="contract_info_query_ds">
                <a:fields>
                    <a:field name="project_number"/>
                    <a:field name="contract_status_n" defaultValue="起租" displayField="code_value_name" options="contract_status_ds" returnField="contract_status" valueField="code_value"/>
                    <a:field name="contract_status" defaultValue="INCEPT"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="onUpdate_contract_info"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="contract_info_query_result_ds" autoQuery="true" model="cont.CON923.contract_info_query" queryDataSet="contract_info_query_ds">
                <a:fields>
                    <a:field name="project_number"/>
                    <a:field name="irr"/>
                    <a:field name="contract_number"/>
                    <a:field name="bpv_bp_name"/>
                    <a:field name="dd_bank_account_name"/>
                    <a:field name="bp_name"/>
                    <a:field name="product_plan_id_n"/>
                    <a:field name="invoice_price"/>
                    <a:field name="purchase_tax_flag"/>
                    <a:field name="purchase_tax"/>
                    <a:field name="insurance_flag"/>
                    <a:field name="insurance_amount"/>
                    <a:field name="travel_tax_flag"/>
                    <a:field name="travel_tax"/>
                    <a:field name="gps_flag"/>
                    <a:field name="gps_amount"/>
                    <a:field name="deposit"/>
                    <a:field name="down_payment"/>
                    <a:field name="lease_charge"/>
                    <a:field name="residual_value"/>
                    <a:field name="total_rental"/>
                    <a:field name="pmt"/>
                    <a:field name="finance_amount"/>
                    <a:field name="total_interest"/>
                    <a:field name="lease_times"/>
                    <a:field name="inception_of_lease"/>
                    <a:field name="lease_end_date"/>
                    <a:field name="gps_provider"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenTopToolbar>
            <a:screenTitle/>
            <a:gridButton click="contract_info_result_ds" text="查询"/>
        </a:screenTopToolbar>
        <a:form column="4" labelWidth="100" marginWidth="30" title="租金收支查询">
            <a:textField name="bp_name" bindTarget="contract_info_query_ds" prompt="经销商名称"/>
            <a:textField name="project_number" bindTarget="contract_info_query_ds" prompt="申请编号"/>
            <a:textField name="contract_number" bindTarget="contract_info_query_ds" prompt="合同编号"/>
            <a:textField name="dd_bank_account_name" bindTarget="contract_info_query_ds" prompt="收款人"/>
            <a:comboBox name="contract_status_n" bindTarget="contract_info_query_ds" prompt="合同状态"/>
            <a:datePicker name="inception_of_lease_from" bindTarget="contract_info_query_ds" prompt="起租日从"/>
            <a:datePicker name="inception_of_lease_to" bindTarget="contract_info_query_ds" prompt="起租日到"/>
        </a:form>
        <a:grid id="grid_id" bindTarget="contract_info_query_result_ds" marginHeight="230" marginWidth="30" navBar="true">
            <a:toolBar>
                <a:button type="excel"/>
            </a:toolBar>
            <a:columns>
                <a:column name="project_number" prompt="申请编号" width="100"/>
                <a:column name="irr" prompt="IRR" width="80"/>
                <a:column name="contract_number" prompt="合同编号" width="150"/>
                <a:column name="contract_status_n" prompt="合同状态" width="80"/>
                <a:column name="bpv_bp_name" prompt="承租人" width="100"/>
                <a:column name="dd_bank_account_name" prompt="收款人" width="80"/>
                <a:column name="bp_name" prompt="经销商名称" width="100"/>
                <a:column name="product_plan_id_n" prompt="产品名称" width="80"/>
                <a:column name="invoice_price" prompt="购车款" renderer="Leaf.formatMoney" width="100"/>
                <a:column name="purchase_tax_flag" prompt="是否融购置税" width="100"/>
                <a:column name="purchase_tax" prompt="购置税" renderer="Leaf.formatMoney" width="80"/>
                <a:column name="insurance_flag" prompt="是否融保险费" width="80"/>
                <a:column name="insurance_amount" prompt="保险费" renderer="Leaf.formatMoney" width="80"/>
                <a:column name="travel_tax_flag" prompt="是否融车船税" width="80"/>
                <a:column name="travel_tax" prompt="车船税" renderer="Leaf.formatMoney" width="80"/>
                <a:column name="gps_flag" prompt="是否融GPS税" width="80"/>
                <a:column name="gps_amount" prompt="GPS" renderer="Leaf.formatMoney" width="100"/>
                <a:column name="deposit" prompt="保证金" renderer="Leaf.formatMoney" width="80"/>
                <a:column name="down_payment" prompt="首付款" renderer="Leaf.formatMoney" width="80"/>
                <a:column name="lease_charge" prompt="手续费" renderer="Leaf.formatMoney" width="80"/>
                <a:column name="residual_value" prompt="留购价款" renderer="Leaf.formatMoney" width="80"/>
                <a:column name="total_rental" prompt="租金总额" renderer="Leaf.formatMoney" width="80"/>
                <a:column name="pmt" prompt="每期租金" renderer="Leaf.formatMoney" width="80"/>
                <a:column name="finance_amount" prompt="本金总额" renderer="Leaf.formatMoney" width="80"/>
                <a:column name="total_interest" prompt="利息总额" renderer="Leaf.formatMoney" width="80"/>
                <a:column name="lease_times" prompt="期数" width="80"/>
                <a:column name="inception_of_lease" prompt="起租日" renderer="Leaf.formatDate" width="100"/>
                <a:column name="lease_end_date" prompt="到期日" renderer="Leaf.formatDate" width="80"/>
                <a:column name="gps_provider" prompt="GPS厂商" width="80"/>
            </a:columns>
            <a:editors/>
        </a:grid>
        <a:hBox/>
    </a:view>
</a:screen>
