<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-9-29 下午02:48:34  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:c="leaf.application.action" xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="cont.CON307.con_cf_aging_buckets_lines" rootPath="aging_bucket_lines_path"/>
        <s:server-script import="con_cf_aging_buckets_analyze.js"/>
    </a:init-procedure>
    <a:view>
        <a:link id="con_aging_buckets_analyze_cashflow_link_id" url="${/request/@context_path}/modules/cont/CON307/con_cf_aging_buckets_analyze_cashflow.lview"/>
        <script type="text/javascript"><![CDATA[
        	function con307_analyze_detail_return(){
        	    $('${/parameter/@winid}').close();
        	}
        	function on_analyze_detail_line_load(ds){
        	    var bucket_lines_records=$('aging_bucket_lines_ds').getAll();
        	    for(var i=0;i<bucket_lines_records.length;i++){
        	        var bucket_lines_record=bucket_lines_records[i];
        	    }
        	}
        	var hls_aging_record={};
        	function see_aging_bucket_line_renderer(value,record,name){
        	    if(record){
        	        return Leaf.formatMoney(value);
        	    }
        	}
        	function openWindow(name,id){
        	    var record=hls_aging_record[id+'---'+name];
        	    new Leaf.Window({
        	        id:'con_aging_buckets_analyze_cashflow_winid',
        	        url:$('con_aging_buckets_analyze_cashflow_link_id').getUrl(),
        	        params:{
        	            winid:'con_aging_buckets_analyze_cashflow_winid',
        	            aging_bucket_seq:name.replace('aging_bucket_',''),
        	            aging_bucket_id:'${/parameter/@aging_bucket_id}',
        	            contract_number:record.get('contract_number'),
        	            contract_name:record.get('contract_name'),
        	            contract_id:record.get('contract_id')
        	        },
        	        title:'${l:CON307.CON_CF_DETAILS}',
        	        fullScreen:true,
        	        draggable:true
        	    });
        	}
        	
        	function con307_excel(){
                $('con307_aging_buckets_analyze_detail_grid_id')._export('xls','con307_aging_buckets_analyze_detail_grid_id');
            }
		]]></script>
        <a:dataSets>
            <a:dataSet id="aging_bucket_lines_ds">
                <a:datas dataSource="/model/aging_bucket_lines_path"/>
            </a:dataSet>
            <a:dataSet id="con307_aging_buckets_analyze_detail_header_ds" autoCreate="true">
                <a:fields>
                    <a:field name="aging_bucket_code" defaultValue="${/parameter/@aging_bucket_code}" readOnly="true"/>
                    <a:field name="analyze_date" defaultValue="${/parameter/@analyze_date}" readOnly="true"/>
                    <a:field name="currency_code" defaultValue="${/parameter/@currency_code}" readOnly="true"/>
                    <a:field name="currency_name" defaultValue="${/parameter/@currency_name}" readOnly="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="con307_aging_buckets_analyze_detail_line_ds" autoPageSize="true" autoQuery="true" model="cont.CON307R.con_revenue_aging_buckets_analyze_dynamic_line" pageSize="500" queryDataSet="con307_aging_buckets_analyze_ds">
                <a:events>
                    <a:event name="load" handler="on_analyze_detail_line_load"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="con307_analyze_detail_return" text="HLS.RETURN"/>
                <a:gridButton click="con307_excel" text="HLS.EXPORT"/>
            </a:screenTopToolbar>
            <a:form column="3" labelWidth="120" title=" " width="800">
                <a:textField name="aging_bucket_code" bindTarget="con307_aging_buckets_analyze_detail_header_ds" prompt="HLS.AGING_BUCKET_CODE"/>
                <a:datePicker name="analyze_date" bindTarget="con307_aging_buckets_analyze_detail_header_ds" prompt="HLS.ANALYZE_DATE"/>
                <a:comboBox name="currency_name" bindTarget="con307_aging_buckets_analyze_detail_header_ds" prompt="HLS.CURRENCY"/>
            </a:form>
            <a:grid id="con307_aging_buckets_analyze_detail_grid_id" bindTarget="con307_aging_buckets_analyze_detail_line_ds" marginHeight="200" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="contract_number" lock="true" prompt="HLS.CONTRACT_NUMBER" width="120"/>
                    <a:column name="contract_name" lock="true" prompt="HLS.CONTRACT_NAME" width="250"/>
                    <a:column name="currency" lock="true" prompt="HLS.CURRENCY" width="80"/>
                    <a:column name="sum_due_amount" align="right" prompt="CON307.SUM_DUE_AMOUNT" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="sum_received_amount" align="right" prompt="CON307.SUM_RECEIVED_AMOUNT" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="sum_overdue_amount" align="right" prompt="CON307.SUM_OVERDUE_AMOUNT" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="sum_forecast_amount" align="right" prompt="CON307.SUM_FORECAST_AMOUNT" renderer="Leaf.formatMoney" width="120"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
