<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: laoguo  
    $Date: 2015年11月26日 上午11:32:54  
    $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
                    TO_CHAR(SUM(NVL(hn.net_principal, 0)) , 'FM999,999,999,990.00') sum_principal,
                    TO_CHAR(SUM(NVL(hn.net_interest, 0)) , 'FM999,999,999,990.00') sum_interest,
                    --不含税租金
                    TO_CHAR( SUM(NVL(hn.net_rental, 0)) , 'FM999,999,999,990.00') sum_net_rental,
                    TO_CHAR(SUM(NVL(hn.vat_rental, 0)) , 'FM999,999,999,990.00') sum_vat_rental,
                    --租金总和
                    TO_CHAR(SUM(NVL(hn.rental, 0)) , 'FM999,999,999,990.00') sum_rental,
                    --本金余额总和
                    TO_CHAR(SUM(NVL(hn.outstanding_rental_tax_incld,0)), 'FM999,999,999,990.00')sum_tax_incld,
                    --增值税总和
                    TO_CHAR(SUM(NVL(hn.ln_user_col_n20,0)), 'FM999,999,999,990.00')sum_ln_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}
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="sum_principal"/>
        <bm:field name="sum_interest"/>
        <bm:field name="sum_net_rental"/>
        <bm:field name="sum_vat_rental"/>
        <bm:field name="sum_rental"/>
        <bm:field name="sum_tax_incld"/>
        <bm:field name="sum_ln_n02"/>
    </bm:fields>
</bm:model>
