<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2013-6-21 下午3:49:51  
    $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.times,
                    t.cf_item,
                    t.cf_type,
                    t.cf_direction,
                    t.due_amount,
                    t.received_amount,
                    (t.due_amount-t.received_amount) outstanding_amount,
                    t.due_date,
                    (SELECT tp.description FROM hls_cashflow_type tp WHERE tp.cf_type = t.cf_type
                    ) cf_type_dis,
                    t.due_amount,
                    (t.due_amount - t.received_amount) undue_amount,
                    t.due_date,
                    ${@adv_settle_date} adv_settle_date,
                    (select  t1.company_id from con_contract t1 where t1.contract_id=t.contract_id) company_id
                FROM
                    con_contract_cashflow t
                WHERE
                    t.contract_id = ${@contract_id}
                    and t.write_off_flag='FULL'
                    and t.received_amount -t.due_amount=0
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
