<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: weiwuzhen  
    $Date: 2016-5-17 上午10:43:41  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
       select
       trim(to_char(pql.lease_item_amount, '999,999,999,990.99')) lease_item_amount, --融资额
       trim(to_char(hd.deposit, '999,999,999,990.99')) deposit, --保证金（期初收取）  
       trim(to_char(hd.lease_term, 'FM999,999,999,990.099999')) lease_term, --租赁期限        
       to_char(hd.int_rate * 100, 'FM999,999,999,990.099999') int_rate, --租赁利率
       (select value_name 
          from (select a.code_value value_code, a.code_value_name value_name
                  from sys_code_values_v a
                 where a.code = 'TRE502_INT_RATE_FIXING_WAY'
                   and a.code_value in ('MUTIPLY', 'PLUS','DECREASE','FLOATING_DOWNWARD')) t
         where t.value_code = hd.Int_Rate_Fixing_Way) int_rate_fixing_way,
           
       to_char(hd.Int_Rate_Fixing_Range * 100, 'FM999,999,999,990.099999') int_rate_range, --租金利率浮动  
       (' 按' ||
       (select value_name
           from (select a.code_value value_code, a.code_value_name value_name
                   from sys_code_values_v a
                  where a.code = 'HLS500_ANNUAL_PAY_TIMES') t2
          where t2.value_code = hd.Annual_Pay_Times))  annual_pay_times, --支付频率   
       to_char(hd.Hd_User_Col_N03, '999,999,999,990.99') hd_user_col_n03, --残值/残值率
        (select value_name
          from (select code_value value_code, code_value_name value_name
         from sys_code_values_v
        where code = 'HLS500_CHARGE_PAY_TIMES'
          and code_value_enabled_flag = 'Y') t
         where t.value_code = hd.HD_USER_COL_V06) hd_user_col_v06, --手续费支付频率
         to_char(hd.hd_user_col_n07* 100  , 'FM999999999990.099999')  hd_user_col_n07--手续费比例值 
  from 
       prj_chance_quotation_lv pql,
       hls_fin_calculator_hd   hd
 where 
   pql.quotation_type = 'MAJOR'
   and pql.calc_session_id = hd.calc_session_id
   and pql.chance_id=${/parameter/@chance_id}
]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
