<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-3-13 下午05:30:50  
    $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
                    sysdate now_time,
                    to_date('3000-01-01','yyyy-mm-dd') never_date,
                    gld_common_pkg.get_gld_period_name(${/session/@company_id},sysdate) now_period_name,
                    gld_common_pkg.get_gld_internal_period_num(${/session/@company_id},gld_common_pkg.get_gld_period_name(${/session/@company_id},sysdate)) now_internal_period_num,
                    CASE
                        WHEN ${/session/@enable_user_authority}='Y' AND
                            ${/session/@owner_user_aut_flag}   ='Y' AND
                            (SELECT
                                    check_authority
                                FROM
                                    aut_company_authority_setup
                                WHERE
                                    company_id      = ${/session/@top_biz_company_id} AND
                                    authority_usage = NVL(${@document_category},${@master_type})
                            )
                            ='Y'
                        THEN 'Y'
                        ELSE ''
                    END authority_flag,
                   (select su.bp_category from sys_user su where su.user_id = ${/session/@user_id})  user_category
                FROM
                    dual
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="now_time" databaseType="DATE" datatype="java.util.Date" physicalName="NOW_TIME"/>
        <bm:field name="never_date" databaseType="DATE" datatype="java.util.Date" physicalName="NEVER_DATE"/>
        <bm:field name="now_period_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="NOW_PERIOD_NAME"/>
        <bm:field name="now_internal_period_num" databaseType="NUMBER" datatype="java.lang.Long" physicalName="NOW_INTERNAL_PERIOD_NUM"/>
        <bm:field name="authority_flag" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="AUTHORITY_FLAG"/>
        <bm:field name="user_category" databaseType="VARCHAR2" datatype="java.lang.String"/>
    </bm:fields>
</bm:model>
