<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: liuguocai5900  
    $Date: 2015年12月29日 上午9:18:57  
    $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
                    '第'
                    || cw.times
                    || '期' times,
                    cw.due_date,
                    TO_CHAR(NVL(cw.principal, 0), 'FM999,999,999,990.00') principal,
                    TO_CHAR(NVL(cw.interest, 0), 'FM999,999,999,990.00') interest,
                    --含税租金
                    TO_CHAR(NVL(cw.due_amount, 0), 'FM999,999,999,990.00') rental,
                    --不含税租金
                    TO_CHAR(NVL(cw.net_due_amount, 0), 'FM999,999,999,990.00') net_rental,
                    --本金余额
                    TO_CHAR(NVL(cw.outstanding_prin_tax_incld, 0), 'FM999,999,999,990.00') rental_incld,
                    --增值税
                    TO_CHAR(NVL(cw.ln_user_col_n20, 0), 'FM999,999,999,990.00') ln_user_col_n02,
                    TO_CHAR(NVL(cw.vat_due_amount, 0), 'FM999,999,999,990.00') vat_rental
                FROM
                    con_contract_cashflow cw
                WHERE
                    cw.times      > 0 AND
                    cw.cf_item    = 1 AND
                    cw.contract_id=${@contract_id} AND
                    cw.times      >0
                ORDER BY
                    cw.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="DATE" datatype="java.util.Date" 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="rental" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RENTAL"/>
        <bm:field name="net_rental" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NET_RENTAL"/>
        <bm:field name="rental_incld" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RENTAL_INCLD"/>
        <bm:field name="ln_user_col_n02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LN_USER_COL_N02"/>
        <bm:field name="vat_rental" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VAT_RENTAL"/>
    </bm:fields>
</bm:model>
