<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ouyangzhaochang2663 $
    $Date: 2010/11/22 01:49:05 $
    $Modify: duanjian 
    $Date: 2012/2/6 $
    $Revision: 1.2 $
    $Purpose “员工组定义” 模块页面
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="exp_employee_group_relations_link" url="${/request/@context_path}/modules/exp/EXP1060/exp_employee_group_relations.lview"/>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[
            function queryEmployeeGroup() {
                $('exp_employee_group_result_ds').query();
            }
            
            function resetEmployeeGroup() {
                $('exp_employee_group_query_ds').reset();
            }
            
            function codeEditFunction(record, name) {
                if (!record.isNew) {
                    return '';
                } else {
                    return 'employee_group_grid_upper_tf';
                }
            
            }
            
            function editRenderer(value, record, name) {
                if (value) {
                    
                    var expense_user_group_code = record.get('expense_user_group_code');
                    var description = record.get('description');
                    var window_id = "employee_id_edit.lview";
                    var path = /*exp_employee_group_relations.screen*/
                    $('exp_employee_group_relations_link').getUrl();
                    //var path=/*exp_employee_group_relations.screen*/$('exp_employee_group_relations_link').getUrl()+'?expense_user_group_id='+value+"&expense_user_group_code="+expense_user_group_code+"&description="+ encodeURI(encodeURI(description));
                    return "<a href=\"javascript:editEmployeeId('" + window_id + "','" + path + "','" + value + "','" + expense_user_group_code + "','" + description + "')\">${l:EXP_EMPLOYEE_ASSIGNS.EMPLOYEES_ASSIGN_ID}</a>";
                } else {
                    return '';
                }
            }
            
            function editEmployeeId(window_id, path, value, expense_user_group_code, description) {
                var urlRecord = {};
                urlRecord['expense_user_group_id'] = value;
                urlRecord['expense_user_group_code'] = expense_user_group_code;
                urlRecord['description'] = description;
                new Leaf.Window({
                    id: window_id,
                    url: path,
                    params:urlRecord,
                    title: '${l:EXP_EMPLOYEE_GROUP.INFO}',
                    height: 550,
                    width: 750
                });
            }
            
            function headersDsUpdate(ds, record, name, value) {
                record.set('company_id', '${/session/@company_id}');
            }
            
            function exp_1060_grid_add() {
                $('exp_1060_grid').showEditorByRecord($('exp_employee_group_result_ds').create());
            }
            
            function exp_1060_grid_clear() {
                $('exp_1060_grid').clear();
            }
            
            function exp_1060_grid_submit() {
                var result_ds = $('exp_employee_group_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            
            function exp_1060_next() {
                history.go(1);
            }
            
            function exp_1060_back() {
                history.go(-1);
            }
            
            function exp_1060_quit() {
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="responsibility_center_ds" autoCount="false" fetchAll="true" loadData="true" model="fnd.EXP1060.fnd_responsibility_centers_select"/>
            <a:dataSet id="exp_employee_group_query_ds" model="exp.EXP1060.exp_user_group_headers"/>
            <a:dataSet id="exp_employee_group_result_ds" autoCount="true" autoQuery="true" fetchAll="false" model="exp.EXP1060.exp_user_group_headers" notification="有数据没有保存" pageSize="15" queryDataSet="exp_employee_group_query_ds" selectable="true">
                <a:fields>
                    <a:field name="expense_user_group_code" required="true"/>
                    <a:field name="description" required="true"/>
                    <a:field name="responsibility_center_name" displayField="responsibility_center_name" options="responsibility_center_ds" returnField="responsibility_center_id" valueField="responsibility_center_id"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" unCheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="headersDsUpdate"/>
                </a:events>
                <!-- pageSize="1"-->
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar height="29">
                <a:button click="exp_1060_back" height="20" icon="${/request/@context_path}/images/back.png" iconAlign="left" text="后退" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="exp_1060_next" height="20" icon="${/request/@context_path}/images/forward.png" iconAlign="left" text="前进" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="exp_1060_grid_add" height="20" icon="${/request/@context_path}/images/add.png" iconAlign="left" text="新增" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="exp_1060_grid_clear" height="20" icon="${/request/@context_path}/images/clear.png" iconAlign="left" text="移除" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="exp_1060_grid_submit" height="20" icon="${/request/@context_path}/images/save.png" iconAlign="left" text="保存" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="exp_1060_quit" height="20" icon="${/request/@context_path}/images/quit.png" iconAlign="left" text="退出" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="queryEmployeeGroup" height="20" icon="${/request/@context_path}/images/search.png" iconAlign="left" text="HAP_QUERY" width="50"/>
                <a:separator style="margin-left:3px;"/>
            </a:screenTopToolbar>
            <a:form column="2" labelWidth="85" title="SYS_PROMPT.QUERY_TITLE">
                <a:textField name="expense_user_group_code" bindTarget="exp_employee_group_query_ds" typeCase="upper" width="200">
                    <a:events>
                        <a:event name="enterdown" handler="queryEmployeeGroup"/>
                    </a:events>
                </a:textField>
                <a:textField name="description" bindTarget="exp_employee_group_query_ds" width="200">
                    <a:events>
                        <a:event name="enterdown" handler="queryEmployeeGroup"/>
                    </a:events>
                </a:textField>
            </a:form>
            <a:grid id="exp_1060_grid" bindTarget="exp_employee_group_result_ds" height="490" marginWidth="20" navBar="true" width="1000">
                <a:columns>
                    <a:column name="expense_user_group_code" align="left" editorFunction="codeEditFunction" sortable="true" width="100"/>
                    <a:column name="description" editor="employee_group_grid_tf" width="200"/>
                    <!-- <a:column name="responsibility_center_name" align="center" editor="employee_group_grid_cBox" prompt="FND_RESPONSIBILITY_CENTERS.RESPONSIBILITY_CENTER_NAME" width="200"/> -->
                    <a:column name="enabled_flag" align="center" editor="employee_group_grid_cb" width="80"/>
                    <a:column name="expense_user_group_id" align="center" prompt="EXP_EMPLOYEE.EMPLOYEE_ASSIGN" renderer="editRenderer" width="150"/>
                </a:columns>
                <a:editors>
                    <a:textField id="employee_group_grid_tf"/>
                    <a:textField id="employee_group_grid_upper_tf" typeCase="upper"/>
                    <a:checkBox id="employee_group_grid_cb"/>
                    <a:comboBox id="employee_group_grid_cBox"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>