<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
    <bm:fields>
        <bm:field name="period_name" datatype="java.lang.String" physicalName="PERIOD_NAME" prompt="CSH_TRANSACTION_HEADERS.PERIOD_NAME"/>
        <bm:field name="internal_period_num" datatype="java.lang.String"/>
        <bm:field name="period_num" datatype="java.lang.String"/>
        <bm:field name="period_year" datatype="java.lang.String"/>
        <bm:field name="period_set_code" datatype="java.lang.String"/>
    </bm:fields>
    <bm:operations>
        <bm:operation name="query">
            <bm:query-sql><![CDATA[
                SELECT
                    v.period_name,
                    gld_common_pkg.get_gld_internal_period_num(NVL(${@company_id},${/session/@company_id}),v.period_name) internal_period_num,
                    gld_common_pkg.get_gld_internal_period_num(NVL(${@company_id},${/session/@company_id}),v.period_name) period_num,
                    gld_common_pkg.get_period_year(NVL(${@company_id},${/session/@company_id}),v.period_name) period_year,
                    gld_common_pkg.get_period_set_code(NVL(${@company_id},${/session/@company_id})) period_set_code
                FROM
                    (SELECT
                        gld_common_pkg.get_gld_period_name(NVL(${@company_id},${/session/@company_id}),to_date(${@p_date},'yyyy-mm-dd')) period_name
                    FROM
                        dual
                    ) v
            ]]></bm:query-sql>
        </bm:operation>
    </bm:operations>
</bm:model>
