<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2015-1-20 下午3:58:23  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
        <bm:field name="contract_id"/>
        <bm:field name="contract_number"/>
        <bm:field name="contract_name"/>
        <bm:field name="bp_id_tenant"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    t1.contract_id,
                    t1.contract_number,
                    t1.contract_name,
                    t1.bp_id_tenant
                FROM
                    CON_CONTRACT_V t1 #WHERE_CLAUSE#
                    order by t1.contract_number desc
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:data-filters>
        <bm:data-filter name="query" expression="EXISTS     (SELECT         *　from con_contract_cashflow cc     WHERE         cc.contract_id     =t1.contract_id AND         cc.billing_status !=&apos;NOT&apos; AND         cc.cf_direction    =&apos;OUTFLOW&apos;     )"/>
    </bm:data-filters>
    <bm:query-fields>
        <bm:query-field field="contract_number" queryExpression="t1.contract_number like &apos;%&apos; || upper(${@contract_number}) || &apos;%&apos;"/>
        <bm:query-field field="contract_name" queryExpression="t1.contract_name like &apos;%&apos; || ${@contract_name} || &apos;%&apos;"/>
    </bm:query-fields>
</bm:model>
