DBA Data[Home] [Help]

PACKAGE: APPS.GMS_BUDGET_UTILS

Source


1 PACKAGE gms_budget_utils AS
2 /* $Header: gmsbubus.pls 120.4 2006/04/11 22:59:58 cmishra noship $ */
3 
4   g_entry_level_code             varchar2(1);
5   g_task_id                      pa_tasks.task_id%TYPE;
6   g_task_number                  pa_tasks.task_name%TYPE;
7 
8   --
9    /****************************************************************
10    This function returns a value 'Y' if the UOM passed is a currency
11    UOM. Otherwise it returns 'N'.
12    ******************************************************************/
13   Function Check_Currency_Uom (x_uom_code in varchar2) return varchar2 ;
14 --	pragma RESTRICT_REFERENCES  (Check_Currency_Uom, WNDS, WNPS );
15 
16    /****************************************************************
17    This function returns the value of budget amount code associated
18    with the budget type. Budget Amount Code determines whether its a
19    cost or a revenue budget.
20    ******************************************************************/
21   Function get_budget_amount_code(x_budget_type_code in varchar2) return varchar2 ;
22 --	pragma RESTRICT_REFERENCES  ( get_budget_amount_code, WNDS, WNPS );
23 
24   procedure get_draft_version_id (x_project_id        in     number,
25                                   x_award_id          in     number,
26                                   x_budget_type_code  in     varchar2,
27                                   x_budget_version_id in out NOCOPY number,
28                                   x_err_code          in out NOCOPY number,
29                                   x_err_stage         in out NOCOPY varchar2,
30                                   x_err_stack         in out NOCOPY varchar2);
31 
32   procedure get_baselined_version_id (x_project_id    in     number,
33                                   x_award_id          in     number,
34                                   x_budget_type_code  in     varchar2,
35                                   x_budget_version_id in out NOCOPY number,
36                                   x_err_code          in out NOCOPY number,
37                                   x_err_stage         in out NOCOPY varchar2,
38                                   x_err_stack         in out NOCOPY varchar2);
39 
40   procedure get_original_version_id (x_project_id    in     number,
41                                   x_award_id          in     number,
42                                   x_budget_type_code  in     varchar2,
43                                   x_budget_version_id in out NOCOPY number,
44                                   x_err_code          in out NOCOPY number,
45                                   x_err_stage         in out NOCOPY varchar2,
46                                   x_err_stack         in out NOCOPY varchar2);
47 
48   procedure get_default_resource_list_id (x_project_id    in     number,
49                                   x_award_id          in     number,
50                                   x_budget_type_code  in     varchar2,
51                                   x_resource_list_id  in out NOCOPY number,
52                                   x_err_code          in out NOCOPY number,
53                                   x_err_stage         in out NOCOPY varchar2,
54                                   x_err_stack         in out NOCOPY varchar2);
55 
56   procedure get_default_entry_method_code (x_project_id       in     number,
57                                   x_budget_type_code          in     varchar2,
58                                   x_budget_entry_method_code  in out NOCOPY varchar2,
59                                   x_err_code                  in out NOCOPY number,
60                                   x_err_stage                 in out NOCOPY varchar2,
61                                   x_err_stack                 in out NOCOPY varchar2);
62 
63   function get_budget_type_code (x_budget_type in varchar2) return varchar2;
64 
65   function get_budget_entry_method_code (x_budget_entry_method in varchar2)
66 						return varchar2;
67 
68   function get_change_reason_code (x_meaning in varchar2) return varchar2;
69 
70   function check_proj_budget_exists (x_project_id in number,
71                                      x_award_id number,
72                                      x_budget_status_code varchar2,
73 				     x_budget_type_code varchar2 default NULL)
74 						return number;
75 
76   function check_task_budget_exists (x_task_id in number,
77                                      x_award_id number,
78                                      x_budget_status_code varchar2,
79 				     x_budget_type_code varchar2 default NULL)
80 						return number;
81 
82   function check_resource_member_level(x_resource_list_member_id in number,
83 				       x_parent_member_id in number,
84 				       x_budget_version_id in number,
85 				       x_task_id in number)
86 						return number;
87 
88   Procedure check_overlapping_dates ( x_budget_version_id in number,
89                                        x_resource_name    in out NOCOPY varchar2,
90                                        x_err_code         in out NOCOPY number);
91 
92   /*-------------------------------------------------------------------+
93    | The get_proj_budget_amount is to get proper budget amount for the |
94    | given project, budget type, and budget version type.	       |
95    |								       |
96    | Parameters:						       |
97    |								       |
98    |	1. x_project_id		project id			       |
99    |	2. x_budget_type	budget type code		       |
100    |	3. x_which_version  	'DRAFT', 'ORIGINAL', or 'CURRENT'.     |
101    |	4. x_revenue_amount	budget revenue			       |
102    |	5. x_raw_cost		budget raw cost			       |
103    |	6. x_burdened_cost	budget burdened cost		       |
104    |	7. x_labor_quantity	budget labor quantity		       |
105    |								       |
106    | The (x_project_id, x_budget_type, x_which_version) input values   |
107    | must be given. The x_which_version value must be one of the       |
108    | above three values (DRAFT/ORIGINAL/CURRENT).		       |
109    |								       |
110    | If there is no budget for the given project or you pass in bad    |
111    | values, the procedure will return $0 budget amount back to the    |
112    | caller. The calling module should handle the error handling.      |
113    +-------------------------------------------------------------------*/
114   procedure get_proj_budget_amount(
115 			      x_project_id 	in	number,
116 			      x_award_id        in      number,
117 			      x_budget_type	in	varchar2,
118 			      x_which_version	in	varchar2,
119                               x_revenue_amount 	out NOCOPY 	real,
120                               x_raw_cost  	out NOCOPY 	real,
121                               x_burdened_cost  	out NOCOPY 	real,
122                               x_labor_quantity 	out NOCOPY 	real);
123 
124   /*-------------------------------------------------------------------+
125    | The get_task_budget_amount is to get proper budget amount for the |
126    | given project, budget type, and budget version type.              |
127    |                                                                   |
128    | Parameters:                                                       |
129    |                                                                   |
130    |    1. x_project_id         project id                             |
131    |    2. x_task_id         	top task id or lowest level task id    |
132    |    3. x_budget_type        budget type code                       |
133    |	4. x_which_version  	'DRAFT', 'ORIGINAL', or 'CURRENT'.     |
134    |    5. x_revenue_amount     budget revenue                         |
135    |    6. x_raw_cost           budget raw cost                        |
136    |    7. x_burdened_cost      budget burdened cost                   |
137    |    8. x_labor_quantity     budget labor quantity                  |
138    |                                                                   |
139    | The (x_project_id, x_budget_type, x_which_version) input values   |
140    | must be given. The x_which_version value must be one of the       |
141    | above three values (DRAFT/ORIGINAL/CURRENT).                      |
142    |                                                                   |
143    | If a mid-level task id is given, it will return $0 budget amount. |
144    | The calling module should handle the error handling.              |
145    | If there is no budget for the given project or you pass in bad    |
146    | values, the procedure will return $0 budget amount back to the    |
147    | caller. The calling module should handle the error handling.      |
148    +-------------------------------------------------------------------*/
149   procedure get_task_budget_amount(
150 			      x_project_id 	in	number,
151 			      x_task_id 	in	number,
152                               x_award_id        in      number,
153 			      x_budget_type	in	varchar2,
154 			      x_which_version	in	varchar2,
155                               x_revenue_amount 	out NOCOPY 	real,
156                               x_raw_cost  	out NOCOPY 	real,
157                               x_burdened_cost  	out NOCOPY 	real,
158                               x_labor_quantity 	out NOCOPY 	real);
159 
160 
161 PROCEDURE Verify_Budget_Rules
162  (p_draft_version_id		IN 	NUMBER
163   , p_mark_as_original  	IN	VARCHAR2
164   , p_event			IN	VARCHAR2
165   , p_project_id		IN	NUMBER
166   , p_award_id  		IN	NUMBER
167   , p_budget_type_code		IN	VARCHAR2
168   , p_resource_list_id		IN	NUMBER
169   , p_project_type_class_code	IN 	VARCHAR2
170   , p_created_by 		IN	NUMBER
171   , p_calling_module		IN	VARCHAR2
172   , p_warnings_only_flag	OUT NOCOPY	VARCHAR2
173   , p_err_msg_count		OUT NOCOPY	NUMBER
174   , p_err_code             	IN OUT NOCOPY	NUMBER
175   , p_err_stage			IN OUT NOCOPY	VARCHAR2
176   , p_err_stack			IN OUT NOCOPY	VARCHAR2
177 );
178 
179   /****************************************************************
180    How to use API - get_project_task_totals:
181    This API can be used to get the totals at the Project Level
182    or at the task level. If x_task_id is passed as a null value then
183    project level totals are fetched. Otherwise task level totals are
184    fetched. For task level totals, first the task level is determined.
185    If the task level is top or intermediate level , then the amounts
186    are rolled from the child tasks.
187   ******************************************************************/
188   procedure get_project_task_totals(x_budget_version_id   in     number,
189                             x_task_id             in     number,
190                             x_quantity_total      in out NOCOPY number,
191                             x_raw_cost_total      in out NOCOPY number,
192                             x_burdened_cost_total in out NOCOPY number,
193                             x_revenue_total       in out NOCOPY number,
194                             x_err_code            in out NOCOPY number,
195                             x_err_stage           in out NOCOPY varchar2,
196                             x_err_stack           in out NOCOPY varchar2) ;
197 
198 
199 
200   Procedure set_entry_level_code(x_entry_level_code in varchar2);
201 
202  PROCEDURE get_valid_period_dates
203 			( x_err_code			OUT NOCOPY	NUMBER
204  			,x_err_stage			OUT NOCOPY	VARCHAR2
205  			,p_project_id			IN	NUMBER
206 			,p_task_id			IN	NUMBER
207 			,p_award_id			IN	NUMBER	-- Added For bug 2200867
208 			,p_time_phased_type_code	IN	VARCHAR2
209 			,p_entry_level_code		IN	VARCHAR2
210 			,p_period_name_in		IN	VARCHAR2
211 			,p_budget_start_date_in	IN	DATE
212 			,p_budget_end_date_in		IN	DATE
213 			,p_period_name_out		OUT NOCOPY	VARCHAR2
214 			,p_budget_start_date_out	OUT NOCOPY	DATE
215 			,p_budget_end_date_out		OUT NOCOPY	DATE	);
216 
217 PROCEDURE check_entry_method_flags
218 			( x_err_code			OUT NOCOPY	NUMBER
219 			,x_err_stage			OUT NOCOPY	VARCHAR2
220 			,p_budget_amount_code		IN	VARCHAR2
221 			,p_budget_entry_method_code	IN	VARCHAR2
222 			,p_quantity			IN	VARCHAR2
223 			,p_raw_cost			IN	VARCHAR2
224 			,p_burdened_cost		IN 	VARCHAR2);
225 
226 
227   Function get_entry_level_code return varchar2;
228 --        pragma RESTRICT_REFERENCES  ( get_entry_level_code, WNDS, WNPS );
229 
230   Procedure set_cross_bg_profile;
231 
232 -- Added the following procedure
233 -- R12 MOAC
234   -- Added the procedure to set single project/OU context.
235   -- Had to add x_err_code to list to accomodate historical procedure standard
236   -- used by the Budget Approval workflow.
237 
238   Procedure Set_Award_Policy_Context
239              (
240               p_award_id                      IN            NUMBER
241               , x_msg_count                     OUT NOCOPY    NUMBER
242               , x_msg_data                      OUT NOCOPY    VARCHAR2
243               , x_return_status                 OUT NOCOPY    VARCHAR2
244               , x_err_code                      OUT NOCOPY    NUMBER
245              );
246 
247 -- Bug 5045636 : Created the procedure get_task_number to fetch the task_name for a particular task_id.
248 FUNCTION get_task_number(P_task_Id  IN NUMBER) RETURN VARCHAR2;
249 
250 END gms_budget_utils ;