<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hp  
    $Date: 2014-1-7 下午05:49:53  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" needAccessControl="false">
    <bm:fields>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="GLD_PERIOD_OPEN_V.COMPANY_ID"/>
        <bm:field name="period_set_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PERIOD_SET_CODE" prompt="GLD_PERIOD_OPEN_V.PERIOD_SET_CODE"/>
        <bm:field name="period_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PERIOD_NAME" prompt="GLD_PERIOD_OPEN_V.PERIOD_NAME"/>
        <bm:field name="internal_period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INTERNAL_PERIOD_NUM" prompt="GLD_PERIOD_OPEN_V.INTERNAL_PERIOD_NUM"/>
        <bm:field name="period_year" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PERIOD_YEAR" prompt="GLD_PERIOD_OPEN_V.PERIOD_YEAR"/>
        <bm:field name="period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PERIOD_NUM" prompt="GLD_PERIOD_OPEN_V.PERIOD_NUM"/>
        <bm:field name="start_date" databaseType="DATE" datatype="java.util.Date" physicalName="START_DATE" prompt="GLD_PERIOD_OPEN_V.START_DATE"/>
        <bm:field name="end_date" databaseType="DATE" datatype="java.util.Date" physicalName="END_DATE" prompt="GLD_PERIOD_OPEN_V.END_DATE"/>
        <bm:field name="quarter_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="QUARTER_NUM" prompt="GLD_PERIOD_OPEN_V.QUARTER_NUM"/>
        <bm:field name="adjustment_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ADJUSTMENT_FLAG" prompt="GLD_PERIOD_OPEN_V.ADJUSTMENT_FLAG"/>
        <bm:field name="period_status_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PERIOD_STATUS_CODE" prompt="GLD_PERIOD_OPEN_V.PERIOD_STATUS_CODE"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
           select b.company_id,
       a.period_set_code,
       a.period_name,
       a.internal_period_num,
       a.period_year,
       a.period_num,
       a.start_date,
       a.end_date,
       a.quarter_num,
       a.adjustment_flag,
       decode(b.period_status_code, null, 'U', b.period_status_code) period_status_code,
       a.creation_date,
       a.created_by,
       a.last_update_date,
       a.last_updated_by
  from gld_periods a, gld_period_status b
 where a.internal_period_num = b.internal_period_num
   and a.period_set_code = b.period_set_code
   and a.period_year = nvl(${@period_year},a.period_year)
   and a.period_set_code = nvl(${@period_set_code},a.period_set_code)


 #WHERE_CLAUSE#
 #ORDER_BY_CLAUSE#
]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
    </bm:features>
</bm:model>
