<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-11-7 下午4:37:43  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="GLD_JE_TEMPLATE_GRP">
    <bm:fields>
        <bm:field name="template_group_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TEMPLATE_GROUP_ID"/>
        <bm:field name="template_group_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TEMPLATE_GROUP_CODE" prompt="GLD110.GLD_JE_TEMPLATE_GRP.TEMPLATE_GROUP_CODE"/>
        <bm:field name="template_group_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TEMPLATE_GROUP_DESC" prompt="GLD110.GLD_JE_TEMPLATE_GRP.TEMPLATE_GROUP_DESC"/>
        <bm:field name="je_template_set_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="JE_TEMPLATE_SET_CODE"/>
        <bm:field name="je_template_set_desc" forInsert="false" forUpdate="false" physicalName="JE_TEMPLATE_SET_DESC" prompt="GLD105.GLD_JE_TEMPLATE_SET.JE_TEMPLATE_SET_CODE"/>
        <bm:field name="je_transaction_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="JE_TRANSACTION_CODE"/>
        <bm:field name="je_transaction_desc" forInsert="false" forUpdate="false" prompt="GLD104.GLD_JE_TRANSACTION.JE_TRANSACTION_CODE"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" forUpdate="false" insertExpression="${/session/@company_id}" physicalName="COMPANY_ID"/>
        <bm:field name="company_short_name" forInsert="false" forUpdate="false" prompt="HLS.COMPANY_SHORT_NAME"/>
        <bm:field name="priority" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PRIORITY" prompt="HLS.PRIORITY"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="HLS.ENABLED_FLAG"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.template_group_id,
				       t1.template_group_code,
				       t1.template_group_desc,
				       t1.je_template_set_code,
				       s.je_template_set_desc,
				       t1.je_transaction_code,
				       t.je_transaction_desc,
				       t1.company_id,
				       c.company_short_name,
				       t1.priority,
				       t1.enabled_flag
				  from gld_je_template_grp t1
				 inner join fnd_companies_vl c
				    on c.company_id = t1.company_id
				 inner join gld_je_template_set s
				    on s.je_template_set_code = t1.je_template_set_code
				 inner join gld_je_transaction t
				    on t.je_transaction_code = t1.je_transaction_code
				  #WHERE_CLAUSE#
				 order by t1.je_template_set_code,t.order_seq,t1.priority
    		]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field field="je_template_set_code" queryExpression="t1.je_template_set_code=${@je_template_set_code}"/>
        <bm:query-field field="je_transaction_code" queryExpression="t1.je_transaction_code=${@je_transaction_code}"/>
        <bm:query-field field="template_group_code" queryExpression="t1.template_group_code like ${@template_group_code}"/>
        <bm:query-field field="template_group_desc" queryExpression="t1.template_group_desc like ${@template_group_desc}"/>
        <bm:query-field field="enabled_flag" queryExpression="t1.enabled_flag = ${@enabled_flag}"/>
    </bm:query-fields>
    <bm:features>
        <o:sequence-pk/>
        <f:standard-who/>
    </bm:features>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.company_id = ${/session/@company_id}"/>
    </bm:data-filters>
    <bm:primary-key>
        <bm:pk-field name="template_group_id"/>
    </bm:primary-key>
</bm:model>
