<?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 t1.*
                From (Select li.line_id,
                li.error_message,
                li.status,
                li.header_id,
                li.line_number,
                hd.created_by,
                li.source_table,
                cc.contract_id,
                (Select bp.bp_name
                From hls_bp_master bp
                Where bp.bp_id = cc.bp_id_tenant) bp_name,
                --li.attribute_1 cashflow_id,
               li.attribute_2 contract_number,
               li.attribute_4 bank_number,
               (li.attribute_6 / 100) due_amount,
               li.attribute_7 currency_code,
               li.attribute_8 due_date,
               li.attribute_9 withhold_id,
               li.attribute_10 withhold_note
                From fnd_interface_headers hd,
                fnd_interface_lines   li,
                con_contract          cc
                Where li.attribute_2 = cc.contract_number
                and  cc.data_class = 'NORMAL'
                And hd.header_id = li.header_id
                And hd.template_code = 'ABC_MANUAL_IMPORT'
                And li.line_number > 0
                And li.header_id = ${@header_id}
                And hd.created_by = ${/session/@user_id}) t1  #WHERE_CLAUSE#
                Order By decode(t1.status, 'ERROR', 1, 2), t1.line_number

            ]]></bm:query-sql>
            <!--  <bm:parameters>
                <bm:parameter name="header_id"/>
                <bm:parameter inputPath="/session/@user_id"/>
            </bm:parameters> -->
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
                BEGIN
                    hls_ebank_abc_pub_pkg.import_interface_to_write_off(p_header_id =>${@header_id},
                                                                        p_header_number => ${@header_number},
													                    p_company_id => ${/session/@company_id}, 
													                    p_user_id => ${/session/@user_id});
                END;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
                BEGIN
                    hls_ebank_abc_pub_pkg.get_err_message(p_session_id => ${/session/@session_id});
                END;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
