<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing $
-->
<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"/>
        <div/>
        <script type="text/javascript"><![CDATA[
            function rsc201_class_target_query() {
                $('rsc_five_class_targets_result_ds').query();
            }
            
            function rsc201_class_target_grid_submit() {
                var result_ds = $('rsc_five_class_targets_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            
            function rsc201_class_target_grid_add() {
                $('rsc201_class_target_grid').showEditorByRecord($('rsc_five_class_targets_result_ds').create());
            }
            
           
            
            function rsc201_class_target_quit() {
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
            
            
            
            function rsc201ModifyPageRenderer(value, record, name) {
                if(record.get('include_target_value')=='Y')
                {
	                var five_class_target_code = record.get('five_class_target');
	                if (record.isNew) {
	                    return '';
	                }
	                return '<a href="javascript:rsc201OpenPage(\'' + five_class_target_code + '\')">${l:RSC_FIVE_CLASS_TARGET.TARGET_VALUE_DEFINE}</a>';
	            }
            }
            
            function rsc201OpenPage(value) {
                new Leaf.Window({
                    id: 'rsc_five_class_target_value',
                    url: 'rsc_five_class_target_value.lview?five_class_target_code=' + value,
                    title: '${l:RSC_FIVE_CLASS_TARGETS.DETAIL_TITLE}',
                    height: 430,
                    width: 680
                });
            }
            
            function five_class_target_code_ef(record, name) {
                if(record.isNew)
                {
                    return 'rsc_five_class_targets_result_grid_tf';
                }
                else
                {
                    return '';
                }
            
            }
            
            function submitSuccess_reflashResultDs(ds,rec)
            {
                ds.query();
            }
            
            
            function usageTypeFunction(record,name)
            {
                if(record.isNew)
                {
                    return 'rsc_five_class_targets_result_grid_comb';
                }
                else
                {
                    return '';
                }
            }
            
        ]]></script>
        <a:dataSets>
            <a:dataSet id="rsc_five_class_target_object" lookupCode="RSC201_TARGET_OBJECT"/>
            <a:dataSet id="rsc_five_class_targets_query_ds"/>
            <a:dataSet id="rsc_data_type" lookupCode="HLS050_DATA_TYPE"/>
            <a:dataSet id="rec200_usage_type_ds" lookupCode="RSC200_RSC_FIVE_CLASS_USAGE_TYPE"/>
            <a:dataSet id="rsc200_target_uom_ds" loadData="true" model="rsc.RSC201.fnd_uom_codes_vl"/>
            <a:dataSet id="rsc_five_class_targets_result_ds" autoCount="true" autoQuery="true" fetchAll="false" model="rsc.RSC201.rsc_five_class_target" pageSize="15" queryDataSet="rsc_five_class_targets_query_ds" queryUrl="${/request/@context_path}/autocrud/rsc.RSC201.rsc_five_class_target/query?ORDER_FIELD=five_class_target_code" selectable="true">
                <a:fields>
                    <a:field name="five_class_target" required="true"/>
                    <a:field name="name" required="true"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="include_target_value" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                    <a:field name="usage_type_desc" displayField="code_value_name" options="rec200_usage_type_ds" prompt="RSC_FIVE_CLASS_TARGET.USAGE_TYPE" required="true" returnField="usage_type" valueField="code_value"/>
                    <a:field name="target_object_desc" displayField="code_value_name" options="rsc_five_class_target_object" prompt="RSC_FIVE_CLASS_TARGET.TARGET_OBJECT" required="true" returnField="target_object" valueField="code_value"/>
                    <a:field name="target_uom_desc" displayField="description_text" options="rsc200_target_uom_ds" prompt="RSC_FIVE_CLASS_TARGET.TARGET_UOM" returnField="target_uom" valueField="uom_code"/>
                    <a:field name="target_type_desc" displayField="code_value_name" options="rsc_data_type" required="true" returnField="target_type" valueField="code_value"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="submitSuccess_reflashResultDs"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="rsc201_class_target_quit" text="HLS.EXIT"/>
                <a:gridButton click="rsc201_class_target_query" text="HLS.QUERY"/>
                <a:gridButton click="rsc201_class_target_grid_add" text="HLS.NEW"/>
                <a:gridButton click="rsc201_class_target_grid_submit" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:grid id="rsc201_class_target_grid" bindTarget="rsc_five_class_targets_result_ds" height="490" marginWidth="20" navBar="true" width="1000">
                <a:columns>
                    <a:column name="five_class_target" editorFunction="five_class_target_code_ef" sortable="true" width="130"/>
                    <a:column name="name" editor="rsc_five_class_targets_result_grid_tf" sortable="true" width="100"/>
                    <a:column name="description" editor="rsc_five_class_targets_result_grid_tf" sortable="true" width="200"/>
                    <a:column name="usage_type_desc" editorFunction="usageTypeFunction"/>
                    <a:column name="target_type_desc" editor="rsc_five_class_targets_result_grid_comb" prompt="RSC_FIVE_CLASS_TARGET.USAGE_TYPE" sortable="true" width="100"/>
                    <a:column name="target_uom_desc" editor="rsc_five_class_targets_result_grid_comb" width="80"/>
                    <a:column name="target_object_desc" editor="rsc_five_class_targets_result_grid_comb" width="100"/>
                    <a:column name="include_target_value" editor="rsc_five_class_targets_result_grid_ckb" width="50"/>
                    <a:column align="center" prompt="RSC_FIVE_CLASS_TARGET.TARGET_VALUE_DEFINE" renderer="rsc201ModifyPageRenderer" width="80"/>
                    <a:column name="enabled_flag" editor="rsc_five_class_targets_result_grid_ckb" width="50"/>
                </a:columns>
                <a:editors>
                    <a:textField id="rsc_five_class_targets_result_grid_tf"/>
                    <a:checkBox id="rsc_five_class_targets_result_grid_ckb"/>
                    <a:comboBox id="rsc_five_class_targets_result_grid_comb"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>