<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
        select
            (SELECT h.extra_nam
              FROM hls_bp_master h
              WHERE h.bp_id=v.bp_id_agent_level1)agent_name,
            (SELECT h.extra_nam
              FROM hls_bp_master h
              WHERE h.bp_id=v.vender_id) vender_name,
            SUM(v.sale_amount) sale_amount,
            SUM(v.sale_penalty)sale_penalty,
            SUM(v.sale_other)sale_other,
            (SUM(v.sale_amount)+SUM(v.sale_penalty)+SUM(v.sale_other)) sum_total
         from (
         select *
          from CONTRACT_BENEFITS_SALE_V t
         #WHERE_CLAUSE#
         )v
      GROUP BY v.bp_id_agent_level1,v.vender_id

                ]]>
            </bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="journal_date_from" queryExpression="to_char(t.journal_date,&apos;yyyy-mm-dd&apos;) &gt;= ${@journal_date_from}"/>
        <bm:query-field name="journal_date_to" queryExpression="to_char(t.journal_date,&apos;yyyy-mm-dd&apos;) &lt;= ${@journal_date_to}"/>
        <bm:query-field name="bp_id_agent_level1" queryExpression="t.bp_id_agent_level1=${@bp_id_agent_level1}"/>
        <bm:query-field name="business_type" queryExpression="t.business_type=${@business_type}"/>
    </bm:query-fields>
</bm:model>
