<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2012-11-13 下午01:59:30  
    $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 'content' type,
               f.line_number field,
               f.field_description_dis title,
               f.header_style titlestyle,
               f.subtotal_type groupFormula,
               (select decode(f.subtotal_type,
                              1,
                              '平均值 ',
                              2,
                              '计数 ',
                              3,
                              '计数 ',
                              4,
                              '最大值 ',
                              5,
                              '最小值 ',
                              6,
                              '乘积 ',
                              7,
                              '标准偏差 ',
                              9,
                              '汇总 ')
                  from dual) groupdesc,
                  (select decode(f.subtotal_type,
                              1,
                              '总计平均值 ',
                              2,
                              '总计数 ',
                              3,
                              '总计数 ',
                              4,
                              '总计最大值 ',
                              5,
                              '总计最小值 ',
                              6,
                              '总计乘积 ',
                              7,
                              '总计标准偏差 ',
                              9,
                              '总计 ')
                  from dual) totalDesc,
                  psr_report_columns_check_pkg.get_groupfield(h.report_header_id,f.subtotal_type)groupField,
                  (select g.line_number
                  from psr_report_groups g
                 where g.report_header_id = ${@report_header_id}
                 and g.field_line_number =f.line_number ) grouplevel,
                 f.REPORT_FIELD_ID,
                 f.header_style groupstyle,
                 f.header_style formulastyle,
                 f.header_style linestyle
          from psr_report_headers h, psr_report_fields f 
         where h.report_header_id = f.report_header_id
           and h.report_header_id = ${@report_header_id}
           and psr_report_columns_check_pkg.get_groupfield(h.report_header_id,f.subtotal_type) is not null) v
   #WHERE_CLAUSE#
   order by v.field
   ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="report_field_id" datatype="java.lang.Long"/>
        <bm:field name="groupFormula" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="GROUPFORMULA"/>
        <bm:field name="groupDesc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="GROUPDESC"/>
        <bm:field name="totalDesc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TOTALDESC"/>
        <bm:field name="groupField" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="GROUPFIELD"/>
        <!-- <bm:field name="groupstyle" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="formulastyle" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="linestyle" databaseType="VARCHAR2" datatype="java.lang.String"/> -->
    </bm:fields>
    <!-- <bm:query-fields>
        <bm:query-field name="instance_id" dataType="java.lang.Long" queryExpression="v.instance_id = ${@instance_id}"/>
    </bm:query-fields> -->
</bm:model>
