<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: xuls  
    $Date: 2014-9-23 下午04:23:02  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
            	begin
            		csh_write_off_pkg.execute_csh_write_off_temp(
            			  p_session_id=>${/session/@session_id},
			              p_write_off_type=>${@write_off_type},
			              p_transaction_category=>${@transaction_category},
			              p_transaction_type=>${@transaction_type},
			              p_write_off_date=>to_date(${@transaction_date},'yyyy-mm-dd hh24:mi:ss'),
			              p_write_off_due_amount=>${@total_inflow_amount},
			              p_write_off_principal=>null,
			              p_write_off_interest=>null,
			              p_write_off_penalty=>null,
			              p_write_off_due_amount_cny =>${@total_inflow_amount},
                          p_write_off_principal_cny=>null,
                          p_write_off_interest_cny=>null,
                          p_exchange_rate=>1,
			              p_company_id=>${/session/@company_id},
			              p_document_category=>${@document_category},
			              p_document_id=>${@contract_id},
			              p_document_line_id=>${@cashflow_id},
			              p_penalty_cashflow_id=>null,
			              p_description=>${@transaction_description},
			              p_user_id=>${/session/@user_id}
            		);
            	end;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
            	begin
            		csh_write_off_pkg.execute_csh_write_off_temp(
            			  p_session_id=>${/session/@session_id},
			              p_write_off_type=>${@write_off_type},
			              p_transaction_category=>${@transaction_category},
			              p_transaction_type=>${@transaction_type},
			              p_write_off_date=>to_date(${../../@transaction_date},'yyyy-mm-dd hh24:mi:ss'),
			              p_write_off_due_amount=>${@transaction_amount},
			              p_write_off_principal=>${@transaction_principal},
			              p_write_off_interest=>${@transaction_interest},
			              p_write_off_penalty=>${@penalty},
			              p_write_off_due_amount_cny =>${@transaction_amount},
                          p_write_off_principal_cny=>${@transaction_principal},
                          p_write_off_interest_cny=>${@transaction_interest},
                          p_exchange_rate=>1,
			              p_company_id=>${/session/@company_id},
			              p_document_category=>${@document_category},
			              p_document_id=>${@contract_id},
			              p_document_line_id=>${@cashflow_id},
			              p_penalty_cashflow_id=>${@penalty_cashflow_id},
			              p_description=>${@description},
			              p_user_id=>${/session/@user_id}
            		);
            	end;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
