<?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
                    t.contract_name,
                    t.project_name,
                    t.bp_name,
                    t.employee_id_of_manager_n,
                    t.lease_organization_n,
                    t.business_type_n,
                    t.price_list_n
                    || '·'
                    || t.annual_pay_times_n
                    || '·'
                    ||
                    (SELECT
                        sc.code_value_name
                    FROM
                        sys_code_values_v sc
                    WHERE
                        ch.pay_type = sc.code_value AND
                        sc.code     = 'HLS500_PAY_TYPE'
                    ) pay_type_n,
                    TO_CHAR(t.finance_amount, 'fm99,999,999,990.00') finance_amount,
                    t.lease_times,
                    ch.lease_term,
                    TO_CHAR(ch.lease_charge, 'fm99,999,999,990.00') lease_charge,
                    ROUND(ch.lease_charge_ratio * 100, 2)
                    || '%' lease_charge_ratio_per,
                    ROUND(ch.down_payment_ratio * 100, 2)
                    || '%' down_payment_ratio_per,
                    TO_CHAR(ch.deposit, 'fm99,999,999,990.00') deposit,
                    ROUND(ch.irr * 100, 2)
                    || '%' irr_per,
                    (SELECT
                        e.description
                    FROM
                        hls_fin_calc_type e
                    WHERE
                        e.calc_type = ch.calc_type
                    ) calc_type_n,
                    ROUND(ch.int_rate_display * 100, 2)
                    || '%' int_rate_display_per
                FROM
                    con_contract_v t,
                    con_contract_wfl_req r,
                    hls_fin_calculator_hd ch
                WHERE
                    r.contract_req_id   = ${@document_id} AND
                    r.document_category = ${@document_category} AND
                    r.contract_id       = t.contract_id AND
                    t.calc_session_id   = ch.calc_session_id
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
