<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: chenlingfeng  
    $Date: 2017-10-24 上午10:20:12  
    $Revision: 1.0  
    $Purpose: 假期定义申请
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="HN_CALENDAR_RULES_REQ">
    <bm:operations>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
                BEGIN
                    -- Call the procedure
                    hn_calendar_rules_req_pkg.hn_calendar_rules_req_save( p_request_id => ${@request_id}, p_calendar_id => ${@calendar_id}, p_description => ${@description}, p_user_id => ${/session/@user_id}, p_company_id => ${/session/@company_id} );
                END;
            ]]></bm:update-sql>
            <bm:parameters>
                <bm:parameter name="request_id" output="true" outputPath="@request_id"/>
            </bm:parameters>
        </bm:operation>
        <bm:operation name="delete">
            <bm:update-sql><![CDATA[
       BEGIN
        
  -- Call the procedure
  hn_calendar_rules_req_pkg.hn_calendar_rules_req_delete(p_request_id => ${@request_id},
                                            p_user_id =>  ${/session/@user_id});

       END;
   ]]></bm:update-sql>
        </bm:operation>
        <bm:operation name="execute">
            <bm:update-sql><![CDATA[
       BEGIN
 
  -- Call the procedure
  hn_calendar_rules_req_pkg.submit_workflow(p_request_id => ${@request_id},
                                            p_user_id =>  ${/session/@user_id});

       END;
   ]]></bm:update-sql>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="request_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="REQUEST_ID" prompt="HN_CALENDAR_RULES_REQ.REQUEST_ID"/>
        <bm:field name="calendar_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="CALENDAR_ID" prompt="HN_CALENDAR_RULES_REQ.CALENDAR_ID"/>
        <bm:field name="calendar_id_n" expression="(select v.description from  fnd_calendar_vl v where v.calendar_id = t1.calendar_id)"/>
        <bm:field name="request_date" databaseType="DATE" datatype="java.util.Date" physicalName="REQUEST_DATE" prompt="HN_CALENDAR_RULES_REQ.REQUEST_DATE"/>
        <bm:field name="approval_date" databaseType="DATE" datatype="java.util.Date" physicalName="APPROVAL_DATE" prompt="HN_CALENDAR_RULES_REQ.APPROVAL_DATE"/>
        <bm:field name="wfl_status" databaseType="VARCHAR2" datatype="java.lang.String" lookupCode="HN_CALENDAR_RULES_REQ_STATUS" lookupField="wfl_status_n" physicalName="WFL_STATUS" prompt="HN_CALENDAR_RULES_REQ.WFL_STAUTS"/>
        <bm:field name="description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="DESCRIPTION" prompt="HN_CALENDAR_RULES_REQ.DESCRIPTION"/>
        <bm:field name="owner_user_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="OWNER_USER_ID" prompt="HN_CALENDAR_RULES_REQ.OWNER_USER_ID"/>
        <bm:field name="owner_user_id_n" expression="(select su.description from sys_user su where su.user_id = t1.owner_user_id)"/>
        <bm:field name="company_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="COMPANY_ID" prompt="HN_CALENDAR_RULES_REQ.COMPANY_ID"/>
        <bm:field name="wfl_instance_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="WFL_INSTANCE_ID" prompt="HN_CALENDAR_RULES_REQ.WFL_INSTANCE_ID"/>
        <bm:field name="wfl_status_n" forInsert="false" forUpdate="false"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="request_id"/>
    </bm:primary-key>
</bm:model>
