<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Mouse Chow  
    $Date: 2012-6-14 下午01:50:14  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <a:link id="SYS8050_sys_service_usage_detail_link" url="${/request/@context_path}/modules/sys/SYS8050/sys_service_usage_detail.lview"/>
        <a:link id="rental_agent_link2" url="${/request/@context_path}/autocrud/sys.sys_service_usage"/>
        <script type="text/javascript"><![CDATA[
				function usage_queryFunction(){
				    $('sys_service_usage_result_ds').query();
				}
				
				function usage_resetFunction(){
					$('sys_service_usage_query_ds').reset();
				}
				
				function usageCodeEditFun(record,name){
				    if(record.isNew){
				        return 'usage_textField';
				    }
				    return '';
				}
				
				function usageDetailRenderer(value,record,name){
				    if(record.isNew){
				        return '';
				    }
				    return '<a href=\'javascript:jumpUsageDetail(' + record.get('usage_id') + ',' + $('sys_service_usage_result_ds').indexOf(record) + ');\'>' + '${l:DETAIL}' + '</a>';
				}
				
				function jumpUsageDetail(usageId,recordIndex){
				    new Leaf.Window({
				        id:'sys_service_usage_detail_screen',
				    	url:$('SYS8050_sys_service_usage_detail_link').getUrl() + '?usage_id=' + usageId + '&record_index=' + recordIndex,				    
				    	title:'${l:SYS_SERVICE_USAGE_DETAIL}',
				    	width:800,
				    	height:600
				    });
				}
				
		   function queryService(){
                $('sys_service_usage_result_ds').query();
            }		
				
		  function sys_8050_grid_add(){
                $('sys_service_usage_grid').showEditorByRecord($('sys_service_usage_result_ds').create());
            }
            function sys_8050_grid_clear(){
                $('sys_service_usage_grid').clear();
            }
           function sys_8050_grid_remove(){
                $('sys_service_usage_grid').remove();
            }
            
            
            
            function sys_8050_grid_submit() {
                var result_ds = $('sys_service_usage_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }	
				
			function sys_8050_next(){
                 history.go(1);
            }
            function sys_8050_back(){
                history.go(-1);
            }
            function sys_8050_quit(){
                location.href = $('sys_service_welcome_link').getUrl();
            }
				
			
		]]></script>
        <a:dataSets>
            <a:dataSet id="sys_service_usage_query_ds" model="sys.sys_service_usage">
                <a:fields>
                    <a:field name="usage_code"/>
                    <a:field name="usage_description"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="sys_service_usage_result_ds" autoQuery="true" model="sys.sys_service_usage" notification="有数据没有保存" pageSize="15" queryDataSet="sys_service_usage_query_ds" selectable="true">
                <a:fields>
                    <a:field name="usage_code" required="true"/>
                    <a:field name="usage_description" required="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar height="29">
                <a:button click="sys_8050_back" height="20" icon="${/request/@context_path}/images/back.png" iconAlign="left" text="HLS.BACK" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="sys_8050_next" height="20" icon="${/request/@context_path}/images/forward.png" iconAlign="left" text="HLS.FORWARD" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="sys_8050_grid_add" height="20" icon="${/request/@context_path}/images/add.png" iconAlign="left" text="HLS.NEW" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="sys_8050_grid_remove" height="20" icon="${/request/@context_path}/images/remove.png" iconAlign="left" text="HLS_REMOVE" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="sys_8050_grid_clear" height="20" icon="${/request/@context_path}/images/clear.png" iconAlign="left" text="HLS.CLEAR" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="sys_8050_grid_submit" height="20" icon="${/request/@context_path}/images/save.png" iconAlign="left" text="HLS.SAVE" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="sys_8050_quit" height="20" icon="${/request/@context_path}/images/quit.png" iconAlign="left" text="HLS.EXIT" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="queryService" height="20" icon="${/request/@context_path}/images/search.png" iconAlign="left" text="HLS.QUERY" width="50"/>
                <a:separator style="margin-left:3px;"/>
            </a:screenTopToolbar>
            <a:form column="2" labelWidth="100" title="SYS_SERVICE_USAGE.TITIEL">
                <a:textField name="usage_code" bindTarget="sys_service_usage_query_ds"/>
                <a:textField name="usage_description" bindTarget="sys_service_usage_query_ds"/>
            </a:form>
            <a:grid id="sys_service_usage_grid" bindTarget="sys_service_usage_result_ds" height="490" marginWidth="20" navBar="true" width="1000">
                <a:columns>
                    <a:column name="usage_code" align="left" editorFunction="usageCodeEditFun" width="200"/>
                    <a:column name="usage_description" editor="usage_textField" width="350"/>
                    <a:column name="usage_detail" align="center" prompt="DETAIL" renderer="usageDetailRenderer" width="150"/>
                </a:columns>
                <a:editors>
                    <a:textField id="usage_textField"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>