<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: niujiaqing1265 $
    $Date: 2010/12/09 05:48:38 $
    $Revision: 1.4 $
    $Purpose: “汇率定义” 功能中,gld_exchange_rate_details.screen页面中,grid用到的bm文件
-->
<ns1:model xmlns:ns2="leaf.database.local.oracle" xmlns:ns1="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="gerd" baseTable="GLD_EXCHANGE_RATES">
    <ns1:fields>
        <ns1:field databaseType="NUMBER" datatype="java.lang.Double" name="exchange_rate_id"/>
        <ns1:field databaseType="VARCHAR2" datatype="java.lang.String" name="from_currency"/>
        <ns1:field databaseType="VARCHAR2" datatype="java.lang.String" name="to_currency"/>
        <ns1:field databaseType="VARCHAR2" datatype="java.lang.String" name="type_code"/>
        <ns1:field databaseType="NUMBER" datatype="java.lang.Double" name="company_id"/>
        <ns1:field databaseType="NUMBER" datatype="java.lang.Double" name="set_of_books_id"/>
        <ns1:field databaseType="NUMBER" datatype="java.lang.Double" name="currency_volume"/>
        <ns1:field databaseType="NUMBER" datatype="java.lang.Double" name="conversion_rate"/>
        <ns1:field databaseType="DATE" datatype="java.util.Date" name="conversion_date"/>
        <ns1:field databaseType="VARCHAR2" datatype="java.lang.String" name="period_name"/>
        <ns1:field databaseType="NUMBER" datatype="java.lang.Double" name="internal_period_num"/>
        <ns1:field databaseType="VARCHAR2" datatype="java.lang.String" lookupCode="EXCHANGE_RATE_QUOTATION" lookupField="quotation_display" name="exchange_rate_quotation" physicalName="EXCHANGE_RATE_QUOTATION"/>
    </ns1:fields>
    <ns1:primary-key>
        <ns1:pk-field name="exchange_rate_id"/>
    </ns1:primary-key>
    <ns1:query-fields>
        <ns1:query-field name="currency_code" queryExpression="gerd.from_currency = ${/parameter/@currency_code}"/>
        <ns1:query-field field="type_code" queryOperator="="/>
        <ns1:query-field name="currency_code_frn" queryExpression="gerd.to_currency =nvl(${/parameter/@currency_code_frn},gerd.to_currency)"/>
        <ns1:query-field name="period_from" queryExpression="exists (             select 1 from gld_periods gp             where gp.period_set_code = sob.period_set_code             and gp.period_name = gerd.period_name             and internal_period_num &gt;= gld_common_pkg.get_gld_internal_period_num(${/session/@company_id},${/parameter/@period_from})              )"/>
        <ns1:query-field name="period_to" queryExpression=" exists (             select 1 from gld_periods gp             where gp.period_set_code = sob.period_set_code             and gp.period_name = gerd.period_name             and internal_period_num &lt;= gld_common_pkg.get_gld_internal_period_num(${/session/@company_id},${@period_from})              ) "/>
        <ns1:query-field name="date_from" queryExpression=" gerd.conversion_date &gt;= ${@date_from}"/>
        <ns1:query-field name="date_to" queryExpression=" gerd.conversion_date &lt;= ${@date_to} "/>
    </ns1:query-fields>
    <ns1:relations>
        <ns1:relation joinType="INNER" name="gc" refModel="gld.gld_currency">
            <ns1:reference foreignField="currency_code" localField="to_currency"/>
        </ns1:relation>
        <ns1:relation joinType="INNER" name="sob" refModel="gld.gld_set_of_books">
            <ns1:reference foreignField="set_of_books_id" localField="set_of_books_id"/>
        </ns1:relation>
    </ns1:relations>
    <ns1:data-filters>
        <ns1:data-filter enforceActions="query" expression="gerd.company_id = ${/session/@company_id}"/>
    </ns1:data-filters>
    <ns1:features>
        <ns2:sequence-pk/>
        <f:standard-who/>
        <f:multi-language-display/>
    </ns1:features>
    <ns1:ref-fields>
        <ns1:ref-field name="period_set_code" relationName="sob" sourceField="period_set_code"/>
        <ns1:ref-field name="currency_name_id" relationName="gc" sourceField="currency_name_id"/>
    </ns1:ref-fields>
</ns1:model>