<?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 p.chance_id,
       p.project_name, --项目名称
       (SDIC_INDIVIDUAL_PKG.string_combination(' SELECT pbl.bp_name from prj_chance_bp_lv Pbl
   WHERE bp_category=''TENANT'' and Pbl.chance_id=',
                                               P.chance_id,
                                               '、')) bp_name_tenant, --主次承租人
       (SDIC_INDIVIDUAL_PKG.string_combination(' SELECT pbl.bp_name from prj_chance_bp_lv Pbl
   WHERE   bp_category=''GUARANTOR'' and Pbl.chance_id=',
                                               P.chance_id,
                                               '、')) bp_name_guarantor, --担保人 
       (SDIC_INDIVIDUAL_PKG.string_combination(' SELECT pi.lease_project_name||pi.lease_itme_name  FROM PRJ_CHANCE_LEASE_ITEM Pi
   WHERE Pi.chance_id=',
                                               P.chance_id,
                                               ';')) lease_itme_name, --租赁物
       p.business_type_n
       -- , --业务类型
       -- 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, --保证金（期初收取）  
       -- hd.lease_term 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_lv           p,
       prj_chance_bp_lv        pb
       -- ,
       -- prj_chance_quotation_lv pql,
       -- hls_fin_calculator_hd   hd
 where p.chance_id = pb.chance_id(+)
   -- and pb.bp_category = 'TENANT'
   -- and pb.bp_type = 'TENANT'
   -- and p.chance_id = pql.chance_id
   -- and pql.quotation_type = 'MAJOR'
   -- and pql.calc_session_id = hd.calc_session_id
   and p.chance_id=${/parameter/@chance_id}
]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
