<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2013-7-15 下午7:48:26  
    $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.cashflow_id,
                    t.contract_id,
                    t.times,
                    t.cf_type,
                    (SELECT
                        tp.description
                    FROM
                        hls_cashflow_type tp
                    WHERE
                        tp.cf_type = t.cf_type
                    ) cf_type_dis,
                    t.cf_item,
                    (SELECT
                        tp.description
                    FROM
                        hls_cashflow_item tp
                    WHERE
                        tp.cf_item = t.cf_item
                    ) cf_item_dis,
                    t.due_amount,
                    t.received_amount,
                    TO_CHAR(t.due_date,'yyyy-mm-dd') due_date,
                    t.received_principal,
                    t.received_interest,
                    t.cf_status,
                    (SELECT
                        v.code_value_name
                    FROM
                        sys_code_values_v v
                    WHERE
                        v.code       = 'HLS005_CF_STATUS' AND
                        v.code_value = t.cf_status
                    ) cf_status_dis,
                    t.write_off_flag,
                    t.outstanding_prin_tax_incld
                FROM
                    con_contract_cashflow t
                WHERE
                    t.contract_id    = ${@contract_id} AND
                    t.write_off_flag = 'FULL' AND
                    t.cf_direction   ='INFLOW'
                    /* and t.received_amount - t.due_amount = 0 */
                    
            ]]></bm:query-sql>
            <bm:parameters>
                <bm:parameter name="contract_id"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
</bm:model>
