<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: syj  
    $Date: 2015年7月15日09:26:37
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="basic.sys_session_info" rootPath="sys_session_info"/>
        <a:model-query defaultWhereClause="t1.document_category=&apos;CONTRACT&apos; and document_type in (&apos;CONL&apos;,&apos;CONLB&apos;)" fetchAll="true" model="basic.hls_document_type_for_lov" rootPath="con731document_type_path"/>
        <a:model-query fetchAll="true" model="cont.CON301.con_contract_business_type_list" rootPath="con731business_type_list"/>
        <a:model-query defaultWhereClause="(exists(select 1 from hls_lease_org_assign ha where ha.unit_id=t1.unit_id))" fetchAll="true" model="basic.exp_org_unit_manager_lov" rootPath="con731exp_org_unit_manager_path"/>
    </a:init-procedure>
    <a:view>
        <a:link id="con734_open_maintain_window_link" url="${/request/@context_path}/modules/cont/CON734/con_contingent_rental_maintain.lview"/>
        <a:link id="con734_open_maintain_window_r_link" url="${/request/@context_path}/modules/cont/CON734/con_contingent_rental_maintain_readOnly.lview"/>
        <script type="text/javascript"><![CDATA[
            function open_window(contract_id, req_id) {
                new Leaf.Window({
                    id: 'con734_maintain_window_id',
                    url: $('con734_open_maintain_window_link').getUrl() + '?contract_id=' + contract_id + '&req_id=' + req_id,
                    title: '或有租金维护',
                    fullScreen: true
                });
            }
            
            function open_window_R(contract_id, req_id) {
                new Leaf.Window({
                    id: 'con734_maintain_window_id',
                    url: $('con734_open_maintain_window_r_link').getUrl() + '?contract_id=' + contract_id + '&req_id=' + req_id,
                    title: '或有租金维护',
                    fullScreen: true
                });
            }
            
            function con731render_contractMaintainDs_grid(value, record, name) {
                var contract_id = record.get('contract_id');
                var req_id = record.get('req_id');
                var approval_status = record.get('approval_status');
                if (approval_status == 'APPROVED' || approval_status == 'APPROVING') {
                    return '<a href="javascript:open_window_R(' + contract_id + ',' + req_id + ');">' + value + '</a>';
                } else {
                    return '<a href="javascript:open_window(' + contract_id + ',' + req_id + ');">' + value + '</a>';
                }
            
            
            }
            
            function con733_back() {
                history.go(-1);
            }
            
            function con731con_contract_query() {
                $('con733contract_result_ds').query();
            }
            
            function con733_reset() {
                $('con733contract_query_ds').reset();
            }
            
            
            function lock_list_window() {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
            }
            
            function unlock_list_window() {
                Leaf.Masker.unmask(Ext.getBody());
            }
            
            function con733_open() {
                var ds = $('con733contract_result_ds');
                var records = ds.getSelected();
                var record = records[0];
                var contract_id = record.get('contract_id');
                var req_id = record.get('req_id');
                var approval_status = record.get('approval_status');
                if (approval_status == 'APPROVED' || approval_status == 'APPROVING') {
                    open_window_R(contract_id, req_id);
                } else {
                    open_window(contract_id, req_id);
                }
            }
            
            function con733_query() {
                $('con733contract_result_ds').query();
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="approval_status_ds" lookupCode="CON_WFL_STATUS"/>
            <a:dataSet id="con733contract_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="contract_status_cancel" defaultValue="CANCEL"/>
                    <a:field name="bp_name" autoComplete="true" lovGridHeight="350" lovHeight="500" lovService="basic.hls_bp_master_v_for_lov" lovWidth="500" title="HLS.BP_TITLE">
                        <a:mapping>
                            <a:map from="bp_name" to="bp_name"/>
                            <a:map from="bp_id" to="bp_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id"/>
                    <a:field name="approval_status_n" displayField="code_value_name" options="approval_status_ds" returnField="approval_status" valueField="code_value"/>
                    <a:field name="approval_status"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="con733contract_result_ds" autoPageSize="true" autoQuery="true" model="cont.CON733.con_contingent_rental_req" queryDataSet="con733contract_query_ds" selectable="true" selectionModel="single"><![CDATA[
               
            ]]></a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="con733_back" text="HLS.BACK"/>
                <a:gridButton click="con733_query" text="HLS.QUERY"/>
                <a:gridButton click="con733_reset" text="HLS.RESET"/>
                <a:gridButton click="con733_open" text="申请明细"/>
            </a:screenTopToolbar>
            <a:form column="4" labelSeparator=" " labelWidth="100" marginWidth="30" title="CON301.CONTRACT_QUERY">
                <a:textField name="contingent_number" bindTarget="con733contract_query_ds" prompt="申请编号"/>
                <a:datePicker name="due_date" bindTarget="con733contract_query_ds" prompt="收取日期"/>
                <a:numberField name="due_amount" bindTarget="con733contract_query_ds" prompt="收取金额"/>
                <a:lov name="bp_name" bindTarget="con733contract_query_ds" prompt="收款对象"/>
                <a:comboBox name="approval_status_n" bindTarget="con733contract_query_ds" prompt="审批状态"/>
            </a:form>
            <a:grid id="con733con_contract_grid_ds" bindTarget="con733contract_result_ds" marginHeight="265" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="contingent_number" lock="true" prompt="申请编号" renderer="con731render_contractMaintainDs_grid" width="160"/>
                    <a:column name="due_date" prompt="收取日期" renderer="Leaf.formatDate" width="160"/>
                    <a:column name="due_amount" prompt="收取金额" renderer="Leaf.formatMoney" width="200"/>
                    <a:column name="bp_name" prompt="收款对象" width="80"/>
                    <a:column name="approval_status_n" prompt="审批状态"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>