<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ZLF  
    $Date: 2015-2-10 下午1:29:31  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
        <bm:field name="bp_id_tenant"/>
        <bm:field name="contract_id"/>
        <bm:field name="project_id"/>
        <bm:field name="business_type"/>
        <bm:field name="contract_number" forDisplay="true" forQuery="true" prompt="HLS.CONTRACT_NUMBER"/>
        <bm:field name="contract_name" forDisplay="true" forQuery="true" prompt="HLS.CONTRACT_NAME"/>
        <bm:field name="project_number" forDisplay="true" forQuery="true" prompt="HLS.PROJECT_NUMBER"/>
        <bm:field name="project_name" forDisplay="true" forQuery="true" prompt="HLS.PROJECT_NAME"/>
        <bm:field name="currency"/>
        <bm:field name="currency_desc"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    t1.bp_id_tenant,
                    t1.contract_id,
                    t1.project_id,
                    t1.business_type,
                    t1.contract_number,
                    t1.contract_name,
                    t1.project_number,
                    t1.project_name,
                    t1.currency,
                    t1.currency_desc
                FROM
                    con_contract_v t1 #WHERE_CLAUSE#
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:query-fields>
        <bm:query-field field="contract_number" queryOperator="like"/>
        <bm:query-field field="project_number" queryOperator="like"/>
        <bm:query-field name="document_type" queryExpression="t1.document_type = ${@document_type}"/>
        <bm:query-field name="project_name" queryExpression="t1.project_name like &apos;%&apos; || ${@project_name} || &apos;%&apos; "/>
        <bm:query-field name="contract_name" queryExpression="t1.contract_name like &apos;%&apos; || ${@contract_name} || &apos;%&apos; "/>
        <bm:query-field name="not_master_contract_flag" queryExpression="${@not_master_contract_flag}=&apos;Y&apos; and t1.business_type!=&apos;MASTER_CONTRACT&apos;"/>
        <bm:query-field name="inception_flag" queryExpression="(${@inception_flag}=&apos;N&apos; and t1.contract_status !=&apos;INCEPT&apos;)"/>
        <bm:query-field name="sign_flag" queryExpression="(${@sign_flag}=&apos;Y&apos; and t1.contract_status =&apos;NEW&apos;)"/>
        <bm:query-field name="con_writeoff_flag" queryExpression="(${@con_writeoff_flag}=&apos;Y&apos; and t1.contract_status not in(&apos;NEW&apos;,&apos;PENDING&apos;))"/>
        <bm:query-field name="change_req_flag" queryExpression="(${@change_req_flag}=&apos;Y&apos; and t1.contract_status in(&apos;NEW&apos;,&apos;SIGN&apos;,&apos;PAID&apos;,&apos;INCEPT&apos;))"/>
        <!-- <bm:query-field name="transaction_id" queryExpression="exists(select 1 from csh_transaction t,con_contract_bp b where t.transaction_id=${@transaction_id} and t.bp_id=b.bp_id and b.contract_id=t1.contract_id)"/> -->
        <bm:query-field name="review_flag" queryExpression="(${@review_flag}=&apos;Y&apos; and t1.contract_status =&apos;SIGN&apos;)"/>
    </bm:query-fields>
</bm:model>
