<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="CSH_WRITE_OFF_INTERFACE" defaultOrderBy="contract_number asc,write_off_times asc,write_off_cf_item asc">
    <bm:fields>
        <bm:field name="write_off_interface_id" databaseType="NUMBER" datatype="java.lang.Long" insertExpression="csh_write_off_interface_s.nextval" physicalName="WRITE_OFF_INTERFACE_ID" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_INTERFACE_ID"/>
        <bm:field name="batch_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BATCH_ID" prompt="CSH_WRITE_OFF_INTERFACE.BATCH_ID"/>
        <bm:field name="trx_interface_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TRX_INTERFACE_ID" prompt="CSH_WRITE_OFF_INTERFACE.TRX_INTERFACE_ID"/>
        <!-- <bm:field name="trx_number" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TRX_NUMBER" prompt="CSH_WRITE_OFF_INTERFACE.TRX_NUMBER"/> -->
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="CSH_WRITE_OFF_INTERFACE.COMPANY_ID"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NUMBER" prompt="CSH_WRITE_OFF_INTERFACE.CONTRACT_NUMBER"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_ID" prompt="CSH_WRITE_OFF_INTERFACE.CONTRACT_ID"/>
        <bm:field name="write_off_cashflow_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WRITE_OFF_CASHFLOW_ID" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_CASHFLOW_ID"/>
        <bm:field name="due_date" datatype="java.util.Date" expression="(select a.due_date from con_contract_cashflow a where a.cashflow_id = t1.write_off_cashflow_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="write_off_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WRITE_OFF_TYPE" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_TYPE"/>
        <bm:field name="write_off_type_desc" Expression="(select v.code_value_name from sys_code_values_v v where v.code_value = t1.write_off_type and v.code = &apos;CSH513_WRITE_OFF_TYPE&apos;)" forInsert="false" forUpdate="false"/>
        <bm:field name="write_off_date" databaseType="DATE" datatype="java.util.Date" physicalName="WRITE_OFF_DATE" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_DATE"/>
        <bm:field name="write_off_period_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WRITE_OFF_PERIOD_NAME" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_PERIOD_NAME"/>
        <bm:field name="write_off_period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WRITE_OFF_PERIOD_NUM" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_PERIOD_NUM"/>
        <bm:field name="write_off_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WRITE_OFF_TIMES" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_TIMES"/>
        <bm:field name="write_off_cf_item" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WRITE_OFF_CF_ITEM" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_CF_ITEM"/>
        <bm:field name="write_off_cf_item_desc" expression="(select a.cf_item_desc from hls_cashflow_item_v a where a.cf_item = t1.write_off_cf_item)" forInsert="false" forUpdate="false"/>
        <bm:field name="write_off_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_AMOUNT" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_AMOUNT"/>
        <bm:field name="write_off_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_PRINCIPAL" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_PRINCIPAL"/>
        <bm:field name="write_off_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_INTEREST" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_INTEREST"/>
        <bm:field name="write_off_description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WRITE_OFF_DESCRIPTION" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_DESCRIPTION"/>
        <bm:field name="check_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHECK_FLAG" prompt="CSH_WRITE_OFF_INTERFACE.CHECK_FLAG"/>
        <bm:field name="post_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="POST_FLAG" prompt="CSH_WRITE_OFF_INTERFACE.POST_FLAG"/>
        <bm:field name="write_off_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WRITE_OFF_ID" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_ID"/>
        <bm:field name="record_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RECORD_TYPE" prompt="CSH_WRITE_OFF_INTERFACE.RECORD_TYPE"/>
        <bm:field name="write_off_bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WRITE_OFF_BP_ID" prompt="CSH_WRITE_OFF_INTERFACE.WRITE_OFF_BP_ID"/>
        <bm:field name="write_off_bp_name" Expression="(select a.bp_name from hls_bp_master a where a.bp_id = t1.write_off_bp_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="csh_bank_slip_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_BANK_SLIP_NUM" prompt="CSH_WRITE_OFF_INTERFACE.CSH_BANK_SLIP_NUM"/>
        <bm:field name="error_message" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ERROR_MESSAGE" prompt="CSH_WRITE_OFF_INTERFACE.ERROR_MESSAGE"/>
        <bm:field name="trx_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TRX_NUMBER" prompt="事务编号"/>
        <bm:field name="left_amount" expression="(select ca.due_amount - nvl(ca.received_amount,0) from con_contract_cashflow ca where ca.cashflow_id = t1.write_off_cashflow_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="left_principal" expression="(select ca.principal - nvl(ca.received_principal,0) from con_contract_cashflow ca where ca.cashflow_id = t1.write_off_cashflow_id)" forInsert="false" forUpdate="false"/>
        <bm:field name="left_interest" expression="(select ca.interest - nvl(ca.received_interest,0) from con_contract_cashflow ca where ca.cashflow_id = t1.write_off_cashflow_id)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="write_off_interface_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="batch_id" queryOperator="="/>
        <bm:query-field field="trx_interface_id" queryOperator="="/>
    </bm:query-fields>
</bm:model>
