<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-9-30 下午12:57:55  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure>
        <a:model-query defaultWhereClause="vv.aging_bucket_seq=(${/parameter/@aging_bucket_seq}-1)" fetchAll="true" model="cont.CON307.fnd_aging_buckets_seq" rootPath="aging_buckets_seq_from_path"/>
        <a:model-query defaultWhereClause="vv.aging_bucket_seq=${/parameter/@aging_bucket_seq}" fetchAll="true" model="cont.CON307.fnd_aging_buckets_seq" rootPath="aging_buckets_seq_to_path"/>
        <a:model-query fetchAll="true" model="cont.CON307.con_cf_aging_buckets_days_limit" rootPath="aging_bucket_days_path"/>
    </a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
        	function on_analysis_cashflow_add(ds){
    	        var record=ds.getCurrentRecord(),days_from;
        	    if(Ext.isEmpty('${/model/aging_buckets_seq_from_path/record/@days}')){
        	       days_from=0;
        	    }else{
        	       days_from='${/model/aging_buckets_seq_from_path/record/@days}';
        	    }
        	    record.set('days_from',days_from);
        	}
        	function con307_analysis_cashflow_return(){
        	    $('${/parameter/@winid}').close();
        	}
		]]></script>
        <a:dataSets>
            <a:dataSet id="con307_aging_buckets_analysis_cashflow_head_ds" autoCreate="true">
                <a:fields>
                    <a:field name="contract_number" defaultValue="${/parameter/@contract_number}" readOnly="true"/>
                    <a:field name="contract_name" defaultValue="${/parameter/@contract_name}" readOnly="true"/>
                    <a:field name="days_from" readOnly="true"/>
                    <a:field name="days_to" defaultValue="${/model/aging_buckets_seq_to_path/record/@days}" readOnly="true"/>
                    <a:field name="contract_id" defaultValue="${/parameter/@contract_id}"/>
                    <a:field name="aging_bucket_seq" defaultValue="${/parameter/@aging_bucket_seq}"/>
                </a:fields>
                <a:events>
                    <a:event name="add" handler="on_analysis_cashflow_add"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="con307_aging_buckets_analysis_cashflow_line_ds" autoPageSize="true" autoQuery="true" model="cont.CON307.fnd_aging_result_ln_tmp_v" queryDataSet="con307_aging_buckets_analysis_cashflow_head_ds" selectable="true"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="con307_analysis_cashflow_return" text="HLS.RETURN"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="100" title="CON307.CON_CF_DETAILS" width="1000">
                <a:textField name="contract_number" bindTarget="con307_aging_buckets_analysis_cashflow_head_ds" prompt="HLS.CONTRACT_NUMBER"/>
                <a:textField name="contract_name" bindTarget="con307_aging_buckets_analysis_cashflow_head_ds" prompt="HLS.CONTRACT_NAME"/>
                <a:numberField name="days_from" bindTarget="con307_aging_buckets_analysis_cashflow_head_ds" decimalPrecision="-1" prompt="CON307.AGING_DAYS_FROM"/>
                <a:numberField name="days_to" bindTarget="con307_aging_buckets_analysis_cashflow_head_ds" decimalPrecision="-1" prompt="CON307.AGING_DAYS_TO"/>
            </a:form>
            <a:grid id="con307_aging_buckets_analysis_cashflow_grid_id" bindTarget="con307_aging_buckets_analysis_cashflow_line_ds" marginHeight="250" marginWidth="100" navBar="true">
                <a:columns>
                    <a:column name="times" align="right" prompt="CON307.CF_TIMES"/>
                    <a:column name="cf_item_name" prompt="HLS.CF_ITEM_DESC"/>
                    <a:column name="days" align="right" prompt="HLS.AGING_DAYS"/>
                    <a:column name="cf_direction" prompt="HLS.CF_DIRECTION"/>
                    <a:column name="due_date" prompt="CON307.DUE_DATE" renderer="Leaf.formatDate"/>
                    <a:column name="due_amount" align="right" prompt="CON307.PRE_DUE_AMOUNT" renderer="Leaf.formatMoney"/>
                    <a:column name="principal" align="right" prompt="CON307.PRE_PRINCIPAL" renderer="Leaf.formatMoney"/>
                    <a:column name="interest" align="right" prompt="CON307.PRE_INTEREST" renderer="Leaf.formatMoney"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
