<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2013-10-30 上午10:59:57  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:e="leaf.service.exception" xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="CON_CONTRACT_PAYMENT_TERMS" defaultOrderBy="t1.payment_terms_id desc">
    <bm:fields>
        <bm:field name="payment_terms_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PAYMENT_TERMS_ID" prompt="CON_CONTRACT_PAYMENT_TERMS.PAYMENT_TERMS_ID"/>
        <bm:field name="cashflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CASHFLOW_ID" prompt="CON_CONTRACT_PAYMENT_TERMS.CASHFLOW_ID"/>
        <bm:field name="cdd_item_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CDD_ITEM_ID" prompt="CON_CONTRACT_PAYMENT_TERMS.CDD_ITEM_ID"/>
        <bm:field name="required_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REQUIRED_FLAG" prompt="CON_CONTRACT_PAYMENT_TERMS.REQUIRED_FLAG"/>
        <bm:field name="cdd_item" expression="(select d.cdd_item from prj_cdd_item d where d.cdd_item_id=t1.cdd_item_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="cdd_item_name" expression="(select d.description from prj_cdd_item d where d.cdd_item_id=t1.cdd_item_id)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="payment_terms_id"/>
    </bm:primary-key>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="exists (select 1 from con_contract_cashflow t where t.cashflow_id = t1.cashflow_id and t.contract_id= ${@contract_id})"/>
    </bm:data-filters>
</bm:model>
