1 package pay_gb_nicar_06042002 AUTHID CURRENT_USER as
2 /* $Header: pygbncpl.pkh 115.8 2002/12/09 18:35:57 rmakhija noship $
3 ******************************************************************
4 * *
5 * Copyright (C) 1989 Oracle Corporation UK Ltd., *
6 * Richmond, England. *
7 * *
8 * All rights reserved. *
9 * *
10 * This material has been provided pursuant to an agreement *
11 * containing restrictions on its use. The material is also *
12 * protected by copyright law. No part of this material may *
13 * be copied or distributed, transmitted or transcribed, in *
14 * any form or by any means, electronic, mechanical, magnetic, *
15 * manual, or otherwise, or disclosed to third parties without *
16 * the express written permission of Oracle Corporation UK Ltd, *
17 * Oracle Park, Bittams Lane, Guildford Road, Chertsey, Surrey, *
18 * England. *
19 * *
20 ******************************************************************
21
22 Name : pay_gb_nicar_2002
23
24 Description : This package contains calculations for use in processing
25 of NI Car Primary and Secondary elements
26
27 Uses :
28
29 Used By : NI Car fast formulas for tax year 2002/3
30
31
32 Change List :
33
34 Version Date Author Description
35 ------- ----- -------- ----------------
36
37 115.0 20/8/01 GBUTLER Created
38 115.1 04/12/01 vmkhande Modified some functions
39 such that they can be used to
40 do the calculation for P11D element
41 verifications
42 115.4 18/1/02 GButler Added nicar_main procedure; this is now
43 called by NI Car fast formulas. Also
44 removed specific parameters for P11d as
45 no longer required. Removed get_next_pay_date
46 function
47 115.5 24/4/02 GButler Removed p_message parameter from
48 nicar_nicable_value_non_co2 as obsolete
49 following updates to message handling
50 115.6 10/5/02 GButler Replaced p_message parameter as used
51 by P11D calculation
52 115.7 29/11/02 RMAKHIJA added Whenever OSERROR on the rop
53 115.8 09/12/02 RMAKHIJA Added NOCOPY to out parameters to fix GSCC warning
54 */
55
56 /* Function to calculate taxable / NICable value based on CO2 emissions data for car */
57 /* Parameters p_business_group_id, p_assignment_id, p_element_type_id provided by */
58 /* context-set variables */
59 function nicar_nicable_value_CO2
60 ( p_assignment_id IN NUMBER,
61 p_element_type_id IN NUMBER,
62 p_business_group_id IN NUMBER,
63 /* Import direct from fast formula */
64 p_car_price IN NUMBER,
65 p_reg_date IN DATE,
66 p_fuel_type IN VARCHAR2,
67 p_engine_size IN NUMBER,
68 p_fuel_scale IN NUMBER DEFAULT NULL,
69 p_payment IN NUMBER,
70 p_CO2_emissions IN NUMBER DEFAULT NULL,
71 p_start_date IN DATE,
72 p_end_date IN DATE,
73 p_end_of_period_date IN DATE,
74 p_emp_term_date IN DATE,
75 p_session_date IN DATE,
76 p_message OUT NOCOPY VARCHAR2,
77 p_number_of_days IN NUMBER DEFAULT 0)
78 return NUMBER;
79
80
81 /* Function to calculate taxable / NICable value based on engine capacity for cars without */
82 /* approved CO2 emissions ratings */
83 /* Parameter p_business_group_id provided by context-set variable */
84 function nicar_nicable_value_non_CO2
85 ( p_assignment_id IN NUMBER,
86 p_element_type_id IN NUMBER,
87 p_business_group_id IN NUMBER,
88 /* Import direct from fast formula */
89 p_car_price IN NUMBER,
90 p_reg_date IN DATE,
91 p_fuel_type IN VARCHAR2,
92 p_engine_size IN NUMBER,
93 p_fuel_scale IN NUMBER DEFAULT NULL,
94 p_payment IN NUMBER,
95 p_start_date IN DATE,
96 p_end_date IN DATE,
97 p_end_of_period_date IN DATE,
98 p_emp_term_date IN DATE,
99 p_session_date IN DATE,
100 p_message OUT NOCOPY VARCHAR2,
101 p_number_of_days IN NUMBER DEFAULT 0)
102 return NUMBER;
103
104 /* Round CO2 emissions figure down to nearest multiple of 5 */
105 function round_CO2_val
106 (p_value IN NUMBER)
107 return NUMBER;
108
109 /* Return applicable percentage charge based on CO2 emissions for car */
110 function get_CO2_percentage
111 (p_business_group_id IN NUMBER,
112 p_co2_emissions IN NUMBER,
113 p_session_date IN DATE)
114 return NUMBER;
115
116
117 /* Return applicable percentage based on engine size */
118 function get_cc_percentage
119 ( p_business_group_id IN NUMBER,
120 p_engine_size IN NUMBER,
121 p_reg_date IN DATE,
122 p_session_date IN DATE)
123 return NUMBER;
124
125 /* Return fixed discount percentage for certain alternative fuel cars */
126 function get_discount
127 ( p_fuel_type IN VARCHAR2,
128 p_session_date IN DATE)
129 return NUMBER;
130
131
132 /* Primary function for pay_gb_nicar_06042002 */
133 /* Called by fast formula and NI Car Detail report */
134 /* Calls nicar_nicable_value_CO2 and nicar_nicable_value_non_CO2 as appropriate */
135 function nicar_main
136 ( /* Context set parameters */
137 p_assignment_id IN number,
138 p_element_type_id IN number,
139 p_business_group_id IN number,
140 /* Fast formula parameters */
141 p_pay_periods_per_year IN number,
142 p_curr_payroll_period IN number,
143 p_curr_payroll_period_end_date IN date,
144 p_emp_term_date IN date,
145 p_session_date IN date,
146 /* OUT parameter */
147 p_message_1 OUT NOCOPY varchar2,
148 p_message_2 OUT NOCOPY varchar2,
149 p_message_3 OUT NOCOPY varchar2,
150 p_message_4 OUT NOCOPY varchar2)
151 return number;
152
153
154 /* End of package */
155 end pay_gb_nicar_06042002;