<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: sf
    $Date: 2019-10-20 下午03:50:31
    $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 count(*) total_number,
               TRIM(to_char(sum(nvl(c.lease_item_amount, 0)),'FM999,999,999,990.00')) sum_amount,
               TRIM(to_char(sum(nvl(v.amount_agent, 0)),'FM999,999,999,990.00')) sum_amount_agent,
               TRIM(to_char(sum(nvl(v.amount_vender, 0)),'FM999,999,999,990.00')) sum_amount_vender,
                TRIM(to_char(sum(nvl(v.other_payment2, 0)),'FM999,999,999,990.00')) sum_other_payment,
               to_char(sysdate, 'yyyy') || '年' || to_char(sysdate, 'mm') || '月' purchase_date
          from csh_payment_req_ln v,con_contract c
          WHERE v.ref_doc_id=c.contract_id
            AND v.payment_req_id=${@payment_req_id}
          ) v


                ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="v.payment_req_id =${@payment_req_id}"/>
    </bm:data-filters>
  <!--  <bm:query-fields>
        <bm:query-field name="payment_req_id" queryOperator="="/>
    </bm:query-fields>-->

</bm:model>
