<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2014-12-10 上午10:30:25  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
    <a:init-procedure><![CDATA[
    ]]></a:init-procedure>
    <a:view>
        <a:link id="add_apply_detail_link" url="${/request/@context_path}/modules/cont/CON572/con_contract_add_detail_confirm.lview"/>
        <script type="text/javascript"><![CDATA[
    		function con571_reset() {
    		    $('add_apply_query_ds').reset();
    		}
    		
    		function con571_query() {
    		    $('add_apply_result_ds').query();
    		}
    		
    		function con571_add_number_renderer(value, record, name) {
    		    if (name == 'apply_number') {
                    return '<a href="javascript:con572_open_apply_detail(' + record.id + ');">' + value + '</a>';
                }
    		}
    		
    		function con572_open_apply_detail(record_id) {
    		    var record=$('add_apply_result_ds').findById(record_id);
    		    var win = new Leaf.Window({
                    id: 'add_apply_detail_window',
                    url: $('add_apply_detail_link').getUrl(),
                    params: {
                        apply_id: record.get('apply_id'),
                        contract_id:record.get('contract_id'),
                        winId: 'add_apply_detail_window'
                    },
                    title: '补充协议申请明细',
                    fullScreen: true
                });
                win.on( 'close', function() {                          
                  	$('add_apply_result_ds').query();
                });  
    		    
    		}
    	]]></script>
        <a:dataSets>
            <a:dataSet id="apply_status_ds" loadData="true" lookupCode="CON572_ADD_APPLY_STATUS"/>
            <a:dataSet id="add_apply_query_ds">
                <a:fields>
                    <a:field name="apply_number"/>
                    <a:field name="contract_number"/>
                    <a:field name="apply_time_from"/>
                    <a:field name="apply_time_to"/>
                    <a:field name="apply_status_des" displayField="code_value_name" options="apply_status_ds" returnField="apply_status" valueField="code_value"/>
                    <a:field name="apply_status"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="add_apply_result_ds" autoPageSize="true" autoQuery="true" model="cont.CON572.con_contract_add_apply" queryDataSet="add_apply_query_ds" selectable="true" selectionModel="single"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="con571_reset" text="重置"/>
                <a:gridButton click="con571_query" text="HLS.QUERY"/>
            </a:screenTopToolbar>
            <a:form column="5" marginWidth="60" title="查询条件">
                <a:textField name="apply_number" bindTarget="add_apply_query_ds" prompt="申请编号"/>
                <a:textField name="contract_number" bindTarget="add_apply_query_ds" prompt="合同编号"/>
                <a:datePicker name="apply_time_from" bindTarget="add_apply_query_ds" prompt="申请日期从"/>
                <a:datePicker name="apply_time_to" bindTarget="add_apply_query_ds" prompt="申请日期到"/>
                <a:comboBox name="apply_status_des" bindTarget="add_apply_query_ds" prompt="申请状态"/>
            </a:form>
            <a:grid id="add_apply_result_grid" bindTarget="add_apply_result_ds" marginHeight="150" marginWidth="60" navBar="true">
                <a:columns>
                    <a:column name="apply_number" align="center" prompt="申请编号" renderer="con571_add_number_renderer" width="150"/>
                    <a:column name="contract_number" align="center" prompt="合同号" width="150"/>
                    <a:column name="contract_name" align="center" prompt="合同名称" width="200"/>
                    <a:column name="apply_time" align="center" prompt="申请时间" renderer="Leaf.formatDate" width="150"/>
                    <a:column name="apply_person_des" align="center" prompt="申请人" width="150"/>
                    <a:column name="apply_status_des" align="center" prompt="申请状态" width="150"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
