<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Mouse Chow  
    $Date: 2012-6-14 下午04:54:01  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <script type="text/javascript"><![CDATA[
			
			function detail_returnFunction(){
			    $('sys_service_usage_detail_screen').close();
			}
			        	function sys_8050_child_grid_add(){
                $('sys_8050_child_grid').showEditorByRecord($('usage_detail_result_ds').create());
            }
            function sys_8050_child_grid_clear(){
                $('sys_8050_child_grid').clear();
            }
            function sys_8050_child_grid_remove(){
                $('sys_8050_child_grid').remove();
            }
            function sys_8050_child_grid_submit() {
                var result_ds = $('usage_detail_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
			
		]]></script>
        <a:dataSets>
            <a:dataSet id="usage_detail_head_ds" autoCreate="true" model="sys.sys_service_usage">
                <a:fields>
                    <a:field name="usage_code"/>
                    <a:field name="usage_description"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="usage_detail_result_ds" autoQuery="true" model="sys.sys_service_usage_detail" notification="有数据没有保存" pageSize="15" queryUrl="${/request/@context_path}/autocrud/sys.sys_service_usage_detail/query?usage_id=${/parameter/@usage_id}" selectable="true">
                <a:fields>
                    <a:field name="detail_id"/>
                    <a:field name="usage_id" defaultValue="${/parameter/@usage_id}" required="true"/>
                    <a:field name="service_id" required="true"/>
                    <a:field name="service_name" lovGridHeight="320" lovHeight="450" lovService="sys.sys_service" lovWidth="500" prompt="PAGE_NAME" required="true" title="PAGE_SELECT">
                        <a:mapping>
                            <a:map from="service_name" to="service_name"/>
                            <a:map from="title" to="title"/>
                            <a:map from="service_id" to="service_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="title" prompt="FND_SERVICE.TITLE"/>
                    <a:field name="usage_detail_code" required="true"/>
                    <a:field name="usage_detail_description" required="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar height="29">
                <a:button click="sys_8050_child_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_child_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_child_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_child_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="detail_returnFunction" 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_DETAIL" width="780">
                <a:label name="usage_code" bindTarget="usage_detail_head_ds"/>
                <a:label name="usage_description" bindTarget="usage_detail_head_ds"/>
            </a:form>
            <a:grid id="sys_8050_child_grid" bindTarget="usage_detail_result_ds" height="460" navBar="true" width="780">
                <a:columns>
                    <a:column name="service_name" align="left" editor="detail_lov" width="300"/>
                    <a:column name="title" width="120"/>
                    <a:column name="usage_detail_code" align="center" editor="detail_textfield" width="120"/>
                    <a:column name="usage_detail_description" editor="detail_textfield" width="150"/>
                </a:columns>
                <a:editors>
                    <a:lov id="detail_lov"/>
                    <a:textField id="detail_textfield"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
        	
        		
        		var recordIndex = '${/parameter/@record_index}';
        		var record = $('sys_service_usage_result_ds').getAt(recordIndex);
        		$('usage_detail_head_ds').getAt(0).set('usage_code',record.get('usage_code'));
        		$('usage_detail_head_ds').getAt(0).set('usage_description',record.get('usage_description'));
        		
        	
        ]]></script>
    </a:view>
</a:screen>