<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hp  
    $Date: 2013-9-10 上午11:02:59  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="ACP_INVOICE_HD" needAccessControl="false">
    <bm:fields>
        <bm:field name="invoice_hd_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INVOICE_HD_ID" prompt="ACP_INVOICE_HD.INVOICE_HD_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="ACP_INVOICE_HD.COMPANY_ID"/>
        <bm:field name="document_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_NUMBER" prompt="ACP_INVOICE_HD.DOCUMENT_NUMBER"/>
        <bm:field name="document_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_TYPE" prompt="ACP_INVOICE_HD.DOCUMENT_TYPE"/>
        <bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY" prompt="ACP_INVOICE_HD.DOCUMENT_CATEGORY"/>
        <bm:field name="business_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE" prompt="ACP_INVOICE_HD.BUSINESS_TYPE"/>
        <bm:field name="billing_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BILLING_METHOD" prompt="ACP_INVOICE_HD.BILLING_METHOD"/>
        <bm:field name="lease_organization" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_ORGANIZATION" prompt="ACP_INVOICE_HD.LEASE_ORGANIZATION"/>
        <bm:field name="lease_channel" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHANNEL" prompt="ACP_INVOICE_HD.LEASE_CHANNEL"/>
        <bm:field name="division" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DIVISION" prompt="ACP_INVOICE_HD.DIVISION"/>
        <bm:field name="manual_invoice_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="MANUAL_INVOICE_FLAG" prompt="ACP_INVOICE_HD.MANUAL_INVOICE_FLAG"/>
        <bm:field name="bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID" prompt="ACP_INVOICE_HD.BP_ID"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME" prompt="ACP_INVOICE_HD.BP_NAME"/>
        <bm:field name="bp_tax_registry_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_TAX_REGISTRY_NUM" prompt="ACP_INVOICE_HD.BP_TAX_REGISTRY_NUM"/>
        <bm:field name="bp_address_phone_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_ADDRESS_PHONE_NUM" prompt="ACP_INVOICE_HD.BP_ADDRESS_PHONE_NUM"/>
        <bm:field name="bp_bank_account" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_BANK_ACCOUNT" prompt="ACP_INVOICE_HD.BP_BANK_ACCOUNT"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="ACP_INVOICE_HD.DESCRIPTION"/>
        <bm:field name="total_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TOTAL_AMOUNT" prompt="ACP_INVOICE_HD.TOTAL_AMOUNT"/>
        <bm:field name="tax_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TAX_AMOUNT" prompt="ACP_INVOICE_HD.TAX_AMOUNT"/>
        <bm:field name="currency" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY" prompt="ACP_INVOICE_HD.CURRENCY"/>
        <bm:field name="exchange_rate_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_TYPE" prompt="ACP_INVOICE_HD.EXCHANGE_RATE_TYPE"/>
        <bm:field name="exchange_rate_quotation" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_QUOTATION" prompt="ACP_INVOICE_HD.EXCHANGE_RATE_QUOTATION"/>
        <bm:field name="exchange_rate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EXCHANGE_RATE" prompt="ACP_INVOICE_HD.EXCHANGE_RATE"/>
        <bm:field name="distribution_set_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DISTRIBUTION_SET_ID" prompt="ACP_INVOICE_HD.DISTRIBUTION_SET_ID"/>
        <bm:field name="internal_period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INTERNAL_PERIOD_NUM" prompt="ACP_INVOICE_HD.INTERNAL_PERIOD_NUM"/>
        <bm:field name="period_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PERIOD_NAME" prompt="ACP_INVOICE_HD.PERIOD_NAME"/>
        <bm:field name="accounting_date" databaseType="DATE" datatype="java.util.Date" physicalName="ACCOUNTING_DATE" prompt="ACP_INVOICE_HD.ACCOUNTING_DATE"/>
        <bm:field name="invoice_date" databaseType="DATE" datatype="java.util.Date" physicalName="INVOICE_DATE" prompt="ACP_INVOICE_HD.INVOICE_DATE"/>
        <bm:field name="invoice_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_NUMBER" prompt="ACP_INVOICE_HD.INVOICE_NUMBER"/>
        <bm:field name="invoice_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_STATUS" prompt="ACP_INVOICE_HD.INVOICE_STATUS"/>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROJECT_ID" prompt="ACP_INVOICE_HD.PROJECT_ID"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="ACP_INVOICE_HD.CONTRACT_ID"/>
        <bm:field name="reversed_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REVERSED_FLAG" prompt="ACP_INVOICE_HD.REVERSED_FLAG"/>
        <bm:field name="source_invoice_header_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SOURCE_INVOICE_HEADER_ID" prompt="ACP_INVOICE_HD.SOURCE_INVOICE_HEADER_ID"/>
        <bm:field name="create_je_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CREATE_JE_FLAG" prompt="ACP_INVOICE_HD.CREATE_JE_FLAG"/>
        <bm:field name="gld_interface_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="GLD_INTERFACE_FLAG" prompt="ACP_INVOICE_HD.GLD_INTERFACE_FLAG"/>
        <bm:field name="confirmed_date" databaseType="DATE" datatype="java.util.Date" physicalName="CONFIRMED_DATE" prompt="ACP_INVOICE_HD.CONFIRMED_DATE"/>
        <bm:field name="confirmed_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONFIRMED_BY" prompt="ACP_INVOICE_HD.CONFIRMED_BY"/>
        <bm:field name="posted_date" databaseType="DATE" datatype="java.util.Date" physicalName="POSTED_DATE" prompt="ACP_INVOICE_HD.POSTED_DATE"/>
        <bm:field name="posted_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="POSTED_BY" prompt="ACP_INVOICE_HD.POSTED_BY"/>
        <bm:field name="invoice_kind" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INVOICE_KIND" prompt="ACP_INVOICE_HD.INVOICE_KIND"/>
        <bm:field name="vat_interface_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VAT_INTERFACE_STATUS" prompt="ACP_INVOICE_HD.VAT_INTERFACE_STATUS"/>
        <bm:field name="vat_invoice_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VAT_INVOICE_CODE" prompt="ACP_INVOICE_HD.VAT_INVOICE_CODE"/>
        <bm:field name="vat_invoice_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VAT_INVOICE_STATUS" prompt="ACP_INVOICE_HD.VAT_INVOICE_STATUS"/>
        <bm:field name="vat_red_notice_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VAT_RED_NOTICE_NUM" prompt="ACP_INVOICE_HD.VAT_RED_NOTICE_NUM"/>
        <bm:field name="ref_vat_invoice_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_VAT_INVOICE_CODE" prompt="ACP_INVOICE_HD.REF_VAT_INVOICE_CODE"/>
        <bm:field name="ref_invoice_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_INVOICE_NUMBER" prompt="ACP_INVOICE_HD.REF_INVOICE_NUMBER"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01" prompt="ACP_INVOICE_HD.REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02" prompt="ACP_INVOICE_HD.REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03" prompt="ACP_INVOICE_HD.REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="ACP_INVOICE_HD.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="ACP_INVOICE_HD.REF_V05"/>
        <bm:field name="ref_v06" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V06" prompt="ACP_INVOICE_HD.REF_V06"/>
        <bm:field name="ref_v07" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V07" prompt="ACP_INVOICE_HD.REF_V07"/>
        <bm:field name="ref_v08" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V08" prompt="ACP_INVOICE_HD.REF_V08"/>
        <bm:field name="ref_v09" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V09" prompt="ACP_INVOICE_HD.REF_V09"/>
        <bm:field name="ref_v10" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V10" prompt="ACP_INVOICE_HD.REF_V10"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N01" prompt="ACP_INVOICE_HD.REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N02" prompt="ACP_INVOICE_HD.REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N03" prompt="ACP_INVOICE_HD.REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N04" prompt="ACP_INVOICE_HD.REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N05" prompt="ACP_INVOICE_HD.REF_N05"/>
        <bm:field name="ref_n06" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N06" prompt="ACP_INVOICE_HD.REF_N06"/>
        <bm:field name="ref_n07" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N07" prompt="ACP_INVOICE_HD.REF_N07"/>
        <bm:field name="ref_n08" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N08" prompt="ACP_INVOICE_HD.REF_N08"/>
        <bm:field name="ref_n09" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N09" prompt="ACP_INVOICE_HD.REF_N09"/>
        <bm:field name="ref_n10" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N10" prompt="ACP_INVOICE_HD.REF_N10"/>
        <bm:field name="ref_d01" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D01" prompt="ACP_INVOICE_HD.REF_D01"/>
        <bm:field name="ref_d02" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D02" prompt="ACP_INVOICE_HD.REF_D02"/>
        <bm:field name="ref_d03" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D03" prompt="ACP_INVOICE_HD.REF_D03"/>
        <bm:field name="ref_d04" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D04" prompt="ACP_INVOICE_HD.REF_D04"/>
        <bm:field name="ref_d05" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D05" prompt="ACP_INVOICE_HD.REF_D05"/>
        <bm:field name="owner_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OWNER_USER_ID" prompt="ACP_INVOICE_HD.OWNER_USER_ID"/>
        <bm:field name="express_date" databaseType="DATE" datatype="java.util.Date" physicalName="EXPRESS_DATE" prompt="ACP_INVOICE_HD.EXPRESS_DATE"/>
        <bm:field name="express_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXPRESS_STATUS" prompt="ACP_INVOICE_HD.EXPRESS_STATUS"/>
        <bm:field name="express_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXPRESS_NUM" prompt="ACP_INVOICE_HD.EXPRESS_NUM"/>
        <bm:field name="express_company" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXPRESS_COMPANY" prompt="ACP_INVOICE_HD.EXPRESS_COMPANY"/>
        <bm:field name="express_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EXPRESS_BY" prompt="ACP_INVOICE_HD.EXPRESS_BY"/>
        <bm:field name="express_note" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXPRESS_NOTE" prompt="ACP_INVOICE_HD.EXPRESS_NOTE"/>
        <bm:field name="tax_registry_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TAX_REGISTRY_NUM" prompt="ACP_INVOICE_HD.TAX_REGISTRY_NUM"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select distinct b.contract_number from  con_contract b where t1.contract_id=b.contract_id)" forDisplay="true" forInsert="true" forQuery="true" physicalName="CONTRACT_NUMBER" prompt="合同编号"/>
        <bm:field name="cf_item" databaseType="NUMBER" datatype="java.lang.Long" expression="(select a.cf_item from acp_invoice_ln a where a.invoice_header_id= t1.invoice_hd_id)" physicalName="CF_ITEM"/>
        <bm:field name="cf_type" databaseType="NUMBER" datatype="java.lang.Long" expression="(select a.cf_type from acp_invoice_ln a where a.invoice_header_id= t1.invoice_hd_id)" physicalName="CF_TYPE"/>
        <bm:field name="cashflow_id" databaseType="NUMBER" datatype="java.lang.Long" expression="(select a.cashflow_id from acp_invoice_ln a where a.invoice_header_id= t1.invoice_hd_id)" physicalName="CASHFLOW_ID"/>
        <bm:field name="cashflow_des" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select b.cf_item_desc from acp_invoice_ln a,hls_cashflow_item_v b where a.invoice_header_id= t1.invoice_hd_id and b.cf_item=a.cf_item)" physicalName="CASHFLOW_DESC"/>
    </bm:fields>
    <bm:features>
        <f:standard-who forQuery="true"/>
    </bm:features>
    <bm:query-fields>
        <bm:query-field name="invoice_date_from" datatype="java.util.Date" queryExpression="t1.invoice_date &gt;= ${@invoice_date_from}"/>
        <bm:query-field name="invoice_date_to" datatype="java.util.Date" queryExpression="t1.invoice_date &lt;= ${@invoice_date_to}"/>
        <bm:query-field datatype="java.lang.String" field="contract_id" queryOperator="="/>
        <bm:query-field datatype="java.lang.String" field="invoice_number" queryOperator="like"/>
        <bm:query-field datatype="java.lang.String" field="vat_invoice_code" queryOperator="like"/>
        <bm:query-field datatype="java.lang.String" field="tax_registry_num" queryOperator="like"/>
        <bm:query-field datatype="java.lang.String" field="bp_tax_registry_num" queryOperator="like"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter name="reversed_flag" enforceOperations="query" expression="t1.reversed_flag = &apos;N&apos;"/>
    </bm:data-filters>
    <bm:features>
        <f:standard-who/>
    </bm:features>
</bm:model>
