<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2013-7-15 下午7:59:08  
    $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
                    t.times,
                    t.cf_type,
                    (SELECT tp.description FROM hls_cashflow_type tp WHERE tp.cf_type = t.cf_type
                    ) cf_type_dis,
                    nvl(t.due_amount,0) due_amount,
                    nvl(t.received_amount,0) received_amount,
                     to_char(t.due_date,'yyyy-mm-dd') due_date,
                    t.principal - NVL(t.received_principal, 0) principal,
                    t.interest - NVL(t.received_interest, 0) interest,
                    t.cf_status,
                    (SELECT
                        v.code_value_name
                    FROM
                        sys_code_values_v v
                    WHERE
                        v.code       = 'CF_STATUS' AND
                        v.code_value = t.cf_status
                    ) cf_status_dis
                FROM
                    con_contract_cashflow t,
                    con_contract_rp_hd cc
                WHERE
                    t.contract_id     = cc.contract_id AND
                    cc.rp_agreement_id = ${@rp_agreement_id} AND
                    t.write_off_flag <> 'FULL'
                    and t.cf_direction = 'INFLOW'
                    order by times,cf_type
                
            ]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter name="contract_id"/>
                <bm:parameter name="rp_agreement_id"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
</bm:model>
