<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-4-23 上午9:29:27  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:f="leaf.database.features" xmlns:bm="http://www.leaf-framework.org/schema/bm" alias="t1" baseTable="PRJ_PROJECT">
    <bm:fields>
        <bm:field name="project_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PROJECT_ID"/>
        <bm:field name="project_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NAME" prompt="PRJ501.PRJ_PROJECT.PROJECT_NAME"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID"/>
        <bm:field name="bp_name" forInsert="false" forUpdate="false" prompt="PRJ501.PRJ_PROJECT.BP_NAME"/>
        <bm:field name="lease_chance_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LEASE_CHANCE_ID"/>
        <bm:field name="lease_chance_code" forInsert="false" forUpdate="false" prompt="HLS.LEASE_CHANCE_CODE"/>
        <bm:field name="status" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="STATUS"/>
        <bm:field name="status_desc" forInsert="false" forUpdate="false" prompt="PRJ501.PRJ_PROJECT.STATUS"/>
        <bm:field name="project_number" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PROJECT_NUMBER" prompt="PRJ501.PRJ_PROJECT.PROJECT_NO"/>
        <bm:field name="document_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_TYPE"/>
        <bm:field name="document_type_desc" forInsert="false" forUpdate="false" prompt="PRJ501.PRJ_PROJECT.DOCUMENT_TYPE"/>
        <bm:field name="business_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BUSINESS_TYPE"/>
        <bm:field name="document_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DOCUMENT_CATEGORY"/>
        <bm:field name="lease_organization" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_ORGANIZATION" prompt="HLS.LEASE_ORGANIZATION_CODE"/>
        <bm:field name="lease_organization_desc" forInsert="false" forUpdate="false" prompt="HLS.LEASE_ORGANIZATION_NAME"/>
        <bm:field name="lease_channel" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="LEASE_CHANNEL" prompt="HLS.LEASE_CHANNEL_CODE"/>
        <bm:field name="lease_channel_desc" forInsert="false" forUpdate="false" prompt="HLS.LEASE_CHANNEL_NAME"/>
        <bm:field name="division" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DIVISION" prompt="HLS.DIVISION"/>
        <bm:field name="division_desc" forInsert="false" forUpdate="false" prompt="HLS.DIVISION_NAME"/>
        <bm:field name="owner_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OWNER_USER_ID"/>
        <bm:field name="unit_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="UNIT_ID"/>
        <bm:field name="unit_name" forInsert="false" forUpdate="false" prompt="HLS.UNIT_NAME"/>
        <bm:field name="employee_id_of_manager" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EMPLOYEE_ID_OF_MANAGER"/>
        <bm:field name="employee_name_of_manager" forInsert="false" forUpdate="false" prompt="PRJ501.PRJ_PROJECT.EMPLOYEE_NAME_OF_MANAGER"/>
        <bm:field name="employee_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="EMPLOYEE_ID"/>
        <bm:field name="employee_name" forInsert="false" forUpdate="false" prompt="PRJ501.PRJ_PROJECT.EMPLOYEE_NAME"/>
        <bm:field name="financed_amount" databaseType="NUMBER" datatype="java.lang.Double" physicalName="FINANCED_AMOUNT" prompt="PRJ501.PRJ_PROJECT.FINANCED_AMOUNT"/>
        <bm:field name="financing_purpose" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FINANCING_PURPOSE" prompt="PRJ501.PRJ_PROJECT.FINANCING_PURPOSE"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="PRJ501.PRJ_PROJECT.DESCRIPTION"/>
        <bm:field name="ref_v01" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V01" prompt="PRJ501.PRJ_PROJECT.REF_V01"/>
        <bm:field name="ref_v02" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V02" prompt="PRJ501.PRJ_PROJECT.REF_V02"/>
        <bm:field name="ref_v03" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V03" prompt="PRJ501.PRJ_PROJECT.REF_V03"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="PRJ501.PRJ_PROJECT.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="PRJ501.PRJ_PROJECT.REF_V05"/>
        <bm:field name="ref_n01" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N01" prompt="PRJ501.PRJ_PROJECT.REF_N01"/>
        <bm:field name="ref_n02" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N02" prompt="PRJ501.PRJ_PROJECT.REF_N02"/>
        <bm:field name="ref_n03" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N03" prompt="PRJ501.PRJ_PROJECT.REF_N03"/>
        <bm:field name="ref_n04" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N04" prompt="PRJ501.PRJ_PROJECT.REF_N04"/>
        <bm:field name="ref_n05" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REF_N05" prompt="PRJ501.PRJ_PROJECT.REF_N05"/>
        <bm:field name="ref_d01" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D01" prompt="PRJ501.PRJ_PROJECT.REF_D01"/>
        <bm:field name="ref_d02" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D02" prompt="PRJ501.PRJ_PROJECT.REF_D02"/>
        <bm:field name="ref_d03" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D03" prompt="PRJ501.PRJ_PROJECT.REF_D03"/>
        <bm:field name="ref_d04" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D04" prompt="PRJ501.PRJ_PROJECT.REF_D04"/>
        <bm:field name="ref_d05" databaseType="DATE" datatype="java.util.Date" physicalName="REF_D05" prompt="PRJ501.PRJ_PROJECT.REF_D05"/>
    </bm:fields>
    <bm:query-fields>
        <bm:query-field field="project_id" queryOperator="="/>
        <bm:query-field field="employee_id" queryOperator="="/>
        <bm:query-field field="unit_id" queryOperator="="/>
        <bm:query-field field="project_number" queryOperator="like"/>
    </bm:query-fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    			select t1.project_id,
				       t1.project_name,
				       t1.bp_name,
				       t1.company_id,
				       t1.lease_chance_id,
				       t1.lease_chance_code,
				       t1.status,
				       t1.status_desc,
				       t1.project_number,
				       t1.document_type,
				       t1.document_type_desc,
				       t1.business_type,
				       t1.document_category,
				       t1.lease_organization,
				       t1.lease_organization_desc,
				       t1.lease_channel,
				       t1.lease_channel_desc,
				       t1.division,
				       t1.division_desc,
				       t1.owner_user_id,
				       t1.employee_id_of_manager,
				       t1.employee_name_of_manager,
				       t1.unit_id,
				       t1.unit_name,
				       t1.employee_id,
				       t1.employee_name,
				       t1.finance_amount,
				       t1.financing_purpose,
				       t1.description,
				       t1.ref_v01,
				       t1.ref_v02,
				       t1.ref_v03,
				       t1.ref_v04,
				       t1.ref_v05,
				       t1.ref_n01,
				       t1.ref_n02,
				       t1.ref_n03,
				       t1.ref_n04,
				       t1.ref_n05,
				       t1.ref_d01,
				       t1.ref_d02,
				       t1.ref_d03,
				       t1.ref_d04,
				       t1.ref_d05
				  from prj_project_v t1
    			#WHERE_CLAUSE#
    			 order by t1.project_number
    		]]></bm:query-sql>
        </bm:operation>
        <bm:operation name="insert">
            <bm:parameters>
                <bm:parameter name="project_id" input="false" output="true" outputPath="@project_id"/>
                <bm:parameter name="project_no" input="true" inputPath="@project_no" output="true" outputPath="@project_no"/>
            </bm:parameters>
            <bm:update-sql><![CDATA[
	        	begin
				   PRJ501_PROJECT_SAVE_PKG.project_manage(p_sql_type		   	   => 'INSERT',
											  			  p_project_id             => ${@project_id},
											              p_project_name           => ${@project_name},
											              p_company_id             => ${/session/@company_id},
											              p_lease_chance_id        => ${@lease_chance_id},
											              p_status                 => ${@status},
											              p_project_no             => ${@project_no},
											              p_document_type          => ${@document_type},
											              p_document_category      => ${@document_category},
											              p_business_type          => ${@business_type},
											              p_lease_organization     => ${@lease_organization},
											              p_lease_channel          => ${@lease_channel},
											              p_division               => ${@division},
											              p_employee_id            => ${@employee_id},
											              p_owner_user_id          => ${/session/@user_id},
											              p_unit_id                => ${@unit_id},
											              p_employee_id_of_manager => ${@employee_id_of_manager},
											              p_financed_amount		   => ${@financed_amount},
											              p_financing_purpose      => ${@financing_purpose},
											              p_description            => ${@description},
											              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'),
											              p_ref_d02                => to_date(${@ref_d02},'yyyy-mm-dd'),
											              p_ref_d03                => to_date(${@ref_d03},'yyyy-mm-dd'),
											              p_ref_d04                => to_date(${@ref_d04},'yyyy-mm-dd'),
											              p_ref_d05                => to_date(${@ref_d05},'yyyy-mm-dd'));
				end;
			]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="update">
            <bm:update-sql><![CDATA[
	        	begin
				   PRJ501_PROJECT_SAVE_PKG.project_manage(p_sql_type		   	   => 'UPDATE',
											  			  p_project_id             => ${@project_id},
											              p_project_name           => ${@project_name},
											              p_company_id             => ${/session/@company_id},
											              p_lease_chance_id        => ${@lease_chance_id},
											              p_status                 => ${@status},
											              p_project_no             => ${@project_no},
											              p_document_type          => ${@document_type},
											              p_document_category      => ${@document_category},
											              p_business_type          => ${@business_type},
											              p_lease_organization     => ${@lease_organization},
											              p_lease_channel          => ${@lease_channel},
											              p_division               => ${@division},
											              p_employee_id            => ${@employee_id},
											              p_owner_user_id          => ${/session/@user_id},
											              p_unit_id                => ${@unit_id},
											              p_employee_id_of_manager => ${@employee_id_of_manager},
											              p_financed_amount		   => ${@financed_amount},
											              p_financing_purpose      => ${@financing_purpose},
											              p_description            => ${@description},
											              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'),
											              p_ref_d02                => to_date(${@ref_d02},'yyyy-mm-dd'),
											              p_ref_d03                => to_date(${@ref_d03},'yyyy-mm-dd'),
											              p_ref_d04                => to_date(${@ref_d04},'yyyy-mm-dd'),
											              p_ref_d05                => to_date(${@ref_d05},'yyyy-mm-dd'));
				end;
			]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
	        	begin
				   PRJ501_PROJECT_SAVE_PKG.project_manage(p_sql_type		   	   => 'DELETE',
											  			  p_project_id             => ${@project_id},
											              p_project_name           => ${@project_name},
											              p_company_id             => ${/session/@company_id},
											              p_lease_chance_id        => ${@lease_chance_id},
											              p_status                 => ${@status},
											              p_project_no             => ${@project_no},
											              p_document_type          => ${@document_type},
											              p_document_category      => ${@document_category},
											              p_business_type          => ${@business_type},
											              p_lease_organization     => ${@lease_organization},
											              p_lease_channel          => ${@lease_channel},
											              p_division               => ${@division},
											              p_employee_id            => ${@employee_id},
											              p_owner_user_id          => ${/session/@user_id},
											              p_unit_id                => ${@unit_id},
											              p_employee_id_of_manager => ${@employee_id_of_manager},
											              p_financed_amount		   => ${@financed_amount},
											              p_financing_purpose      => ${@financing_purpose},
											              p_description            => ${@description},
											              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'),
											              p_ref_d02                => to_date(${@ref_d02},'yyyy-mm-dd'),
											              p_ref_d03                => to_date(${@ref_d03},'yyyy-mm-dd'),
											              p_ref_d04                => to_date(${@ref_d04},'yyyy-mm-dd'),
											              p_ref_d05                => to_date(${@ref_d05},'yyyy-mm-dd'));
				end;
			]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="project_id"/>
    </bm:primary-key>
</bm:model>