<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qianming  
    $Date: 2015-9-9 下午01:47:51  
    $Revision: 1.0  
    $Purpose: 收付款明细
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <script type="text/javascript"><![CDATA[
            function quit() {
                $('con_contract_balance_details_win').close();
            }
            
            function con_contract_balance_details_clear() {
                $('con_contract_balance_details_line_grid').clear();
            }
            
            function con_contract_balance_details_query() {
                $('con_contract_balance_details_line_ds').query();
            }
            function con_contract_balance_details_export() {
                $('con_contract_balance_details_line_grid')._export();
            }
            function con_contract_balance_details_line_load(ds) {
                var grid_id = $('con_contract_balance_details_line_grid');
                grid_id.hideColumn('principal');
                grid_id.hideColumn('interest');
                grid_id.hideColumn('received_principal');
                grid_id.hideColumn('received_interest');
                grid_id.hideColumn('outstanding_int_tax_incld');
                grid_id.hideColumn('outstanding_prin_tax_incld');
                grid_id.hideColumn('outstanding_rental_tax_incld');
                grid_id.hideColumn('cf_item');
            }
            
            function times_renderer(value, record, name) {
                return '<span style="color:' + record.get('colour_scheme') + '">' + value + '</span>';
            }
            
            function cf_item_desc_renderer(value, record, name) {
                return '<span style="color:' + record.get('colour_scheme') + '">' + value + '</span>';
            }
            
            function due_date_renderer(value, record, name) {
                return '<span style="color:' + record.get('colour_scheme') + '">' + Leaf.formatDate(value) + '</span>';
            }
            
            function due_amount_renderer(value, record, name) {
                return '<span style="color:' + record.get('colour_scheme') + '">' + Leaf.formatMoney(value) + '</span>';
            }
            
            function last_received_date_renderer(value, record, name) {
                return '<span style="color:' + record.get('colour_scheme') + '">' + Leaf.formatDate(value) + '</span>';
            }
            
            function received_amount_renderer(value, record, name) {
                return '<span style="color:' + record.get('colour_scheme') + '">' + Leaf.formatMoney(value) + '</span>';
            }
            
            function unpaid_amount_renderer(value, record, name) {
                return '<span style="color:' + record.get('colour_scheme') + '">' + Leaf.formatMoney(value) + '</span>';
            }
            
            function unpaid_fine_renderer(value, record, name) {
                return '<span style="color:' + record.get('colour_scheme') + '">' + Leaf.formatMoney(value) + '</span>';
            }
            
            function total_amount_renderer(value, record, name) {
                return '<span style="color:' + record.get('colour_scheme') + '">' + Leaf.formatMoney(value) + '</span>';
            }
            
            // function set_export_parameter(){
                // var new_records=$('con_contract_balance_details_line_ds').getAll();
                // var all_records=$('con_contract_balance_details_export_ds').getAll();
                // if(new_records.length==all_records.length){
                    // return;
                // }
                // var export_record;
                // var choose_record;
                // var list=[];
                // for(var i=0;i<new_records.length;i++){
                     // export_record=new_records[i];
                     // choose_record=$('con_contract_balance_details_export_ds').find('cashflow_id',export_record.get('cashflow_id'));
                    // if(choose_record){
                    	// list.push(export_record.get('cashflow_id'));
                    // }
                // }
                // list=list.join(',');
                // $('con_contract_balance_details_line_ds').setQueryParameter('export_list',list);
            // }
            
            function con_contract_balance_details_line_query(ds,qpara){
                delete qpara['export_list'];
            }
            function cf_direction_render_func(value,record,name){
                if(value === 'INFLOW'){
                    return '应收项';
                }else if(value === 'OUTFLOW'){
                    return '<font color="red">应付项</font>';
                }
                return '';
            }
            function write_off_flag_func(value,record,name){
                if(value === 'FULL'){
                    return '<font color="red">完全核销</font>';
                }else if(value === 'PARTIAL'){
                    return '部分核销';
                }else{
                    return '未核销';
                }
            }
        ]]></SCRIPT>
        <style><![CDATA[
        	a:link {color: #0000EE}  
        	a:hover {color: #ff8400} 
			a:active {color:#0A0A0A }
			a:visited {color:#0A0A0A} 
        ]]></style>
        <a:dataSets>
            <a:dataSet id="con_contract_balance_details_line_ds" autoQuery="true" fetchAll="true" model="csh.CSH501.con_contract_balance_details_line" queryUrl="${/request/@context_path}/autocrud/csh.CSH501.con_contract_balance_details_line/query?contract_id=${/parameter/@contract_id}" selectable="true">
                <a:events>
                    <a:event name="load" handler="con_contract_balance_details_line_load"/>
                    <a:event name="query" handler="con_contract_balance_details_line_query"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="quit" text="HLS.CLOSE"/>
                <a:gridButton click="con_contract_balance_details_clear" text="HLS.CLEAR"/>
                <a:gridButton click="con_contract_balance_details_export" text="HLS.EXPORT"/>
            </a:screenTopToolbar>
            <a:grid id="con_contract_balance_details_line_grid" bindTarget="con_contract_balance_details_line_ds" marginHeight="120" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="times" align="center" prompt="CON305.TIMES" renderer="times_renderer" width="50"/>
                    <a:column name="cf_item" align="center" prompt="HLS.CF_ITEM"/>
                    <a:column name="cf_item_desc" prompt="CON305.CF_ITEM" renderer="cf_item_desc_renderer" width="80"/>
                    <a:column name="cf_direction" align="center" prompt="类型" renderer="cf_direction_render_func" width="80"/>
                    <a:column name="write_off_flag" align="center" prompt="核销情况" renderer="write_off_flag_func" width="80"/>
                    <a:column name="due_date" prompt="预定收/付款日" renderer="due_date_renderer" width="90"/>
                    <a:column name="calc_date" prompt="计算日" renderer="due_date_renderer" width="90"/>
                    <a:column name="due_amount" align="right" prompt="预定收/付款金额" renderer="due_amount_renderer" width="130"/>
                    <a:column name="principal" align="right" prompt="预定收/付款本金" renderer="Leaf.formatMoney" width="130"/>
                    <a:column name="interest" align="right" prompt="预定收/付款利息" renderer="Leaf.formatMoney" width="130"/>
                    <a:column name="last_received_date" prompt="最后收/付款日" renderer="last_received_date_renderer" width="90"/>
                    <a:column name="received_amount" align="right" prompt="已收/付金额" renderer="received_amount_renderer" width="130"/>
                    <a:column name="received_principal" align="right" prompt="已收/付本金" renderer="Leaf.formatMoney" width="130"/>
                    <a:column name="received_interest" align="right" prompt="已收/付利息" renderer="Leaf.formatMoney" width="130"/>
                    <a:column name="unpaid_amount" align="right" prompt="未收/付金额" renderer="unpaid_amount_renderer" width="130"/>
                    <a:column name="outstanding_rental_tax_incld" align="right" prompt="TRE503.RESIDUE_RENTAL" renderer="Leaf.formatMoney" width="130"/>
                    <a:column name="outstanding_prin_tax_incld" align="right" prompt="TRE503.UNPAY_PRINCIPAL" renderer="Leaf.formatMoney" width="130"/>
                    <a:column name="outstanding_int_tax_incld" align="right" prompt="TRE503.UNPAY_INTEREST" renderer="Leaf.formatMoney" width="130"/>
                    <a:column name="unpaid_fine" align="right" prompt="未收罚金" renderer="unpaid_fine_renderer" width="130"/>
                    <a:column name="received_fine" align="right" prompt="已收罚金" width="130"/>
                    <a:column name="total_amount" align="right" prompt="已收/付总额(含罚息)" renderer="total_amount_renderer" width="130"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>