<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" baseTable="CON_CONTRACT_OVERDUE_LV">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
               SELECT
                   to_char(promised_repay_date,'yyyy-mm-dd') promised_repay_date,
                   search_term_1,
                   contract_number,
                   bp_id_tenant_n,
                   serial_number,
                   bp_id_vender_n,
                   lease_term,
                   bp_id_guarantor_n,
                   direct_debit_bank_id_n,
                   dd_bank_account_num,
                   collector_user_id_n,
                    to_char(lease_start_date,'yyyy-mm-dd') lease_start_date,
                   division_n,
                   annual_pay_times_n,
                   lease_channel_n,
                   document_type_n,
                   contract_status_n,
                   legal_status_n,
                   overdue_times,
                   overdue_amount,
                   penalty,
                   remain_principal,
                    to_char(send_date,'yyyy-mm-dd') send_date,
                     to_char(dispose_date,'yyyy-mm-dd') dispose_date,
       
                   overdue_amount_1_30,
                   overdue_amount_31_60,
                   overdue_amount_61_90,
                   overdue_amount_91_120,
                   overdue_amount_121,
                   country_id_n,
                   province_id_n,
                   city_id_n,
                   district_id_n,
                   address,
                   zipcode,
                   employee_id_n,
                   (select e.mobil from exp_employees e where e.employee_id = t1.employee_id) employee_phone,
                   bp_id_tenant_n,
                   dunning_flag,
                   to_char(unreceived_amount_lastday,'fm9999,999,999,999,990.00') unreceived_amount_lastday,
                   to_char(sysdate-1, 'yyyy') yyyy_l,
       to_char(sysdate-1, 'MM') mm_l,
       to_char(sysdate-1, 'dd') dd_l, 
                   to_char(inception_of_lease,'yyyy-mm-dd') inception_of_lease
               FROM
                   con_contract_incept_lv t1
                #WHERE_CLAUSE# 
           ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field name="contract_id" queryExpression="contract_id IN ${:@contract_id}"/>
    </bm:query-fields>
</bm:model>
