<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ouyangzhaochang2663 $
    $Date: 2010/11/15 07:47:59 $
    $Revision: 1.3 $
    $Purpose: 帐套定义
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
        <a:model-query autocount="true" fetchall="true" model="gld.gld_period_sets" queryOrderBy="period_set_code" rootpath="period_set_list"/>
        <a:model-query autocount="true" defaultWhereClause="gc.enabled_flag = &apos;Y&apos;" fetchall="true" model="gld.gld_currency" queryOrderBy="currency_code" rootpath="currency_list"/>
        <a:model-query autocount="true" fetchall="true" model="gld.gld_account_sets" queryOrderBy="account_set_code" rootpath="account_set_list"/>
    </a:init-procedure>
    <a:view>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <a:screen-include screen="modules/hls/hls_common_javascript.lview"/>
        <script type="text/javascript"><![CDATA[
            function querySetOfBooks(){
                $('gld_set_of_books_result_ds').query();
            }
            function resetSetOfBooks(){
            	$('gld_set_of_books_query_ds').reset();
            }
            function fnd_2010_grid_add(){
                $('fnd_2010_grid').showEditorByRecord($('gld_set_of_books_result_ds').create());
            }
            function fnd_2010_grid_clear(){
                $('fnd_2010_grid').clear();
            }
            function fnd_2010_grid_submit() {
                var result_ds = $('gld_set_of_books_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            function fnd_2010_next(){
                 history.go(1);
            }
            function fnd_2010_back(){
                history.go(-1);
            }
            function fnd_2010_quit(){
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
            
            function codeEdit(record,name){
                if(record.isNew){
                    return 'code_grid_gf';
                }
                return '';
            }
            
            function onUpdate(ds,record,name,value){
                
                if(name == 'account_set_name'){
                    alert('a');
                }
            }
            
            function periodsSetEdit(record,name){
                if(record.isNew){
                    return 'period_set_code_grid_cmb';
                }
                return '';
            }
            
            function currencyNameEdit(record,name){
                if(record.isNew){
                    return 'currency_name_grid_cmb';
                }
                return '';
            }
            
            function accountSetNameEdit(record,name){
                if(record.isNew){
                    return 'account_set_name_grid_cmb';
                }
                return '';
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="enabled_status_ds" lookupCode="ENABLED_STATUS"/>
            <a:dataSet id="period_set_list_ds">
                <a:datas dataSource="/model/period_set_list"/>
            </a:dataSet>
            <a:dataSet id="currency_list_ds">
                <a:datas dataSource="/model/currency_list"/>
            </a:dataSet>
            <a:dataSet id="account_set_list_ds">
                <a:datas dataSource="/model/account_set_list"/>
            </a:dataSet>
            <a:dataSet id="gld_set_of_books_query_ds" model="gld.gld_set_of_books">
                <a:fields>
                    <a:field name="enabled_status" defaultValue="Y"/>
                    <a:field name="enabled_status_desc" displayField="code_value_name" options="enabled_status_ds" returnField="enabled_status" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="gld_set_of_books_result_ds" autoQuery="true" fetchAll="false" model="gld.gld_set_of_books" notification="有数据没有保存" pageSize="15" queryDataSet="gld_set_of_books_query_ds" queryUrl="${/request/@context_path}/autocrud/gld.gld_set_of_books/query?ORDER_FIELD=set_of_books_code" selectable="true">
                <a:fields>
                    <a:field name="set_of_books_code" required="true" validator="hlsCommon_validateCode"/>
                    <a:field name="set_of_books_name" required="true"/>
                    <a:field name="period_set_code_desc" displayField="period_set_name" options="period_set_list_ds" prompt="GLD_PERIOD_SET.PERIOD_SET_NAME" required="true" returnField="period_set_code" valueField="period_set_code"/>
                    <a:field name="currency_name" displayField="currency_name" options="currency_list_ds" required="true" returnField="functional_currency_code" valueField="currency_code"/>
                    <a:field name="account_set_name" displayField="account_set_name" options="account_set_list_ds" required="true" returnField="account_set_id" valueField="account_set_id"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="fnd_2010_quit" text="HLS.EXIT"/>
                <a:gridButton click="querySetOfBooks" text="HLS.QUERY"/>
                <a:gridButton click="fnd_2010_grid_add" text="HLS.NEW"/>
                <a:gridButton click="fnd_2010_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="fnd_2010_grid_submit" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:form column="3" title="GLD_SET_OF_BOOKS.QUERY">
                <a:textField name="set_of_books_code" bindTarget="gld_set_of_books_query_ds" typeCase="upper">
                    <a:events>
                        <a:event name="enterdown" handler="querySetOfBooks"/>
                    </a:events>
                </a:textField>
                <a:textField name="set_of_books_name" bindTarget="gld_set_of_books_query_ds">
                    <a:events>
                        <a:event name="enterdown" handler="querySetOfBooks"/>
                    </a:events>
                </a:textField>
                <a:comboBox name="enabled_status_desc" bindTarget="gld_set_of_books_query_ds" prompt="启用">
                    <a:events>
                        <a:event name="enterdown" handler="querySetOfBooks"/>
                    </a:events>
                </a:comboBox>
            </a:form>
            <a:grid id="fnd_2010_grid" bindTarget="gld_set_of_books_result_ds" height="490" marginWidth="20" navBar="true" width="1000">
                <a:columns>
                    <a:column name="set_of_books_code" align="left" editorFunction="codeEdit" sortable="true" width="125"/>
                    <a:column name="set_of_books_name" align="left" editor="name_grid_gf" width="190"/>
                    <a:column name="period_set_code_desc" editorFunction="periodsSetEdit" sortable="true" width="150"/>
                    <a:column name="currency_name" align="left" editorFunction="currencyNameEdit"/>
                    <a:column name="account_set_name" align="left" editorFunction="accountSetNameEdit" prompt="GLD_SET_OF_BOOKS.ACCOUNT_SET"/>
                    <a:column name="enabled_flag" editor="enabled_flag_grid_checkbox"/>
                </a:columns>
                <a:editors>
                    <a:textField id="code_grid_gf" typeCase="upper"/>
                    <a:textField id="name_grid_gf"/>
                    <a:comboBox id="period_set_code_grid_cmb"/>
                    <a:comboBox id="currency_name_grid_cmb"/>
                    <a:comboBox id="account_set_name_grid_cmb"/>
                    <a:checkBox id="enabled_flag_grid_checkbox"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>