<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng  
    $Date: 2018-09-05 14:21:57
    $Revision: 1.0  
    $Purpose: 预核销分配
-->
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="CSH_WRITE_OFF_ASSIGNS">
    <bm:fields>
        <bm:field name="write_off_assignse_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_ASSIGNSE_ID" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_ASSIGNSE_ID"/>
        <bm:field name="record_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RECORD_TYPE" prompt="CSH_WRITE_OFF_ASSIGNS.RECORD_TYPE"/>
        <bm:field name="transaction_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="TRANSACTION_ID" prompt="CSH_WRITE_OFF_ASSIGNS.TRANSACTION_ID"/>
        <bm:field name="trx_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TRX_NUMBER" prompt="CSH_WRITE_OFF_ASSIGNS.TRX_NUMBER"/>
        <bm:field name="csh_bank_slip_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_BANK_SLIP_NUM" prompt="CSH_WRITE_OFF_ASSIGNS.CSH_BANK_SLIP_NUM"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="COMPANY_ID" prompt="CSH_WRITE_OFF_ASSIGNS.COMPANY_ID"/>
        <bm:field name="contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CONTRACT_NUMBER" prompt="CSH_WRITE_OFF_ASSIGNS.CONTRACT_NUMBER"/>
        <bm:field name="contract_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="CONTRACT_ID" prompt="CSH_WRITE_OFF_ASSIGNS.CONTRACT_ID"/>
        <bm:field name="write_off_cashflow_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_CASHFLOW_ID" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_CASHFLOW_ID"/>
        <bm:field name="write_off_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WRITE_OFF_TYPE" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_TYPE"/>
        <bm:field name="write_off_date" databaseType="DATE" datatype="java.util.Date" physicalName="WRITE_OFF_DATE" prompt="CSH_WRITE_OFF_ASSIGNS.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_ASSIGNS.WRITE_OFF_PERIOD_NAME"/>
        <bm:field name="write_off_period_num" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_PERIOD_NUM" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_PERIOD_NUM"/>
        <bm:field name="write_off_times" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_TIMES" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_TIMES"/>
        <bm:field name="write_off_cf_item" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_CF_ITEM" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_CF_ITEM"/>
        <bm:field name="write_off_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_AMOUNT" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_AMOUNT"/>
        <bm:field name="write_off_principal" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_PRINCIPAL" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_PRINCIPAL"/>
        <bm:field name="write_off_interest" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_INTEREST" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_INTEREST"/>
        <bm:field name="write_off_description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WRITE_OFF_DESCRIPTION" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_DESCRIPTION"/>
        <bm:field name="write_off_bp_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_BP_ID" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_BP_ID"/>
        <bm:field name="check_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHECK_FLAG" prompt="CSH_WRITE_OFF_ASSIGNS.CHECK_FLAG"/>
        <bm:field name="post_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="POST_FLAG" prompt="CSH_WRITE_OFF_ASSIGNS.POST_FLAG"/>
        <bm:field name="write_off_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="WRITE_OFF_ID" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_ID"/>
        <bm:field name="error_message" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ERROR_MESSAGE" prompt="CSH_WRITE_OFF_ASSIGNS.ERROR_MESSAGE"/>
        <bm:field name="agent_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="AGENT_ID" prompt="CSH_WRITE_OFF_ASSIGNS.AGENT_ID"/>
        <bm:field name="write_off_cf_item_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WRITE_OFF_CF_ITEM_NAME" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_CF_ITEM_NAME"/>
        <bm:field name="write_off_type_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WRITE_OFF_TYPE_NAME" prompt="CSH_WRITE_OFF_ASSIGNS.WRITE_OFF_TYPE_NAME"/>
        <bm:field name="classification_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CLASSIFICATION_NAME" prompt="CSH_WRITE_OFF_ASSIGNS.CLASSIFICATION_NAME"/>
        <bm:field name="batch_id" databaseType="NUMBER" datatype="java.lang.Double" physicalName="BATCH_ID" prompt="CSH_WRITE_OFF_ASSIGNS.BATCH_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="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_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="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:field name="agent_id_desc" expression="(select hbm.bp_name from hls_bp_master hbm where hbm.bp_id = t1.agent_id)" forUpdate="false" forInsert="false"/>
        <bm:field name="write_off_classification"  lookupField="write_off_classification_desc" lookupCode="DS_CSH_WRITE_OFF_CLASSIFICATION" databaseType="VARCHAR2" datatype="java.lang.String"/>
        <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_classification_desc" prompt="核销分类" forInsert="false" forUpdate="false"/>
        <bm:field name="journal_date" databaseType="DATE" datatype="java.util.Date"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
        <o:sequence-pk/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="write_off_assignse_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="transaction_id" queryOperator="="/>
        <bm:query-field field="batch_id" queryOperator="="/>
    </bm:query-fields>
</bm:model>
