<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    *
                FROM
                    (SELECT
                        t.session_id,
                        t.order_seq,
                        ccc.times,
                        TO_CHAR(ccc.principal,'FM999,999,990.00') principal,
                        TO_CHAR(ccc.net_interest,'FM999,999,990.00') interest,
                        TO_CHAR(ccc.due_amount,'FM999,999,990.00') due_amount,
                        TO_CHAR(ccc.vat_due_amount,'FM999,999,990.00') vat_due_amount,
                        TO_CHAR(ccc.due_date,'YYYY-MM-DD') due_date,
                        TO_CHAR(outstanding_prin_tax_incld,'FM999,999,999,990.00') outstanding_principal
                    FROM
                        prj_project pp,
                        con_contract cc,
                        con_contract_cashflow ccc,
                        sdic_batch_csh_accounts t
                    WHERE
                        pp.project_id   = cc.project_id AND
                        cc.contract_id  = ccc.contract_id AND
                        ccc.cashflow_id = t.cashflow_id AND
                        cc.data_class   = 'NORMAL'
                    ) t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
            
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
            begin
            sdic_virtual_con_content_pkg.sdic_csh_accounts_ins(p_session_id  =>${/session/@session_id},
                                  p_cashflow_id =>${@cashflow_id},
                                  p_times       =>${@times},
                                  p_user_id     =>${/session/@user_id});
            end;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.session_id=${/session/@session_id}"/>
        <!-- <bm:data-filter enforceOperations="query" expression="rownum=1"  /> -->
    </bm:data-filters>
</bm:model>
