<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
     SELECT t1.bp_code,
                t1.bp_name,
                t1.contract_number,
                (t1.int_rate_display*100)||'%' int_rate_display,
                t1.lease_start_date,
                t1.contract_amount TOTAL_SIGN,
                t1.pre_pay_amount  DOWN_PAYMENT,
                t1.contract_principal_amount HD_USER_COL_N11,
                (csh_write_off_pkg.get_ifr_overdue_amount(p_contract_id => t1.ref_contract_id,
                       p_base_date => t1.base_date)) TOTAL_OVERDUE_AMOUNT,
               (csh_write_off_pkg.get_overdue_day(p_contract_id => t1.ref_contract_id,
                                                                   p_calc_date   => t1.base_date,
                                                                   p_user_id     => 1))OVERDUE_MAX_DAYS,
                t1.rest_amount RESIDUAL_CLAIMS,
                t1.pay_date PAYDATE_1,
                t1.pay_amount RESIDUAL_VALUE,
                t1.industry_belonged INDUSTRY,
                t1.lease_item_location LEASE_ITEM_LOCATION,
                t1.base_date,
                t1.created_by,
                t1.creation_date,
                t1.last_updated_by,
                t1.last_update_date,
                t1.ifrs_id,
                t1.period_day period_name,
                t1.ref_contract_id
          FROM con_contract_ifrs9 t1
          #WHERE_CLAUSE#
                ]]>
            </bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            	begin
            		csh_write_off_pkg.update_ifrs9_col(
        			 p_period_name =>${@period_name}
        			 );
            	end;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="period_name" queryExpression="t1.period_day=${@period_name}"/>
<!--        <bm:query-field name="journal_date_to" queryExpression="to_char(t.journal_date,&apos;yyyy-mm-dd&apos;) &lt;= ${@journal_date_to}"/>-->
<!--        <bm:query-field name="bp_id_agent_level1" queryExpression="t.bp_id_agent_level1=${@bp_id_agent_level1}"/>-->
    </bm:query-fields>
</bm:model>
