<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2015-1-26 下午1:06:44  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
            	select rownum,
       pqv.document_id,
       pqv.quotation_date,
       pqv.contract_seq,
       pqv.price_list,
       pqv.price_list_name,
       decode(h.lease_item_amount,0,'0',to_char(h.lease_item_amount,'999,999,999,990.99')) lease_item_amount,--项目总价款
       decode(h.finance_amount,0,'0',to_char(h.finance_amount,'999,999,999,990.99'))finance_amount,--融资额
       concat(to_char(h.down_payment_ratio*100,'990.99'),'%') down_payment_ratio,--首付款比例
       decode(h.down_payment,0,'0',to_char(h.down_payment,'999,999,999,990.99')) down_payment,--首付金额
       h.lease_times,--还款期数
       h.annual_pay_times,--支付频率
       h.lease_term,--租赁期数（年）
       concat(to_char(h.int_rate*100,'990.99'),'%') int_rate,--租赁年利率
       concat(to_char(h.deposit_ratio*100,'990.99'),'%') deposit_ratio,--保证金比例
       decode(h.deposit,0,'0',to_char(h.deposit,'999,999,999,990.99')) deposit,--保证金
       concat(to_char(h.lease_charge_ratio*100,'990.99'),'%') lease_charge_ratio,--手续费比例
       decode(h.lease_charge,0,'0',to_char(h.lease_charge,'999,999,999,990.99')) lease_charge,--手续费
       concat(to_char(nvl(h.residual_ratio,0)*100,'990.99'),'%') residual_ratio,--期末残值比例
       decode(h.residual_value,0,'0',null,'0',to_char(h.residual_value,'999,999,999,990.99')) residual_value,--期末残值
       concat(to_char(h.hd_user_col_n01*100,'990.99'),'%') hd_user_col_n01,--厂商返利比率
       decode(h.net_other_fee3,0,'0',to_char(h.net_other_fee3,'999,999,999,990.99')) net_other_fee3,--厂商返利
       decode(h.interim_rental,0,'0',to_char(h.interim_rental,'999,999,999,990.99')) interim_rental,--租前息
       decode(h.contract_amount,0,'0',to_char(h.contract_amount,'999,999,999,990.99')) contract_amount,--租赁合同总金额
       decode(h.hd_user_col_n03,0,'0',to_char(h.hd_user_col_n03,'999,999,999,990.99')) hd_user_col_n03,--我司实际动用资金
       decode(h.hd_user_col_n04,0,'0',to_char(h.hd_user_col_n04,'999,999,999,990.99')) hd_user_col_n04,--项目粗利
       decode(h.irr,0,'0',to_char(h.irr,'999,999,999,990.99')) irr,--IRR
       decode(h.pmt,0,'0',to_char(h.pmt,'999,999,999,990.99')) pmt,--每期租金
       h.pay_type --支付类型
  from prj_quotation_v pqv, hls_fin_calculator_hd h
 where pqv.calc_session_id = h.calc_session_id
   and pqv.document_category = 'PROJECT'
   and pqv.document_id = ${@project_id}
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
