<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: lgc5900  
    $Date: 2015年11月25日 下午5:42:53  
    $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
                    '第'
                    || hn.times
                    || '期' AS times,
                    hn.due_date,
                    TO_CHAR(NVL(hn.net_principal,0), 'FM999,999,999,990.00')principal,
                    TO_CHAR(NVL(hn.net_interest,0), 'FM999,999,999,990.00')interest,
                    TO_CHAR(NVL(hn.vat_rental,0), 'FM999,999,999,990.00')vat_rental,
                    TO_CHAR(NVL(hn.due_amount_cny,0), 'FM999,999,999,990.00')due_amount_cny,
                    --含税租金
                    TO_CHAR(NVL(hn.rental,0), 'FM999,999,999,990.00')rental,
                    --不含税租金
                    TO_CHAR(NVL(hn.net_rental,0), 'FM999,999,999,990.00')net_rental,
                    --本金余额
                    TO_CHAR(NVL(hn.outstanding_prin_tax_incld,0), 'FM999,999,999,990.00')rental_incld,
                    --增值税
                    TO_CHAR(NVL(hn.ln_user_col_n20,0), 'FM999,999,999,990.00')ln_user_col_n02
                FROM
                    prj_quotation pn,
                    hls_fin_calculator_hd hd,
                    hls_fin_calculator_ln hn
                WHERE
                    pn.document_category = 'PROJECT' AND
                    pn.calc_session_id   = hd.calc_session_id AND
                    hd.calc_session_id   = hn.calc_session_id AND
                    pn.quotation_id      =${@quotation_id} AND
                    hn.times             >0
                ORDER BY
                    to_number(hn.times)
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="times" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TIMES"/>
        <bm:field name="due_date" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DUE_DATE"/>
        <bm:field name="principal" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRINCIPAL"/>
        <bm:field name="interest" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTEREST"/>
        <bm:field name="net_rental" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NET_RENTAL"/>
        <bm:field name="vat_rental" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VAT_RENTAL"/>
        <bm:field name="due_amount_cny" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DUE_AMOUNT_CNY"/>
        <bm:field name="rental_incld"/>
        <bm:field name="rental"/>
        <bm:field name="ln_user_col_n02"/>
    </bm:fields>
</bm:model>
