<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="insert">
            <bm:parameters>
                <bm:parameter name="journal_submit_batch_id" output="true" outputPath="@journal_submit_batch_id"/>
            </bm:parameters>
            <bm:update-sql>
            <![CDATA[
        declare
        v_journal_submit_batch_id  hls_journal_submit_batch.journal_submit_batch_id%TYPE := hls_journal_submit_batch_s.nextval;
        begin
               ${@journal_submit_batch_id} := v_journal_submit_batch_id;
               insert into hls_journal_submit_batch
                           (journal_submit_batch_id,
                                      instance_id,
                                      wfl_status,
                                      wfl_type,
                                      created_by,
                                      creation_date,
                                      last_updated_by,
                                      last_update_date)
                                      values
                                      (v_journal_submit_batch_id,
                                      null,
                                      null,
                                      ${@wfl_type},
                                      ${/session/@user_id},
                                      sysdate,
                                      ${/session/@user_id},
                                      sysdate
                                      );

        end;
            ]]>
            </bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql>
                <![CDATA[
        update hls_journal_header_imp hjhi
        set 
        hjhi.journal_submit_batch_id = ${/parameter/@journal_submit_batch_id},
        hjhi.last_updated_by = ${/session/@user_id},
        hjhi.last_update_date = sysdate
        where hjhi.journal_header_id = ${@journal_header_id}
            ]]>
            </bm:update-sql>
            <!--<bm:parameters>
                <bm:parameter inputPath="/session/@session_id"/>
            </bm:parameters>-->
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql>
            <![CDATA[
            begin
                hls_journal_import_pkg.submit_hls_journal_tmp(
                    p_journal_submit_batch_id => ${/parameter/@journal_submit_batch_id},
                    p_user_id => ${/session/@user_id},
                    p_company_id => ${/session/@company_id}
                    );
            end;
            ]]>
            </bm:update-sql>
            <!--<bm:parameters>
                <bm:parameter inputPath="/session/@session_id"/>
            </bm:parameters>-->
        </bm:operation>
    </bm:operations>
</bm:model>
