<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID"
                  required="true"/>
        <bm:field name="calc_session_id" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="CALC_SESSION_ID"/>
        <bm:field name="data_class" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DATA_CLASS"
                  required="true"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="CONTRACT_NUMBER"/>
        <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="CONTRACT_NAME"/>
        <bm:field name="business_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE"
                  required="true"/>
        <bm:field name="document_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_TYPE"
                  required="true"/>
        <bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="DOCUMENT_CATEGORY" required="true"/>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROJECT_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"
                  required="true"/>
        <bm:field name="spv_company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SPV_COMPANY_ID"/>
        <bm:field name="lease_organization" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="LEASE_ORGANIZATION" required="true"/>
        <bm:field name="lease_channel" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHANNEL"
                  required="true"/>
        <bm:field name="division" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DIVISION"
                  required="true"/>
        <bm:field name="bp_id_tenant" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_TENANT"/>
        <bm:field name="bp_id_agent_level1" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="BP_ID_AGENT_LEVEL1"/>
        <bm:field name="bp_id_agent_level2" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="BP_ID_AGENT_LEVEL2"/>
        <bm:field name="bp_id_agent_level3" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="BP_ID_AGENT_LEVEL3"/>
        <bm:field name="owner_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OWNER_USER_ID"/>
        <bm:field name="employee_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EMPLOYEE_ID"/>
        <bm:field name="unit_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="UNIT_ID"/>
        <bm:field name="employee_id_of_manager" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="EMPLOYEE_ID_OF_MANAGER"/>
        <bm:field name="search_term_1" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="SEARCH_TERM_1"/>
        <bm:field name="search_term_2" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SEARCH_TERM_2"/>
        <bm:field name="factoring_type" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="FACTORING_TYPE"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION"/>
        <bm:field name="price_list" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRICE_LIST"/>
        <bm:field name="calc_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CALC_METHOD"/>
        <bm:field name="calc_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CALC_TYPE"/>
        <bm:field name="cdd_list_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CDD_LIST_ID"/>
        <bm:field name="inception_of_lease" databaseType="DATE" datatype="java.util.Date"
                  physicalName="INCEPTION_OF_LEASE"/>
        <bm:field name="lease_start_date" databaseType="DATE" datatype="java.util.Date"
                  physicalName="LEASE_START_DATE"/>
        <bm:field name="first_pay_date" databaseType="DATE" datatype="java.util.Date" physicalName="FIRST_PAY_DATE"/>
        <bm:field name="last_pay_date" databaseType="DATE" datatype="java.util.Date" physicalName="LAST_PAY_DATE"/>
        <bm:field name="lease_end_date" databaseType="DATE" datatype="java.util.Date" physicalName="LEASE_END_DATE"/>
        <bm:field name="lease_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_TIMES"/>
        <bm:field name="pay_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PAY_TIMES"/>
        <bm:field name="annual_pay_times" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="ANNUAL_PAY_TIMES"/>
        <bm:field name="lease_term" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_TERM"/>
        <bm:field name="pay_type" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PAY_TYPE"/>
        <bm:field name="currency" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY"/>
        <bm:field name="currency_precision" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="CURRENCY_PRECISION"/>
        <bm:field name="machinery_amount" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="MACHINERY_AMOUNT"/>
        <bm:field name="parts_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PARTS_AMOUNT"/>
        <bm:field name="lease_item_amount" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="LEASE_ITEM_AMOUNT"/>
        <bm:field name="net_lease_item_amount" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_LEASE_ITEM_AMOUNT"/>
        <bm:field name="vat_input" databaseType="NUMBER" datatype="java.lang.Long" physicalName="VAT_INPUT"/>
        <bm:field name="lease_item_cost" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="LEASE_ITEM_COST"/>
        <bm:field name="main_business_income" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="MAIN_BUSINESS_INCOME"/>
        <bm:field name="main_business_cost" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="MAIN_BUSINESS_COST"/>
        <bm:field name="financing_cost" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FINANCING_COST"/>
        <bm:field name="calc_prompt" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CALC_PROMPT"/>
        <bm:field name="calc_prompt_msg" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="CALC_PROMPT_MSG"/>
        <bm:field name="lease_item_price_agent" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="LEASE_ITEM_PRICE_AGENT"/>
        <bm:field name="down_payment_ratio" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="DOWN_PAYMENT_RATIO"/>
        <bm:field name="down_payment" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DOWN_PAYMENT"/>
        <bm:field name="net_down_payment" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_DOWN_PAYMENT"/>
        <bm:field name="vat_down_payment" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_DOWN_PAYMENT"/>
        <bm:field name="finance_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FINANCE_AMOUNT"/>
        <bm:field name="net_finance_amount" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_FINANCE_AMOUNT"/>
        <bm:field name="vat_finance_amount" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_FINANCE_AMOUNT"/>
        <bm:field name="actual_finance_amount" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="ACTUAL_FINANCE_AMOUNT"/>
        <bm:field name="total_rental" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TOTAL_RENTAL"/>
        <bm:field name="net_total_rental" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_TOTAL_RENTAL"/>
        <bm:field name="vat_total_rental" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_TOTAL_RENTAL"/>
        <bm:field name="total_interest" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TOTAL_INTEREST"/>
        <bm:field name="net_total_interest" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_TOTAL_INTEREST"/>
        <bm:field name="vat_total_interest" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_TOTAL_INTEREST"/>
        <bm:field name="total_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TOTAL_FEE"/>
        <bm:field name="net_total_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NET_TOTAL_FEE"/>
        <bm:field name="vat_total_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="VAT_TOTAL_FEE"/>
        <bm:field name="finance_income" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FINANCE_INCOME"/>
        <bm:field name="net_finance_income" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_FINANCE_INCOME"/>
        <bm:field name="vat_finance_income" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_FINANCE_INCOME"/>
        <bm:field name="contract_amount" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="CONTRACT_AMOUNT"/>
        <bm:field name="tax_type_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TAX_TYPE_ID"/>
        <bm:field name="vat_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VAT_FLAG"/>
        <bm:field name="vat_rate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="VAT_RATE"/>
        <bm:field name="vat_rate_of_interest" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_RATE_OF_INTEREST"/>
        <bm:field name="vat_rate_of_fee" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_RATE_OF_FEE"/>
        <bm:field name="vat_rate_reserved1" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_RATE_RESERVED1"/>
        <bm:field name="lease_charge_ratio" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="LEASE_CHARGE_RATIO"/>
        <bm:field name="lease_charge" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_CHARGE"/>
        <bm:field name="net_lease_charge" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_LEASE_CHARGE"/>
        <bm:field name="vat_lease_charge" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_LEASE_CHARGE"/>
        <bm:field name="lease_mgt_fee_ratio" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="LEASE_MGT_FEE_RATIO"/>
        <bm:field name="lease_mgt_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_MGT_FEE"/>
        <bm:field name="net_lease_mgt_fee" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_LEASE_MGT_FEE"/>
        <bm:field name="vat_lease_mgt_fee" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_LEASE_MGT_FEE"/>
        <bm:field name="lease_mgt_fee_rule" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="LEASE_MGT_FEE_RULE"/>
        <bm:field name="deposit_ratio" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DEPOSIT_RATIO"/>
        <bm:field name="deposit" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DEPOSIT"/>
        <bm:field name="deposit_deduction" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="DEPOSIT_DEDUCTION"/>
        <bm:field name="residual_ratio" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESIDUAL_RATIO"/>
        <bm:field name="residual_value" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESIDUAL_VALUE"/>
        <bm:field name="net_residual_value" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_RESIDUAL_VALUE"/>
        <bm:field name="vat_residual_value" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_RESIDUAL_VALUE"/>
        <bm:field name="balloon_ratio" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BALLOON_RATIO"/>
        <bm:field name="balloon" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BALLOON"/>
        <bm:field name="net_balloon" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NET_BALLOON"/>
        <bm:field name="vat_balloon" databaseType="NUMBER" datatype="java.lang.Long" physicalName="VAT_BALLOON"/>
        <bm:field name="interim_rent_period" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="INTERIM_RENT_PERIOD"/>
        <bm:field name="interim_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INTERIM_TIMES"/>
        <bm:field name="interim_rental" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INTERIM_RENTAL"/>
        <bm:field name="net_interim_rental" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_INTERIM_RENTAL"/>
        <bm:field name="vat_interim_rental" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_INTERIM_RENTAL"/>
        <bm:field name="insurance_rate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INSURANCE_RATE"/>
        <bm:field name="insurance_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INSURANCE_FEE"/>
        <bm:field name="net_insurance_fee" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_INSURANCE_FEE"/>
        <bm:field name="vat_insurance_fee" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_INSURANCE_FEE"/>
        <bm:field name="insurance_fee_payable" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="INSURANCE_FEE_PAYABLE"/>
        <bm:field name="notarial_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NOTARIAL_FEE"/>
        <bm:field name="net_notarial_fee" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_NOTARIAL_FEE"/>
        <bm:field name="vat_notarial_fee" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_NOTARIAL_FEE"/>
        <bm:field name="notarial_fee_payable" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NOTARIAL_FEE_PAYABLE"/>
        <bm:field name="commission_receivable" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="COMMISSION_RECEIVABLE"/>
        <bm:field name="net_commission_receivable" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="NET_COMMISSION_RECEIVABLE"/>
        <bm:field name="vat_commission_receivable" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="VAT_COMMISSION_RECEIVABLE"/>
        <bm:field name="commission_payable" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="COMMISSION_PAYABLE"/>
        <bm:field name="third_party_deposit" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="THIRD_PARTY_DEPOSIT"/>
        <bm:field name="promise_to_pay" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROMISE_TO_PAY"/>
        <bm:field name="other_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OTHER_FEE"/>
        <bm:field name="net_other_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NET_OTHER_FEE"/>
        <bm:field name="vat_other_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="VAT_OTHER_FEE"/>
        <bm:field name="other_fee2" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OTHER_FEE2"/>
        <bm:field name="net_other_fee2" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NET_OTHER_FEE2"/>
        <bm:field name="vat_other_fee2" databaseType="NUMBER" datatype="java.lang.Long" physicalName="VAT_OTHER_FEE2"/>
        <bm:field name="other_fee3" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OTHER_FEE3"/>
        <bm:field name="net_other_fee3" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NET_OTHER_FEE3"/>
        <bm:field name="vat_other_fee3" databaseType="NUMBER" datatype="java.lang.Long" physicalName="VAT_OTHER_FEE3"/>
        <bm:field name="other_payment" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OTHER_PAYMENT"/>
        <bm:field name="other_payment2" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OTHER_PAYMENT2"/>
        <bm:field name="other_payment3" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OTHER_PAYMENT3"/>
        <bm:field name="rounding_object" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="ROUNDING_OBJECT"/>
        <bm:field name="rounding_method" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="ROUNDING_METHOD"/>
        <bm:field name="int_rate_fixing_way" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="INT_RATE_FIXING_WAY"/>
        <bm:field name="int_rate_fixing_range" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="INT_RATE_FIXING_RANGE"/>
        <bm:field name="int_rate_display" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="INT_RATE_DISPLAY"/>
        <bm:field name="base_rate_type" databaseType="VARCHAR2" datatype="java.lang.String"
                  physicalName="BASE_RATE_TYPE"/>
        <bm:field name="base_rate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BASE_RATE"/>
        <bm:field name="int_rate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INT_RATE"/>
        <bm:field name="int_rate_implicit" databaseType="NUMBER" datatype="java.lang.Long"
                  physicalName="INT_RATE_IMPLICIT"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            SELECT *
                    FROM con_contract t
                   WHERE t.contract_id IN
                         (Select cc.contract_id
                            From con_contract_cashflow cc
                           Where TRUNC(Sysdate) - TRUNC(cc.due_date) = 5
                             and cc.write_off_flag != 'FULL'
                             And cc.cf_item = 1
                             And cc.overdue_status = 'Y'
                             and cc.cf_direction = 'INFLOW'
                             AND CC.cf_status = 'RELEASE'
                          union
                          select cc.contract_id
                            from CON_CONTRACT_CASHFLOW cc
                           where TRUNC(cc.due_date) - TRUNC(Sysdate) = 5
                             and cc.write_off_flag != 'FULL'
                             And cc.cf_item = 1
                             And cc.overdue_status = 'N'
                             and cc.cf_direction = 'INFLOW'
                             AND CC.cf_status = 'RELEASE')
                     AND t.contract_status = 'INCEPT'
                     AND t.data_class = 'NORMAL'
                     and t.send_message = 'YES'
                     and t.phone_status != 'APPROVING'
    ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            begin
                hls_payment_msm_send_pkg.sys_collection_t5_sms_loop(p_user_id =>${/session/@user_id}, p_batch_id =>${@batch_id});
            end;
            ]]></bm:update-sql>
            <bm:parameters>
                <bm:parameter name="batch_id" dataType="java.lang.Long" input="true" output="true"
                              outputPath="/parameter/@batch_id"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>

</bm:model>
