<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2013-6-20 上午10:06:11  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
        <bm:field name="unit_id"/>
        <bm:field name="unit_code" displayWidth="60" forDisplay="true" prompt="编码"/>
        <bm:field name="description" displayWidth="200" forDisplay="true" forQuery="true" prompt="名称"/>
        <bm:field name="company_id"/>
        <bm:field name="company_name" displayWidth="300" forDisplay="true" forQuery="true" prompt="所属公司"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            select * from(
            select 
				unit_id,
				unit_code,
				org_unit_type,
				enabled_flag,
				description,
				company_id,
				(select company_full_name from fnd_companies where company_id = t.company_id)company_name
			from exp_org_unit_vl t)t1
		  	#WHERE_CLAUSE#
  			]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field field="unit_code" queryExpression="upper(t1.unit_code) like &apos;%&apos; || upper(${@unit_code}) || &apos;%&apos;"/>
        <bm:query-field field="description" queryExpression="upper(t1.description) like &apos;%&apos; || upper(${@description}) || &apos;%&apos;"/>
        <bm:query-field field="company_name" queryExpression="upper(t1.company_name) like &apos;%&apos; || upper(${@company_name}) || &apos;%&apos;"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.enabled_flag = &apos;Y&apos; and t1.org_unit_type = &apos;4S&apos;"/>
    </bm:data-filters>
</bm:model>
