<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: WangQiaosen3207  
    $Date: 2011-6-2 上午11:34:30  
    $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 ev.expense_type_id,
				       ev.company_id,
				       ev.expense_type_code,
				       ev.description,
				       t.expense_item_types_id,
				       t.expense_item_id
				  from exp_expense_item_types t, exp_expense_types_vl ev
				 where t.expense_type_id = ev.expense_type_id
				   and ev.enabled_flag = 'Y'
				   and t.expense_item_id = ${@expense_item_id}
				   and ev.company_id = ${/session/@company_id}
				 order by ev.expense_type_code
   		]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
            	begin
            		exp_expense_items_pkg.insert_exp_expense_item_types(p_expense_item_id =>${@expense_item_id},
							                                            p_expense_type_id =>${@expense_type_id},
							                                            p_created_by      =>${/session/@user_id},
							                                            p_last_updated_by =>${/session/@user_id});
            	end;
        	]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            	begin
            		exp_expense_items_pkg.update_exp_expense_item_types(p_expense_item_types_id =>${@expense_item_types_id},
							                                            p_expense_item_id       =>${@expense_item_id},
							                                            p_expense_type_id       =>${@expense_type_id},
							                                            p_last_updated_by       =>${/session/@user_id});
            	end;
        	]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
            	begin
            		exp_expense_items_pkg.delete_exp_expense_item_types(p_expense_item_types_id =>${@expense_item_types_id});
            	end;
        	]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="expense_type_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EXPENSE_TYPE_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"/>
        <bm:field name="expense_type_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXPENSE_TYPE_CODE" prompt="EXP_EXPENSE_ITEM_TYPES.EXPENSE_TYPE_ID"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="EXP_EXP_ITEM_TYPE.DESCRIPTION"/>
        <bm:field name="expense_item_types_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EXPENSE_ITEM_TYPES_ID"/>
        <bm:field name="expense_item_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EXPENSE_ITEM_ID"/>
    </bm:fields>
</bm:model>
