<?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 l.times_1,
       l.principal_1,
       l.interest_1,
       l.discount_limit_1,
       l.rental_1,
       p.product_id,
       p.product_id_n,
       p.hd_user_col_v01,
       p.hd_user_col_v01_n,
       
       p.down_payment_ratio*100 down_payment_ratio,
       p.down_payment,
       p.other_fee,
       p.other_fee3,
       p.lease_charge_ratio*100 lease_charge_ratio,
       p.lease_charge,
       p.int_rate_display*100 int_rate_display,
       
       p.lease_item_amount,
       p.deposit_ratio*100 deposit_ratio,
       p.deposit,
       p.deposit_deduction,
       (select b.code_value_name value_name
  from sys_codes a, sys_code_values_vl b
 where b.code_id = a.code_id
   and a.code = 'HLS500_DEPOSIT_DEDUCTION'
   and b.code_value = p.deposit_deduction
 )deposit_deduction_n,
       p.hd_user_col_n14,
       p.insurance_fee,
       p.hd_user_col_n05,
       
       p.notarial_fee_payable,
       p.btb_interest_margin,
       p.lease_item_price_agent,
        p.hd_user_col_n06*100 hd_user_col_n06,
       p.btb_fee_after_tax,
       p.base_rate,
       p.base_rate_type,
       
       p.price_list,
       p.price_list_n,
       p.lease_times,
       p.lease_times_n,
       p.annual_pay_times,
       p.annual_pay_times_n,
       p.project_id,
       p.hd_user_col_v05,
       p.hd_user_col_v05_n,
       p.promise_to_pay,
       p.residual_value,
       
        p.btb_fee_after_tax_n,
        to_char(p.lease_start_date,'yyyy-mm-dd') lease_start_date,
        p.commission_receivable,
        p.third_party_deposit,
        p.hd_user_col_n13,
        h.financing_cost,
        h.irr irr,
       
       p.quotation_id,
       p.calc_session_id
  FROM yonda_project_cashflow_lv l,
       prj_quotation_new_lv      p,
       hls_fin_calculator_hd     h,
       prj_project               t
 WHERE h.calc_session_id = l.calc_session_id
   AND p.calc_session_id = h.calc_session_id
   AND t.project_id = p.document_id
   and t.project_id = ${@project_id}
   AND p.document_category = 'PROJECT'

            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="btb_fee_after_tax_n"/>
        <bm:field name="lease_start_date"/>
        <bm:field name="deposit_deduction_n"/>
        <bm:field name="down_payment"/>
        <bm:field name="commission_receivable"/>
        <bm:field name="third_party_deposit"/>
        <bm:field name="hd_user_col_n13"/>
        <bm:field name="financing_cost"/>
        <bm:field name="irr"/>
        <bm:field name="price_list"/>
        <bm:field name="price_list_n"/>
        <bm:field name="lease_times"/>
        <bm:field name="lease_times_n"/>
        <bm:field name="annual_pay_times"/>
        <bm:field name="annual_pay_times_n"/>
        <bm:field name="project_id"/>
        <bm:field name="notarial_fee_payable"/>
        <bm:field name="btb_interest_margin"/>
        <bm:field name="lease_item_price_agent"/>
        <bm:field name="hd_user_col_n06"/>
        <bm:field name="btb_fee_after_tax"/>
        <bm:field name="base_rate"/>
        <bm:field name="base_rate_type"/>
        <bm:field name="lease_item_amount"/>
        <bm:field name="deposit_ratio"/>
        <bm:field name="deposit"/>
        <bm:field name="deposit_deduction"/>
        <bm:field name="hd_user_col_n14"/>
        <bm:field name="insurance_fee"/>
        <bm:field name="hd_user_col_n05"/>
        <bm:field name="times_1"/>
        <bm:field name="principal_1"/>
        <bm:field name="interest_1"/>
        <bm:field name="discount_limit_1"/>
        <bm:field name="rental_1"/>
        <bm:field name="product_id"/>
        <bm:field name="product_id_n"/>
        <bm:field name="hd_user_col_v01"/>
        <bm:field name="hd_user_col_v01_n"/>
        <bm:field name="hd_user_col_v05"/>
        <bm:field name="hd_user_col_v05_n"/>
        <bm:field name="down_payment_ratio"/>
        <bm:field name="other_fee"/>
        <bm:field name="quotation_id"/>
        <bm:field name="other_fee3"/>
        <bm:field name="lease_charge_ratio"/>
        <bm:field name="lease_charge"/>
        <bm:field name="int_rate_display"/>
        <bm:field name="promise_to_pay"/>
        <bm:field name="residual_value"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="searchInput" queryExpression="t.bp_id_tenant_n like &apos;%&apos;||${@searchInput}||&apos;%&apos; or t.contract_number like &apos;%&apos;||${@searchInput}||&apos;%&apos;"/>
    </bm:query-fields>
</bm:model>
