<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Clocc  
    $Date: 2015-6-10 下午3:34:58  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <a:link id="con_write_off_reverse_detail_link" url="${/request/@context_path}/modules/cont/CON410/con_write_off_reverse_detail_contract_query.lview"/>
        <script type="text/javascript"><![CDATA[
            var body = $('${/parameter/@winId}').wrap;
            
            function csh514_write_off_reverse_return() {
                $('${/parameter/@winId}').close();
            }
            
            function csh514_formatDate(v) {
                if (v) {
                    return v.parseDate('yyyy-mm-dd hh24:mi:ss').format('yyyy-mm-dd');
                }else{
                    return '';
                }
            }
            
             function resetFunction() {
                $('con_write_off_reverse_detail_query_ds').reset();
            }
        
			function queryFunction(){
				$('con_write_off_reverse_detail_result_ds').query();
				 }	
				 
			function contract_detail(value, record, name) {
                var contract_id = record.get('contract_id');                
                if (record.get('contract_id')) {
                    return '<a href="javascript:perfectEmployeeInfo('+contract_id+')">' + value + '</a>';
                }
            }           
            function perfectEmployeeInfo(id) {
                var url = $('con_write_off_reverse_detail_link').getUrl() + '?contract_id=' + id;
                new Leaf.Window({
                    id: 'con_write_off_reverse_detail_window_id', 
                    
                    url: url,
                    params :{
                        winId: 'con_write_off_reverse_detail_window_id'
                    },
                    title: '详情页',
                    // height:365,
                    // width:465,
                    fullScreen: true
                });
            }	
            
            function dateValidator(record, name, value) { //日期校验方法
                if (name == 'transaction_date_from' || name == 'transaction_date_to') {
                    var start_date = Leaf.formatDate(record.get('transaction_date_from'));
                    var end_date = Leaf.formatDate(record.get('transaction_date_to'));
                    if ( !! end_date) { //由于结束日期非必填，只有在结束日期填了才进行比较
                        if (!compareDate(start_date, end_date)) {
                            return '${l:CSH510.CSH_RECEIPT_DATE_CHECK}'; //校验不通过返回字符串
                        }
                    }
                    return true; //校验通过返回true
                }
            } 
        ]]></script>
        <a:dataSets>
            <a:dataSet id="con_write_off_reverse_detail_query_ds">
                <a:fields>
                    <a:field name="bp_name" lovHeight="530" lovService="cont.CON410.con_write_off_reverse_detail_bp_name_lov" lovWidth="550" title="承租人"/>
                    <a:mapping>
                        <a:map from="bp_name" to="bp_name"/>
                    </a:mapping>
                    <a:field name="write_off_type_name"/>
                    <a:field name="contract_number"/>
                    <a:field name="write_off_date_from"/>
                    <a:field name="write_off_date_to"/>
                    <a:field name="reversed_flag" defaultValue="R"/>
                    <a:field name="bank_slip_num_from"/>
                    <a:field name="bank_slip_num_to"/>
                    <a:field name="transaction_date_from"/>
                    <a:field name="transaction_date_to"/>
                    <a:field name="due_date_from"/>
                    <a:field name="due_date_to"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="con_write_off_reverse_detail_result_ds" autoPageSize="true" autoQuery="true" model="cont.CON410.con_write_off_reverse_detail_query" queryDataSet="con_write_off_reverse_detail_query_ds"><![CDATA[
            ]]></a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="queryFunction" text="HAP_QUERY"/>
                <a:gridButton click="resetFunction" text="HLS.RESET"/>
            </a:screenTopToolbar>
            <a:form bindTarget="con_write_off_reverse_detail_query_ds" column="4" labelWidth="130" marginWidth="30" title="核销反冲明细查询">
                <a:lov name="bp_name" bindTarget="con_write_off_reverse_detail_query_ds" prompt="承租人"/>
                <a:textField name="contract_number" bindTarget="con_write_off_reverse_detail_query_ds" prompt="合同序号"/>
                <a:datePicker name="write_off_date_from" bindTarget="con_write_off_reverse_detail_query_ds" prompt="核销日期从"/>
                <a:datePicker name="write_off_date_to" bindTarget="con_write_off_reverse_detail_query_ds" prompt="核销日期至"/>
                <a:datePicker name="transaction_date_from" bindTarget="con_write_off_reverse_detail_query_ds" prompt="HLS.TRANSACTION_DATE_FROM"/>
                <a:datePicker name="transaction_date_to" bindTarget="con_write_off_reverse_detail_query_ds" prompt="HLS.TRANSACTION_DATE_TO"/>
                <a:textField name="bank_slip_num_from" bindTarget="con_write_off_reverse_detail_query_ds" prompt="单据号从"/>
                <a:textField name="bank_slip_num_to" bindTarget="con_write_off_reverse_detail_query_ds" prompt="单据号至"/>
                <a:textField name="write_off_type_name" bindTarget="con_write_off_reverse_detail_query_ds" prompt="核销类型"/>
                <a:datePicker name="due_date_from" bindTarget="con_write_off_reverse_detail_query_ds" prompt="预订收款日从"/>
                <a:datePicker name="due_date_to" bindTarget="con_write_off_reverse_detail_query_ds" prompt="预订收款日至"/>
            </a:form>
            <a:grid id="con_write_off_reverse_detail_grid_ds" bindTarget="con_write_off_reverse_detail_result_ds" marginHeight="200" marginWidth="30" navBar="true">
                <a:toolBar>
                    <a:button type="excel"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="write_off_type_name" prompt="核销类型"/>
                    <a:column name="bank_slip_num" prompt="单据号"/>
                    <a:column name="division" prompt="产品线"/>
                    <a:column name="write_off_date" renderer="Leaf.formatDate" width="80"/>
                    <a:column name="transaction_date" prompt="交易日期" renderer="Leaf.formatDate" width="80"/>
                    <a:column name="csh_write_off_amount" align="right" renderer="Leaf.formatMoney"/>
                    <a:column name="cf_item_name" prompt="CSH513.CF_TYPE" width="60"/>
                    <a:column name="write_off_due_amount" align="right" renderer="Leaf.formatMoney"/>
                    <a:column name="write_off_principal" align="right" renderer="Leaf.formatMoney"/>
                    <a:column name="write_off_interest" align="right" renderer="Leaf.formatMoney"/>
                    <!-- <a:column name="write_off_penalty" prompt="CSH513.WRITE_OFF_PENALTY"  renderer="Leaf.formatMoney"/> -->
                    <a:column name="due_date" prompt="CSH513.DUE_DATE" renderer="Leaf.formatDate" width="80"/>
                    <a:column name="times" align="right" prompt="期数"/>
                    <a:column name="contract_number" prompt="HLS.CONTRACT_NUMBER" renderer="contract_detail" width="110"/>
                    <a:column name="project_name" prompt="PRJ501.PRJ_PROJECT.PROJECT_NAME" width="180"/>
                    <a:column name="company_name" prompt="出租人" width="180"/>
                    <a:column name="bp_name" prompt="CSH513.BP_TENANT" width="180"/>
                    <a:column name="reversed_flag_desc" prompt="反冲标志" width="80"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
