<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-5-7 下午07:36:31  
    $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[
			   declare
                v_int_rate_display prj_quotation.int_rate_display%type;
                begin
				 select decode(${@hd_user_col_v06},'Y',${@int_rate_display},null) into
            	   v_int_rate_display from dual;
            	prj_quotation_pkg.insert_prj_quotation(
            		      p_quotation_id=>${@quotation_id},
			              p_document_category=>${@document_category},
			              p_document_id=>${@document_id},
			              p_calc_session_id=>${@calc_session_id},
			              p_quotation_date=>to_date(${@quotation_date},'yyyy-mm-dd hh24:mi:ss'),
			              p_quotation_type=>${@quotation_type},
			              p_version=>${@version},
			              p_text=>${@text},
			              p_contract_seq=>${@contract_seq},
			              p_internal_confirm=>${@internal_confirm},
			              p_external_confirm=>${@external_confirm},
			              p_enabled_flag=>${@enabled_flag},
			              p_company_id=>${/session/@company_id},
			              p_create_contract_flag=>${@create_contract_flag},
			              p_currency_precision=>${@currency_precision},
			              p_finance_amount=>${@finance_amount},
			              p_currency=>${@currency},
			              p_lease_start_date=>to_date(${@lease_start_date},'yyyy-mm-dd hh24:mi:ss'),
			              p_price_list=>${@price_list},
			              p_lease_times=>${@lease_times},
			              p_annual_pay_times=>${@annual_pay_times},
			              p_down_payment=>${@down_payment},
			              p_business_type=>${@business_type},
			              p_user_id=>${/session/@user_id},
			              p_ref_v01=>${@ref_v01},
			              p_ref_v02=>${@ref_v02},
			              p_ref_v03=>${@ref_v03},
			              p_ref_v04=>${@ref_v04},
			              p_ref_v05=>${@ref_v05},
			              p_ref_n01=>${@ref_n01},
			              p_ref_n02=>${@ref_n02},
			              p_ref_n03=>${@ref_n03},
			              p_ref_n04=>${@ref_n04},
			              p_ref_n05=>${@ref_n05},
			              p_ref_d01=>to_date(${@ref_d01},'yyyy-mm-dd hh24:mi:ss'),
			              p_ref_d02=>to_date(${@ref_d02},'yyyy-mm-dd hh24:mi:ss'),
			              p_ref_d03=>to_date(${@ref_d03},'yyyy-mm-dd hh24:mi:ss'),
			              p_ref_d04=>to_date(${@ref_d04},'yyyy-mm-dd hh24:mi:ss'),
			              p_ref_d05=>to_date(${@ref_d05},'yyyy-mm-dd hh24:mi:ss'),
						  p_int_rate_display=>v_int_rate_display,
			              p_btb_int_rate=>${@btb_int_rate},
			              p_hd_user_col_v06=>${@hd_user_col_v06}
);
            	end;
    		]]></bm:update-sql>
            <bm:parameters>
                <bm:parameter name="quotation_id" dataType="java.lang.Long" input="false" inputPath="@quotation_id" output="true" outputPath="/parameter/@quotation_id"/>
                <bm:parameter name="calc_session_id" dataType="java.lang.Long" input="true" inputPath="@calc_session_id" output="true" outputPath="@to_doc_pk"/>
            </bm:parameters>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
			    declare
                 v_int_rate_display prj_quotation.int_rate_display%type;
            	begin
				 select decode(${@hd_user_col_v06},'Y',${@int_rate_display},null) into
            	   v_int_rate_display from dual;
        		prj_quotation_pkg.update_prj_quotation(
            		      p_quotation_id=>${@quotation_id},
			              p_document_category=>${@document_category},
			              p_document_id=>${@document_id},
			              p_calc_session_id=>${@calc_session_id},
			              p_quotation_date=>to_date(${@quotation_date},'yyyy-mm-dd hh24:mi:ss'),
			              p_quotation_type=>${@quotation_type},
			              p_version=>${@version},
			              p_text=>${@text},
			              p_contract_seq=>${@contract_seq},
			              p_internal_confirm=>${@internal_confirm},
			              p_external_confirm=>${@external_confirm},
			              p_enabled_flag=>${@enabled_flag},
			              p_company_id=>${/session/@company_id},
			              p_create_contract_flag=>${@create_contract_flag},
			              p_currency_precision=>${@currency_precision},
			              p_finance_amount=>${@finance_amount},
			              p_currency=>${@currency},
			              p_lease_start_date=>to_date(${@lease_start_date},'yyyy-mm-dd hh24:mi:ss'),
			              p_price_list=>${@price_list},
			              p_lease_times=>${@lease_times},
			              p_annual_pay_times=>${@annual_pay_times},
			              p_down_payment=>${@down_payment},
			              p_business_type=>${@business_type},
			              p_user_id=>${/session/@user_id},
			              p_ref_v01=>${@ref_v01},
			              p_ref_v02=>${@ref_v02},
			              p_ref_v03=>${@ref_v03},
			              p_ref_v04=>${@ref_v04},
			              p_ref_v05=>${@ref_v05},
			              p_ref_n01=>${@ref_n01},
			              p_ref_n02=>${@ref_n02},
			              p_ref_n03=>${@ref_n03},
			              p_ref_n04=>${@ref_n04},
			              p_ref_n05=>${@ref_n05},
			              p_ref_d01=>to_date(${@ref_d01},'yyyy-mm-dd hh24:mi:ss'),
			              p_ref_d02=>to_date(${@ref_d02},'yyyy-mm-dd hh24:mi:ss'),
			              p_ref_d03=>to_date(${@ref_d03},'yyyy-mm-dd hh24:mi:ss'),
			              p_ref_d04=>to_date(${@ref_d04},'yyyy-mm-dd hh24:mi:ss'),
			              p_ref_d05=>to_date(${@ref_d05},'yyyy-mm-dd hh24:mi:ss'),
						  p_int_rate_display=>v_int_rate_display,
						  p_btb_int_rate=>${@btb_int_rate},
						  p_hd_user_col_v06=>${@hd_user_col_v06}

);
            	end;
    		]]></bm:update-sql>
            <bm:parameters>
                <bm:parameter name="calc_session_id" dataType="java.lang.Long" input="true" inputPath="@calc_session_id" output="true" outputPath="@to_doc_pk"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
</bm:model>
