<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: feng
    $Date: 2013-9-11 下午15:13:20
    $Revision: 1.0
    $Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql>
                <![CDATA[
                select *
                from (select c.contract_id,
                c.contract_number,
                c.contract_name,
                c.business_type,
                c.search_term_1,
                (SELECT description
                FROM HLS_BUSINESS_TYPE_V a
                WHERE a.business_type = c.business_type) business_type_n
                from con_contract c
                where c.data_class = 'NORMAL'
                and c.contract_status IN
                ('REPURING', 'ETING', 'INCEPT', 'PENDING')
                and c.business_type <> 'LEASEBACK'
                and not exists
                (select 1
                from acp_invoice_ln an
                where an.contract_id = c.contract_id
                and an.confirmation_status in ('APPROVING', 'APPROVED'))) V
                #WHERE_CLAUSE#
                ]]></bm:query-sql>
        </bm:operation>

    </bm:operations>
    <bm:fields>
        <bm:field name="contract_number" forDisplay="true"  forQuery="true" prompt="ACR310.CONTRACT_NUMBER"/>
        <bm:field name="contract_name"  forDisplay="true" forQuery="true" prompt="ACR310.CONTRACT_NAME"/>
        <bm:field name="contract_id"/>
        <bm:field name="search_term_1" forDisplay="true" forQuery="true" prompt="厂商合同编号"/>
        <bm:field name="business_type_n" forDisplay="true" forQuery="true" prompt="业务类型"/>
<!--        <bm:field name="business_type" forDisplay="true" forQuery="true" prompt="业务类型"/>-->

    </bm:fields>
<!--    <bm:fields>-->
<!--        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" forDisplay="true" forQuery="true" physicalName="contract_number" prompt="ACR310.CONTRACT_NUMBER"/>-->
<!--        <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String" forDisplay="true" forQuery="true" physicalName="contract_name" prompt="ACR310.CONTRACT_NAME"/>-->
<!--        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="contract_id" />-->
<!--    </bm:fields>-->
    <bm:query-fields>
        <bm:query-field field="contract_number" queryOperator="like"/>
        <bm:query-field field="contract_name" queryOperator="like"/>
        <bm:query-field field="business_type_n" queryOperator="like"/>
<!--        <bm:query-field field="business_type" queryOperator="like"/>-->
        <bm:query-field field="search_term_1" queryOperator="like"/>

    </bm:query-fields>
</bm:model>
