<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ouyangzhaochang2663 $
    $Date: 2010/11/15 07:47:05 $
    $Revision: 1.4 $
    $Purpose: 公司查询
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query autoCount="true" defaultWhereClause="enabled_flag = &apos;Y&apos;" fetchAll="true" model="gld.gld_set_of_books" queryOrderBy="set_of_books_code" rootPath="set_of_books_list"/>
    </a:init-procedure>
    <a:view>
        <a:link id="fnd_company_create_link" url="${/request/@context_path}/modules/fnd/FND2020/fnd_company_create.lview"/>
        <a:link id="fnd_company_update_link" url="${/request/@context_path}/modules/fnd/FND2020/fnd_company_update.lview"/>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[
            function fnd_2020_next() {
                history.go(1);
            }
            
            function fnd_2020_back() {
                history.go(-1);
            }
            
            function fnd_2020_quit() {
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
            
            function queryCompanies() {
                $('fnd_companies_result_ds').query();
            }
            
            function resetCompanies() {
                $('fnd_companies_query_ds').reset();
            }
            
            function showViewCompanyRenderer(value,record,name)
            {
                var company_id=record.get('company_id');
                return '<a href="javascript:editCompany(' +company_id+ ')">'+value+'</a>';
            }
            
            function viewCompanyRenderer(value, record, name) {
                return '<a href="javascript:editCompany(' + value + ')">${l:PROMPT.EDIT}</a>';
            }
            
            function editCompany(id) {
                new Leaf.Window({
                    id: 'company_edit_window',
                    url: $('fnd_company_update_link').getUrl() + '?company_id=' + id,
                    title: '${l:FND_COMPANIES.DEFINE}',
                    // height: 400,
                    // width: 600
                    fullScreen: true
                });
            }
            
            function openCreateCompanyWindow(grid, record, row, index) {
                new Leaf.Window({
                    id: 'company_create_window',
                    url: $('fnd_company_create_link').getUrl(),
                    title: '${l:FND_COMPANIES.DEFINE}',
                    // height: 400,
                    // width: 600
                    fullScreen: true
                });
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="gld_set_of_books_ds">
                <a:datas dataSource="/model/set_of_books_list"/>
            </a:dataSet>
            <a:dataSet id="fnd_companies_query_ds" model="fnd.fnd_companies">
                <a:fields>
                    <a:field name="include_disabled_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                    <a:field name="set_of_books_id_display" displayField="set_of_books_name_display" options="gld_set_of_books_ds" returnField="set_of_books_id" valueField="set_of_books_id"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="fnd_companies_result_ds" autoCount="true" autoQuery="true" fetchAll="false" model="fnd.fnd_companies" pageSize="15" queryDataSet="fnd_companies_query_ds" queryUrl="${/request/@context_path}/autocrud/fnd.fnd_companies/query?ORDER_FIELD=company_code">
                <a:fields>
                    <a:field name="start_date_active" datatype="date"/>
                    <a:field name="end_date_active" datatype="date"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="fnd_2020_back" text="HLS.BACK"/>
                <a:gridButton click="fnd_2020_next" text="HLS.FORWARD"/>
                <a:gridButton click="fnd_2020_quit" text="HLS.EXIT"/>
                <a:gridButton click="openCreateCompanyWindow" text="HLS.NEW"/>
                <a:gridButton click="queryCompanies" text="HLS.QUERY"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="120" title="HAP_QUERY_TITLE">
                <a:textField name="company_code" bindTarget="fnd_companies_query_ds" typeCase="upper" width="150">
                    <a:events>
                        <a:event name="enterdown" handler="queryCompanies"/>
                    </a:events>
                </a:textField>
                <a:textField name="company_short_name" bindTarget="fnd_companies_query_ds" width="150">
                    <a:events>
                        <a:event name="enterdown" handler="resetCompanies"/>
                    </a:events>
                </a:textField>
                <a:comboBox name="set_of_books_id_display" bindTarget="fnd_companies_query_ds" width="150"/>
                <a:checkBox name="include_disabled_flag" bindTarget="fnd_companies_query_ds" prompt="包含失效公司"/>
            </a:form>
            <a:grid bindTarget="fnd_companies_result_ds" marginHeight="180" marginWidth="30" navBar="true" width="1000">
                <a:columns>
                    <a:column name="company_code" align="left" renderer="showViewCompanyRenderer" width="100"/>
                    <a:column name="company_type_display" align="left" width="80"/>
                    <a:column name="company_short_name" align="left" width="100"/>
                    <a:column name="company_full_name" align="left" width="200"/>
                    <a:column name="set_of_books_id_display" align="left" width="200"/>
                    <!-- <a:column name="company_level_id_display" align="left" width="150"/> -->
                    <!-- <a:column name="chief_position_id_display" align="left" width="100"/> -->
                    <a:column name="parent_biz_company_display" align="left" width="250"/>
                    <a:column name="start_date_active" align="left" renderer="Leaf.formatDate" width="90"/>
                    <a:column name="end_date_active" align="left" renderer="Leaf.formatDate" width="90"/>
                    <!-- <a:column name="address" align="left" width="150"/> -->
                    <a:column name="company_id" Renderer="viewCompanyRenderer" align="center" prompt="HAP_EDIT" width="50"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>