<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2013-11-1 上午11:02:38  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="HLS_FIN_CALCULATOR_HD">
    <bm:fields>
        <bm:field name="rnum" expression="rownum"/>
        <bm:field name="calc_session_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CALC_SESSION_ID" prompt="HLS_FIN_CALCULATOR_HD.CALC_SESSION_ID"/>
        <bm:field name="lease_term" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_TERM" prompt="HLS_FIN_CALCULATOR_HD.LEASE_TERM"/>
        <bm:field name="lease_times" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_TIMES" prompt="HLS_FIN_CALCULATOR_HD.LEASE_TIMES"/>
        <bm:field name="annual_pay_times_n" expression="(decode(t1.annual_pay_times,12,&apos;月&apos;，4,&apos;季&apos;,2,&apos;半年&apos;,1,&apos;年&apos;))"/>
        <bm:field name="finance_amount" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char(t1.finance_amount,&apos;FM99,999,999,999,990.00&apos;)" physicalName="FINANCE_AMOUNT" prompt="HLS_FIN_CALCULATOR_HD.FINANCE_AMOUNT"/>
        <bm:field name="finance_amount_rmb" databaseType="VARCHAR2" datatype="java.lang.String" expression="CHANGE_NUMBER_TO_RMB(t1.finance_amount)" physicalName="FINANCE_AMOUNT" prompt="HLS_FIN_CALCULATOR_HD.FINANCE_AMOUNT"/>
        <bm:field name="deposit_ratio_n" expression="to_char((t1.deposit_ratio)*100,&apos;FM990.0099&apos;)||&apos;%&apos;"/>
        <bm:field name="deposit" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char(t1.deposit,&apos;FM99,999,999,999,990.00&apos;)" physicalName="DEPOSIT" prompt="HLS_FIN_CALCULATOR_HD.DEPOSIT"/>
        <bm:field name="deposit_rmb" databaseType="VARCHAR2" datatype="java.lang.String" expression="CHANGE_NUMBER_TO_RMB(t1.deposit)"/>
        <bm:field name="currency_n" expression="(select v.currency_name from gld_currency_vl v where v.currency_code=t1.currency)"/>
        <bm:field name="currency_symbol" expression="(select g.currency_symbol from gld_currency g where g.currency_code = t1.currency)" forInsert="false" forUpdate="false"/>
        <bm:field name="deposit_deduction_n" expression="(select v.code_value_name from sys_code_values_v v where v.code=&apos;HLS500_DEPOSIT_DEDUCTION&apos; and v.code_value=t1.deposit_deduction)"/>
        <bm:field name="pay_type_n" expression="decode(t1.pay_type,1,&apos;期初&apos;,0,&apos;期末&apos;)"/>
        <bm:field name="lease_charge" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char(t1.lease_charge,&apos;FM99,999,999,999,990.00&apos;)" physicalName="LEASE_CHARGE" prompt="HLS_FIN_CALCULATOR_HD.LEASE_CHARGE"/>
        <bm:field name="lease_charge_rmb" databaseType="VARCHAR2" datatype="java.lang.String" expression="CHANGE_NUMBER_TO_RMB(t1.lease_charge)"/>
        <bm:field name="net_lease_charge" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char(t1.net_lease_charge,&apos;FM99,999,999,999,990.00&apos;)"/>
        <bm:field name="net_lease_charge_rmb" databaseType="VARCHAR2" datatype="java.lang.String" expression="CHANGE_NUMBER_TO_RMB(t1.net_lease_charge)"/>
        <bm:field name="lease_charge_ratio_n" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char((t1.lease_charge_ratio)*100,&apos;FM990.0099&apos;)||&apos;%&apos;"/>
        <bm:field name="net_lease_charge_ratio_n" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char((t1.net_lease_charge/t1.finance_amount)*100,&apos;FM990.0099&apos;)||&apos;%&apos;"/>
        <bm:field name="lease_mgt_fee" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_MGT_FEE" prompt="HLS_FIN_CALCULATOR_HD.LEASE_MGT_FEE"/>
        <!-- <bm:field name="total_rental" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char(t1.net_total_interest+t1.finance_amount,&apos;FM99,999,999,999,990.00&apos;)" physicalName="TOTAL_RENTAL" prompt="HLS_FIN_CALCULATOR_HD.TOTAL_RENTAL"/> -->
        <!-- <bm:field name="total_rental_rmb" databaseType="VARCHAR2" datatype="java.lang.String" expression="CHANGE_NUMBER_TO_RMB(t1.net_total_interest+t1.finance_amount)"/> -->
        <bm:field name="total_rental" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char(t1.total_rental,&apos;FM99,999,999,999,990.00&apos;)" physicalName="TOTAL_RENTAL" prompt="HLS_FIN_CALCULATOR_HD.TOTAL_RENTAL"/>
        <bm:field name="total_rental_rmb" databaseType="VARCHAR2" datatype="java.lang.String" expression="CHANGE_NUMBER_TO_RMB(t1.total_rental)"/>
        <bm:field name="notarial_fee" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char(t1.notarial_fee,&apos;FM99,999,999,999,990.00&apos;)" physicalName="NOTARIAL_FEE" prompt="HLS_FIN_CALCULATOR_HD.NOTARIAL_FEE"/>
        <bm:field name="notarial_fee_rmb" databaseType="VARCHAR2" datatype="java.lang.String" expression="CHANGE_NUMBER_TO_RMB(t1.notarial_fee)"/>
        <bm:field name="residual_value" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char(t1.residual_value,&apos;FM99,999,999,999,990.00&apos;)" physicalName="RESIDUAL_VALUE" prompt="HLS_FIN_CALCULATOR_HD.RESIDUAL_VALUE"/>
        <bm:field name="residual_value_rmb" databaseType="VARCHAR2" datatype="java.lang.String" expression="CHANGE_NUMBER_TO_RMB(t1.residual_value)"/>
        <bm:field name="net_residual_value" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char(t1.net_residual_value,&apos;FM99,999,999,999,990.00&apos;)" physicalName="RESIDUAL_VALUE" prompt="HLS_FIN_CALCULATOR_HD.RESIDUAL_VALUE"/>
        <bm:field name="net_residual_value_rmb" databaseType="VARCHAR2" datatype="java.lang.String" expression="CHANGE_NUMBER_TO_RMB(t1.net_residual_value)"/>
        <bm:field name="lease_start_date" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_START_DATE" prompt="HLS_FIN_CALCULATOR_HD.LEASE_START_DATE"/>
        <bm:field name="lease_mgt_fee_times" expression="(select count(*) from hls_fin_calculator_ln l where t1.calc_session_id =l.calc_session_id and l.lease_mgt_fee is not null)" forInsert="false" forUpdate="false"/>
        <bm:field name="lease_mgt_fee_first_time" expression="(select l.lease_mgt_fee from hls_fin_calculator_ln l where t1.calc_session_id =l.calc_session_id and l.times=0)" forInsert="false" forUpdate="false"/>
        <bm:field name="lease_mgt_fee_first_time_rate" expression="to_char((select decode(t1.lease_mgt_fee,0,0, l.lease_mgt_fee/t1.lease_mgt_fee) from hls_fin_calculator_ln l where t1.calc_session_id =l.calc_session_id and l.times=0),&apos;FM99,999,999,999,990.00&apos;)" forInsert="false" forUpdate="false"/>
        <bm:field name="down_payment" databaseType="VARCHAR2" datatype="java.lang.String" expression="to_char(t1.down_payment,&apos;FM99,999,999,999,990.00&apos;)"/>
        <bm:field name="down_payment_rmb" databaseType="VARCHAR2" datatype="java.lang.String" expression="CHANGE_NUMBER_TO_RMB(t1.down_payment)"/>
        <bm:field name="tax_type_id" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TAX_TYPE_ID" prompt="HLS_FIN_CALCULATOR_HD.TAX_TYPE_ID"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="calc_session_id"/>
    </bm:primary-key>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.calc_session_id=(select q.calc_session_id from con_contract q where q.contract_id=${@contract_id})"/>
    </bm:data-filters>
</bm:model>
