<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-4-15 上午10:04:05  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="HLS_PRICE_LIST" defaultOrderBy="enabled_flag desc,order_seq" needAccessControl="false">
    <bm:fields>
        <bm:field name="price_list" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="PRICE_LIST" prompt="HLS050.HLS_PRICE_LIST.PRICE_LIST"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="HLS050.HLS_PRICE_LIST.DESCRIPTION"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" defaultValue="${/session/@company_id}" physicalName="COMPANY_ID"/>
        <bm:field name="enabled_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="ENABLED_FLAG" prompt="HLS050.HLS_PRICE_LIST.ENABLED_FLAG"/>
        <bm:field name="authority_group" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="AUTHORITY_GROUP"/>
        <bm:field name="calc_method" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CALC_METHOD" prompt="HLS050.HLS_PRICE_LIST.CALC_METHOD"/>
        <bm:field name="calc_type" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CALC_TYPE" prompt="HLS050.HLS_PRICE_LIST.CALC_TYPE"/>
        <bm:field name="show_column_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SHOW_COLUMN_CODE" prompt="HLS050.HLS_PRICE_LIST.SHOW_COLUMN_CODE"/>
        <bm:field name="exhibition_price_list" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="EXHIBITION_PRICE_LIST"/>
        <bm:field name="exhibition_price_list_display" expression="(select  c.description  from hls_price_list c where c.calc_usage=&apos;CON_CHANGE&apos; and c.price_list = t1.exhibition_price_list)" forInsert="false" forUpdate="false" prompt="HLS050.HLS_PRICE_LIST.AUTHORITY_GROUP"/>
        <bm:field name="authority_group_display" expression="(select g.description from aut_authority_group g where g.authority_group=t1.authority_group)" forInsert="false" forUpdate="false" prompt="HLS050.HLS_PRICE_LIST.AUTHORITY_GROUP"/>
        <bm:field name="company_name" expression="(select c.COMPANY_SHORT_NAME from fnd_companies_vl c where c.COMPANY_ID=${/session/@company_id})" forInsert="false" forUpdate="false" prompt="HLS.COMPANY_NAME"/>
        <bm:field name="calc_method_display" expression="(select m.description from hls_fin_calc_method m where m.calc_method=t1.calc_method)" forInsert="false" forUpdate="false" prompt="HLS050.HLS_PRICE_LIST.CALC_METHOD"/>
        <bm:field name="calc_type_display" expression="(select t.description from hls_fin_calc_type t where t.calc_type=t1.calc_type)" forInsert="false" forUpdate="false" prompt="HLS050.HLS_PRICE_LIST.CALC_TYPE"/>
        <bm:field name="show_box" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SHOW_BOX" prompt="HLS050.HLS_PRICE_LIST.SHOW_BOX"/>
        <bm:field name="column_count" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COLUMN_COUNT" prompt="HLS050.HLS_PRICE_LIST.COLUMN_COUNT"/>
        <bm:field name="label_width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="LABEL_WIDTH" prompt="HLS050.HLS_PRICE_LIST.LABEL_WIDTH"/>
        <bm:field name="field_width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FIELD_WIDTH" prompt="HLS050.HLS_PRICE_LIST.FIELD_WIDTH"/>
        <bm:field name="box_width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BOX_WIDTH" prompt="HLS050.HLS_PRICE_LIST.BOX_WIDTH"/>
        <bm:field name="margin_top" databaseType="NUMBER" datatype="java.lang.Long" physicalName="MARGIN_TOP" prompt="HLS050.HLS_PRICE_LIST.MARGIN_TOP"/>
        <bm:field name="order_seq" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ORDER_SEQ" prompt="HLS.ORDER_SEQ"/>
        <bm:field name="calc_usage"/>
        <bm:field name="calc_usage_desc" expression="(select sc.code_value_name from sys_code_values_v sc where sc.code=&apos;HLS050_CALC_USAGE&apos; and sc.code_value=nvl(t1.calc_usage,&apos;NORMAL&apos;))" forInsert="false" forUpdate="false"/>
        <bm:field name="ref_v04" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V04" prompt="HLS050.HLS_PRICE_LIST.REF_V04"/>
        <bm:field name="ref_v05" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="REF_V05" prompt="HLS050.HLS_PRICE_LIST.REF_V05"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
    			begin
				 sys_load_hls_price_list_pkg.copy(p_price_list 			=> ${@price_list},
				                                  p_new_price_list 		=> ${@new_price_list},
				                                  p_new_price_list_desc => ${@new_price_list_desc},
				                                  p_user_id 			=> ${/session/@user_id});
				end;
    		]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="price_list"/>
    </bm:primary-key>
    <!-- <bm:data-filters>
        <bm:data-filter name="company_id" enforceOperations="query" expression="exists (select 1           from hls_price_list_assign t          where t.price_list = t1.price_list            and t.company_id = ${/session/@company_id})"/>
    </bm:data-filters> -->
</bm:model>
