<?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
                    t2.contract_id,
                    t2.contract_name,
                    t2.contract_number,
                    t2.project_number,
                    t2.bp_id_tenant_n,
                    t2.company_id_n,
                    t2.business_type_n,
                    t2.division_n,
                    t2.direct_debit_bank_id,
                    t2.direct_debit_bank_id_n,
                    t2.dd_bank_account_name,
                    t2.dd_bank_account_num,
                    t2.ebank_account_prop,
                    t2.ebank_account_prop_n,
                    t2.finance_amount,
                    t2.pmt,
                    t2.annual_pay_times_n,
                    t2.lease_times,
                    t2.price_list_n,
                    t2.lease_item_amount,
                    t2.net_lease_item_amount,
                    t2.lease_term,
                    t2.down_payment_ratio,
                    t2.down_payment,
                    (ROUND(t2.down_payment_ratio*100,2)
                    ||'%'
                    || '-'
                    || fmt_number(t2.down_payment) )AS down_payment_ratio_together,
                    t2.deposit_ratio,
                    t2.deposit,
                    (ROUND(t2.deposit_ratio*100,2)
                    ||'%'
                    || '-'
                    || fmt_number(t2.deposit) )AS deposit_ratio_together,
                    t2.lease_charge_ratio,
                    t2.lease_charge,
                    (ROUND(t2.lease_charge_ratio*100,2)
                    ||'%'
                    || '-'
                    || fmt_number(t2.lease_charge) )AS lease_charge_ratio_together
                FROM
                    con_contract_lv t2
                WHERE
                    t2.contract_id=${@contract_id}
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="contract_id"/>
        <bm:field name="contract_name"/>
        <bm:field name="contract_number"/>
        <bm:field name="project_number"/>
        <bm:field name="bp_id_tenant_n"/>
        <bm:field name="company_id_n"/>
        <bm:field name="business_type_n"/>
        <bm:field name="division_n"/>
        <bm:field name="direct_debit_bank_id"/>
        <bm:field name="direct_debit_bank_id_n"/>
        <bm:field name="dd_bank_account_name"/>
        <bm:field name="dd_bank_account_num"/>
        <bm:field name="ebank_account_prop"/>
        <bm:field name="ebank_account_prop_n"/>
        <bm:field name="finance_amount"/>
        <bm:field name="pmt"/>
        <bm:field name="annual_pay_times_n"/>
        <bm:field name="lease_times"/>
        <bm:field name="price_list_n"/>
        <bm:field name="lease_item_amount"/>
        <bm:field name="net_lease_item_amount"/>
        <bm:field name="lease_term"/>
        <bm:field name="down_payment_ratio"/>
        <bm:field name="down_payment_ratio_together"/>
        <bm:field name="deposit_ratio"/>
        <bm:field name="deposit"/>
        <bm:field name="deposit_ratio_together"/>
        <bm:field name="lease_charge_ratio"/>
        <bm:field name="lease_charge"/>
        <bm:field name="lease_charge_ratio_together"/>
    </bm:fields>
</bm:model>
