<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-3-26 下午02:26:38  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:view>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[
            function hls_hls108_query() {
                $('hls_salesman_assign_result_ds').query();
            }
            
            function hls_hls108_reset() {
                $('hls_salesman_assign_query_ds').reset();
            }
            
            function hls_hls108_forward() {
                history.go(1);
            }
            
            function hls_hls108_back() {
                history.go(-1);
            }
            
            function hls_hls108_quit() {
                location.href = $('sys_service_welcome_link').getUrl();
            }
            
            function hls_hls108_add() {
                $('hls_salesman_assign_grid_ds').showEditorByRecord($('hls_salesman_assign_result_ds').create());
            }
            
            function hls_hls108_submit() {
                var result_ds = $('hls_salesman_assign_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            
            function hls_hls108_clear() {
                $('hls_salesman_assign_grid_ds').clear();
            }
            
            function hls_hls108_delete() {
                $('hls_salesman_assign_grid_ds').remove();
            }
            
            function do_hls108_grid_lov(record, name) {
                if (record.isNew) {
                    return 'hls108_grid_lov';
                }
                return '';
            }
            
            function do_hls108_submitsuccess() {
                $('hls_salesman_assign_result_ds').query();
            }
            
            function do_hls108_line_update(ds, record, name, value, oldvalue) {
                if (name == 'company_id') {
                    record.getField('employee_code').setLovPara('company_id', value);
                    if (value != oldvalue) {
                        record.set('employee_id', '');
                        record.set('employee_code', '');
                        record.set('employee_name', '');
                    }
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="hls_salesman_assign_query_ds" autoCreate="true" model="hls.HLS108.hls_salesman_assign">
                <a:fields>
                    <a:field name="lease_organization_name" lovGridHeight="320" lovHeight="450" lovLabelWidth="120" lovService="basic.hls_lease_organization_for_lov" lovWidth="550" prompt="HLS.LEASE_ORGANIZATION" title="HLS.LEASE_ORGANIZATION">
                        <a:mapping>
                            <a:map from="description" to="lease_organization_name"/>
                            <a:map from="lease_organization" to="lease_organization"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="lease_organization"/>
                    <a:field name="employee_name" lovGridHeight="320" lovHeight="450" lovLabelWidth="120" lovService="basic.hls_exp_employees_for_lov?display_flag=Y" lovWidth="550" prompt="HLS.EMPLOYEE_NAME" title="HLS.EMPLOYEE">
                        <a:mapping>
                            <a:map from="employee_id" to="employee_id"/>
                            <a:map from="name" to="employee_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="employee_id"/>
                    <a:field name="enabled_flag" checkedValue="Y" prompt="HLS.ENABLED_FLAG" uncheckedValue="N"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls_salesman_assign_result_ds" autoQuery="true" model="hls.HLS108.hls_salesman_assign" queryDataSet="hls_salesman_assign_query_ds" selectable="true">
                <a:fields>
                    <a:field name="lease_organization" lovGridHeight="320" lovHeight="450" lovLabelWidth="120" lovService="basic.hls_lease_organization_for_lov" lovWidth="550" prompt="HLS.LEASE_ORGANIZATION" required="true" title="HLS.LEASE_ORGANIZATION">
                        <a:mapping>
                            <a:map from="description" to="lease_organization_name"/>
                            <a:map from="lease_organization" to="lease_organization"/>
                            <a:map from="company_id" to="company_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="lease_organization_name" prompt="HLS.LEASE_ORGANIZATION_NAME"/>
                    <a:field name="company_id"/>
                    <a:field name="employee_code" lovGridHeight="320" lovHeight="450" lovLabelWidth="120" lovService="basic.hls_exp_employees_company_for_lov" lovWidth="550" prompt="HLS.EMPLOYEE_CODE" required="true" title="HLS.EMPLOYEE">
                        <a:mapping>
                            <a:map from="employee_id" to="employee_id"/>
                            <a:map from="name" to="employee_name"/>
                            <a:map from="employee_code" to="employee_code"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="employee_id"/>
                    <a:field name="employee_name" prompt="HLS.EMPLOYEE_NAME"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" prompt="HLS.ENABLED_FLAG" uncheckedValue="N"/>
                    <a:field name="employee_primary_position" prompt="HLS.EMPLOYEE_PRIMARY_POSITION"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="do_hls108_submitsuccess"/>
                    <a:event name="update" handler="do_hls108_line_update"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="hls_hls108_back" text="HLS.BACK"/>
                <a:gridButton click="hls_hls108_forward" text="HLS.FORWARD"/>
                <a:gridButton click="hls_hls108_quit" text="HLS.EXIT"/>
                <a:gridButton click="hls_hls108_add" text="HLS.NEW"/>
                <a:gridButton click="hls_hls108_clear" text="HLS.CLEAR"/>
                <a:gridButton click="hls_hls108_submit" text="HLS.SAVE"/>
                <a:gridButton click="hls_hls108_query" text="HLS.QUERY"/>
                <a:gridButton click="hls_hls108_reset" text="HLS.RESET"/>
            </a:screenTopToolbar>
            <a:form bindTarget="hls_salesman_assign_query_ds" column="3" title="HLS.QUERY_TITLE">
                <a:lov name="lease_organization_name" bindTarget="hls_salesman_assign_query_ds"/>
                <a:lov name="employee_name" bindTarget="hls_salesman_assign_query_ds"/>
                <a:checkBox name="enabled_flag" bindTarget="hls_salesman_assign_query_ds"/>
            </a:form>
            <a:grid id="hls_salesman_assign_grid_ds" bindTarget="hls_salesman_assign_result_ds" marginHeight="170" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="lease_organization" align="center" editorFunction="do_hls108_grid_lov" width="200"/>
                    <a:column name="lease_organization_name" align="center" width="200"/>
                    <a:column name="employee_code" align="center" editorFunction="do_hls108_grid_lov" width="200"/>
                    <a:column name="employee_name" align="center" width="200"/>
                    <a:column name="employee_primary_position" align="center" width="200"/>
                    <a:column name="enabled_flag" align="center" editor="hls108_grid_checkbox" width="175"/>
                </a:columns>
                <a:editors>
                    <a:lov id="hls108_grid_lov"/>
                    <a:checkBox id="hls108_grid_checkbox"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
