<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: wangwei  
    $Date: 2015-11-6 下午1:29:08  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[  SELECT t1.*
               FROM ( SELECT q.*,
  (select a.description from hls_price_list a where a.price_list=q.price_list) price_list_n,
  (select gc.currency_name from gld_currency_v gc where gc.currency_code=q.currency ) currency_n,
  (select sc.code_value_name from sys_code_values_v sc where sc.code='HLS500_ANNUAL_PAY_TIMES' 
  and sc.code_enabled_flag='Y'
  and sc.code_value_enabled_flag='Y'
  and sc.code_value=q.annual_pay_times ) annual_pay_times_n
          FROM prj_quotation q
         WHERE q.document_id = ${@project_id}
           AND q.document_category = 'PROJECT') t1 #WHERE_CLAUSE#
    ]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
                BEGIN
  sdic_prj_project_pkg.submit_quotation(p_project_id   =>${@project_id},
                                        p_quotation_id =>${@quotation_id},
                                        p_user_id      =>${/session/@user_id});
                 END;

            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
        begin
             sdic_prj_project_pkg.update_con_bank_id(p_quotation_id=>${@quotation_id} );
        end;
        ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
           begin
            sdic_prj_project_pkg.update_con_contract_number(
            P_QUOTATION_ID           =>${@quotation_id} ,
            P_UPDATE_CONTRACT_NUMBER =>${@update_contract_number} ,
            p_user_id                =>${/session/@user_id} );
          end;
            ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
           begin
            hn_prj_project_pkg.delete_prj_con_quotation(p_project_id=>${@project_id},
            P_QUOTATION_ID           =>${@quotation_id} ,
            p_user_id                =>${/session/@user_id} );
          end;
            ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="quotation_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="QUOTATION_ID" required="true"/>
        <bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY" required="true"/>
        <bm:field name="document_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DOCUMENT_ID" required="true"/>
        <bm:field name="calc_session_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CALC_SESSION_ID"/>
        <bm:field name="business_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE"/>
        <bm:field name="quotation_date" databaseType="DATE" datatype="java.util.Date" physicalName="QUOTATION_DATE"/>
        <bm:field name="quotation_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="QUOTATION_TYPE"/>
        <bm:field name="version" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="VERSION"/>
        <bm:field name="text" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TEXT"/>
        <bm:field name="contract_seq" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CONTRACT_SEQ"/>
        <bm:field name="create_contract_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CREATE_CONTRACT_FLAG"/>
        <bm:field name="internal_confirm" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INTERNAL_CONFIRM"/>
        <bm:field name="external_confirm" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXTERNAL_CONFIRM"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"/>
        <bm:field name="finance_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FINANCE_AMOUNT"/>
        <bm:field name="currency" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CURRENCY"/>
        <bm:field name="currency_precision" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CURRENCY_PRECISION"/>
        <bm:field name="lease_start_date" databaseType="DATE" datatype="java.util.Date" physicalName="LEASE_START_DATE"/>
        <bm:field name="price_list" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRICE_LIST"/>
        <bm:field name="lease_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_TIMES"/>
        <bm:field name="annual_pay_times" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ANNUAL_PAY_TIMES"/>
        <bm:field name="down_payment" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DOWN_PAYMENT"/>
        <bm:field name="created_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CREATED_BY"/>
        <bm:field name="creation_date" databaseType="DATE" datatype="java.util.Date" physicalName="CREATION_DATE"/>
        <bm:field name="last_updated_by" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LAST_UPDATED_BY"/>
        <bm:field name="last_update_date" databaseType="DATE" datatype="java.util.Date" physicalName="LAST_UPDATE_DATE"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N05"/>
        <bm:field name="ref_d01" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D01"/>
        <bm:field name="ref_d02" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D02"/>
        <bm:field name="ref_d03" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D03"/>
        <bm:field name="ref_d04" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D04"/>
        <bm:field name="ref_d05" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D05"/>
        <bm:field name="rent_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="RENT_TYPE"/>
        <bm:field name="rent_date" databaseType="DATE" datatype="java.util.Date" physicalName="RENT_DATE"/>
        <bm:field name="lease_item_amount" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_ITEM_AMOUNT"/>
        <bm:field name="rent_day" databaseType="NUMBER" datatype="java.lang.Long" physicalName="RENT_DAY"/>
        <bm:field name="insurance_fee" databaseType="NUMBER" datatype="java.lang.Long" physicalName="INSURANCE_FEE"/>
        <bm:field name="bp_id_insure" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID_INSURE"/>
        <bm:field name="insure_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="INSURE_TYPE"/>
        <bm:field name="main_contract_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="MAIN_CONTRACT_FLAG"/>
        <bm:field name="currency_n"/>
        <bm:field name="price_list_n"/>
        <bm:field name="annual_pay_times_n"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field name="main_contract_flag" queryExpression="nvl(t1.main_contract_flag,&apos;N&apos;)=${@main_contract_flag}"/>
    </bm:query-fields>
</bm:model>
