<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
				select fv.company_id, 
   					   fv.company_code, 
					   fv.company_short_name,
					   fv.company_full_name,
					   fnd_companies_pkg.get_parent_biz_company(fv.company_id) parent_biz_company_id,
					   fv.company_code || ' - ' || fv.company_short_name code_name,
					   (select oa.unit_id 
					   from hls_lease_org_assign oa 
					   where oa.lease_organization = ${@lease_organization}
					   and oa.company_id=fv.company_id) unit_id,
					   (select eou.unit_name 
					   from hls_lease_org_assign oa,exp_org_unit_v eou 
					   where oa.lease_organization = ${@lease_organization}
				   			and oa.company_id=fv.company_id
				   			and oa.unit_id=eou.unit_id) unit_name  
				 from fnd_companies_vl fv        
				#WHERE_CLAUSE# 
				order by  fv.company_code
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="company_code" forDisplay="true" forQuery="true" prompt="COMPANY_CODE"/>
        <bm:field name="company_short_name" forDisplay="true" forQuery="true" prompt="FND_COMPANIES.COMPANY_NAME"/>
        <bm:field name="company_full_name"/>
        <bm:field name="company_id"/>
        <bm:field name="parent_biz_company_id"/>
        <bm:field name="code_name"/>
        <bm:field name="unit_id"/>
        <bm:field name="unit_name"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="company_code" queryExpression="fv.company_code like &apos;%&apos;||${@company_code}||&apos;%&apos;"/>
        <bm:query-field name="company_short_name" queryExpression="fv.company_short_name like &apos;%&apos;||${@company_short_name}||&apos;%&apos;"/>
        <bm:query-field name="code_name" queryExpression=" fv.code_name like ${@code_name}||&apos;%&apos;"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="fv.company_type =1 and fv.start_date_active &lt;= sysdate and (fv.end_date_active is null or end_date_active &gt; sysdate) and fv.set_of_books_id=(select v.set_of_books_id from fnd_companies_vl v where v.company_id=${/session/@company_id})  "/>
    </bm:data-filters>
</bm:model>