<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2013-12-28 下午1:30:33  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="TRE_ACCRUED_INTEREST">
    <bm:fields>
        <bm:field name="record_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RECORD_ID" prompt="TRE_ACCRUED_INTEREST.RECORD_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="TRE_ACCRUED_INTEREST.COMPANY_ID"/>
        <bm:field name="loan_contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LOAN_CONTRACT_ID" prompt="TRE_ACCRUED_INTEREST.LOAN_CONTRACT_ID"/>
        <bm:field name="internal_period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INTERNAL_PERIOD_NUM" prompt="TRE_ACCRUED_INTEREST.INTERNAL_PERIOD_NUM"/>
        <bm:field name="cf_item" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CF_ITEM" prompt="TRE_ACCRUED_INTEREST.CF_ITEM"/>
        <bm:field name="seq_in_period" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SEQ_IN_PERIOD" prompt="TRE_ACCRUED_INTEREST.SEQ_IN_PERIOD"/>
        <bm:field name="accrued_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="ACCRUED_INTEREST" prompt="TRE_ACCRUED_INTEREST.ACCRUED_INTEREST"/>
        <bm:field name="net_accrued_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="NET_ACCRUED_INTEREST" prompt="TRE_ACCRUED_INTEREST.NET_ACCRUED_INTEREST"/>
        <bm:field name="accrued_interest_balance" databaseType="NUMBER" datatype="java.lang.Double" physicalName="ACCRUED_INTEREST_BALANCE" prompt="TRE_ACCRUED_INTEREST.ACCRUED_INTEREST_BALANCE"/>
        <bm:field name="recognized_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RECOGNIZED_FLAG" prompt="TRE_ACCRUED_INTEREST.RECOGNIZED_FLAG"/>
        <bm:field name="weight_factor" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WEIGHT_FACTOR" prompt="TRE_ACCRUED_INTEREST.WEIGHT_FACTOR"/>
        <bm:field name="total_weight" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TOTAL_WEIGHT" prompt="TRE_ACCRUED_INTEREST.TOTAL_WEIGHT"/>
        <bm:field name="factor_days" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FACTOR_DAYS" prompt="TRE_ACCRUED_INTEREST.FACTOR_DAYS"/>
        <bm:field name="factor_outstanding_principal" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FACTOR_OUTSTANDING_PRINCIPAL" prompt="TRE_ACCRUED_INTEREST.FACTOR_OUTSTANDING_PRINCIPAL"/>
        <bm:field name="factor_reserved1" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FACTOR_RESERVED1" prompt="TRE_ACCRUED_INTEREST.FACTOR_RESERVED1"/>
        <bm:field name="factor_reserved2" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FACTOR_RESERVED2" prompt="TRE_ACCRUED_INTEREST.FACTOR_RESERVED2"/>
        <bm:field name="factor_reserved3" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FACTOR_RESERVED3" prompt="TRE_ACCRUED_INTEREST.FACTOR_RESERVED3"/>
        <bm:field name="repayment_plan_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REPAYMENT_PLAN_ID" prompt="TRE_ACCRUED_INTEREST.REPAYMENT_PLAN_ID"/>
        <bm:field name="times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TIMES" prompt="TRE_ACCRUED_INTEREST.TIMES"/>
        <bm:field name="cf_type" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CF_TYPE" prompt="TRE_ACCRUED_INTEREST.CF_TYPE"/>
        <bm:field name="calc_start_date" databaseType="DATE" datatype="java.util.Date" physicalName="CALC_START_DATE" prompt="TRE_ACCRUED_INTEREST.CALC_START_DATE"/>
        <bm:field name="calc_end_date" databaseType="DATE" datatype="java.util.Date" physicalName="CALC_END_DATE" prompt="TRE_ACCRUED_INTEREST.CALC_END_DATE"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" expression="(SELECT         tr.loan_contract_number     FROM         tre_loan_contract tr     WHERE         tr.loan_contract_id = t1.loan_contract_id )" forInsert="false" forUpdate="false"/>
        <bm:field name="business_type_desc" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select h.description from tre_loan_contract t ,hls_business_type h where t.loan_contract_id = t1.loan_contract_id and h.business_type = t.business_type)" forInsert="false" forUpdate="false"/>
        <bm:field name="cf_item_desc" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select t.description from hls_cashflow_item t where t.cf_item = t1.cf_item)" forInsert="false" forUpdate="false"/>
        <bm:field name="int_rate" databaseType="NUMBER" datatype="java.lang.Double" expression="round((select t.ref_n01 from tre_loan_con_withdrawal_plan t where t.widthdrawal_plan_id = t1.widthdrawal_plan_id),4)" forInsert="false" forUpdate="false"/>
        <bm:field name="withdraw_number" databaseType="VARCHAR2" datatype="java.lang.String" expression="(select t.ref_v05 from tre_loan_con_withdrawal_plan t where t.widthdrawal_plan_id = t1.widthdrawal_plan_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="loan_contract_number" databaseType="VARCHAR2" datatype="java.lang.String" expression="(SELECT t.loan_contract_number FROM tre_loan_contract t WHERE t.loan_contract_id = t1.loan_contract_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="calc_start_date_n" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char(t1.calc_start_date,&apos;yyyy-mm-dd&apos;)" forInsert="false" forUpdate="false"/>
        <bm:field name="calc_end_date_n" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char(t1.calc_end_date,&apos;yyyy-mm-dd&apos;)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="record_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="company_id" queryOperator="="/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.internal_period_num = ${@internal_period_num} and   t1.company_id IN     (SELECT  t.company_id  FROM         fnd_companies t      WHERE         t.company_type   =1 AND         t.set_of_books_id=         (SELECT             v.set_of_books_id         FROM             fnd_companies_vl v         WHERE             v.company_id=${/session/@company_id}         )START     WITH t.company_id = ${/session/@company_id} CONNECT BY prior t.company_id = t.parent_biz_company_id     )"/>
    </bm:data-filters>
</bm:model>
