<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2014-11-24 下午04:34:31  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="CON_CONTRACT_V">
    <bm:fields>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="CON_CONTRACT_V.CONTRACT_ID"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="200" forDisplay="true" forQuery="true" physicalName="CONTRACT_NUMBER" prompt="合同编号"/>
        <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="200" forDisplay="true" forQuery="true" physicalName="CONTRACT_NAME" prompt="合同名称"/>
        <bm:field name="business_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE" prompt="CON_CONTRACT_V.BUSINESS_TYPE"/>
        <bm:field name="business_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE_DESC" prompt="CON_CONTRACT_V.BUSINESS_TYPE_DESC"/>
        <bm:field name="document_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_TYPE" prompt="CON_CONTRACT_V.DOCUMENT_TYPE"/>
        <bm:field name="document_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_TYPE_DESC" prompt="CON_CONTRACT_V.DOCUMENT_TYPE_DESC"/>
        <bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY" prompt="CON_CONTRACT_V.DOCUMENT_CATEGORY"/>
        <bm:field name="document_category_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY_DESC" prompt="CON_CONTRACT_V.DOCUMENT_CATEGORY_DESC"/>
        <bm:field name="lease_organization" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_ORGANIZATION" prompt="CON_CONTRACT_V.LEASE_ORGANIZATION"/>
        <bm:field name="lease_organization_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_ORGANIZATION_DESC" prompt="CON_CONTRACT_V.LEASE_ORGANIZATION_DESC"/>
        <bm:field name="lease_channel" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHANNEL" prompt="CON_CONTRACT_V.LEASE_CHANNEL"/>
        <bm:field name="lease_channel_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHANNEL_DESC" prompt="CON_CONTRACT_V.LEASE_CHANNEL_DESC"/>
        <bm:field name="bp_id_tenant" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_TENANT" prompt="CON_CONTRACT_V.BP_ID_TENANT"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME" prompt="CON_CONTRACT_V.BP_NAME"/>
        <bm:field name="bp_type_desc" expression="(select bt.description from hls_bp_type bt where bt.bp_type = (select m.bp_type from hls_bp_master m where m.bp_id=t1.bp_id_tenant))"/>
        <bm:field name="hls_lease_channel_desc" expression="(select lc.description  from hls_lease_channel lc where lc.lease_channel = t1.lease_channel)"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="company_id"/>
        <bm:field name="spv_company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="spv_company_id"/>
        <bm:field name="invoice_agent_desc" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="division_desc" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="bp_class_desc" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="docu_number_reg" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select docu_number from CON_CONTRACT_LOCATION_LN c where  c.contract_id=t1.contract_id and c.doc_type=&apos;20&apos;)" forInsert="false" forUpdate="false"/>
        <bm:field name="docu_numberr_archive" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select docu_number from CON_CONTRACT_LOCATION_LN c where  c.contract_id=t1.contract_id and c.doc_type=&apos;10&apos;)" forInsert="false" forUpdate="false"/>
        <bm:field name="archive_status_n" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <bm:field name="reg_status_n" databaseType="VARCHAR2" datatype="java.lang.String"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <!-- <bm:query-fields>
        <bm:query-field field="contract_number" queryExpression="upper(t1.contract_number) like &apos;%&apos; || upper(${@contract_number}) || &apos;%&apos;"/>
        <bm:query-field field="contract_name" queryExpression="upper(t1.contract_name) like &apos;%&apos; || upper(${@contract_name}) || &apos;%&apos;"/>
    </bm:query-fields> -->
    <bm:data-filters>
        <!-- <bm:data-filter name="contract_id" expression="t1.contract_id in (select  ccll.contract_id  from CON_CONTRACT_LOCATION_LN ccll)"/> -->
        <bm:data-filter name="contract_id" expression="t1.contract_id=${@contract_id}"/>
    </bm:data-filters>
    <!--  <bm:data-filters>
        <bm:data-filter name="1" enforcedQuery="query" expression="(t1.company_id = ${/session/@company_id} or t1.spv_company_id = ${/session/@company_id})"/>
    </bm:data-filters> -->
</bm:model>
