<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-8-14 下午01:54:30  
    $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 cashflow_id,
                   contract_number,
                   to_char(cashflow_id, 'FM000000000000000000000000000000') as yurref,
                   bp_id_tenant,
                   bp_name,
                   times,
                   cf_item_name,
                   to_char(due_date, 'yyyy-mm-dd') as due_date,
                   due_amount,
                   (select gcv.currency_name
			          from con_contract    c,
			               gld_currency_vl gcv
			         where c.currency = gcv.currency_code
			           and c.contract_id = v.contract_id) as currency_name
              from CON_CONTRACT_CASHFLOW_V v
         #WHERE_CLAUSE# 
        order by v.contract_number,v.times
         ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="cashflow_id" databasetype="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="bp_id_tenant" databasetype="NUMBER" datatype="java.lang.Long"/>
        <bm:field name="yurref" databasetype="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="contract_number" databasetype="VARCHAR2" datatype="java.lang.String" displayWidth="140" forDisplay="true" forQuery="true" prompt="合同编号"/>
        <bm:field name="bp_name" databasetype="VARCHAR2" datatype="java.lang.String" displayWidth="120" forDisplay="true" forQuery="true" prompt="客户名"/>
        <bm:field name="times" databasetype="NUMBER" datatype="java.lang.Long" displayWidth="60" forDisplay="true" forQuery="true" prompt="期数"/>
        <bm:field name="cf_item_name" databasetype="VARCHAR2" datatype="java.lang.String" displayWidth="70" forDisplay="true" prompt="性质"/>
        <bm:field name="due_date" databasetype="VARCHAR2" datatype="java.lang.String" displayWidth="90" forDisplay="true" prompt="预定收款时间"/>
        <bm:field name="due_amount" databasetype="NUMBER" datatype="java.lang.Double" displayWidth="100" forDisplay="true" prompt="金额"/>
        <bm:field name="currency_name" databasetype="VARCHAR2" datatype="java.lang.String" displayWidth="70" forDisplay="true" prompt="币种"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="contract_number" queryExpression="v.contract_number like &apos;%&apos;|| ${@contract_number} ||&apos;%&apos;"/>
        <bm:query-field name="bp_name" queryExpression="v.bp_name like &apos;%&apos;|| ${@bp_name} ||&apos;%&apos;"/>
        <bm:query-field name="times" queryExpression="v.times=${@times}"/>
        <bm:query-field name="due_date" queryExpression="v.due_date=to_date(${@due_date},&apos;yyyy-mm-dd&apos;)"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="v.cf_type=1 AND v.cf_direction=&apos;INFLOW&apos; and v.cf_status=&apos;RELEASE&apos; and v.write_off_flag!=&apos;FULL&apos; and v.contract_status=&apos;INCEPT&apos; and v.cashflow_id not in (select i.cashflow_id from cux_ebank_cmb_interface i)"/>
    </bm:data-filters>
</bm:model>
