<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="CSH_TRANSACTION_INTERFACE" defaultOrderBy="trx_interface_id asc">
    <bm:fields>
        <bm:field name="batch_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BATCH_ID" prompt="CSH_TRANSACTION_INTERFACE.BATCH_ID"/>
        <bm:field name="trx_interface_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="TRX_INTERFACE_ID" prompt="CSH_TRANSACTION_INTERFACE.TRX_INTERFACE_ID"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="CSH_TRANSACTION_INTERFACE.COMPANY_ID"/>
        <bm:field name="csh_trx_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_TRX_TYPE" prompt="CSH_TRANSACTION_INTERFACE.CSH_TRX_TYPE"/>
        <bm:field name="csh_trx_date" databaseType="DATE" datatype="java.util.Date" physicalName="CSH_TRX_DATE" prompt="CSH_TRANSACTION_INTERFACE.CSH_TRX_DATE"/>
        <bm:field name="csh_trx_period_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_TRX_PERIOD_NAME" prompt="CSH_TRANSACTION_INTERFACE.CSH_TRX_PERIOD_NAME"/>
        <bm:field name="csh_trx_period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CSH_TRX_PERIOD_NUM" prompt="CSH_TRANSACTION_INTERFACE.CSH_TRX_PERIOD_NUM"/>
        <bm:field name="csh_trx_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="CSH_TRX_AMOUNT" prompt="CSH_TRANSACTION_INTERFACE.CSH_TRX_AMOUNT"/>
        <bm:field name="csh_trx_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_TRX_NUMBER" prompt="CSH_TRANSACTION_INTERFACE.CSH_TRX_NUMBER"/>
        <bm:field name="csh_bank_account_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CSH_BANK_ACCOUNT_ID" prompt="CSH_TRANSACTION_INTERFACE.CSH_BANK_ACCOUNT_ID"/>
        <bm:field name="csh_bp_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_BP_CATEGORY" prompt="CSH_TRANSACTION_INTERFACE.CSH_BP_CATEGORY"/>
        <bm:field name="csh_bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CSH_BP_ID" prompt="CSH_TRANSACTION_INTERFACE.CSH_BP_ID"/>
        <bm:field name="csh_bp_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_BP_CODE" prompt="CSH_TRANSACTION_INTERFACE.CSH_BP_CODE"/>
        <bm:field name="csh_bp_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_BP_NAME" prompt="CSH_TRANSACTION_INTERFACE.CSH_BP_NAME"/>
        <bm:field name="csh_bp_bank_account_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CSH_BP_BANK_ACCOUNT_ID" prompt="CSH_TRANSACTION_INTERFACE.CSH_BP_BANK_ACCOUNT_ID"/>
        <bm:field name="csh_bp_bank_account_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_BP_BANK_ACCOUNT_NUM" prompt="CSH_TRANSACTION_INTERFACE.CSH_BP_BANK_ACCOUNT_NUM"/>
        <bm:field name="csh_payment_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_PAYMENT_METHOD" prompt="CSH_TRANSACTION_INTERFACE.CSH_PAYMENT_METHOD"/>
        <bm:field name="csh_payment_method_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CSH_PAYMENT_METHOD_ID" prompt="CSH_TRANSACTION_INTERFACE.CSH_PAYMENT_METHOD_ID"/>
        <bm:field name="csh_bank_slip_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_BANK_SLIP_NUM" prompt="CSH_TRANSACTION_INTERFACE.CSH_BANK_SLIP_NUM"/>
        <bm:field name="csh_currency_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_CURRENCY_CODE" prompt="CSH_TRANSACTION_INTERFACE.CSH_CURRENCY_CODE"/>
        <bm:field name="csh_exchange_rate_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_EXCHANGE_RATE_TYPE" prompt="CSH_TRANSACTION_INTERFACE.CSH_EXCHANGE_RATE_TYPE"/>
        <bm:field name="csh_exchange_rate_quotation" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_EXCHANGE_RATE_QUOTATION" prompt="CSH_TRANSACTION_INTERFACE.CSH_EXCHANGE_RATE_QUOTATION"/>
        <bm:field name="csh_exchange_rate" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CSH_EXCHANGE_RATE" prompt="CSH_TRANSACTION_INTERFACE.CSH_EXCHANGE_RATE"/>
        <bm:field name="csh_handling_charge" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CSH_HANDLING_CHARGE" prompt="CSH_TRANSACTION_INTERFACE.CSH_HANDLING_CHARGE"/>
        <bm:field name="csh_description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_DESCRIPTION" prompt="CSH_TRANSACTION_INTERFACE.CSH_DESCRIPTION"/>
        <bm:field name="ref_contract_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_CONTRACT_NUMBER" prompt="CSH_TRANSACTION_INTERFACE.REF_CONTRACT_NUMBER"/>
        <bm:field name="ref_contract_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_CONTRACT_ID" prompt="CSH_TRANSACTION_INTERFACE.REF_CONTRACT_ID"/>
        <bm:field name="check_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CHECK_FLAG" prompt="CSH_TRANSACTION_INTERFACE.CHECK_FLAG"/>
        <bm:field name="post_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="POST_FLAG" prompt="CSH_TRANSACTION_INTERFACE.POST_FLAG"/>
        <bm:field name="csh_transaction_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CSH_TRANSACTION_ID" prompt="CSH_TRANSACTION_INTERFACE.CSH_TRANSACTION_ID"/>
        <bm:field name="ref_contract_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_CONTRACT_TIMES" prompt="CSH_TRANSACTION_INTERFACE.REF_CONTRACT_TIMES"/>
        <bm:field name="csh_bp_bank_account_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_BP_BANK_ACCOUNT_NAME" prompt="CSH_TRANSACTION_INTERFACE.CSH_BP_BANK_ACCOUNT_NAME"/>
        <bm:field name="csh_bank_account_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CSH_BANK_ACCOUNT_NUM" prompt="CSH_TRANSACTION_INTERFACE.CSH_BANK_ACCOUNT_NUM"/>
        <bm:field name="write_off_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WRITE_OFF_FLAG" prompt="CSH_TRANSACTION_INTERFACE.WRITE_OFF_FLAG"/>
        <bm:field name="lock_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LOCK_FLAG" prompt="CSH_TRANSACTION_INTERFACE.LOCK_FLAG"/>
        <bm:field name="ref_contract_cf_item" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_CONTRACT_CF_ITEM" prompt="CSH_TRANSACTION_INTERFACE.REF_CONTRACT_CF_ITEM"/>
        <bm:field name="ebank_company_acc_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EBANK_COMPANY_ACC_NUM" prompt="CSH_TRANSACTION_INTERFACE.EBANK_COMPANY_ACC_NUM"/>
        <bm:field name="ebank_cust_acc_num" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EBANK_CUST_ACC_NUM" prompt="CSH_TRANSACTION_INTERFACE.EBANK_CUST_ACC_NUM"/>
        <bm:field name="ebank_cust_acc_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EBANK_CUST_ACC_NAME" prompt="CSH_TRANSACTION_INTERFACE.EBANK_CUST_ACC_NAME"/>
        <bm:field name="ebank_trx_amt" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EBANK_TRX_AMT" prompt="CSH_TRANSACTION_INTERFACE.EBANK_TRX_AMT"/>
        <bm:field name="ebank_description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EBANK_DESCRIPTION" prompt="CSH_TRANSACTION_INTERFACE.EBANK_DESCRIPTION"/>
        <bm:field name="ebank_trx_date" databaseType="DATE" datatype="java.util.Date" physicalName="EBANK_TRX_DATE" prompt="CSH_TRANSACTION_INTERFACE.EBANK_TRX_DATE"/>
        <bm:field name="ebank_success_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EBANK_SUCCESS_STATUS" prompt="CSH_TRANSACTION_INTERFACE.EBANK_SUCCESS_STATUS"/>
        <bm:field name="ebank_result_status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EBANK_RESULT_STATUS" prompt="CSH_TRANSACTION_INTERFACE.EBANK_RESULT_STATUS"/>
        <bm:field name="ebank_result_status_desc" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EBANK_RESULT_STATUS_DESC" prompt="CSH_TRANSACTION_INTERFACE.EBANK_RESULT_STATUS_DESC"/>
        <bm:field name="ebank_result_acc_balance" databaseType="NUMBER" datatype="java.lang.Double" physicalName="EBANK_RESULT_ACC_BALANCE" prompt="CSH_TRANSACTION_INTERFACE.EBANK_RESULT_ACC_BALANCE"/>
        <bm:field name="ebank_result_success_amt" databaseType="NUMBER" datatype="java.lang.Double" physicalName="EBANK_RESULT_SUCCESS_AMT" prompt="CSH_TRANSACTION_INTERFACE.EBANK_RESULT_SUCCESS_AMT"/>
        <bm:field name="line_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LINE_NUM" prompt="CSH_TRANSACTION_INTERFACE.LINE_NUM"/>
        <bm:field name="error_message" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ERROR_MESSAGE" prompt="CSH_TRANSACTION_INTERFACE.ERROR_MESSAGE"/>
        <bm:field name="write_off_amount" expression="(select sum(ci.write_off_amount)           from CSH_WRITE_OFF_INTERFACE ci          where ci.batch_id = t1.batch_id            and ci.trx_interface_id = t1.trx_interface_id)" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="trx_interface_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field field="csh_bank_slip_num" queryOperator="="/>
        <bm:query-field field="csh_bank_account_num" queryOperator="="/>
        <bm:query-field field="csh_trx_date" queryOperator="="/>
        <bm:query-field field="csh_bp_bank_account_num" queryOperator="="/>
        <bm:query-field field="csh_bp_bank_account_name" queryOperator="="/>
        <bm:query-field field="write_off_flag" queryOperator="="/>
        <bm:query-field name="csh_description" queryExpression="t1.csh_description like &apos;%&apos;||${@csh_description}||&apos;%&apos;"/>
    </bm:query-fields>
    <bm:data-filters>
        <bm:data-filter enforceOperations="query" expression="t1.batch_id = ${@batch_id}"/>
    </bm:data-filters>
    <bm:operations>
        <bm:operation name="execute">
            <bm:query-sql><![CDATA[
                begin
                	csh_transaction_interface_pkg.calc_write_off_flag(p_batch_id	=>${@batch_id});
                end;
            ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
        		
        			begin
        				csh_ebank_interface_pkg.delete_trx_interface(p_trx_interface_id => ${@trx_interface_id},p_user_id => ${/session/@user_id});
        			end;
        		
        	]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
