<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-4-13 下午03:08:40  
    $Revision: 1.0  
    $Purpose: session中的信息
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
        <bm:field name="today" datatype="java.util.Date"/>
        <bm:field name="current_year" datatype="java.lang.Long"/>
        <bm:field name="current_month" datatype="java.lang.Long"/>
        <bm:field name="current_day" datatype="java.lang.Long"/>
        <bm:field name="never_date" datatype="java.util.Date"/>
        <bm:field name="company_id" datatype="java.lang.Long"/>
        <bm:field name="company_code" datatype="java.lang.String"/>
        <bm:field name="company_short_name" datatype="java.lang.String"/>
        <bm:field name="company_full_name" datatype="java.lang.String"/>
        <bm:field name="role_id" datatype="java.lang.Long"/>
        <bm:field name="role_name" datatype="java.lang.String"/>
        <bm:field name="role_code" datatype="java.lang.String"/>
        <bm:field name="country_id" datatype="java.lang.Long"/>
        <bm:field name="country_name" datatype="java.lang.String"/>
        <bm:field name="lease_channel" datatype="java.lang.String"/>
        <bm:field name="lease_channel_desc" datatype="java.lang.String"/>
        <bm:field name="division" datatype="java.lang.String"/>
        <bm:field name="division_desc" datatype="java.lang.String"/>
        <bm:field name="lease_organization" datatype="java.lang.String"/>
        <bm:field name="lease_organization_desc" datatype="java.lang.String"/>
        <bm:field name="currency_code" datatype="java.lang.String"/>
        <bm:field name="currency_name" datatype="java.lang.String"/>
        <bm:field name="user_name" datatype="java.lang.String"/>
        <bm:field name="user_desc" datatype="java.lang.String"/>
        <bm:field name="bp_category" datatype="java.lang.String"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
    	        select to_char(sysdate, 'yyyy-mm-dd') as today,
    	        	   to_char(sysdate, 'yyyy') as current_year,
    	        	   to_number(to_char(sysdate, 'mm')) as current_month,
    	        	   to_number(to_char(sysdate, 'dd')) as current_day,
		               '3000-01-01' as never_date,
		               t1.company_id,
		               t1.company_code,
		               t1.company_short_name,
		               t1.company_full_name,
		               t2.role_id,
		               t2.role_name,
		               t2.role_code,
		               t3.country_id,
		               t3.description as country_name,
		               t4.lease_channel,
		               t4.description as lease_channel_desc,
		               t5.division,
		               t5.description as division_desc,
		               t6.lease_organization,
		               t6.description as lease_organization_desc,
		               t7.currency_code,
               		   t7.currency_name,
               		   t8.user_name,
               		   t8.description as user_desc,
                       t8.bp_category
		          from dual t
		          left join fnd_companies_vl t1
		            on t1.company_id = ${/session/@company_id}
		           and t1.enabled_flag = 'Y'
		          left join sys_role_vl t2
		            on t2.role_id = ${/session/@role_id}
		           and t2.enabled_flag = 'Y'
		          left join fnd_country t3
		            on t3.country_code = 'CHN'
		           and t3.enabled_flag='Y'
		            left join hls_lease_channel t4
		            on t4.lease_channel = ${/session/@lease_channel}
		           and t4.enabled_flag='Y'
		          left join hls_division t5
		            on t5.division = ${/session/@division}
		           and t5.enabled_flag='Y'
		          left join hls_lease_organization t6
		            on t6.lease_organization = ${/session/@lease_organization}
		           and t6.enabled_flag='Y'
		          left join gld_currency_vl t7
		            on t7.currency_code='CNY'
		           and t7.enabled_flag='Y'
		          left join sys_user t8
		            on t8.user_id = ${/session/@user_id}
    		]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>