1 PACKAGE pay_us_tax_internal AUTHID CURRENT_USER AS
2 /* $Header: pytaxbsi.pkh 120.1.12010000.1 2008/07/27 23:43:57 appldev ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |----------------------< maintain_tax_percentage >-------------------------|
6 -- ----------------------------------------------------------------------------
7 -- {Start Of Comments}
8 --
9 -- Description:
10 -- This procedure can be used to maintain the percentage coverage for each
11 -- location. The routine will update all necessary element entries.
12 --
13 -- Prerequisites: None
14 --
15 -- In Parameters:
16 -- Name Reqd Type Description
17 -- p_assignment_id Yes number The ID of the assignment
18 -- p_effective_date Yes date The effective date of change
19 -- p_state_code Yes varchar2
20 -- p_county_code Yes varchar2
21 -- p_city_code Yes varchar2
22 -- p_percentage No number New percentage for location
23 -- p_calculate_pct No boolean
24 -- p_datetrack_mode Yes varchar2
25 -- p_effective_start_date Yes date The start date of the element
26 -- p_effective_end_date Yes date The end date of the element
27 --
28 -- Post Success:
29 -- Processing continues. The effective_start_date and effective_end_date
30 -- set.
31 --
32 -- Post Failure:
33 -- No changes will be made and an error is raised.
34 --
35 -- Access Status:
36 -- Internal Development Use Only.
37 --
38 -- {End Of Comments}
39 --
40 procedure maintain_tax_percentage
41 (
42 p_assignment_id in number,
43 p_effective_date in date,
44 p_state_code in varchar2,
45 p_county_code in varchar2,
46 p_city_code in varchar2,
47 p_percentage in number default 0,
48 p_calculate_pct in boolean default true,
49 p_datetrack_mode in varchar2,
50 p_effective_start_date in out nocopy date,
51 p_effective_end_date in out nocopy date
52 );
53
54 -- ----------------------------------------------------------------------------
55 -- |-----------------------------< maintain_wc >------------------------------|
56 -- ----------------------------------------------------------------------------
57 -- {Start Of Comments}
58 --
59 -- Description:
60 -- This procedure can be used to create as well as update the workers
61 -- compensation element entry for the assignment of a federal tax record.
62 -- It calls the element entries api to insert and update the element entry
63 -- record.
64 --
65 -- Note : For every change in the federal tax record, we will be changing
66 -- the worker's comp element entry.
67 --
68 -- Prerequisites:
69 --
70 --
71 -- In Parameters:
72 -- Name Reqd Type Description
73 -- p_emp_fed_tax_rule_id Yes number The ID of the federal tax
74 -- rule for which the workers
75 -- comp element element entry
76 -- is to be created/modified.
77 -- p_effective_start_date Yes date The start date of the
78 -- element entry.
79 -- p_effective_end_date Yes date The end date of the element
80 -- entry.
81 -- p_effective_date Yes date effective date of the change
82 -- p_datetrack_mode Yes varchar2
83 --
84 -- Post Success:
85 -- Processing continues. No OUT parameters are set.
86 --
87 -- Post Failure:
88 -- The workers comp entry will not be changed and an error will be raised.
89 --
90 -- Access Status:
91 -- Internal Development Use Only.
92 --
93 -- {End Of Comments}
94 --
95 procedure maintain_wc
96 (
97 p_emp_fed_tax_rule_id in number
98 ,p_effective_start_date in date
99 ,p_effective_end_date in date
100 ,p_effective_date in date
101 ,p_datetrack_mode in varchar2
102 );
103
104 -- ----------------------------------------------------------------------------
105 -- |------------------------< delete_fed_tax_rule >---------------------------|
106 -- ----------------------------------------------------------------------------
107 -- {Start Of Comments}
108 --
109 -- Description:
110 -- This API will delete the federal tax rule for an assignment. In the
111 -- process, it will delete the workers compensation element entry, the
112 -- state, county and city tax rules, and the tax percentage element
113 -- entries.
114 --
115 -- Once the federal tax rule is created for an assignment, it should exist
116 -- as long as the assignment exists. It should only be deleted when the
117 -- assignment is being deleted.
118 --
119 -- Prerequisites:
120 --
121 --
122 --
123 -- In Parameters:
124 -- Name Reqd Type Description
125 -- p_effective_date Yes date Session Date.
126 -- p_datetrack_delete_mode Yes varchar2 Datetrack mode.
127 -- p_assignment_id Yes number assignment of rules to delete
128 -- p_delete_routine No varchar2 Name of the routine that is
129 -- calling this process. Should
130 -- be set to 'ASSIGNMENT' to show
131 -- that the assignment is being
132 -- deleted.
133 --
134 -- Post Success:
135 -- When the federal tax rule has been deleted, the following OUT parameters
136 -- are set.
137 --
138 -- Name Type Description
139 -- p_effective_start_date date Effective Start Date of Record
140 -- p_effective_end_date date Effective End Date of Record
141 -- p_object_version_number number OVN of record
142 --
143 -- Post Failure:
144 -- The tax rules will not be deleted, and an error will be raised.
145 --
146 -- Access Status:
147 -- Internal Development Use Only.
148 --
149 -- {End Of Comments}
150 --
151 procedure delete_fed_tax_rule
152 (p_effective_date in date
153 ,p_datetrack_delete_mode in varchar2
154 ,p_assignment_id in number
155 ,p_delete_routine in varchar2 default null
156 ,p_effective_start_date out nocopy date
157 ,p_effective_end_date out nocopy date
158 ,p_object_version_number out nocopy number
159 );
160 -- ----------------------------------------------------------------------------
161 -- |---------------------------< address_change >-------------------------|
162 -- ----------------------------------------------------------------------------
163 -- {Start Of Comments}
164 --
165 -- Description:
166 -- This API creates new tax rule records when a person changes their primary
167 -- address. Tax percentage records are also created.
168 --
169 -- In two cases, this API will complete successfully, but not create any new
170 -- tax rules. If no federal tax rule exists, the tax defaulting criteria
171 -- has not been met, so no tax rules will be created. If the tax rules for
172 -- the state, county and city of the new address already existed for the
173 -- person's assignment, they will not be recreated.
174 --
175 --
176 -- Prerequisites:
177 --
178 --
179 -- In Parameters:
180 -- Name Reqd Type Description
181 -- p_effective_date Yes date Effective date of address
182 -- change (Date_from value).
183 -- p_person_id No number ID of person whose address
184 -- has changed.
185 -- (Primary entry method.)
186 -- p_assignment_id No number ID of an assignment of person
187 -- whose addesss has changed.
188 -- (An alternate entry method.)
189 --
190 -- Post Success:
191 -- Processing continues. No OUT parameters are set.
192 --
193 -- Post Failure:
194 -- The tax rules will not be created and an error will be raised.
195 --
196 -- Access Status:
197 -- Internal Development Use Only.
198 --
199 -- {End Of Comments}
200 --
201 procedure address_change
202 (p_effective_date In date
203 ,p_person_id In number default null
204 ,p_assignment_id In number default null
205 );
206
207 -- ----------------------------------------------------------------------------
208 -- |-----------------------< create_default_tax_rules >-----------------------|
209 -- ----------------------------------------------------------------------------
210 -- {Start Of Comments}
211 --
212 -- Description:
213 -- This API will check whether a given assignment meets the tax defaulting
214 -- criteria. If it does, the API will create default tax records for the
215 -- assignment.
216 --
217 -- Prerequisites:
218 --
219 --
220 -- In Parameters:
221 -- Name Reqd Type Description
222 -- p_effective_date Yes date Session Date.
223 -- p_assignment_id Yes number ID of ASG of new tax records
224 --
225 -- Post Success:
226 -- When default tax records are created for an assignment, the following
227 -- OUT parameters are set:
228 --
229 -- Name Type Description
230 -- p_emp_fed_tax_rule_id number PK of federal tax record
231 -- p_fed_object_version_number number OVN of federal tax record
232 -- p_fed_effective_start_date date Effective Start Date of
233 -- the federal tax Record
234 -- p_fed_effective_end_date date Effective End Date of
235 -- the federal tax Record
236 --
237 -- Post Failure:
238 -- The tax records are not created, and an error will be raised.
239 --
240 -- Access Status:
241 -- Internal Development Use Only.
242 --
243 -- {End Of Comments}
244 --
245 procedure create_default_tax_rules
246 (p_effective_date in date
247 ,p_assignment_id in number
248 ,p_emp_fed_tax_rule_id out nocopy number
249 ,p_fed_object_version_number out nocopy number
250 ,p_fed_effective_start_date out nocopy date
251 ,p_fed_effective_end_date out nocopy date
252 );
253
254 -- ----------------------------------------------------------------------------
255 -- |----------------------< maintain_us_employee_taxes >----------------------|
256 -- ----------------------------------------------------------------------------
257 -- {Start Of Comments}
258 --
259 -- Description:
260 --
261 -- This procedure can be called for a wide variety of situations that affect
262 -- US employee taxes. It is a central api for handling changes to the tax
263 -- rules and percentages that occur as a result of changes to either the
264 -- person or the assignment. It can be called for all of the following cases:
265 --
266 -- A change to the assignment so that it meets the tax defaulting criteria,
267 -- Providing a person's primary residence to meet the tax defaulting criteria,
268 -- Changes to the assignment location,
269 -- Changes to the primary residence address,
270 -- Termination of the assignment,
271 -- Purging of the assignment
272 --
273 --
274 -- How to call this procedure:
275 -- ===========================
276 -- From an assignment API
277 -- p_effective_date Required
278 -- p_datetrack_mode Required
279 -- p_assignment_id Required
280 -- p_location_id Provide only if it has changed
281 -- p_address_id NULL
282 -- p_delete_routine 'ASSIGNMENT' if using datetrack delete
283 -- mode of ZAP or DELETE, otherwise NULL
284 --
285 -- From an address API
286 -- p_effective_date Required - Use the date_from column
287 -- of the changed address record
288 -- p_datetrack_mode NULL
289 -- p_assignment_id NULL
290 -- p_location_id NULL
291 -- p_address_id Required
292 -- p_delete_routine NULL
293 --
294 --
295 -- Prerequisites:
296 --
297 --
298 -- In Parameters:
299 -- Name Reqd Type Description
300 -- p_effective_date Yes date Session Date.
301 -- p_datetrack_mode Yes varchar2 Datetrack mode.
302 -- p_assignment_id No number Pass this parameter only if
303 -- the tax change is related to
304 -- an assignment change.
305 -- p_location_id No number If the assignment change
306 -- includes a change in the work
307 -- location, pass in the new
308 -- location id.
309 -- p_address_id No number Pass this parameter if the
310 -- tax change is related to a
311 -- change to the person's
312 -- primary residence address.
313 -- p_delete_routine No varchar2 Set this parameter to
314 -- 'ASSIGNMENT' only if the
315 -- assignment is being
316 -- terminated or purged.
317 --
318 -- Post Success:
319 -- Processing continues. No OUT parameters are set.
320 --
321 -- Post Failure:
322 -- No data is created or updated and an error will be raised.
323 --
324 -- Access Status:
325 -- Internal Development Use Only.
326 --
327 -- {End Of Comments}
328 --
329 procedure maintain_us_employee_taxes
330 ( p_effective_date in date
331 ,p_datetrack_mode in varchar2 default null
332 ,p_assignment_id in number default null
333 ,p_location_id in number default null
334 ,p_address_id in number default null
335 ,p_delete_routine in varchar2 default null
336 );
337
338 -- ----------------------------------------------------------------------------
339 -- |---------------------------< location_change >--------------------------|
340 -- ----------------------------------------------------------------------------
341 -- {Start Of Comments}
342 --
343 -- Description:
344 -- This API will make all of the necessary changes to the taxes of an
345 -- assignment when the location of that assignment changes.
346 -- The federal tax rule sui state will be updated to the new location, as
347 -- will the workers compensation element entry. The existing tax
348 -- percentage records will be updated to reflect the change in location.
349 -- If tax rules for the new location's state, county or city did not
350 -- already exist for this assignment, they will be created along with new
351 -- tax percentage records.
352 --
353 -- Prerequisites:
354 --
355 --
356 -- In Parameters:
357 -- Name Reqd Type Description
361 -- location changed
358 -- p_effective_date Yes date Session Date.
359 -- p_datetrack_mode Yes varchar2
360 -- p_assignment_id Yes number ID of assignment whose
362 -- p_location_id Yes number ID of new location
363 --
364 -- Post Success:
365 -- The taxes will be updated for the new location. Any new tax rules and
366 -- percentage records will be created.
367 --
368 -- Post Failure:
369 -- The tax rules will not be created and an error will be raised.
370 --
371 -- Access Status:
372 -- Internal Development Use Only.
373 --
374 -- {End Of Comments}
375 --
376 procedure location_change
377 (p_effective_date In date
378 ,p_datetrack_mode In varchar2
379 ,p_assignment_id In number
380 ,p_location_id In number
381 );
382
383 -- ----------------------------------------------------------------------------
384 -- |-------------------------< move_tax_default_date >------------------------|
385 -- ----------------------------------------------------------------------------
386 -- {Start Of Comments}
387 --
388 -- Description:
389 -- This API will move the tax defaulting date for all tax records related
390 -- to the assignment. This is necessary when an assignment change before the
391 -- tax defaulting date meets the defaulting criteria, or when a person's
392 -- hire date changes.
393 --
394 -- Prerequisites:
395 --
396 --
397 -- In Parameters:
398 -- Name Reqd Type Description
399 -- p_effective_date Yes date Session Date.
400 -- p_datetrack_mode Yes varchar2
401 -- p_assignment_id Yes number ID of assignment whose
402 -- location changed
403 -- p_new_location_id No number ID of new location
404 -- p_new_hire_date No date new hire date from change
405 -- to the person's record
406 --
407 -- Post Success:
408 -- Processing continues. No OUT parameters are set.
409 --
410 -- Post Failure:
411 -- Tax records are not updated and an error will be raised.
412 --
413 -- Access Status:
414 -- Internal Development Use Only.
415 --
416 -- {End Of Comments}
417 --
418 procedure move_tax_default_date
419 (p_effective_date In date
420 ,p_datetrack_mode In varchar2
421 ,p_assignment_id In number
422 ,p_new_location_id In number default null
423 ,p_new_hire_date In date default null
424 );
425
426 --
427 End pay_us_tax_internal;