1 package body hrbaldtm as
2 /* $Header: pybaldtm.pkb 115.0 99/07/17 05:44:24 porting ship $ */
3 --
4 /*
5 --
6 -- Copyright (c) Oracle Corporation 1991, 1992, 1993. All rights reserved.
7 --
8 /*
9 NAME
10 pybaldtm.pkb - Payroll Balance for DaTe Mode
11 --
12 DESCRIPTION
13 This procedure is called from the Balance user exit 'C' code. Its
14 purpose is to insert an assignment action for the given assignment id on
15 the given date. This assignment action id is then passed back to the
16 user exit to calculate the balance. The user exit is expected to
17 perform the savepoint and rollback to remove the assignment
18 action. The procedure first creates a payroll action which is used
19 to insert the assignment action on the effective date.
20 --
21 MODIFIED (DD-MON-YYYY)
22 mwcallag 19-JAN-1995 - Temp. insert into pay_payroll_actions now also
23 populates date_earned with the virtual date
24 value.
25 mwcallag 10-JAN-1995 - New mandatory column 'object_version_number'
26 added to insert of pay_payroll_actions.
27 mwcallag 01-OCT-1993 - created.
28 */
29 procedure get_bal_ass_action
30 (
31 p_business_group_id in number,
32 p_assignment_id in number,
33 p_date in date,
34 p_ass_action_id out number
35 )is
36 l_payroll_id per_assignments_f.payroll_id%type;
37 l_consol_set_id pay_payrolls_f.payroll_id%type;
38 l_ass_action_id pay_assignment_actions.assignment_action_id%type;
39 l_pay_action_id pay_payroll_actions.payroll_action_id%type;
40 begin
41 --
42 -- get the payroll id and the consolidation set id
43 --
44 hr_utility.set_location ('hrbaldtm.get_bal_ass_action', 1);
45 select ASSIGN.payroll_id,
46 PAYROLL.consolidation_set_id
47 into l_payroll_id,
48 l_consol_set_id
49 from per_assignments_f ASSIGN,
50 pay_payrolls_f PAYROLL
51 where ASSIGN.assignment_id = p_assignment_id
52 and p_date between ASSIGN.effective_start_date
53 and ASSIGN.effective_end_date
54 and PAYROLL.payroll_id = ASSIGN.payroll_id
55 and p_date between PAYROLL.effective_start_date
56 and PAYROLL.effective_end_date;
57 --
58 -- get the next value for payroll action id
59 --
60 hr_utility.set_location ('hrbaldtm.get_bal_ass_action', 2);
61 select pay_payroll_actions_s.nextval
62 into l_pay_action_id
63 from dual;
64 --
65 -- insert a temporary row into pay_payroll_actions
66 --
67 hr_utility.set_location ('hrbaldtm.get_bal_ass_action', 3);
68 insert into pay_payroll_actions
69 (payroll_action_id,
70 action_type,
71 business_group_id,
72 consolidation_set_id,
73 payroll_id,
74 action_population_status,
75 action_status,
76 effective_date,
77 date_earned,
78 object_version_number)
79 values
80 (l_pay_action_id,
81 'N', -- not tracked action type
82 p_business_group_id,
83 l_consol_set_id,
84 l_payroll_id,
85 'U',
86 'U',
87 p_date,
88 p_date,
89 1);
90 --
91 -- now insert the assigment action:
92 --
93 hr_utility.set_location ('hrbaldtm.get_bal_ass_action', 4);
94 hrassact.inassact (l_pay_action_id, p_assignment_id);
95 --
96 -- retrieve the assignment action id:
97 --
98 hr_utility.set_location ('hrbaldtm.get_bal_ass_action', 5);
99 select assignment_action_id
100 into l_ass_action_id
101 from pay_assignment_actions
102 where payroll_action_id = l_pay_action_id;
103 --
104 hr_utility.trace ('Assignment action id = ' || to_char (l_ass_action_id));
105 p_ass_action_id := l_ass_action_id;
106 end;
107 end hrbaldtm;