<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2013-7-8 下午7:31:56  
    $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 queryFunction() {
                $('orgAssignDs').query();
            }
            
            function hls_org_close() {
                $('hls_lease_org_assign').close();
            }
            
            function hls_org_grid_add() {
                $('orgAssignDs_grid').showEditorByRecord($('orgAssignDs').create());
            }
            
            function hls_org_grid_clear() {
                $('orgAssignDs_grid').clear();
            }
            
            function hls_org_grid_remove() {
                $('orgAssignDs_grid').remove();
            }
            
            function hls_org_grid_submit() {
                $('orgAssignDs').submit();
            }
            
            function gridCellClick(grid, row, name, record){
                if(name =='responsibility_center_name'){
                    record.getField(name).setLovPara('company_id',record.get('company_id'));
                }
                if(name == 'unit_name'){
                    record.getField(name).setLovPara('company_id',record.get('company_id'));
                }
            }
            function onUpdate_orgAssignDs(dataSet, record, name, value, oldvalue){
                if(name =='responsibility_center_name'){
                    record.getField(name).setLovPara('company_id',record.get('company_id'));
                }
                if(name == 'unit_name'){
                    record.getField(name).setLovPara('company_id',record.get('company_id'));
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="orgAssignDs" autoQuery="true" model="hls.HLS101.hls_lease_org_assign" queryUrl="${/request/@context_path}/autocrud/hls.HLS101.hls_lease_org_assign_query/query?lease_organization=${/parameter/@lease_organization}" selectable="true">
                <a:fields>
                    <a:field name="lease_organization" defaultValue="${/parameter/@lease_organization}"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="company_code" lovGridHeight="300" lovHeight="460" lovService="fnd.fnd_companies_vl" lovWidth="500" required="true" title="HLS.COMPANY_CODE">
                        <a:mapping>
                            <a:map from="company_id" to="company_id"/>
                            <a:map from="company_code" to="company_code"/>
                            <a:map from="company_short_name" to="company_short_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="responsibility_center_name" lovGridHeight="300" lovHeight="460" lovLabelWidth="100" lovService="hls.HLS101.fnd_responsibility_center_for_lov" lovWidth="600">
                        <a:mapping>
                            <a:map from="responsibility_center_id" to="responsibility_center_id"/>
                            <a:map from="responsibility_center_name" to="responsibility_center_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="unit_name" lovGridHeight="300" lovHeight="460" lovService="hls.HLS101.exp_org_unit_for_lov" lovWidth="500">
                        <a:mapping>
                            <a:map from="unit_id" to="unit_id"/>
                            <a:map from="unit_code" to="unit_code"/>
                            <a:map from="unit_name" to="unit_name"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="onUpdate_orgAssignDs"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="hls_org_close" text="HLS.CLOSE"/>
                <a:gridButton click="queryFunction" text="HLS.QUERY"/>
                <a:gridButton click="hls_org_grid_add" text="HLS.NEW"/>
                <a:gridButton click="hls_org_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="hls_org_grid_submit" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:grid id="orgAssignDs_grid" bindTarget="orgAssignDs" marginHeight="150" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="company_code" editor="orgAssignDs_grid_lov" prompt="HLS.COMPANY_CODE" width="200"/>
                    <a:column name="company_short_name" prompt="HLS.COMPANY_NAME" width="250"/>
                    <a:column name="responsibility_center_name" editor="orgAssignDs_grid_lov" prompt="HLS.RESPONSIBILITY_CENTER_NAME" width="200"/>
                    <a:column name="unit_name" editor="orgAssignDs_grid_lov" prompt="HLS.UNIT_NAME" width="250"/>
                </a:columns>
                <a:editors>
                    <a:comboBox id="orgAssignDs_grid_comb"/>
                    <a:checkBox id="orgAssignDs_grid_check"/>
                    <a:lov id="orgAssignDs_grid_lov"/>
                </a:editors>
                <a:events>
                    <a:event name="cellclick" handler="gridCellClick"/>
                </a:events>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
