<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: hp  
    $Date: 2013-12-9 上午09:40:07  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="CSH_DEPOSIT_WRITE_OFF_V" needAccessControl="false">
    <bm:fields>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="CSH_DEPOSIT_WRITE_OFF_V.CONTRACT_ID"/>
        <bm:field name="cashflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CASHFLOW_ID" prompt="CSH_DEPOSIT_WRITE_OFF_V.CASHFLOW_ID"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NUMBER" prompt="CSH_DEPOSIT_WRITE_OFF_V.CONTRACT_NUMBER"/>
        <bm:field name="document_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_TYPE" prompt="CSH_DEPOSIT_WRITE_OFF_V.DOCUMENT_TYPE"/>
        <bm:field name="bp_id_agent_level1" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_AGENT_LEVEL1" prompt="CSH_DEPOSIT_WRITE_OFF_V.BP_ID_AGENT_LEVEL1"/>
        <bm:field name="bp_id_agent_level1_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_ID_AGENT_LEVEL1_N" prompt="CSH_DEPOSIT_WRITE_OFF_V.BP_ID_AGENT_LEVEL1_N"/>
        <bm:field name="bp_id_tenant" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_TENANT" prompt="CSH_DEPOSIT_WRITE_OFF_V.BP_ID_TENANT"/>
        <bm:field name="bp_id_tenant_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_ID_TENANT_N" prompt="CSH_DEPOSIT_WRITE_OFF_V.BP_ID_TENANT_N"/>
        <bm:field name="lease_item_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_ITEM_AMOUNT" prompt="CSH_DEPOSIT_WRITE_OFF_V.LEASE_ITEM_AMOUNT"/>
        <bm:field name="due_date" databaseType="DATE" datatype="java.util.Date" physicalName="DUE_DATE" prompt="CSH_DEPOSIT_WRITE_OFF_V.DUE_DATE"/>
        <bm:field name="due_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DUE_AMOUNT" prompt="CSH_DEPOSIT_WRITE_OFF_V.DUE_AMOUNT"/>
        <bm:field name="received_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RECEIVED_AMOUNT" prompt="CSH_DEPOSIT_WRITE_OFF_V.RECEIVED_AMOUNT"/>
        <bm:field name="residue_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RESIDUE_AMOUNT" prompt="CSH_DEPOSIT_WRITE_OFF_V.RESIDUE_AMOUNT"/>
        <bm:field name="transaction_id" databaseType="NUMBER" datatype="java.lang.Long" expression="(select a.transaction_id from csh_transaction a where a.source_doc_id= contract_id and a.source_doc_line_id=cashflow_id)" physicalName="TRANSACTION_ID"/>
        <bm:field name="transaction_num" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select a.transaction_num from csh_transaction a where a.source_doc_id= contract_id and a.source_doc_line_id=cashflow_id)" physicalName="TRANSACTION_NUM"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="bp_id_agent_level1" queryOperator="="/>
        <bm:query-field field="bp_id_tenant" queryOperator="="/>
        <bm:query-field name="due_date_from" queryExpression="t1.due_date &gt;= to_date(${@due_date_from},&apos;yyyy-mm-dd&apos;)"/>
        <bm:query-field name="due_date_to" queryExpression="t1.due_date &lt;= to_date(${@due_date_to},&apos;yyyy-mm-dd&apos;)"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter name="query" expression="(t1.received_amount &gt; 0) "/>
    </bm:data-filters>
    <bm:features>
        <f:standard-who/>
    </bm:features>
</bm:model>
