<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Harry
    $Date: 2018-10-29 下午4:45:08
    $Revision: 1.0
    $Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" accessControlMode="false" needAccessControl="false">
    <bm:operations>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
                begin
                insert into sap_bank_payment_info
                       (info_id,
                        zbukr,
                        zaldt,
                        zresult,
                        complete,
                        fb_acct,
                        clr_belnr,
                        vblnr,
                        erdat,
                        erzet,
                        ernam,
                        amount,
                        record_status,
                        belnr,
                        gjahr,
                        buzei,
                        shkzg,
                        recvdat,
                        recvzet,
                        lifnr,
                        creation_date)
                        values
                        (sap_bank_payment_info_s.nextval,
                        ${@zbukr},
                        ${@zaldt},
                        ${@zresult},
                        ${@complete},
                        ${@fb_acct},
                        ${@clr_belnr},
                        ${@vblnr},
                        ${@erdat},
                        ${@erzet},
                        ${@ernam},
                        ${@amount},
                        ${@record_status},
                        ${@belnr},
                        ${@gjahr},
                        ${@buzei},
                        ${@shkzg},
                        ${@recvdat},
                        ${@recvzet},
                        ${@lifnr},
                        sysdate
                        );

             update
                 hls_journal_detail t
             set
                 t.sap_payment_status = 'Y',
                 t.sap_payment_num    = ${@clr_belnr},
                 t.sap_zaldt = ${@zaldt},
                 t.last_update_date   = sysdate,
                 t.last_updated_by    = 1
             where
                 t.journal_header_id = (select h.journal_header_id from hls_journal_header h where h.sap_belnr = ${@belnr})
             and t.sap_buzei = ${@buzei};

             end;
]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>