<?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,
       trunc(t.times) 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 tc.description FROM HLS_CASHFLOW_ITEM tc WHERE tc.CF_ITEM = t.CF_ITEM
       ) cf_item_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.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}
   and t.write_off_flag = 'FULL'
   and t.cf_direction = 'INFLOW'
   order by times,cf_type    
   /* and t.received_amount - t.due_amount = 0 */]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
