<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng
    $Date: 2019-05-27 09:49:33
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            begin
            DS_IMPORT_CORE_PKG.insert_cus_info(p_loan_contrat_number => ${@loan_contrat_number},
                                                p_user_id => ${/session/@user_id});
                                                end;
]]></bm:update-sql>
        </bm:operation>
        <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,
               li.attribute_1,
               li.attribute_2,
               li.attribute_3,
               li.attribute_4,
                li.attribute_5,
               li.attribute_6,
               li.attribute_7,
               li.attribute_8,
               li.attribute_9,
               li.attribute_10,
               li.attribute_11,
               li.attribute_12,
               li.attribute_13,
               li.attribute_14,
               li.attribute_15,
               li.attribute_16,
               li.attribute_17,
               li.attribute_18,
               li.attribute_19,
               li.attribute_20,
               li.attribute_21,
               li.attribute_22,
               li.attribute_23,
               li.attribute_24,
               li.attribute_25,
               li.attribute_26,
               li.attribute_27,
li.attribute_28,
li.attribute_29,
li.attribute_30,
li.attribute_31,
li.attribute_32,
li.attribute_33,
li.attribute_34,
li.attribute_35,
li.attribute_36,
li.attribute_37,
li.attribute_38,
li.attribute_39,
li.attribute_40,
li.attribute_41,
li.attribute_42,
li.attribute_43,
li.attribute_44
          FROM fnd_interface_headers hd,
               fnd_interface_lines   li
         WHERE hd.header_id = li.header_id
           AND hd.template_code = 'INSTALLMENT_LIST'
           AND li.line_number >0
        AND HD.CREATED_BY = ${/session/@user_id}
        ) t1
 #WHERE_CLAUSE#
   order by t1.line_number

]]></bm:query-sql>
        </bm:operation>

        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
            begin
            DS_IMPORT_CORE_PKG.installment_import_check(p_header_id => ${/model/header/record/@header_id},
                                                p_batch_id => ${@batch_id},
                                                p_user_id => ${/session/@user_id});
                                                end;
]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
        begin
          DS_IMPORT_CORE_PKG.installment_import(
                                    p_header_id   =>${/parameter/@header_id},
                                    p_batch_id =>${/parameter/@batch_id},
                                    p_user_id     =>${/session/@user_id});
        end;
        ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="header_id" queryExpression="t1.header_id=${@header_id}"/>
    </bm:query-fields>
</bm:model>
