1 PACKAGE AHL_VWP_TIMES_PVT AUTHID CURRENT_USER AS
2 /* $Header: AHLVTMSS.pls 120.3.12020000.2 2012/12/07 15:24:05 sareepar ship $ */
3
4 -------------------------------------------------------------------
5 -- Procedure name : Calculate_Task_Times
6 -- Type : Private
7 -- Function : Derive the start and end times/hours of tasks
8 -- and the end_date_time of the visit
9 -- Parameters :
10 --
11 -- Standard OUT Parameters :
12 -- x_return_status OUT VARCHAR2 Required
13 -- x_msg_count OUT NUMBER Required
14 -- x_msg_data OUT VARCHAR2 Required
15 --
16 -- Derive_Visit_Task_Times Parameters:
17 -- p_visit_id IN NUMBER Required
18 -- The id of the visit whose associated tasks' start and end times or hours
19 -- need to be derived
20 -- Version :
21 -- Initial Version 1.0
22 --
23 -------------------------------------------------------------------
24 PROCEDURE Calculate_Task_Times
25 (
26 p_api_version IN NUMBER,
27 p_init_msg_list IN VARCHAR2 := Fnd_Api.G_FALSE,
28 p_commit IN VARCHAR2 := Fnd_Api.G_FALSE,
29 p_validation_level IN NUMBER := Fnd_Api.G_VALID_LEVEL_FULL,
30 x_return_status OUT NOCOPY VARCHAR2,
31 x_msg_count OUT NOCOPY NUMBER,
32 x_msg_data OUT NOCOPY VARCHAR2,
33 p_visit_id IN NUMBER);
34
35 -------------------------------------------------------------------
36 -- Procedure name : Calculate_Task_Times_For_Dept
37 -- Type : Private
38 -- Function : Recalculate all Visits for Dept for Task Times
39 -- Parameters :
40 --
41 -- Standard OUT Parameters :
42 -- x_return_status OUT VARCHAR2 Required
43 -- x_msg_count OUT NUMBER Required
44 -- x_msg_data OUT VARCHAR2 Required
45 --
46 -- Derive_Visit_Task_Times Parameters:
47 -- p_dept_id IN NUMBER Required
48 -- The dept id which need to have all its visits recalculated.
49 -- Need to be called from concurrent program due to performance issues.
50 --
51 -------------------------------------------------------------------
52 PROCEDURE Calculate_Task_Times_For_Dept
53 (
54 p_api_version IN NUMBER,
55 p_init_msg_list IN VARCHAR2 := Fnd_Api.G_FALSE,
56 p_commit IN VARCHAR2 := Fnd_Api.G_FALSE,
57 p_validation_level IN NUMBER := Fnd_Api.G_VALID_LEVEL_FULL,
58 x_return_status OUT NOCOPY VARCHAR2,
59 x_msg_count OUT NOCOPY NUMBER,
60 x_msg_data OUT NOCOPY VARCHAR2,
61 p_dept_id IN NUMBER);
62
63 --------------------------------------------------------------------
64 -- Procedure name : Adjust_task_times
65 -- Type : Private
66 -- Purpose : Adjusts tasks times and all dependent task times
67 -- Parameters :
68 --
69 -- Standard OUT Parameters :
70 -- x_return_status OUT VARCHAR2 Required,
71 --
72 -- Validate_bef_Times_Derive IN Parameters :
73 -- p_task_id IN NUMBER Required
74 --
75 -- Version :
76 -- Initial Version 1.0
77 --
78 --------------------------------------------------------------------
79 -- SKPATHAK :: Bug 8343599 :: 14-APR-2009
80 -- Added the optional in param p_task_start_date
81 PROCEDURE Adjust_Task_Times
82 (
83 p_api_version IN NUMBER,
84 p_init_msg_list IN VARCHAR2 := Fnd_Api.G_FALSE,
85 p_commit IN VARCHAR2 := Fnd_Api.G_FALSE,
86 p_validation_level IN NUMBER := Fnd_Api.G_VALID_LEVEL_FULL,
87 x_return_status OUT NOCOPY VARCHAR2,
88 x_msg_count OUT NOCOPY NUMBER,
89 x_msg_data OUT NOCOPY VARCHAR2,
90 p_task_id IN NUMBER,
91 p_reset_sysdate_flag IN VARCHAR2 := FND_API.G_FALSE,
92 p_task_start_date IN DATE := NULL);
93
94 --------------------------------------------------------------------
95 -- Function name : Get_Visit_Start_Time
96 -- Type : Public
97 -- Purpose : Fetches Master Work Order Actual Start Date if the
98 -- Visit is Closed, else returns the Visit Start Date.
99 -- Parameters :
100 -- p_visit_id Visit ID to fetch the data
101 --
102 --------------------------------------------------------------------
103 function Get_Visit_Start_Time(
104 p_visit_id IN NUMBER
105 )
106 RETURN DATE;
107
108 --------------------------------------------------------------------
109 -- Function name : Get_Visit_End_Time
110 -- Type : Public
111 -- Purpose : To RETURN the End Date for the visit.
112 -- For Unit Affectivity API it returns
113 -- Master Work Order Actual End Date when visit is Closed
114 -- and NVL(Visit Close Date,Max(Task End Times))
115 -- For VWP it returns
116 -- Max(Task End Times) when Visit is in Planning
117 -- Max(Max(WO Released Job Completion Date),Max(Task End Times))
118
119 -- Parameters :
120 -- p_visit_id Visit ID to fetch the data
121 -- p_use_actual This is a boolean value equal to FND_API.G_TRUE or FND_API.G_FALSE
122 --
123 --------------------------------------------------------------------
124 function Get_Visit_End_Time(
125 p_visit_id IN NUMBER,
126 p_use_actuals IN VARCHAR2 := FND_API.G_TRUE
127 )
128 RETURN DATE;
129
130 -----------------------------------------------------------
131 --Convert date+duration and department into end date/time
132 ---------------------------------------------------------
133 FUNCTION Compute_Date(
134 p_start_date date,
135 p_dept_id number,
136 p_duration number := 0)
137 RETURN DATE;
138
139 --------------------------------------------------------------------
140 -- Function name : Get_task_duration
141 -- Type : Public
142 -- Purpose : To return the total duration of the task
143 -- based on the resource requirements.
144 -- Parameters :
145 -- p_vst_task_qty : Visit task quantity
146 -- p_route_id : Route id
147 --
148 -- 06/Jul/2007 Initial Version Sowmya B6182718
149 --
150 -- For Internal use only. The function is used in visit task time
151 -- calculation.
152 --------------------------------------------------------------------
153
154 Function Get_task_duration(
155 p_vst_task_qty IN NUMBER,
156 p_route_id IN NUMBER
157 )
158 RETURN NUMBER;
159
160 -- PRAKKUM :: AVF :: Bug 13416865 - AVF ENHANCEMENTS
161 --------------------------------------------------------------------
162 -- Function name : Compute_Start_Date
163 -- Type : Public
164 -- Purpose : To return start date from the given end date, duration and dept. id.
165 -- Parameters :
166 -- p_end_date : End Date
167 -- p_dept_id : Department id
168 -- p_duration : Start Date
169 --
170 -- Initial Version PRAKKUM
171 --
172 -- For Internal use only.
173 --------------------------------------------------------------------
174
175 FUNCTION Compute_Start_Date(
176 p_end_date date,
177 p_dept_id number,
178 p_duration NUMBER :=0)
179 RETURN DATE;
180
181 END AHL_VWP_TIMES_PVT;