<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang 
    $Date: 2015-1-28 上午11:55:40  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
                BEGIN
                    INSERT
                    INTO
                        csh_payment_req_detail_tmp
                        (
                            session_id,
                            id,
                            amt,
                            bank_account_id
                        )
                        VALUES
                        (
                            ${/session/@session_id},
                            ${@id},
                            ${@amt},
                            ${@bank_account_id}
                        );
                END;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            declare
            v_bank_record_id number;
          begin
          v_bank_record_id :=csh_payment_req_ln_bank_s.nextval;
            insert into CSH_PAYMENT_REQ_LN_BANK(BANK_RECORD_ID,
                                    PAYMENT_REQ_LN_ID,
                                    BANK_ACCOUNT_ID,
                                    AMOUNT,
                                    PAY_WAY,
                                    PAY_TYPE,
                                    INVOICE_INFO,
                                    CREATION_DATE,
                                    CREATED_BY,
                                    LAST_UPDATE_DATE,
                                    LAST_UPDATED_BY,
                                    payment_method)
                                   values
                                   (v_bank_record_id,
                                   ${@id},
                                   ${@bank_account_id},
                                   ${@amt},
                                   ${@pay_way},
                                   ${@pay_type},
                                   ${@invoice_info},
                                   sysdate,
                                   ${/session/@user_id},
                                    sysdate,
                                   ${/session/@user_id},
                                   ${@payment_method});
              INSERT
                    INTO
                        csh_payment_req_detail_tmp
                        (
                            session_id,
                            id,
                            amt,
                            bank_account_id,
                            bank_record_id
                        )
                        VALUES
                        (
                            ${/session/@session_id},
                            ${@id},
                            ${@amt},
                            ${@bank_account_id},
                            v_bank_record_id
                        );
            end;
          ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
                BEGIN
                    DELETE
                    FROM
                        csh_payment_req_detail_tmp l
                    WHERE
                        l.session_id=${/session/@session_id};
                END;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
