<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-5-9 下午06:42:00  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
    <bm:operations>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
            	begin
				   csh_deposit_write_off_pkg.delete_pre_csh_transaction(p_contract_id => ${@source_doc_id},
				                                                       p_cashflow_id => ${@source_doc_line_id},
				                                                       p_user_id => ${/session/@user_id});
            		csh_transaction_pkg.insert_csh_transaction(
            			  p_transaction_id=>${@transaction_id},
			              p_transaction_num=>${@transaction_num},
			              p_transaction_category=>'BUSINESS',
			              p_transaction_type=>'RECEIPT',
			              p_transaction_date=>to_date(${@transaction_date},'yyyy-mm-dd hh24:mi:ss'),
			              p_penalty_calc_date=>to_date(${@transaction_date},'yyyy-mm-dd hh24:mi:ss'),
			              p_bank_slip_num=>${@bank_slip_num},
			              p_company_id=>${/session/@company_id},
			              p_internal_period_num=>${@internal_period_num},
			              p_period_name=>${@period_name},
			              p_payment_method_id=>${@payment_method_id},
			              p_distribution_set_id=>${@distribution_set_id},
			              p_cashflow_amount=>0,
			              p_currency_code=>${@currency_code},
			              p_transaction_amount=>0,
			              p_exchange_rate_type=>${@exchange_rate_type},
			              p_exchange_rate_quotation=>${@exchange_rate_quotation},
			              p_exchange_rate=>${@exchange_rate},
			              p_bank_account_id=>${@bank_account_id},
			              p_bp_category=>${@bp_category},
			              p_bp_id=>${@bp_id},
			              p_bp_bank_account_id=>${@bp_bank_account_id},
			              p_bp_bank_account_num=>${@bp_bank_account_num},
			              p_description=>${@description},
			              p_handling_charge=>${@handling_charge},
			              p_posted_flag=>nvl(${@posted_flag},'N'),
			              p_reversed_flag=>nvl(${@reversed_flag},'N'),
			              p_reversed_date=>to_date(${@reversed_date},'yyyy-mm-dd 24hh:mi:ss'),
			              p_returned_flag=>nvl(${@returned_flag},'NOT'),
			              p_returned_amount=>${@returned_amount},
			              p_write_off_flag=>nvl(${@write_off_flag},'NOT'),
			              p_write_off_amount=>0,
			              p_full_write_off_date=>to_date(${@full_write_off_date},'yyyy-mm-dd 24hh:mi:ss'),
			              p_twin_csh_trx_id=>${@twin_csh_trx_id},
			              p_return_from_csh_trx_id=>${@return_from_csh_trx_id},
			              p_reversed_csh_trx_id=>${@reversed_csh_trx_id},
			              p_source_csh_trx_type=>${@source_csh_trx_type},
			              p_source_csh_trx_id=>${@source_csh_trx_id},
			              p_source_doc_category=>${@source_doc_category},
			              p_source_doc_type=>${@source_doc_type},
			              p_source_doc_id=>${@source_doc_id},
			              p_source_doc_line_id=>${@source_doc_line_id},
			              p_create_je_mothed=>${@create_je_mothed},
			              p_create_je_flag=>nvl(${@create_je_flag},'N'),
			              p_gld_interface_flag=>nvl(${@gld_interface_flag},'N'),
			              p_user_id=>${/session/@user_id});
            	end;
            ]]></bm:update-sql>
            <bm:parameters>
                <bm:parameter name="transaction_id" dataType="java.lang.Long" input="false" inputPath="@transaction_id" output="true" outputPath="/parameter/@transaction_id"/>
            </bm:parameters>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
            	begin
            		csh_transaction_pkg.update_csh_transaction(
            		      p_transaction_id=>${@transaction_id},
			              p_transaction_num=>${@transaction_num},
			              p_transaction_category=>'BUSINESS',
			              p_transaction_type=>'RECEIPT',
			              p_transaction_date=>to_date(${@transaction_date},'yyyy-mm-dd hh24:mi:ss'),
			              p_penalty_calc_date=>to_date(${@transaction_date},'yyyy-mm-dd hh24:mi:ss'),
			              p_bank_slip_num=>${@bank_slip_num},
			              p_company_id=>${/session/@company_id},
			              p_internal_period_num=>${@internal_period_num},
			              p_period_name=>${@period_name},
			              p_payment_method_id=>${@payment_method_id},
			              p_distribution_set_id=>${@distribution_set_id},
			              p_cashflow_amount=>0,
			              p_currency_code=>${@currency_code},
			              p_transaction_amount=>0,
			              p_exchange_rate_type=>${@exchange_rate_type},
			              p_exchange_rate_quotation=>${@exchange_rate_quotation},
			              p_exchange_rate=>${@exchange_rate},
			              p_bank_account_id=>${@bank_account_id},
			              p_bp_category=>${@bp_category},
			              p_bp_id=>${@bp_id},
			              p_bp_bank_account_id=>${@bp_bank_account_id},
			              p_bp_bank_account_num=>${@bp_bank_account_num},
			              p_description=>${@description},
			              p_handling_charge=>${@handling_charge},
			              p_posted_flag=>nvl(${@posted_flag},'N'),
			              p_reversed_flag=>nvl(${@reversed_flag},'N'),
			              p_reversed_date=>to_date(${@reversed_date},'yyyy-mm-dd 24hh:mi:ss'),
			              p_returned_flag=>nvl(${@returned_flag},'NOT'),
			              p_returned_amount=>${@returned_amount},
			              p_write_off_flag=>nvl(${@write_off_flag},'NOT'),
			              p_write_off_amount=>0,
			              p_full_write_off_date=>to_date(${@full_write_off_date},'yyyy-mm-dd 24hh:mi:ss'),
			              p_twin_csh_trx_id=>${@twin_csh_trx_id},
			              p_return_from_csh_trx_id=>${@return_from_csh_trx_id},
			              p_reversed_csh_trx_id=>${@reversed_csh_trx_id},
			              p_source_csh_trx_type=>${@source_csh_trx_type},
			              p_source_csh_trx_id=>${@source_csh_trx_id},
			              p_source_doc_category=>${@source_doc_category},
			              p_source_doc_type=>${@source_doc_type},
			              p_source_doc_id=>${@source_doc_id},
			              p_source_doc_line_id=>${@source_doc_line_id},
			              p_create_je_mothed=>${@create_je_mothed},
			              p_create_je_flag=>nvl(${@create_je_flag},'N'),
			              p_gld_interface_flag=>nvl(${@gld_interface_flag},'N'),
			              p_user_id=>${/session/@user_id});
            	end;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
