<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2014-2-17 上午10:09:24  
    $Revision: 1.0  
    $Purpose: 
-->
<ns1:model xmlns:ns1="http://www.leaf-framework.org/schema/bm" alias="t1" extend="basic.gld_periods" extendMode="reference">
    <ns1:fields>
        <ns1:field name="internal_period_num" datatype="java.lang.String" displayWidth="100" forDisplay="true" forQuery="true"/>
        <ns1:field name="period_name" displayWidth="100" forDisplay="true" forQuery="true"/>
        <ns1:field name="adjustment_flag" displayWidth="60" forDisplay="true"/>
        <ns1:field name="start_date" displayWidth="100" forDisplay="true"/>
        <ns1:field name="end_date" displayWidth="100" forDisplay="true"/>
    </ns1:fields>
    <ns1:operations>
        <ns1:operation name="query">
            <ns1:query-sql><![CDATA[
    			SELECT t1.internal_period_num,
				       t1.period_name,
				       t1.adjustment_flag,
				       t1.start_date,
				       t1.end_date
				  FROM gld_periods t1
				 INNER JOIN gld_period_status s
				    ON s.internal_period_num = t1.internal_period_num
				   AND s.period_set_code = t1.period_set_code
				 INNER JOIN fnd_company_book_set_v b
				    on b.period_set_code = t1.period_set_code
				   and b.company_id = s.company_id
				  #WHERE_CLAUSE#
				 order by t1.internal_period_num desc
    		]]></ns1:query-sql>
        </ns1:operation>
    </ns1:operations>
    <ns1:query-fields>
        <ns1:query-field name="internal_period_num" queryExpression="t1.internal_period_num like &apos;%&apos;||${@internal_period_num} ||&apos;%&apos; "/>
        <ns1:query-field name="period_name" queryExpression="t1.period_name like &apos;%&apos;||${@period_name} ||&apos;%&apos; "/>
        <ns1:query-field name="period_year" queryExpression="t1.period_year = ${@period_year} "/>
        <ns1:query-field name="adjustment_flag" queryExpression="t1.adjustment_flag = ${@adjustment_flag} "/>
    </ns1:query-fields>
    <ns1:data-filters>
        <ns1:data-filter enforceOperations="query" expression="s.company_id = ${/session/@top_biz_company_id}"/>
    </ns1:data-filters>
</ns1:model>
