<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: jack  
    $Date: 2014-6-3 上午11:14:59  
    $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 * FROM (SELECT DISTINCT b.fin_statement_templet_id,
                b.bp_id,
                a.bp_category,
                a.bp_class,
                a.project_id,
        (select t.fiscal_year || '年' || t.fiscal_month || '月' fiscal_year   
   from rsc_fin_statement_prj_hds t
  where t.fin_statement_id =(SELECT rsc_fin_statement_prj_pkg.get_fin_statement_id(b.fin_statement_templet_id,1,b.bp_id,1) FROM DUAL)) YEAR_1,
        (select t.fiscal_year || '年' || t.fiscal_month || '月' fiscal_year   
   from rsc_fin_statement_prj_hds t
  where t.fin_statement_id =(SELECT rsc_fin_statement_prj_pkg.get_fin_statement_id(b.fin_statement_templet_id,1,b.bp_id,2) FROM DUAL)) YEAR_2,
        (select t.fiscal_year || '年' || t.fiscal_month || '月' fiscal_year   
   from rsc_fin_statement_prj_hds t
  where t.fin_statement_id =(SELECT rsc_fin_statement_prj_pkg.get_fin_statement_id(b.fin_statement_templet_id,1,b.bp_id,3) FROM DUAL)) YEAR_3,
         (select t.fiscal_year || '年' || t.fiscal_month || '月' fiscal_year   
   from rsc_fin_statement_prj_hds t
  where t.fin_statement_id =(SELECT rsc_fin_statement_prj_pkg.get_fin_statement_id(b.fin_statement_templet_id,1,b.bp_id,4) FROM DUAL)) YEAR_4
  FROM prj_project_bp            a,
       rsc_fin_statement_prj_hds b
 WHERE a.bp_id = b.bp_id) A) t1 #WHERE_CLAUSE#
 ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="fin_statement_templet_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="fin_statement_templet_id"/>
        <bm:field name="bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="bp_id"/>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="project_id"/>
        <bm:field name="bp_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="bp_category"/>
        <bm:field name="bp_class" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="bp_class"/>
    </bm:fields>
</bm:model>
