<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2013-11-29 下午01:50:24  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="basic.hls_sys_time_default_value" rootPath="default_value_path"/>
    </a:init-procedure>
    <a:view template="default">
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[
            function queryFunction() {
                $('aut_trx_user_chance_ds').query();
            }
            
            function aut_103_back() {
                $('${/parameter/@winId}').close();
            }
            
            function aut_103_next() {
                history.go(1);
            }
            
            function aut_103_quit() {
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
            
            function aut_103_grid_add() {
                var grid=$('aut_trx_user_chance_grid');
                var index=$('aut_trx_user_chance_ds').indexOf($('aut_trx_user_chance_ds').getCurrentRecord());
                $('aut_trx_user_chance_grid').showEditorByRecord(2,$('aut_trx_user_chance_ds').create(index+1));
            }
            
            function aut_103_grid_clear() {
                $('aut_trx_user_chance_grid').clear();
            }
            
            function aut_103_grid_delete() {
                $('aut_trx_user_chance_grid').remove();
            }
            
            function aut_103_grid_submit() {
                $('aut_trx_user_chance_ds').submit();
            }
            
            
            function aut103trxCategoryFunction(record,name){
			    if(record.isNew){
                    return 'aut103_grid_comb';
                }else{
                    return '';
                }
			}
			
			function aut103lovFunction(record,name){
			    if(record.isNew){
                    return 'aut103_grid_lov';
                }else{
                    return '';
                }
			}
			
			function trx_id_ef(record,name){
			    if(record.isNew){
                    return 'aut103_grid_tf';
                }else{
                    return '';
                }
			}
			
			function aut_trx_user_chance_ds_add(ds,record){
			    record.set('trx_category','${/parameter/@trx_category}');
			    record.set('trx_category_desc','${/parameter/@trx_category_desc}');
			}
			
			function aut103_trx_id_ef(record,name){
			    if(record.isNew){
                    return 'aut103_grid_lov';
                }else{
                    return '';
                }
			}
        ]]></script>
        <a:dataSets>
            <a:dataSet id="aut_trx_user_query_ds">
                <a:fields>
                    <a:field name="trx_number"/>
                    <a:field name="user_desc"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="aut_trx_user_chance_ds" autoPageSize="true" autoQuery="true" model="aut.AUT103.aut_trx_user_authorize" queryDataSet="aut_trx_user_query_ds" queryUrl="${/request/@context_path}/autocrud/aut.AUT103.aut_trx_user_chance_query/query" selectable="true">
                <a:fields>
                    <a:field name="trx_category"/>
                    <a:field name="trx_category_desc"/>
                    <a:field name="trx_number" lovGridHeight="350" lovHeight="550" lovService="basic.prj_chance_for_lov" lovWidth="550" required="true">
                        <a:mapping>
                            <a:map from="chance_id" to="trx_id"/>
                            <a:map from="chance_number" to="trx_number"/>
                            <a:map from="bp_name" to="bp_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="user_id" required="true"/>
                    <a:field name="user_desc" autoComplete="true" lovGridHeight="350" lovHeight="550" lovService="basic.sys_user_for_lov" lovWidth="550" prompt="AUT_TRX_USER_AUTHORIZE.USER_ID" required="true" title="AUT103.USER_ID">
                        <a:mapping>
                            <a:map from="description" to="user_desc"/>
                            <a:map from="employee_name" to="user_employee_name"/>
                            <a:map from="user_id" to="user_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="user_employee_name"/>
                    <a:field name="start_date" defaultValue="${/model/default_value_path/record/@now_time}" required="true"/>
                    <a:field name="end_date" defaultValue="${/model/default_value_path/record/@never_date}"/>
                </a:fields>
                <a:events>
                    <a:event name="add" handler="aut_trx_user_chance_ds_add"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="aut_103_back" text="HLS.RETURN"/>
                <a:gridButton click="queryFunction" text="HLS.QUERY"/>
                <a:gridButton click="aut_103_grid_add" text="HLS.NEW"/>
                <!-- <a:gridButton click="aut_103_grid_delete" text="HLS.REMOVE"/> -->
                <a:gridButton click="aut_103_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="aut_103_grid_submit" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:form column="3" title="HLS.QUERY_TITLE">
                <a:textField name="trx_number" bindTarget="aut_trx_user_query_ds" prompt="AUT103.TRX_NUMBER"/>
                <a:textField name="trx_name" bindTarget="aut_trx_user_query_ds" prompt="AUT103.TRX_NAME"/>
                <a:textField name="user_desc" bindTarget="aut_trx_user_query_ds" prompt="AUT_TRX_USER_AUTHORIZE.USER_ID"/>
            </a:form>
            <a:grid id="aut_trx_user_chance_grid" bindTarget="aut_trx_user_chance_ds" marginHeight="200" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="trx_category_desc" prompt="AUT103.TRX_CATEGORY" width="120"/>
                    <a:column name="trx_number" editorFunction="aut103_trx_id_ef" prompt="AUT103.TRX_NUMBER" width="120"/>
                    <a:column name="trx_id" prompt="AUT103.TRX_ID" width="100"/>
                    <a:column name="bp_name" prompt="HLS.BP_NAME"/>
                    <a:column name="user_desc" editorFunction="aut103lovFunction" prompt="AUT_TRX_USER_AUTHORIZE.USER_ID" width="100"/>
                    <a:column name="user_employee_name" prompt="EXP_EMPLOYEES.NAME"/>
                    <a:column name="start_date" editor="aut103_datepicker_lov" prompt="HLS.START_DATE" renderer="Leaf.formatDate"/>
                    <a:column name="end_date" editor="aut103_datepicker_lov" prompt="HLS.END_DATE" renderer="Leaf.formatDate"/>
                </a:columns>
                <a:editors>
                    <a:textField id="aut103_grid_tf"/>
                    <a:comboBox id="aut103_grid_comb"/>
                    <a:lov id="aut103_grid_lov"/>
                    <a:datePicker id="aut103_datepicker_lov"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>