1 PACKAGE py_za_tx_utl_01032012 AUTHID CURRENT_USER AS
2 /* $Header: pyzatu13.pkh 120.5.12020000.2 2013/01/31 11:06:56 nchinnam noship $ */
3 /* Copyright (c) Oracle Corporation 2005. All rights reserved. */
4 /*
5 PRODUCT
6 Oracle Payroll - ZA Localisation Tax Module
7
8 NAME
9 py_za_tx_utl_01032012.pkh
10
11 DESCRIPTION
12 This is the ZA Tax Module utility package. It contains
13 functions and procedures used by the main tax package.
14
15 PUBLIC FUNCTIONS
16 GlbVal
17 Returns the value of a Oracle Application Global
18 date effectively
19 NegPtd
20 Boolean function returns true if any current PTD
21 total balance value is negative
22 LatePayPeriod
23 Boolean function returns true if the current period
24 is a Late Payment Period, i.e. a payment over the
25 tax year boundary.
26 LstPeriod
27 Boolean function returns true if current period is the
28 last period in the current tax year.
29 EmpTermInPeriod
30 Boolean function returns true if the assignment was terminated
31 in the current pay period.
32 EmpTermPrePeiod
33 Boolean function returns true if the assignment was terminated
34 before the current period.
35 PreErnPeriod
36 Boolean function returns true if this run is deemed to be
37 a Pre-Earnings Calculation Run.
38 For a complete description see the tax module design document.
39 SitePeriod
40 Boolean function returns true if it is a tax site period.
41 For a complete description see the tax module design document.
42 Annualise
43 Returns annualised value to the calling object.
44 For a complete description see the tax module design document.
45 TaxLiability
46 Returns the gross tax liability on passed value.
47 For a complete description see the tax module design document.
48 DeAnnualise
49 Returns the de-annualised value to the calling object.
50 For a complete description see the tax module design document.
51 DaysWorked
52 Returns the number of days worked for the assignment.
53 For a complete description see the tax module design document.
54
55 PUBLIC PROCEDURES
56 StartHrTrace
57 Sets package global that determines if extra trace information
58 will be written to file - hr_utility
59 StopHrTrace
60 Stops trace information from being written to file
61 WriteHrTrace
62 Writes extra trace information to file if global
63 has been set
64 PeriodFactor
65 Calculates the period factor for the assignment.
66 For a complete description see the tax module design document.
67 PossiblePeriodsFactor
68 Calculates the possible period factor for the assignment.
69 For a complete description see the tax module design document.
70 SetRebates
71 Calculate tax Rebate and Threshold values.
72 For a complete description see the tax module design document.
73 Abatements
74 Calculates all necessary abatements.
75 For a complete description see the tax module design document.
76 ArrearExcess
77 Calculates the arrear excess figure to 'effectively' update the
78 Asg_Itd dimension of the arrear excess pension and retirement
79 annuity balances. Will only fire on siteperiod.
80 TrvAll
81 Calculates the taxable travel allowance over a period of
82 time based on the effective global values at the time.
83 For a complete description see the tax module design document.
84 ValidateTaxOns
85 Validates the calculated category liabilities.
86 For a complete description see the tax module design document.
87 SitPaySplit
88 Calculates the site paye split of tax liabilities.
89 For a complete description see the tax module design document.
90 Trace
91 Traces the tax calculation.
92 For a complete description see the tax module design document.
93 ClearGlobals
94 Clears any set package globals.
95 For a complete description see the tax module design document.
96
97 PRIVATE FUNCTIONS
98 see package body
99
100 PRIVATE PROCEDURES
101 see package body
102
103 NOTES
104 .
105
106 MODIFICATION HISTORY
107 Person Date Version Bug Comments
108 --------- ---------- -------------- ------- --------------------------------
109 R Babla 03/04/2009 115.0 8406456 For detail history see
110 py_za_tx_utl_01032007
111 Added new function AllowableDeduction
112 for TYS2010
113 ABDASH 21/05/2012 115.2 14062746 MEDICAL TAX CREDIT CALCULATION IN CASE OF TAX REFUND.
114 ABDASH 25/05/2012 115.4 14062746 MEDICAL TAX CREDIT CALCULATION IN CASE OF TAX REFUND WITH NEGATIVE PAYE.
115 ABDASH 12/06/2012 115.5 14168167 MAC ALLOWED TO BE REFUNDED INCASE OF EMPLOYEE ABOVE AGE 65 OR WHEN BALANCES FOR CODE 3810, 4005 AND 4474 ARE ZERO.
116 */
117
118 -------------------------------------------------------------------------------
119 -- PACKAGE GLOBAL AREA --
120 -------------------------------------------------------------------------------
121 -- hr_utility wrapper globals
122 g_HrTraceEnabled BOOLEAN DEFAULT FALSE;
123 g_HrTracePipeName VARCHAR2(30);
124
125 -- Tax Specific Subtypes
126 SUBTYPE t_balance IS NUMBER(15,2);
127 -------------------------------------------------------------------------------
128 -- PACKAGE SPECIFICATION --
129 -------------------------------------------------------------------------------
130
131 -- StartHrTrace
132 -- Wrapper for hr_utility.trace_on
133 PROCEDURE StartHrTrace;
134
135 -- StartHrTrace
136 -- Function wrapper for hr_utility.trace_on
137 FUNCTION StartHrTrace(
138 p_HrTracePipeName VARCHAR2
139 ) RETURN VARCHAR2;
140
141 -- StopHrTrace
142 -- Wrapper for hr_utility.trace_off
143 PROCEDURE StopHrTrace;
144
145 -- StopHrTrace
146 -- Function wrapper for hr_utility.trace_off
147 FUNCTION StopHrTrace RETURN VARCHAR2;
148
149 -- WriteHrTrace
150 -- Wrapper for hr_utility.trace
151 PROCEDURE WriteHrTrace(
152 p_Buffer VARCHAR2
153 );
154
155
156
157 -- Tax Utility Functions
158 --
159
160 FUNCTION GlbVal
161 (p_GlbNme ff_globals_f.global_name%TYPE
162 ,p_EffDte DATE
163 ) RETURN ff_globals_f.global_value%TYPE;
164
165 FUNCTION NegPtd RETURN BOOLEAN;
166
167 FUNCTION LatePayPeriod RETURN BOOLEAN;
168
169 FUNCTION LstPeriod RETURN BOOLEAN;
170
171 FUNCTION EmpTermInPeriod RETURN BOOLEAN;
172
173 FUNCTION EmpTermPrePeriod RETURN BOOLEAN;
174
175 FUNCTION PreErnPeriod RETURN BOOLEAN;
176
177 FUNCTION SitePeriod RETURN BOOLEAN;
178
179 PROCEDURE PeriodFactor;
180
181
182 PROCEDURE PossiblePeriodsFactor;
183
184
185 FUNCTION Annualise
186 (p_YtdInc IN NUMBER
187 ,p_PtdInc IN NUMBER
188 ) RETURN NUMBER;
189
190 PROCEDURE SetRebates;
191
192 PROCEDURE Abatements;
193
197 (p_Amt IN NUMBER
194 PROCEDURE ArrearExcess;
195
196 FUNCTION TaxLiability
198 )RETURN NUMBER;
199
200
201 FUNCTION DeAnnualise
202 (p_Liab IN NUMBER
203 ,p_TxOnYtd IN NUMBER
204 ,p_TxOnPtd IN NUMBER
205 ) RETURN NUMBER;
206
207
208 PROCEDURE TrvAll;
209
210 /*TYS2010 */
211 FUNCTION AllowableDeduction
212 (p_Amt IN NUMBER
213 ,p_Donat_Amt IN NUMBER
214 ) RETURN NUMBER;
215
216
217 PROCEDURE ValidateTaxOns(
218 p_Rf IN BOOLEAN DEFAULT FALSE -- Refund Allowed Regardless
219 );
220
221
222 -- DaysWorked
223 /* Returns the number of days that the person has worked
224 This could be a negative number that would indicate
225 a LatePayePeriod
226 */
227 FUNCTION DaysWorked RETURN NUMBER;
228
229
230 PROCEDURE SitPaySplit;
231
232
233 -- Trace Function
234 --
235 PROCEDURE Trace;
236
237 PROCEDURE ClearGlobals;
238
239 FUNCTION AllowableMedTaxCrdtRfnd
240 (p_Avlbl_Md_Tx_Crdt IN NUMBER
241 ,p_Md_tx_Crdt_Used_YTD IN NUMBER
242 ,p_Tx_RUN in NUMBER
243 ,p_Tx_YTD in NUMBER
244 ) RETURN NUMBER;
245
246 PROCEDURE CalMedTxCrUSEDOns
247 (p_Avlbl_Md_Tx_Crdt IN NUMBER
248 ,p_Md_Tx_Crdt_Used_YTD IN NUMBER
249 ,p_Tx_RUN IN NUMBER
250 ,p_Tx_YTD IN NUMBER
251 ,p_Md_Tx_Cr_Usd OUT NOCOPY NUMBER
252 ,p_Md_Tx_Cr_Usd_Upd OUT NOCOPY NUMBER
253 );
254
255 Function AdjMACTxOns
256 ( p_MedTxCrUsedDR_Upd IN OUT NOCOPY NUMBER
257 , p_MedTxCrUsedNI_Upd IN OUT NOCOPY NUMBER
258 , p_MedTxCrUsedFB_Upd IN OUT NOCOPY NUMBER
259 , p_MedTxCrUsedTA_Upd IN OUT NOCOPY NUMBER
260 , p_MedTxCrUsedBP_Upd IN OUT NOCOPY NUMBER
261 , p_MedTxCrUsedAB_Upd IN OUT NOCOPY NUMBER
262 , p_MedTxCrUsedAP_Upd IN OUT NOCOPY NUMBER
263 , p_MedTxCrUsedPO_Upd IN OUT NOCOPY NUMBER
264 , p_MedTxCrUsedNtgAP_Upd IN OUT NOCOPY NUMBER
265 , p_MedTxCrUsedNtgEEDbt_Upd IN OUT NOCOPY NUMBER
266 , p_MedTxCrAvailable IN NUMBER
267 ) RETURN NUMBER;
268
269 FUNCTION AllowRefund
270 ( p_65Year IN DATE
271 ) RETURN BOOLEAN ;
272
273 END py_za_tx_utl_01032012;