<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng  
    $Date: 2017-8-31 上午9:16:08  
    $Revision: 1.0  
    $Purpose: 资金台账
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    t1.specific_loan_terms,
                    t1.fund_source_type,
                    t1.fund_source_type_n,
                    t1.risk_analysis,
                    t1.loan_amount_type,
                    t1.loan_amount_type_n,
                    t1.used_amount,
                    t1.available_amount,
                    t1.withhold_value_added_tax,
                    t1.way_of_increasing_trust_plus,
                    t1.add_credit_method,
                    t1.lease_item_price_agent,
                    t1.hd_user_col_v01,
                    t1.hd_user_col_n18,
                    t1.external_debt_flag,
                    t1.data_class,
                    t1.loan_charge_share_way_n,
                    t1.bank_branch_bp_id_n,
                    t1.loan_contract_balance,
                    t1.withhold_income_tax,
                    t1.withhold_sale_tax,
                    t1.comment_add,
                    t1.withhold_sale_tax_add,
                    t1.interest_desc,
                    t1.loan_con_terms,
                    t1.loan_con_terms_n,
                    t1.first_withdraw_date,
                    t1.loan_contract_id,
                    t1.company_id,
                    t1.loan_contract_number,
                    t1.loan_contract_name,
                    t1.signing_date,
                    t1.loan_contreat_num,
                    t1.transactor,
                    t1.transactor_code,
                    t1.transact_unit_name,
                    t1.transact_unit_code,
                    t1.transfer_from,
                    t1.transfer_to,
                    t1.loan_usage_description,
                    t1.signing_breed,
                    t1.document_category,
                    t1.business_type,
                    t1.original_con_num,
                    t1.contract_period,
                    t1.business_type_n,
                    t1.document_type,
                    t1.loan_contract_book_date,
                    t1.bank_credit_contract_id,
                    t1.bank_credit_contract_id_n,
                    t1.credit_limit_type,
                    t1.credit_limit_type_n,
                    t1.bank_account_id,
                    t1.bank_account_id_n,
                    t1.withdraw_account_id,
                    t1.withdraw_account_code,
                    t1.withdraw_account_num,
                    t1.loan_certificate_flag,
                    t1.related_party_flag,
                    t1.loan_amount,
                    sdic_tre_loan_contract_pkg.get_approved_amount(t1.loan_contract_id,to_date(${@end_date},'yyyy-mm-dd')) withdraw_amount,
                    sdic_tre_loan_contract_pkg.get_no_approved_amount(t1.loan_contract_id,to_date(${@end_date},'yyyy-mm-dd')) remaining_amount,
                    (SELECT
                        NVL(SUM(wo.due_amount), 0)
                    FROM
                        tre_loan_con_write_off wo
                    WHERE
                        wo.cf_item                 = 302 AND
                        wo.plan_type               = 'REPAYMENT' AND
                        wo.loan_contract_id        = t1.loan_contract_id AND
                        NVL(wo.reversed_flag, 'N') = 'N' AND
                        (
                            wo.write_off_date <= to_date(${@end_date},'yyyy-mm-dd') or to_date(${@end_date},'yyyy-mm-dd') IS NULL
                        )
                    ) received_principal,
                    sdic_tre_loan_contract_pkg.get_approved_amount(t1.loan_contract_id, to_date(${@end_date},'yyyy-mm-dd')) -
                    (SELECT
                        NVL(SUM(wo.due_amount), 0)
                    FROM
                        tre_loan_con_write_off wo
                    WHERE
                        wo.cf_item                 = 302 AND
                        wo.plan_type               = 'REPAYMENT' AND
                        wo.loan_contract_id        = t1.loan_contract_id AND
                        NVL(wo.reversed_flag, 'N') = 'N' AND
                        (
                            wo.write_off_date <= to_date(${@end_date},'yyyy-mm-dd') or to_date(${@end_date},'yyyy-mm-dd') IS NULL
                        )
                    ) no_received_principal,
                    t1.loan_accrued_interest,
                    t1.currency,
                    t1.currency_n,
                    t1.precision,
                    t1.loan_contract_status,
                    t1.loan_contract_status_display,
                    t1.loan_contract_status_n,
                    t1.time_horizon,
                    t1.loan_date_from,
                    t1.loan_date_to,
                    t1.base_rate,
                    t1.int_rate_fixing_way,
                    t1.int_rate_fixing_way_n,
                    t1.adjust_rate_type,
                    t1.adjust_rate_type_n,
                    t1.int_rate_fixing_range,
                    t1.interest_rate,
                    t1.interest_rate_n,
                    t1.calc_method,
                    t1.calc_method_n,
                    t1.interest_period,
                    t1.interest_period_n,
                    t1.base_rate_type,
                    t1.base_rate_type_n,
                    t1.interest_calc_date,
                    t1.interest_payment_date,
                    t1.penalty_rate,
                    t1.misappropriate_rate,
                    t1.et_penalty_rate,
                    t1.annual_days,
                    t1.rate_float_cycle,
                    t1.flt_execute_times_day,
                    t1.adjust_day,
                    t1.withdrawal_method,
                    t1.last_withdrawal_date,
                    t1.factoring_financing_method,
                    t1.payment_method,
                    t1.payment_date,
                    t1.discount_rate,
                    t1.bank_financing_scale,
                    t1.financing_scale,
                    t1.repayment_method,
                    t1.last_repayment_date,
                    t1.total_repayment,
                    t1.total_interest,
                    t1.total_fee,
                    t1.total_fee_pv,
                    t1.net_finance_amount,
                    t1.interest_margin,
                    t1.reviewed_by,
                    t1.reviewed_date,
                    t1.closed_by,
                    t1.closed_date,
                    t1.contract_id,
                    t1.bp_name,
                    t1.employee_name,
                    t1.finance_amount,
                    t1.contract_number,
                    t1.contract_name,
                    t1.vat_rate_of_interest,
                    t1.note,
                    t1.created_by_n,
                    t1.ref_v01,
                    t1.ref_v02,
                    t1.ref_v03,
                    t1.ref_v04,
                    t1.ref_v05,
                    t1.ref_n01,
                    t1.ref_n02,
                    t1.ref_n03,
                    t1.ref_n04,
                    t1.ref_n05,
                    t1.ref_d01,
                    t1.ref_d02,
                    t1.ref_d03,
                    t1.ref_d04,
                    t1.ref_d05,
                    t1.loan_charge,
                    t1.consulting_fee,
                    t1.other_fee,
                    t1.interest_period_times,
                    t1.consulting_fee_rate,
                    t1.deposit_amount,
                    t1.bank_branch_bp_id,
                    t1.price_list,
                    t1.price_list_n,
                    t1.loan_charge_share_way,
                    t1.main_quotation_id,
                    t1.calc_session_id,
                    t1.loan_con_type,
                    t1.loan_con_type_n,
                    t1.loan_con_type_detail,
                    t1.lease_times,
                    t1.loan_con_type_detail_n,
                    t1.way_of_increasing_trust,
                    t1.way_of_increasing_trust_n,
                    t1.inside_or_outside,
                    t1.inside_or_outside_n,
                    t1.free_trade_agreement,
                    t1.free_trade_agreement_n,
                    t1.within_the_group,
                    t1.within_the_group_n,
                    t1.loan_con_bp,
                    t1.loan_con_bp_code,
                    t1.loan_con_bp_n,
                    t1.loan_con_wfl_status,
                    t1.loan_con_wfl_status_n,
                    t1.external_debt_cir_flag,
                    t1.cdd_list_id,
                    t1.loan_amount_status
                FROM
                    tre_loan_contract_lv t1 #WHERE_CLAUSE#
                ORDER BY
                    loan_contract_number DESC
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="specific_loan_terms" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SPECIFIC_LOAN_TERMS"/>
        <bm:field name="fund_source_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FUND_SOURCE_TYPE"/>
        <bm:field name="fund_source_type_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FUND_SOURCE_TYPE_N"/>
        <bm:field name="risk_analysis" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RISK_ANALYSIS"/>
        <bm:field name="loan_amount_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_AMOUNT_TYPE"/>
        <bm:field name="loan_amount_type_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_AMOUNT_TYPE_N"/>
        <bm:field name="used_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="USED_AMOUNT"/>
        <bm:field name="available_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="AVAILABLE_AMOUNT"/>
        <bm:field name="withhold_value_added_tax" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WITHHOLD_VALUE_ADDED_TAX"/>
        <bm:field name="way_of_increasing_trust_plus" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WAY_OF_INCREASING_TRUST_PLUS"/>
        <bm:field name="add_credit_method" databaseType="CHAR" datatype="java.lang.String" physicalName="ADD_CREDIT_METHOD"/>
        <bm:field name="lease_item_price_agent" databaseType="NUMBER" datatype="java.lang.Double" physicalName="LEASE_ITEM_PRICE_AGENT"/>
        <bm:field name="hd_user_col_v01" databaseType="NUMBER" datatype="java.lang.Double" physicalName="HD_USER_COL_V01"/>
        <bm:field name="hd_user_col_n18" databaseType="NUMBER" datatype="java.lang.Double" physicalName="HD_USER_COL_N18"/>
        <bm:field name="external_debt_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXTERNAL_DEBT_FLAG"/>
        <bm:field name="data_class" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DATA_CLASS"/>
        <bm:field name="loan_charge_share_way_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CHARGE_SHARE_WAY_N"/>
        <bm:field name="bank_branch_bp_id_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BANK_BRANCH_BP_ID_N"/>
        <bm:field name="loan_contract_balance" databaseType="NUMBER" datatype="java.lang.Double" physicalName="LOAN_CONTRACT_BALANCE"/>
        <bm:field name="withhold_income_tax" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WITHHOLD_INCOME_TAX"/>
        <bm:field name="withhold_sale_tax" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WITHHOLD_SALE_TAX"/>
        <bm:field name="comment_add" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="COMMENT_ADD"/>
        <bm:field name="withhold_sale_tax_add" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WITHHOLD_SALE_TAX_ADD"/>
        <bm:field name="interest_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTEREST_DESC"/>
        <bm:field name="loan_con_terms" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CON_TERMS"/>
        <bm:field name="loan_con_terms_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CON_TERMS_N"/>
        <bm:field name="first_withdraw_date" databaseType="DATE" datatype="java.util.Date" physicalName="FIRST_WITHDRAW_DATE"/>
        <bm:field name="loan_contract_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="LOAN_CONTRACT_ID" required="true"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="COMPANY_ID"/>
        <bm:field name="loan_contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CONTRACT_NUMBER"/>
        <bm:field name="loan_contract_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CONTRACT_NAME"/>
        <bm:field name="signing_date" databaseType="DATE" datatype="java.util.Date" physicalName="SIGNING_DATE"/>
        <bm:field name="loan_contreat_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CONTREAT_NUM"/>
        <bm:field name="transactor" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TRANSACTOR"/>
        <bm:field name="transactor_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TRANSACTOR_CODE"/>
        <bm:field name="transact_unit_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TRANSACT_UNIT_NAME"/>
        <bm:field name="transact_unit_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TRANSACT_UNIT_CODE"/>
        <bm:field name="transfer_from" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TRANSFER_FROM"/>
        <bm:field name="transfer_to" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TRANSFER_TO"/>
        <bm:field name="loan_usage_description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_USAGE_DESCRIPTION"/>
        <bm:field name="signing_breed" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SIGNING_BREED"/>
        <bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY"/>
        <bm:field name="business_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE"/>
        <bm:field name="original_con_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ORIGINAL_CON_NUM"/>
        <bm:field name="contract_period" databaseType="NUMBER" datatype="java.lang.Double" physicalName="CONTRACT_PERIOD"/>
        <bm:field name="business_type_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE_N"/>
        <bm:field name="document_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_TYPE"/>
        <bm:field name="loan_contract_book_date" databaseType="DATE" datatype="java.util.Date" physicalName="LOAN_CONTRACT_BOOK_DATE"/>
        <bm:field name="bank_credit_contract_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BANK_CREDIT_CONTRACT_ID"/>
        <bm:field name="bank_credit_contract_id_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BANK_CREDIT_CONTRACT_ID_N"/>
        <bm:field name="credit_limit_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CREDIT_LIMIT_TYPE"/>
        <bm:field name="credit_limit_type_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CREDIT_LIMIT_TYPE_N"/>
        <bm:field name="bank_account_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BANK_ACCOUNT_ID"/>
        <bm:field name="bank_account_id_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BANK_ACCOUNT_ID_N"/>
        <bm:field name="withdraw_account_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WITHDRAW_ACCOUNT_ID"/>
        <bm:field name="withdraw_account_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WITHDRAW_ACCOUNT_CODE"/>
        <bm:field name="withdraw_account_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WITHDRAW_ACCOUNT_NUM"/>
        <bm:field name="loan_certificate_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CERTIFICATE_FLAG"/>
        <bm:field name="related_party_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RELATED_PARTY_FLAG"/>
        <bm:field name="loan_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="LOAN_AMOUNT"/>
        <bm:field name="withdraw_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WITHDRAW_AMOUNT"/>
        <bm:field name="remaining_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REMAINING_AMOUNT"/>
        <bm:field name="received_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="RECEIVED_PRINCIPAL"/>
        <bm:field name="no_received_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="NO_RECEIVED_PRINCIPAL"/>
        <bm:field name="loan_accrued_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="LOAN_ACCRUED_INTEREST"/>
        <bm:field name="currency" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY"/>
        <bm:field name="currency_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY_N"/>
        <bm:field name="precision" databaseType="NUMBER" datatype="java.lang.Double" physicalName="PRECISION" required="true"/>
        <bm:field name="loan_contract_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CONTRACT_STATUS"/>
        <bm:field name="loan_contract_status_display" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CONTRACT_STATUS_DISPLAY"/>
        <bm:field name="loan_contract_status_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CONTRACT_STATUS_N"/>
        <bm:field name="time_horizon" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TIME_HORIZON"/>
        <bm:field name="loan_date_from" databaseType="DATE" datatype="java.util.Date" physicalName="LOAN_DATE_FROM"/>
        <bm:field name="loan_date_to" databaseType="DATE" datatype="java.util.Date" physicalName="LOAN_DATE_TO"/>
        <bm:field name="base_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BASE_RATE"/>
        <bm:field name="int_rate_fixing_way" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INT_RATE_FIXING_WAY"/>
        <bm:field name="int_rate_fixing_way_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INT_RATE_FIXING_WAY_N"/>
        <bm:field name="adjust_rate_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ADJUST_RATE_TYPE"/>
        <bm:field name="adjust_rate_type_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ADJUST_RATE_TYPE_N"/>
        <bm:field name="int_rate_fixing_range" databaseType="NUMBER" datatype="java.lang.Double" physicalName="INT_RATE_FIXING_RANGE"/>
        <bm:field name="interest_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="INTEREST_RATE"/>
        <bm:field name="interest_rate_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTEREST_RATE_N"/>
        <bm:field name="calc_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CALC_METHOD"/>
        <bm:field name="calc_method_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CALC_METHOD_N"/>
        <bm:field name="interest_period" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTEREST_PERIOD"/>
        <bm:field name="interest_period_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTEREST_PERIOD_N"/>
        <bm:field name="base_rate_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BASE_RATE_TYPE"/>
        <bm:field name="base_rate_type_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BASE_RATE_TYPE_N"/>
        <bm:field name="interest_calc_date" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTEREST_CALC_DATE"/>
        <bm:field name="interest_payment_date" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTEREST_PAYMENT_DATE"/>
        <bm:field name="penalty_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="PENALTY_RATE"/>
        <bm:field name="misappropriate_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="MISAPPROPRIATE_RATE"/>
        <bm:field name="et_penalty_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="ET_PENALTY_RATE"/>
        <bm:field name="annual_days" databaseType="NUMBER" datatype="java.lang.Double" physicalName="ANNUAL_DAYS"/>
        <bm:field name="rate_float_cycle" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RATE_FLOAT_CYCLE"/>
        <bm:field name="flt_execute_times_day" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FLT_EXECUTE_TIMES_DAY"/>
        <bm:field name="adjust_day" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ADJUST_DAY"/>
        <bm:field name="withdrawal_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WITHDRAWAL_METHOD"/>
        <bm:field name="last_withdrawal_date" databaseType="DATE" datatype="java.util.Date" physicalName="LAST_WITHDRAWAL_DATE"/>
        <bm:field name="factoring_financing_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FACTORING_FINANCING_METHOD"/>
        <bm:field name="payment_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PAYMENT_METHOD"/>
        <bm:field name="payment_date" databaseType="DATE" datatype="java.util.Date" physicalName="PAYMENT_DATE"/>
        <bm:field name="discount_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="DISCOUNT_RATE"/>
        <bm:field name="bank_financing_scale" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BANK_FINANCING_SCALE"/>
        <bm:field name="financing_scale" databaseType="NUMBER" datatype="java.lang.Double" physicalName="FINANCING_SCALE"/>
        <bm:field name="repayment_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REPAYMENT_METHOD"/>
        <bm:field name="last_repayment_date" databaseType="DATE" datatype="java.util.Date" physicalName="LAST_REPAYMENT_DATE"/>
        <bm:field name="total_repayment" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TOTAL_REPAYMENT"/>
        <bm:field name="total_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TOTAL_INTEREST"/>
        <bm:field name="total_fee" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TOTAL_FEE"/>
        <bm:field name="total_fee_pv" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TOTAL_FEE_PV"/>
        <bm:field name="net_finance_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="NET_FINANCE_AMOUNT"/>
        <bm:field name="interest_margin" databaseType="NUMBER" datatype="java.lang.Double" physicalName="INTEREST_MARGIN"/>
        <bm:field name="reviewed_by" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REVIEWED_BY"/>
        <bm:field name="reviewed_date" databaseType="DATE" datatype="java.util.Date" physicalName="REVIEWED_DATE"/>
        <bm:field name="closed_by" databaseType="NUMBER" datatype="java.lang.Double" physicalName="CLOSED_BY"/>
        <bm:field name="closed_date" databaseType="DATE" datatype="java.util.Date" physicalName="CLOSED_DATE"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="CONTRACT_ID"/>
        <bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_NAME"/>
        <bm:field name="employee_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EMPLOYEE_NAME"/>
        <bm:field name="finance_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="FINANCE_AMOUNT"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NUMBER"/>
        <bm:field name="contract_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NAME"/>
        <bm:field name="vat_rate_of_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="VAT_RATE_OF_INTEREST"/>
        <bm:field name="note" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NOTE"/>
        <bm:field name="created_by_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CREATED_BY_N"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Double" physicalName="REF_N05"/>
        <bm:field name="ref_d01" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D01"/>
        <bm:field name="ref_d02" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D02"/>
        <bm:field name="ref_d03" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D03"/>
        <bm:field name="ref_d04" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D04"/>
        <bm:field name="ref_d05" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D05"/>
        <bm:field name="loan_charge" databaseType="NUMBER" datatype="java.lang.Double" physicalName="LOAN_CHARGE"/>
        <bm:field name="consulting_fee" databaseType="NUMBER" datatype="java.lang.Double" physicalName="CONSULTING_FEE"/>
        <bm:field name="other_fee" databaseType="NUMBER" datatype="java.lang.Double" physicalName="OTHER_FEE"/>
        <bm:field name="interest_period_times" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTEREST_PERIOD_TIMES"/>
        <bm:field name="consulting_fee_rate" databaseType="NUMBER" datatype="java.lang.Double" physicalName="CONSULTING_FEE_RATE"/>
        <bm:field name="deposit_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="DEPOSIT_AMOUNT"/>
        <bm:field name="bank_branch_bp_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BANK_BRANCH_BP_ID"/>
        <bm:field name="price_list" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRICE_LIST"/>
        <bm:field name="price_list_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRICE_LIST_N"/>
        <bm:field name="loan_charge_share_way" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CHARGE_SHARE_WAY"/>
        <bm:field name="main_quotation_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="MAIN_QUOTATION_ID"/>
        <bm:field name="calc_session_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="CALC_SESSION_ID"/>
        <bm:field name="loan_con_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CON_TYPE"/>
        <bm:field name="loan_con_type_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CON_TYPE_N"/>
        <bm:field name="loan_con_type_detail" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CON_TYPE_DETAIL"/>
        <bm:field name="lease_times" databaseType="NUMBER" datatype="java.lang.Double" physicalName="LEASE_TIMES"/>
        <bm:field name="loan_con_type_detail_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CON_TYPE_DETAIL_N"/>
        <bm:field name="way_of_increasing_trust" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WAY_OF_INCREASING_TRUST"/>
        <bm:field name="way_of_increasing_trust_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WAY_OF_INCREASING_TRUST_N"/>
        <bm:field name="inside_or_outside" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INSIDE_OR_OUTSIDE"/>
        <bm:field name="inside_or_outside_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INSIDE_OR_OUTSIDE_N"/>
        <bm:field name="free_trade_agreement" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FREE_TRADE_AGREEMENT"/>
        <bm:field name="free_trade_agreement_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FREE_TRADE_AGREEMENT_N"/>
        <bm:field name="within_the_group" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WITHIN_THE_GROUP"/>
        <bm:field name="within_the_group_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WITHIN_THE_GROUP_N"/>
        <bm:field name="loan_con_bp" databaseType="NUMBER" datatype="java.lang.Double" physicalName="LOAN_CON_BP"/>
        <bm:field name="loan_con_bp_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CON_BP_CODE"/>
        <bm:field name="loan_con_bp_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CON_BP_N"/>
        <bm:field name="loan_con_wfl_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CON_WFL_STATUS"/>
        <bm:field name="loan_con_wfl_status_n" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_CON_WFL_STATUS_N"/>
        <bm:field name="external_debt_cir_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXTERNAL_DEBT_CIR_FLAG"/>
        <bm:field name="cdd_list_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="CDD_LIST_ID"/>
        <bm:field name="loan_amount_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOAN_AMOUNT_STATUS"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="loan_contract_number" queryOperator="like"/>
        <bm:query-field field="original_con_num" queryOperator="like"/>
        <bm:query-field field="loan_con_bp" queryOperator="="/>
        <bm:query-field field="within_the_group" queryOperator="="/>
        <bm:query-field field="loan_con_type_detail" queryOperator="="/>
        <bm:query-field field="loan_amount_status" queryOperator="="/>
        <bm:query-field field="loan_con_terms" queryOperator="="/>
        <bm:query-field field="currency" queryOperator="="/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter expression=" (  t1.data_class = &apos;NORMAL&apos;    and nvl(t1.loan_con_wfl_status, &apos;WFL_NEW&apos;) = &apos;WFL_APPROVED&apos;    and nvl(t1.loan_contract_status, &apos;NEW&apos;) in (&apos;REVIEWED&apos;)    and exists (select 1           from prj_quotation q          where q.document_id = t1.loan_contract_id            and q.document_category = &apos;LOAN_CONTRACT&apos;            and nvl(q.main_contract_flag, &apos;N&apos;) = &apos;N&apos;            and q.wfl_status = &apos;APPROVED&apos;            and nvl(q.review_flag, &apos;N&apos;) = &apos;Y&apos;            and nvl(q.document_status, &apos;NEW&apos;) = &apos;REVIEW&apos;            and nvl(q.reverse_flag, &apos;N&apos;) = &apos;N&apos;))"/>
    </bm:data-filters>
</bm:model>
