<?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 t.* from (
                SELECT
                    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,      --项目粗利
                    concat(TO_CHAR(h.irr*100,'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.quotation_type = 'MAJOR') t 
                    #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
