<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-7-4 下午5:06:21  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="ACR_INVOICE_CONTRACT_CF_V" defaultOrderBy="t1.times,t1.due_date,t1.cf_item">
    <bm:fields>
        <bm:field name="cashflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CASHFLOW_ID"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID"/>
        <bm:field name="cf_item" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CF_ITEM" prompt="ACR510.ACR_INVOICE_CONTRACT_CF_V.CF_ITEM"/>
        <bm:field name="cf_item_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CF_ITEM_DESC" prompt="应付项目"/>
        <bm:field name="times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TIMES" prompt="HLS.PERIOD_NUMBER"/>
        <bm:field name="last_received_date" databaseType="DATE" datatype="java.util.Date" physicalName="LAST_RECEIVED_DATE" prompt="付款日期"/>
        <bm:field name="due_date" databaseType="DATE" datatype="java.util.Date" physicalName="DUE_DATE" prompt="ACR.DUE_DATE"/>
        <bm:field name="due_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="DUE_AMOUNT" prompt="应付金额"/>
        <bm:field name="principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="PRINCIPAL" prompt="HLS.PRINCIPAL_AMOUNT"/>
        <bm:field name="interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="INTEREST" prompt="HLS.PAYMENT_INTEREST_AMT"/>
        <bm:field name="received_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RECEIVED_AMOUNT" prompt="已付金额"/>
        <bm:field name="received_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RECEIVED_PRINCIPAL" prompt="ACR.RECEIVED_PRINCIPAL"/>
        <bm:field name="received_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RECEIVED_INTEREST" prompt="ACR.RECEIVED_INTEREST"/>
        <bm:field name="billing_amount" databaseType="NUMBER" datatype="java.lang.Double" expression="nvl(t1.billing_amount,0)" physicalName="BILLING_AMOUNT" prompt="ACR.BILLING_AMOUNT"/>
        <bm:field name="billing_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BILLING_PRINCIPAL" prompt="ACR.BILLING_PRINCIPAL"/>
        <bm:field name="billing_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BILLING_INTEREST" prompt="ACR.BILLING_INTEREST"/>
        <bm:field name="vat_due_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="VAT_DUE_AMOUNT" prompt="ACR.TAX_AMOUNT"/>
        <bm:field name="vat_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="VAT_PRINCIPAL" prompt="ACR.VAT_PRINCIPAL"/>
        <bm:field name="vat_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="VAT_INTEREST" prompt=""/>
        <bm:field name="net_due_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="NET_DUE_AMOUNT" prompt=""/>
        <bm:field name="net_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="NET_PRINCIPAL" prompt=""/>
        <bm:field name="net_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="NET_INTEREST" prompt=""/>
        <bm:field name="currency" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY" prompt="HLS.CURRENCY"/>
        <bm:field name="currency_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY_DESC" prompt="HLS.CURRENCY"/>
        <bm:field name="exchange_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="EXCHANGE_RATE" prompt="HLS.EXCHANGE_RATE"/>
        <bm:field name="exchange_rate_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_TYPE" prompt="HLS.EXCHANGE_RATE_TYPE"/>
        <bm:field name="exchange_rate_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_TYPE_DESC" prompt="HLS.EXCHANGE_RATE_TYPE_DESC"/>
        <bm:field name="exchange_rate_quotation" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_QUOTATION"/>
        <bm:field name="exchange_rate_quotation_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXCHANGE_RATE_QUOTATION_DESC" prompt="汇率报价方式"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:query-fields>
        <bm:query-field name="cf_item" queryExpression="t1.cf_item = ${@cf_item}"/>
        <bm:query-field name="last_received_date_from" queryExpression="t1.last_received_date &gt;= to_date(${@last_received_date_from},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="last_received_date_to" queryExpression="t1.last_received_date &lt; to_date(${@last_received_date_to},&apos;yyyy-mm-dd&apos;)+1"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.contract_id = ${@contract_id}"/>
        <bm:data-filter enforceOperations="query" expression="t1.cf_status = &apos;RELEASE&apos;"/>
        <bm:data-filter enforceOperations="query" expression="t1.billing_status != &apos;FULL&apos;"/>
        <bm:data-filter enforceOperations="query" expression="t1.cf_direction = &apos;OUTFLOW&apos; "/>
        <!-- add by qianming ， 不一定要先收款再开票 -->
        <!-- <bm:data-filter enforceOperations="query" expression="t1.cf_direction = &apos;OUTFLOW&apos;"/> -->
        <!--<bm:data-filter enforceOperations="query" expression="((t1.cf_type = 109) OR (t1.cf_type = 9 AND t1.write_off_flag != &apos;NOT&apos;) OR (t1.write_off_flag = &apos;FULL&apos; AND t1.cf_direction = &apos;INFLOW&apos;))"/>
        <bm:data-filter enforceOperations="query" expression="not exists (select 1 from con_contract_billing_method m where m.equipment_billing = &apos;Y&apos; and t1.cf_type = 2 and m.contract_id = t1.contract_id)"/>-->
    </bm:data-filters>
</bm:model>
