[Home] [Help]
PACKAGE BODY: APPS.PAY_RUN_BALANCE_WF_PKG
Source
1 PACKAGE BODY pay_run_balance_wf_pkg AS
2 /* $Header: pyzzrbwf.pkb 120.0 2005/05/29 10:38:10 appldev noship $ */
3 --
4 procedure verify_revalidation(itemtype in varchar2
5 ,itemkey in varchar2
6 ,actid in number
7 ,funcmode in varchar2
8 ,resultout out nocopy varchar2)
9 is
10 --
11 cursor check_status(p_def_bal_id in number
12 ,p_bg_id in number)
13 is
14 select pbv.run_balance_status
15 , pbv.balance_load_date
16 , hl.meaning
17 from pay_balance_validation pbv
18 , hr_lookups hl
19 where pbv.defined_balance_id = p_def_bal_id
20 and pbv.business_group_id = p_bg_id
21 and hl.lookup_type = 'RUN_BALANCE_STATUS'
22 and hl.lookup_code = pbv.run_balance_status;
23 --
24 business_group_id number;
25 defined_balance_id number;
26 l_status varchar2(30);
27 l_stat_meaning varchar2(80);
28 l_balance_load_date date;
29 begin
30 if (funcmode = 'RUN') THEN
31 --
32 business_group_id := wf_engine.getactivityattrnumber
33 (itemtype => itemtype
34 ,itemkey => itemkey
35 ,actid => actid
36 ,aname => 'BUSINESS_GROUP_ID');
37 defined_balance_id := wf_engine.getactivityattrnumber
38 (itemtype => itemtype
39 ,itemkey => itemkey
40 ,actid => actid
41 ,aname => 'DEFINED_BALANCE_ID');
42 --
43 open check_status(defined_balance_id, business_group_id);
44 fetch check_status into l_status, l_balance_load_date, l_stat_meaning;
45 if check_status%notfound then
46 --
47 close check_status;
48 resultout := 'COMPLETE:NDF';
49 else
50 close check_status;
51 resultout := 'COMPLETE:'||l_status;
52 end if;
53 wf_engine.setItemAttrText(itemtype => itemtype
54 ,itemkey => itemkey
55 ,aname => 'RUN_BALANCE_STATUS'
56 ,avalue => l_stat_meaning);
57 wf_engine.setItemAttrDate(itemtype => itemtype
58 ,itemkey => itemkey
59 ,aname => 'BALANCE_LOAD_DATE'
60 ,avalue => l_balance_load_date);
61 return;
62 end if;
63 --
64 exception
65 when others then
66 WF_CORE.CONTEXT('ret_test_wf_pkg'
67 ,'verify_revalidation'
68 ,itemtype
69 ,itemkey
70 ,to_char(actid)
71 ,resultout);
72 raise;
73 --
74 end verify_revalidation;
75 --
76 procedure prepare_conc_prog_params(itemtype in varchar2
77 ,itemkey in varchar2
78 ,actid in number
79 ,funcmode in varchar2
80 ,resultout out nocopy varchar2)
81 is
82 --
83 cursor get_bal_level (p_defined_balance_id in number)
84 is
85 select pbd.dimension_level
86 , hl.meaning
87 from pay_balance_dimensions pbd
88 , pay_defined_balances db
89 , hr_lookups hl
90 where pbd.balance_dimension_id = db.balance_dimension_id
91 and db.defined_balance_id = p_defined_balance_id
92 and hl.lookup_type = 'PAY_BRA_BALANCE_LEVEL'
93 and hl.lookup_code = pbd.dimension_level;
94 --
95 defined_balance_id number;
96 balance_load_date date;
97 bal_load_date_char varchar2(80);
98 cp_bal_start_date varchar2(80);
99 cp_def_bal_id varchar2(80);
100 cp_bal_lvl varchar2(80);
101 cp_bal_lvl_code varchar2(80);
102 cp_bal_lvl_mean varchar2(80);
103 begin
104 if (funcmode = 'RUN') THEN
105 --
106 defined_balance_id := wf_engine.getitemattrnumber
107 (itemtype => itemtype
108 ,itemkey => itemkey
109 ,aname => 'DEFINED_BALANCE_ID');
110 balance_load_date := wf_engine.getitemattrdate
111 (itemtype => itemtype
112 ,itemkey => itemkey
113 ,aname => 'BALANCE_LOAD_DATE');
114 bal_load_date_char := to_char(balance_load_date,'YYYY/MM/DD');
115 --
116 cp_bal_start_date := 'BAL_START_DATE='||bal_load_date_char;
117 cp_def_bal_id := 'DEF_BAL_ID='||to_char(defined_balance_id);
118 --
119 open get_bal_level(defined_balance_id);
120 fetch get_bal_level into cp_bal_lvl_code, cp_bal_lvl_mean;
121 if get_bal_level%notfound then
122 --
123 close get_bal_level;
124 resultout := 'COMPLETE:NDF';
125 else
126 close get_bal_level;
127 cp_bal_lvl := 'BAL_LVL='||cp_bal_lvl_code;
128 resultout := 'COMPLETE:DF';
129 end if;
130 --
131 -- set activity parameters
132 --
133 wf_engine.setItemAttrText(itemtype => itemtype
134 ,itemkey => itemkey
135 ,aname => 'CP_BAL_START_DATE'
136 ,avalue => cp_bal_start_date);
137 wf_engine.setItemAttrText(itemtype => itemtype
138 ,itemkey => itemkey
139 ,aname => 'CP_DEF_BAL_ID'
140 ,avalue => cp_def_bal_id);
141 wf_engine.setItemAttrText(itemtype => itemtype
142 ,itemkey => itemkey
143 ,aname => 'CP_BAL_LVL_CODE'
144 ,avalue => cp_bal_lvl_code);
145 wf_engine.setItemAttrText(itemtype => itemtype
146 ,itemkey => itemkey
147 ,aname => 'CP_BAL_LVL_MEAN'
148 ,avalue => cp_bal_lvl_MEAN);
149 wf_engine.setItemAttrText(itemtype => itemtype
150 ,itemkey => itemkey
151 ,aname => 'CP_BAL_LVL'
152 ,avalue => cp_bal_lvl);
153 return;
154 end if;
155 --
156 exception
157 when others then
158 WF_CORE.CONTEXT('ret_test_wf_pkg'
159 ,'prepare_conc_prog_params'
160 ,itemtype
161 ,itemkey
162 ,to_char(actid)
163 ,resultout);
164 raise;
165 --
166 end prepare_conc_prog_params;
167 --
168 --
169 end pay_run_balance_wf_pkg;