<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Guoxuezhao  
    $Date: 2013-6-20 上午10:43:21  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    lc.loan_contract_id,
                    lc.loan_contract_number,
                    lc.currency,
                    lc.loan_contract_book_date,
                    lc.loan_date_from,
			 		lc.loan_date_to,
                    (SELECT
                        fd.description_text
                    FROM
                        gld_currency gc,
                        fnd_descriptions fd
                    WHERE
                        gc.currency_name_id = fd.description_id AND
                        fd.language         = ${/session/@lang} AND
                        gc.currency_code    = lc.currency
                    ) AS currency_name,
                    lc.int_rate_fixing_way,
                    lc.int_rate_fixing_range,
                    lc.interest_rate
                FROM
                    tre_loan_contract lc
                WHERE
                    lc.loan_contract_id = ${@loan_contract_id}
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="loan_contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LOAN_CONTRACT_ID" required="true"/>
        <bm:field name="loan_contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CONTRACT_NUMBER"/>
        <bm:field name="currency" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY"/>
        <bm:field name="loan_contract_book_date" databaseType="DATE" datatype="java.util.Date" physicalName="LOAN_CONTRACT_BOOK_DATE"/>
        <bm:field name="loan_date_from" databaseType="DATE" datatype="java.util.Date" physicalName="LOAN_DATE_FROM"/>
        <bm:field name="loan_date_to" databaseType="DATE" datatype="java.util.Date" physicalName="LOAN_DATE_TO"/>
        <bm:field name="int_rate_fixing_way" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INT_RATE_FIXING_WAY"/>
        <bm:field name="int_rate_fixing_range" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INT_RATE_FIXING_RANGE"/>
        <bm:field name="currency_name" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="interest_rate" databaseType="NUMBER" datatype="java.lang.Double"/>
    </bm:fields>
</bm:model>
