<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zjw  
    $Date: 2011-9-6 下午03:32:15  
    $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 * from
            (select t.*, to_char(t.start_date,'yyyy-mm-dd') start_date_c, to_char(t.end_date,'yyyy-mm-dd') end_date_c 
            from fnd_sob_period_status_v t 
            where t.set_of_books_id = (select f.set_of_books_id from fnd_companies f where f.company_id = ${/session/@company_id})
            
            )v
            #WHERE_CLAUSE# 
            order by v.period_status_code asc,v.period_year asc, v.period_num asc
]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="period_set_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PERIOD_SET_CODE" required="true"/>
        <bm:field name="period_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PERIOD_NAME" required="true"/>
        <bm:field name="internal_period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INTERNAL_PERIOD_NUM" required="true"/>
        <bm:field name="period_year" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PERIOD_YEAR" required="true"/>
        <bm:field name="period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PERIOD_NUM" required="true"/>
        <bm:field name="start_date" databaseType="DATE" datatype="java.util.Date" physicalName="START_DATE" required="true"/>
        <bm:field name="end_date" databaseType="DATE" datatype="java.util.Date" physicalName="END_DATE" required="true"/>
        <bm:field name="quarter_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="QUARTER_NUM" required="true"/>
        <bm:field name="adjustment_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ADJUSTMENT_FLAG" required="true"/>
        <bm:field name="period_status_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PERIOD_STATUS_CODE"/>
        <bm:field name="creation_date" databaseType="DATE" datatype="java.util.Date" physicalName="CREATION_DATE" required="true"/>
        <bm:field name="created_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CREATED_BY" required="true"/>
        <bm:field name="last_update_date" databaseType="DATE" datatype="java.util.Date" physicalName="LAST_UPDATE_DATE" required="true"/>
        <bm:field name="last_updated_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LAST_UPDATED_BY" required="true"/>
        <bm:field name="start_date_c" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="START_DATE_C"/>
        <bm:field name="end_date_c" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="END_DATE_C"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="period_set_code" queryExpression="v.period_set_code=${@period_set_code}"/>
    </bm:query-fields>
</bm:model>
