<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-5-29 下午2:24:55  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="FND_BASE_RATE">
    <bm:fields>
        <bm:field name="base_rate_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BASE_RATE_ID"/>
        <bm:field name="base_rate_set" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BASE_RATE_SET"/>
        <bm:field name="currency" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY" prompt="HLS.CURRENCY"/>
        <bm:field name="base_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BASE_RATE" prompt="FND251.FND_BASE_RATE.BASE_RATE"/>
        <bm:field name="months_from" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MONTHS_FROM" prompt="FND251.FND_BASE_RATE.MONTHS_FROM"/>
        <bm:field name="months_to" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MONTHS_TO" prompt="FND251.FND_BASE_RATE.MONTHS_TO"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="HLS.DESCRIPTION"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.base_rate_id,
				       t1.base_rate_set,
				       t1.currency,
				       (t1.base_rate*100) as base_rate,
				       t1.months_from,
				       t1.months_to,
				       t1.description
				  from fnd_base_rate t1
				 #WHERE_CLAUSE#
				 order by t1.currency,t1.months_from
    		]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:parameters>
                <bm:parameter name="base_rate_id" input="false" output="true" outputPath="@base_rate_id"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
    			begin
				  FND251_SAVE_PKG.rate_manage(p_sql_type	  => 'INSERT',
				  							  p_base_rate_id  => ${@base_rate_id},
								              p_base_rate_set => ${@base_rate_set},
								              p_currency      => ${@currency},
								              p_base_rate     => ${@base_rate},
								              p_months_from   => ${@months_from},
								              p_months_to     => ${@months_to},
								              p_description   => ${@description},
								              p_user_id       => ${/session/@user_id});
				end;
    		]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
    			begin
				  FND251_SAVE_PKG.rate_manage(p_sql_type	  => 'UPDATE',
				  							  p_base_rate_id  => ${@base_rate_id},
								              p_base_rate_set => ${@base_rate_set},
								              p_currency      => ${@currency},
								              p_base_rate     => ${@base_rate},
								              p_months_from   => ${@months_from},
								              p_months_to     => ${@months_to},
								              p_description   => ${@description},
								              p_user_id       => ${/session/@user_id});
				end;
    		]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
    			begin
				  FND251_SAVE_PKG.rate_manage(p_sql_type	  => 'DELETE',
				  							  p_base_rate_id  => ${@base_rate_id},
								              p_base_rate_set => ${@base_rate_set},
								              p_currency      => ${@currency},
								              p_base_rate     => ${@base_rate},
								              p_months_from   => ${@months_from},
								              p_months_to     => ${@months_to},
								              p_description   => ${@description},
								              p_user_id       => ${/session/@user_id});
				end;
    		]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
    			begin
				  FND251_SAVE_PKG.rate_check(p_base_rate_set => ${@base_rate_set},
								             p_user_id       => ${/session/@user_id});
				end;
    		]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:data-filters>
        <bm:data-filter name="base_rate_set" enforceOperations="query" expression="t1.base_rate_set=${@base_rate_set}"/>
    </bm:data-filters>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="base_rate_id"/>
    </bm:primary-key>
</bm:model>
