1 Package per_inc_bus as
2 /* $Header: peincrhi.pkh 120.0 2005/05/31 10:08:42 appldev noship $ */
3 --
4 -- ---------------------------------------------------------------------------
5 -- |----------------------< set_security_group_id >--------------------------|
6 -- ---------------------------------------------------------------------------
7 -- {Start Of Comments}
8 --
9 -- Description:
10 -- Sets the security_group_id in CLIENT_INFO for the appropriate business
11 -- group context.
12 --
13 -- Prerequisites:
14 -- The primary key identified by p_incident_id
15 -- already exists.
16 --
17 -- In Arguments:
18 -- p_incident_id
19 --
20 --
21 -- Post Success:
22 -- The security_group_id will be set in CLIENT_INFO.
23 --
24 -- Post Failure:
25 -- An error is raised if the value does not exist.
26 --
27 -- Access Status:
28 -- Internal Development Use Only.
29 --
30 -- {End Of Comments}
31 -- ---------------------------------------------------------------------------
32 procedure set_security_group_id
33 (p_incident_id in number
34 );
35 --
36 --
37 -- ---------------------------------------------------------------------------
38 -- |---------------------< return_legislation_code >-------------------------|
39 -- ---------------------------------------------------------------------------
40 -- {Start Of Comments}
41 --
42 -- Description:
43 -- Return the legislation code for a specific primary key value
44 --
45 -- Prerequisites:
46 -- The primary key identified by p_incident_id
47 -- already exists.
48 --
49 -- In Arguments:
50 -- p_incident_id
51 --
52 --
53 -- Post Success:
54 -- The business group's legislation code will be returned.
55 --
56 -- Post Failure:
57 -- An error is raised if the value does not exist.
58 --
59 -- Access Status:
60 -- Internal Development Use Only.
61 --
62 -- {End Of Comments}
63 -- ---------------------------------------------------------------------------
64 FUNCTION return_legislation_code
65 (p_incident_id in number
66 ) RETURN varchar2;
67 --
68 --
69 -- ---------------------------------------------------------------------------
70 -- |----------------------< get_osha_case_number >---------------------------|
71 -- ---------------------------------------------------------------------------
72 -- {Start Of Comments}
73 --
74 -- Description:
75 -- Returns the generated next OSHA case number
76 --
77 -- Prerequisites:
78 -- The table PER_US_OSHA_NUMBERS must have been populated with values.
79 --
80 -- In Arguments:
81 -- p_date (incident_date)
82 -- p_bg_id (business_group_id)
83 --
84 --
85 -- Post Success:
86 -- Generated next OSHA case number will be returned.
87 --
88 -- Post Failure:
89 -- An error is raised if the value does not exist.
90 --
91 -- Access Status:
92 -- Internal Development Use Only.
93 --
94 -- {End Of Comments}
95 -- ---------------------------------------------------------------------------
96 Function get_osha_case_number
97 (p_date in date
98 ,p_bg_id in number
99 ) RETURN varchar2;
100 --
101 -- ---------------------------------------------------------------------------
102 -- |---------------------< chk_incident_reference >-------------------------|
103 -- ---------------------------------------------------------------------------
104 -- {Start Of Comments}
105 --
106 -- Description:
107 -- Validates incident_reference is not null and is unique
108 --
109 -- Prerequisites:
110 --
111 -- In Arguments:
112 -- p_incident_id
113 -- p_incident_reference
114 -- p_object_version_number
115 --
116 -- Post Success:
117 -- processing continues
118 --
119 -- Post Failure:
120 -- An error is raised if the value does not exist.
121 --
122 -- Access Status:
123 -- Public access.
124 --
125 -- {End Of Comments}
126 -- ---------------------------------------------------------------------------
127 PROCEDURE chk_incident_reference
128 (p_incident_id in per_work_incidents.incident_id%TYPE
129 ,p_incident_reference in per_work_incidents.incident_reference%TYPE
130 ,p_object_version_number in per_work_incidents.object_version_number%TYPE
131 );
132 --
133 -- ----------------------------------------------------------------------------
134 -- |---------------------------< insert_validate >----------------------------|
135 -- ----------------------------------------------------------------------------
136 -- {Start of comments}
137 --
138 -- Description:
139 -- This procedure controls the execution of all insert business rules
140 -- validation.
141 --
142 -- Prerequisites:
143 -- This private procedure is called from ins procedure.
144 --
145 -- In Parameters:
146 -- A Pl/Sql record structure.
147 --
148 -- Post Success:
149 -- Processing continues.
150 --
151 -- Post Failure:
152 -- If a business rules fails the error will not be handled by this procedure
153 -- unless explicity coded.
154 --
155 -- Developer Implementation Notes:
156 -- For insert, your business rules should be executed from this procedure and
157 -- should ideally (unless really necessary) just be straight procedure or
158 -- function calls. Try and avoid using conditional branching logic.
159 --
160 -- Access Status:
161 -- Internal Row Handler Use Only.
162 --
163 -- {End of comments}
164 -- ----------------------------------------------------------------------------
165 Procedure insert_validate
166 (p_effective_date in date
167 ,p_rec in per_inc_shd.g_rec_type
168 );
169 --
170 -- ----------------------------------------------------------------------------
171 -- |---------------------------< update_validate >----------------------------|
172 -- ----------------------------------------------------------------------------
173 -- {Start Of Comments}
174 --
175 -- Description:
176 -- This procedure controls the execution of all update business rules
177 -- validation.
178 --
179 -- Prerequisites:
180 -- This private procedure is called from upd procedure.
181 --
182 -- In Parameters:
183 -- A Pl/Sql record structure.
184 --
185 -- Post Success:
186 -- Processing continues.
187 --
188 -- Post Failure:
189 -- If a business rules fails the error will not be handled by this procedure
190 -- unless explicity coded.
191 --
192 -- Developer Implementation Notes:
193 -- For update, your business rules should be executed from this procedure and
194 -- should ideally (unless really necessary) just be straight procedure or
195 -- function calls. Try and avoid using conditional branching logic.
196 --
197 -- Access Status:
198 -- Internal Row Handler Use Only.
199 --
200 -- {End Of Comments}
201 -- ----------------------------------------------------------------------------
202 Procedure update_validate
203 (p_effective_date in date
204 ,p_rec in per_inc_shd.g_rec_type
205 );
206 --
207 -- ----------------------------------------------------------------------------
208 -- |---------------------------< delete_validate >----------------------------|
209 -- ----------------------------------------------------------------------------
210 -- {Start Of Comments}
211 --
212 -- Description:
213 -- This procedure controls the execution of all delete business rules
214 -- validation.
215 --
216 -- Prerequisites:
217 -- This private procedure is called from del procedure.
218 --
219 -- In Parameters:
220 -- A Pl/Sql record structure.
221 --
222 -- Post Success:
223 -- Processing continues.
224 --
225 -- Post Failure:
226 -- If a business rules fails the error will not be handled by this procedure
227 -- unless explicity coded.
228 --
229 -- Developer Implementation Notes:
230 -- For delete, your business rules should be executed from this procedure and
231 -- should ideally (unless really necessary) just be straight procedure or
232 -- function calls. Try and avoid using conditional branching logic.
233 --
234 -- Access Status:
235 -- Internal Row Handler Use Only.
236 --
237 --
238 -- ----------------------------------------------------------------------------
239 Procedure delete_validate
240 (p_rec in per_inc_shd.g_rec_type
241 );
242 --
243 -- ----------------------------------------------------------------------------
244 -- |-------------------------< get_incident_reference >------------------------|
245 -- ----------------------------------------------------------------------------
246 -- {Start Of Comments}
247 --
248 -- Description:
249 -- This function returns the incident_reference for the supplied incident_id
250 -- (surrogate_key)
251 --
252 -- {End Of Comments}
253 --
254 Function GET_INCIDENT_REFERENCE (p_incident_id in number) return varchar2;
255 --
256 -- ----------------------------------------------------------------------------
257 -- |--------------------< chk_person_reported_date_time >----------------------|
258 -- ----------------------------------------------------------------------------
259 -- {Start Of Comments}
260 --
261 -- Description:
262 -- Performs cross attribute vatidation on person_reported_by, report_date,
263 -- report_time.
264 --
265 -- {End Of Comments}
266 --
267 --
268 procedure chk_person_reported_date_time
269 (p_incident_id in per_work_incidents.incident_id%TYPE
270 ,p_incident_date in per_work_incidents.incident_date%TYPE
271 ,p_incident_time in per_work_incidents.incident_time%TYPE
272 ,p_person_reported_by in per_work_incidents.person_reported_by%TYPE
273 ,p_report_date in per_work_incidents.report_date%TYPE
274 ,p_report_time in per_work_incidents.report_time%TYPE
275 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
276 ,p_object_version_number in per_work_incidents.object_version_number%TYPE);
277 --
278 -- ----------------------------------------------------------------------------
279 -- |----------------------< chk_notified_hsrep_and_date >----------------------|
280 -- ----------------------------------------------------------------------------
281 -- {Start Of Comments}
282 --
283 -- Description:
284 -- Performs cross attribute vatidation on notified_hsrep_id, notified_hsrep_date.
285 --
286 -- {End Of Comments}
287 --
288 --
289 procedure chk_notified_hsrep_and_date
290 (p_incident_id in per_work_incidents.incident_id%TYPE
291 ,p_incident_date in per_work_incidents.incident_date%TYPE
292 ,p_notified_hsrep_id in per_work_incidents.notified_hsrep_id%TYPE
293 ,p_notified_hsrep_date in per_work_incidents.notified_hsrep_date%TYPE
294 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
295 ,p_object_version_number in per_work_incidents.object_version_number%TYPE);
296 --
297 --
298 -- ----------------------------------------------------------------------------
299 -- |----------------------< chk_notified_rep_org_date >------------------------|
300 -- ----------------------------------------------------------------------------
301 -- {Start Of Comments}
302 --
303 -- Description:
304 -- Performs cross attribute vatidation on notified_rep_org_id, notified_rep_id
305 -- and notified_rep_date.
306 --
307 -- {End Of Comments}
308 --
309 --
310 procedure chk_notified_rep_org_date
311 (p_incident_id in per_work_incidents.incident_id%TYPE
312 ,p_incident_date in per_work_incidents.incident_date%TYPE
313 ,p_notified_rep_org_id in per_work_incidents.notified_rep_org_id%TYPE
314 ,p_notified_rep_id in per_work_incidents.notified_rep_id%TYPE
315 ,p_notified_rep_date in per_work_incidents.notified_rep_date%TYPE
316 ,p_business_group_id in per_all_people_f.business_group_id%TYPE
317 ,p_object_version_number in per_work_incidents.object_version_number%TYPE);
318 --
319 --
320 -- ----------------------------------------------------------------------------
324 --
321 -- |-------------------------< create_osha_numbers >--------------------------|
322 -- ----------------------------------------------------------------------------
323 -- {Start Of Comments}
325 -- Description:
326 -- This procedure inserts a row into per_us_osha_numbers table, with
327 -- next_value = 1, for each US Business Group, for the year starting
328 -- from 1900 until the EOT (4712).
329 --
330 -- {End Of Comments}
331 --
332 --
333 procedure create_osha_numbers
334 (p_number_of_workers in number default 1,
335 p_current_worker in number default 1);
336 end per_inc_bus;