<?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
                    c.overdue_state,
                    (SELECT
                        t.status_name
                    FROM
                        conllection_overdue_status_lv t
                    WHERE
                        t.status_id=c.overdue_state
                    )overdue_state_n,
                    (SELECT
                        v.code_value_name value_name
                    FROM
                        sys_code_values_v v
                    WHERE
                        v.code       = 'OVERDUE_STATUS_TYPE' AND
                        v.code_value = c.overdue_state_type
                    ) overdue_state_type_n,
                    c.overdue_state_type,
                    c.payments_day,
                    c.contract_id,
                    c.project_id,
                    TO_CHAR(c.payments_date,'yyyy-mm-dd') payments_date
                FROM
                    con_collection_call_hd c
                WHERE
                    c.contract_id=${@contract_id} AND
                    c.project_id =${@project_id}
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
