<?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.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    
  from con_contract_cashflow t
 WHERE (t.contract_id = ${@contract_id}
 		or exists (
 		select 1 from con_contract_et_hd where et_agreement_id = ${@et_agreement_id} and contract_id = t.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>
