<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hp  
    $Date: 2014-1-7 下午02:47:38  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query model="gld.gld_period_status" rootPath="gld_periods_combo"/>
    </a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
			function query()
			{
			    $('con_unearned_finance_result_ds').query();			    
			}
			function reset()
			{
			    $('con_unearned_finance_query_ds').reset();			    
			}
			
			function summaryRenderer(datas, name) {
           		
                var sum = 0;
         
                for (var i = 0;i < datas.length;i++) {
                    record = datas[i];
                    if (name == "unearned_finance_income" ) {
                        var t_1 = record.get("unearned_finance_income" );
                        var  t_2 = parseFloat(t_1);
                        if (!isNaN(t_2)) {
                            sum += t_2;
                        }
                    }
                   
                
                
                }
                if (name == "calc_end_date") {
                    return '<div align="right">合计:</div>';
                }
                if (name == "unearned_finance_income" ) {           
                    return '<font color="red">' + Leaf.formatNumber(sum, 2) + '</font>';
                }
            
            }
		]]></script>
        <a:dataSets>
            <a:dataSet id="con330_period_name_ds">
                <a:datas dataSource="/model/gld_periods_combo"/>
            </a:dataSet>
            <a:dataSet id="finance_income_recognized_ds">
                <a:datas>
                    <a:record code_value="Y" code_value_name="是"/>
                    <a:record code_value="N" code_value_name="否"/>
                </a:datas>
            </a:dataSet>
            <a:dataSet id="con_unearned_finance_query_ds">
                <a:fields>
                    <a:field name="period_name_from" displayField="period_name" options="con330_period_name_ds" returnField="period_name_from" valueField="period_name"/>
                    <a:field name="period_name_to" displayField="period_name" options="con330_period_name_ds" returnField="period_name_to" valueField="period_name"/>
                    <a:field name="contract_id"/>
                    <a:field name="contract_number" lovGridHeight="300" lovHeight="430" lovService="cont.CON330.con_contract_lov" lovWidth="400">
                        <a:mapping>
                            <a:map from="contract_id" to="contract_id"/>
                            <a:map from="contract_number" to="contract_number"/>
                            <a:map from="contract_name" to="contract_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="contract_name"/>
                    <a:field name="bp_id_vender"/>
                    <a:field name="bp_vender_n" lovGridHeight="300" lovHeight="430" lovService="basic.hls_bp_master_v_all_lov?bp_category=VENDER" lovWidth="550">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id_vender"/>
                            <a:map from="bp_name" to="bp_vender_n"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id_tenant"/>
                    <a:field name="bp_tenant_n" lovGridHeight="300" lovHeight="430" lovService="basic.hls_bp_master_v_all_lov?bp_category=TENANT" lovWidth="550">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id_tenant"/>
                            <a:map from="bp_name" to="bp_tenant_n"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id_agent_level1"/>
                    <a:field name="bp_id_agent_level1_n" lovGridHeight="300" lovHeight="430" lovService="basic.hls_bp_master_v_all_lov?bp_category=AGENT" lovWidth="550">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id_agent_level1"/>
                            <a:map from="bp_name" to="bp_id_agent_level1_n"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="finance_income_recognized" displayField="code_value" options="finance_income_recognized_ds" returnField="finance_income_recognized" valueField="code_value"><![CDATA[                   	
                    ]]></a:field>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="con_unearned_finance_result_ds" autoPageSize="true" autoQuery="true" model="cont.CON328.con_unearned_finance_income" queryDataSet="con_unearned_finance_query_ds"><![CDATA[
			]]></a:dataSet>
            <a:dataSet id="con_unearned_finance_result_sum_ds" autoQuery="true" model="cont.CON328.con_unearned_finance_income_form" pageSize="15" queryDataSet="con_unearned_finance_query_ds"><![CDATA[
			]]></a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="query" text="HLS.QUERY"/>
                <a:gridButton click="reset" text="HLS.RESET"/>
            </a:screenTopToolbar>
            <a:form column="4" marginWidth="80" title="支付表收益分摊查询">
                <a:lov name="contract_number" bindTarget="con_unearned_finance_query_ds" prompt="支付表编号"/>
                <a:textField name="contract_name" bindTarget="con_unearned_finance_query_ds" prompt="支付表名称"/>
                <a:lov name="bp_tenant_n" bindTarget="con_unearned_finance_query_ds" prompt="承租人"/>
                <a:lov name="bp_id_agent_level1_n" bindTarget="con_unearned_finance_query_ds" prompt="经销商"/>
            </a:form>
            <a:form column="4" marginWidth="80" title=" ">
                <a:textField name="sum_un_fin_income" bindTarget="con_unearned_finance_result_sum_ds" prompt="收益分摊总额" readOnly="true"/>
                <a:textField name="ensure_sum_un_fin_income" align="right" bindTarget="con_unearned_finance_result_sum_ds" prompt="已确认收益分摊总额" readOnly="true"/>
                <a:textField name="unensure_sum_un_fin_income" align="right" bindTarget="con_unearned_finance_result_sum_ds" prompt="未确认收益分摊总额" readOnly="true"/>
                <a:textField name="should_confirmed_sum_income" align="right" bindTarget="con_unearned_finance_result_sum_ds" prompt="应确认收入总额" readOnly="true"/>
            </a:form>
            <a:grid bindTarget="con_unearned_finance_result_ds" marginHeight="240" marginWidth="80" navBar="true">
                <a:toolBar>
                    <a:button type="excel"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="contract_number" lock="true" prompt="支付表编号" sortable="true" width="130"/>
                    <a:column name="contract_name" lock="true" prompt="支付表名称" width="130"/>
                    <a:column name="bp_id_tenant_n" prompt="承租人" width="160"/>
                    <a:column name="bp_id_agent_level1_n" prompt="经销商" width="200"/>
                    <a:column name="lease_organization_n" prompt="事业部" width="160"/>
                    <a:column name="division_n" prompt="产品线" width="160"/>
                    <a:column name="sum_un_fin_income" align="right" footerRenderer="summaryRenderer" prompt="未实现收益" renderer="Leaf.formatMoney"/>
                    <a:column name="ensure_sum_un_fin_income" align="right" footerRenderer="summaryRenderer" prompt="已确认未实现收益" renderer="Leaf.formatMoney"/>
                    <a:column name="unensure_sum_un_fin_income" align="right" footerRenderer="summaryRenderer" prompt="未确认未实现收益" renderer="Leaf.formatMoney"/>
                    <a:column name="overdue_amount" align="right" footerRenderer="summaryRenderer" prompt="逾期租金总额" renderer="Leaf.formatMoney"/>
                    <a:column name="overdue_un_interest" align="right" footerRenderer="summaryRenderer" prompt="逾期未收利息总额" renderer="Leaf.formatMoney"/>
                    <a:column name="should_confirmed_sum_income" align="right" footerRenderer="summaryRenderer" prompt="应确认收入总额" renderer="Leaf.formatMoney"/>
                    <a:column name="overdue_amount_out_ninety" align="right" footerRenderer="summaryRenderer" prompt="逾期大于90天租金总额" renderer="Leaf.formatMoney"/>
                    <a:column name="overdue_amount_in_ninety" align="right" footerRenderer="summaryRenderer" prompt="90天以内逾期租金总额" renderer="Leaf.formatMoney"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
