<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-2-6 下午5:35:52  
    $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 t1.* from(select 
       h.contract_id,
       h.price_list,
       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,--支付频率
       (select a.code_value_name from sys_code_values_v a 
       where a.code='HLS500_ANNUAL_PAY_TIMES' and a.code_value=h.annual_pay_times) annual_pay_times_n,
       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,--每期租金
       decode(h.pay_type,1,'先付',0,'后付')  pay_type --支付类型
  from con_contract h
 where h.data_class='NORMAL') t1 #WHERE_CLAUSE#
 
]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter name="project_id"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
</bm:model>
