<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: weiwuzhen  
    $Date: 2016-4-28 上午11:07:27  
    $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 
   (select V.code_value_name from prj_quotation q,HLS_FIN_CALCULATOR_HD HD, SYS_CODE_VALUES_V V where q.document_id=p.chance_id
   and q.document_category='CHANCE'
   AND Q.QUOTATION_TYPE='MAJOR'
   AND HD.CALC_SESSION_ID=Q.CALC_SESSION_ID
   AND HD.pay_type=V.code_value
   AND V.code='HLS500_PAY_TYPE'
   and v.code_enabled_flag='Y'
   and v.code_value_enabled_flag='Y') beginning_or_ending,--期初期末
   pcql.price_list_n,--还款方式
   trim(to_char((hd.irr_reserved2)*100,'90.99999999'))|| '%' irr_reserved2,--我司综合XIRR
   trim(to_char((hd.lease_charge_ratio)*100,'90.99')) || '%' lease_charge_ratio,--手续费
    (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,--手续费比例值 
   trim(to_char((hd.deposit_ratio)*100,'90.99'))||'%' deposit_ratio,--保证金
  -- hfct.description,--等额本息等额本金
   SDIC_INDIVIDUAL_PKG.string_combination(' SELECT pi.lease_itme_name  FROM PRJ_CHANCE_LEASE_ITEM Pi
   WHERE Pi.chance_id=',P.chance_id,'、') lease_itme_name,--租赁标的物 
   trim(to_char((hd.int_rate)*100,'90.9999'))||'%' int_rate --租金率    
   FROM PRJ_CHANCE P, prj_quotation q,HLS_FIN_CALCULATOR_HD hd,hls_fin_calc_type hfct,hls_price_list hpl
   ,prj_chance_quotation_lv pcql
   where q.document_id=p.chance_id
   and q.document_category='CHANCE'
   AND Q.QUOTATION_TYPE='MAJOR'
   AND HD.CALC_SESSION_ID=Q.CALC_SESSION_ID  
   and hd.price_list=hpl.price_list
   and hpl.calc_type=hfct.calc_type
   and p.chance_id=pcql.chance_id
   and p.chance_id=${/parameter/@chance_id}
   ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
