<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: duanjian  
    $Date: 2012-2-8 下午01:31:13  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT *
                FROM (
                      SELECT fc.company_id,
                             fc.company_code,
                             fc.company_short_name,
                             e.unit_type_id,
                             e.enabled_flag flag
                      FROM fnd_companies_vl fc,exp_org_unit_assign_types e
                      WHERE fc.set_of_books_id = ${/parameter/@set_of_books_id}
                        and (fc.end_date_active IS null
                          	 OR sysdate BETWEEN fc.start_date_active AND fc.end_date_active)
                        AND fc.company_id = e.company_id
                        AND e.unit_type_code = ${/parameter/@unit_type_code}
                    ) v #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"/>
        <bm:field name="company_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COMPANY_CODE"/>
        <bm:field name="company_short_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COMPANY_SHORT_NAME"/>
        <bm:field name="unit_type_id" databaseType="VARCHAR2" datatype="java.lang.Long" physicalName="UNIT_TYPE_ID"/>
        <bm:field name="flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FLAG"/>
    </bm:fields>
</bm:model>
