DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_FORECASTING_OPTIONS_ALL_PKG

Source


1 PACKAGE BODY pa_forecasting_options_all_pkg AS
2 /* $Header: PARUTFRB.pls 120.3 2005/10/27 06:13:47 nkumbi noship $ */
3 
4 PROCEDURE insert_row (
5     x_rowid                             IN OUT NOCOPY VARCHAR2, --File.Sql.39 bug 4440895
6     x_org_id                            IN     NUMBER,
7   /* Bug 4576715 begin */
8   /*  x_include_admin_proj_flag           IN     VARCHAR2,
9     x_gl_period_flag                    IN     VARCHAR2,
10     x_pa_period_flag                    IN     VARCHAR2, */
11     x_forecast_thru_date                IN     DATE,
12     x_actuals_thru_date                 IN     DATE,
13   /*  x_max_historical_versions           IN     NUMBER,
14     x_util_calc_method                  IN     VARCHAR2, */
15     x_default_assign_exp_typ_class     IN     VARCHAR2,
16     x_default_assign_exp_type           IN     VARCHAR2,
17     x_default_tp_amount_type            IN     VARCHAR2,
18     x_bill_unassign_time_flag           IN     VARCHAR2,
19     x_nonbill_unassign_time_flag        IN     VARCHAR2,
20     x_bill_unassign_proj_id             IN     NUMBER,
21     x_bill_unassign_exp_type_class      IN     VARCHAR2,
22     x_bill_unassign_exp_type            IN     VARCHAR2,
23     x_nonbill_unassign_proj_id          IN     NUMBER,
24     x_nonbill_unassign_exp_typ_cls      IN     VARCHAR2,
25     x_nonbill_unassign_exp_type         IN     VARCHAR2,
26     X_CREATION_DATE                     in     DATE,
27     X_CREATED_BY                        in     NUMBER,
28     X_LAST_UPDATE_DATE                  in     DATE,
29     X_LAST_UPDATED_BY                   in     NUMBER,
30     X_LAST_UPDATE_LOGIN                 in     NUMBER,
31 /*    x_key_member_role_id		in     NUMBER, */
32     x_job_cost_rate_schedule_id		in     NUMBER,
33 /*    x_forecast_class_category		in     VARCHAR2, */
34 /* Bug 4576715 ends */
35     x_org_fcst_period_type              in     VARCHAR2,
36     x_start_period_name                 in     VARCHAR2,
37     x_number_of_periods                 in     NUMBER,
38     x_org_fcst_project_template_id      in     NUMBER,
39     x_weighted_or_full_code             in     VARCHAR2
40   ) AS
41 /*||  Change History :
42   ||  Who             When            What
43   ||  NAVEEN         12-MAR-2001      Passing 3 more parameters namely x_key_member_role_id, x_job_cost_rate_schedule_id
44   ||                                  and x_forecast_class_category to the procedure in order to add data for
45   ||                                  fields key_member_role_id,job_cost_rate_schedule_id,forecast_class_category
46   ||                                  in the table
47   ||  (reverse chronological order - newest change first)
48   */
49     CURSOR c IS
50       SELECT   rowid
51       FROM     pa_forecasting_options_all
52       WHERE  nvl(org_id,-99) = nvl(x_org_id,-99);
53 
54     l_rowid NUMBER;  -- used to restore x_row_id for NOCOPY changes
55 
56   BEGIN
57     l_rowid := x_rowid;
58     INSERT INTO pa_forecasting_options_all (
59       org_id,
60     /* Bug 4576715 begin */
61     /*  include_admin_proj_flag,
62       gl_period_flag,
63       pa_period_flag, */
64       forecast_thru_date,
65       actuals_thru_date,
66      /* max_historical_versions,
67       util_calc_method, */
68       default_assign_exp_type_class,
69       default_assign_exp_type,
70       default_tp_amount_type,
71       bill_unassign_time_flag,
72       nonbill_unassign_time_flag,
73       bill_unassign_proj_id,
74       bill_unassign_exp_type_class,
75       bill_unassign_exp_type,
76       nonbill_unassign_proj_id,
77       nonbill_unassign_exp_typ_cls,
78       nonbill_unassign_exp_type,
79       creation_date,
80       created_by,
81       last_update_date,
82       last_updated_by,
83       last_update_login,
84    /*   key_member_role_id, */
85       job_cost_rate_schedule_id,
86    /*   forecast_class_category, */
87    /* Bug 4576715 ends */
88       org_fcst_period_type,
89       start_period_name,
90       number_of_periods,
91       org_fcst_project_template_id,
92       weighted_or_Full_code
93     ) VALUES (
94       x_org_id,
95     /* Bug 4576715 begins */
96     /*  x_include_admin_proj_flag,
97       x_gl_period_flag,
98       x_pa_period_flag, */
99       x_forecast_thru_date,
100       x_actuals_thru_date,
101    /*   x_max_historical_versions,
102       x_util_calc_method,*/
103       x_default_assign_exp_typ_class,
104       x_default_assign_exp_type,
105       x_default_tp_amount_type,
106       x_bill_unassign_time_flag,
107       x_nonbill_unassign_time_flag,
108       x_bill_unassign_proj_id,
109       x_bill_unassign_exp_type_class,
110       x_bill_unassign_exp_type,
111       x_nonbill_unassign_proj_id,
112       x_nonbill_unassign_exp_typ_cls,
113       x_nonbill_unassign_exp_type,
114       x_last_update_date,
115       x_last_updated_by,
116       x_last_update_date,
117       x_last_updated_by,
118       x_last_update_login,
119    /*   x_key_member_role_id, */
120       x_job_cost_rate_schedule_id,
121    /*   x_forecast_class_category, */
122    /* Bug 4576715 ends */
123       x_org_fcst_period_type,
124       x_start_period_name,
125       x_number_of_periods,
126       x_org_fcst_project_template_id,
127       x_weighted_or_full_code
128     );
129     OPEN c;
130     FETCH c INTO x_rowid;
131     IF (c%NOTFOUND) THEN
132       CLOSE c;
133       RAISE NO_DATA_FOUND;
134     END IF;
135     CLOSE c;
136 
137   EXCEPTION
138     WHEN OTHERS THEN
139       x_rowid := l_rowid;
140       RAISE;
141   END insert_row;
142   PROCEDURE lock_row (
143     x_rowid                             IN     VARCHAR2,
144     x_org_id                            IN     NUMBER,
145     /* Bug 4576715 begins */
146     /* x_include_admin_proj_flag           IN     VARCHAR2,
147     x_gl_period_flag                    IN     VARCHAR2,
148     x_pa_period_flag                    IN     VARCHAR2, */
149     x_forecast_thru_date                IN     DATE,
150     x_actuals_thru_date                 IN     DATE,
151    /* x_max_historical_versions           IN     NUMBER,
152     x_util_calc_method                  IN     VARCHAR2, */
153     x_default_assign_exp_typ_class     IN     VARCHAR2,
154     x_default_assign_exp_type           IN     VARCHAR2,
155     x_default_tp_amount_type            IN     VARCHAR2,
156     x_bill_unassign_time_flag           IN     VARCHAR2,
157     x_nonbill_unassign_time_flag        IN     VARCHAR2,
158     x_bill_unassign_proj_id             IN     NUMBER,
159     x_bill_unassign_exp_type_class      IN     VARCHAR2,
160     x_bill_unassign_exp_type            IN     VARCHAR2,
161     x_nonbill_unassign_proj_id          IN     NUMBER,
162     x_nonbill_unassign_exp_typ_cls      IN     VARCHAR2,
163     x_nonbill_unassign_exp_type         IN     VARCHAR2,
164     X_CREATION_DATE                     in     DATE,
165     X_CREATED_BY                        in     NUMBER,
166     X_LAST_UPDATE_DATE                  in     DATE,
167     X_LAST_UPDATED_BY                   in     NUMBER,
168     X_LAST_UPDATE_LOGIN                 in     NUMBER,
169    /* x_key_member_role_id                in     NUMBER, */
170     x_job_cost_rate_schedule_id         in     NUMBER,
171    /* x_forecast_class_category           in     VARCHAR2, */
172    /* Bug 4576715 ends */
173     x_org_fcst_period_type              in     VARCHAR2,
174     x_start_period_name                 in     VARCHAR2,
175     x_number_of_periods                 in     NUMBER,
176     x_org_fcst_project_template_id      in     NUMBER,
177     x_weighted_or_full_code             in     VARCHAR2
178   ) AS
179   /*
180   ||  Created By :
181   ||  Created On : 16-OCT-2000
182   ||  Purpose : Handles the LOCK mechanism for the table.
183   ||  Known limitations, enhancements or remarks :
184   ||  Change History :
185   ||  Who             When            What
186   ||  NAVEEN         12-MAR-2001      Passing 3 more parameters namely x_key_member_role_id, x_job_cost_rate_schedule_id
187   ||                                  and x_forecast_class_category to the procedure in order to pass values for
188   ||                                  fields key_member_role_id,job_cost_rate_schedule_id,forecast_class_category
189   ||  (reverse chronological order - newest change first)
190   */
191     CURSOR c1 IS
192       SELECT
193         org_id,
194        /* Bug 4576715 begin */
195        /* include_admin_proj_flag,
196         gl_period_flag,
197         pa_period_flag, */
198         forecast_thru_date,
199         actuals_thru_date,
200         /* max_historical_versions,
201         util_calc_method, */
202         default_assign_exp_type_class,
203         default_assign_exp_type,
204         default_tp_amount_type,
205         bill_unassign_time_flag,
206         nonbill_unassign_time_flag,
207         bill_unassign_proj_id,
208         bill_unassign_exp_type_class,
209         bill_unassign_exp_type,
210         nonbill_unassign_proj_id,
211         nonbill_unassign_exp_typ_cls,
212         nonbill_unassign_exp_type,
213         /* key_member_role_id, */
214         job_cost_rate_schedule_id,
215         /* forecast_class_category, */
216 	/* Bug 4576715 ends */
217         org_fcst_period_type,
218         start_period_name,
219         number_of_periods,
220         org_fcst_project_template_id,
221         weighted_or_full_code
222       FROM  pa_forecasting_options_all
223       WHERE rowid = x_rowid
224       FOR UPDATE NOWAIT;
225     tlinfo c1%ROWTYPE;
226   BEGIN
227     OPEN c1;
228     FETCH c1 INTO tlinfo;
229     IF (c1%notfound) THEN
230       fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
231       CLOSE c1;
232       app_exception.raise_exception;
233       RETURN;
234     END IF;
235     CLOSE c1;
236     IF (
237         (nvl(tlinfo.org_id,-99) = nvl(x_org_id,-99))
238       --  AND (tlinfo.include_admin_proj_flag = x_include_admin_proj_flag) Bug 4576715
239       --  AND (tlinfo.gl_period_flag = x_gl_period_flag) Bug 4576715
240       --  AND (tlinfo.pa_period_flag = x_pa_period_flag) Bug 4576715
241         AND (tlinfo.forecast_thru_date = x_forecast_thru_date)
242         AND (tlinfo.actuals_thru_date  = x_actuals_thru_date)
243        -- AND (tlinfo.max_historical_versions = x_max_historical_versions) Bug 4576715
244        -- AND (tlinfo.util_calc_method = x_util_calc_method) Bug 4576715
245         AND (tlinfo.default_assign_exp_type_class = x_default_assign_exp_typ_class)
246         AND (tlinfo.default_assign_exp_type = x_default_assign_exp_type)
247         AND (tlinfo.default_tp_amount_type = x_default_tp_amount_type)
248         AND (tlinfo.bill_unassign_time_flag = x_bill_unassign_time_flag)
249         AND (tlinfo.nonbill_unassign_time_flag = x_nonbill_unassign_time_flag)
250        -- AND (tlinfo.key_member_role_id = x_key_member_role_id) Bug 4576715
251         AND (tlinfo.job_cost_rate_schedule_id = x_job_cost_rate_schedule_id)
252        -- AND (tlinfo.forecast_class_category = x_forecast_class_category) Bug 4576715
253         AND (tlinfo.org_fcst_period_type = x_org_fcst_period_Type)
254         AND (tlinfo.start_period_name = x_start_period_name)
255         AND (tlinfo.number_of_periods = x_number_of_periods)
256         AND (tlinfo.org_fcst_project_template_id = x_org_fcst_project_template_id)
257         AND (tlinfo.weighted_or_full_code = x_weighted_or_full_code)
258         AND ((tlinfo.bill_unassign_proj_id = x_bill_unassign_proj_id) OR ((tlinfo.bill_unassign_proj_id IS NULL) AND (X_bill_unassign_proj_id IS NULL)))
259         AND ((tlinfo.bill_unassign_exp_type_class = x_bill_unassign_exp_type_class) OR ((tlinfo.bill_unassign_exp_type_class IS NULL) AND (X_bill_unassign_exp_type_class IS NULL)))
260         AND ((tlinfo.bill_unassign_exp_type = x_bill_unassign_exp_type) OR ((tlinfo.bill_unassign_exp_type IS NULL) AND (X_bill_unassign_exp_type IS NULL)))
261         AND ((tlinfo.nonbill_unassign_proj_id = x_nonbill_unassign_proj_id) OR ((tlinfo.nonbill_unassign_proj_id IS NULL) AND (X_nonbill_unassign_proj_id IS NULL)))
262         AND ((tlinfo.nonbill_unassign_exp_typ_cls = x_nonbill_unassign_exp_typ_cls) OR ((tlinfo.nonbill_unassign_exp_typ_cls IS NULL) AND (X_nonbill_unassign_exp_typ_cls IS NULL)))
263         AND ((tlinfo.nonbill_unassign_exp_type = x_nonbill_unassign_exp_type) OR ((tlinfo.nonbill_unassign_exp_type IS NULL) AND (X_nonbill_unassign_exp_type IS NULL)))
264        ) THEN
265       NULL;
266     ELSE
267       fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
268       app_exception.raise_exception;
269     END IF;
270     RETURN;
271   END lock_row;
272   PROCEDURE update_row (
273     x_rowid                             IN     VARCHAR2,
274     x_org_id                            IN     NUMBER,
275    /* Bug 4576715 begin */
276    /* x_include_admin_proj_flag           IN     VARCHAR2,
277     x_gl_period_flag                    IN     VARCHAR2,
278     x_pa_period_flag                    IN     VARCHAR2, */
279     x_forecast_thru_date                IN     DATE,
280     x_actuals_thru_date                 IN     DATE,
281    /*   x_max_historical_versions           IN     NUMBER,
282     x_util_calc_method                  IN     VARCHAR2, */
283     x_default_assign_exp_typ_class     IN     VARCHAR2,
284     x_default_assign_exp_type           IN     VARCHAR2,
285     x_default_tp_amount_type            IN     VARCHAR2,
286     x_bill_unassign_time_flag           IN     VARCHAR2,
287     x_nonbill_unassign_time_flag        IN     VARCHAR2,
288     x_bill_unassign_proj_id             IN     NUMBER,
289     x_bill_unassign_exp_type_class      IN     VARCHAR2,
290     x_bill_unassign_exp_type            IN     VARCHAR2,
291     x_nonbill_unassign_proj_id          IN     NUMBER,
292     x_nonbill_unassign_exp_typ_cls      IN     VARCHAR2,
293     x_nonbill_unassign_exp_type         IN     VARCHAR2,
294     X_CREATION_DATE                     in     DATE,
295     X_CREATED_BY                        in     NUMBER,
296     X_LAST_UPDATE_DATE                  in     DATE,
297     X_LAST_UPDATED_BY                   in     NUMBER,
298     X_LAST_UPDATE_LOGIN                 in     NUMBER,
299     /* x_key_member_role_id                in     NUMBER, */
300     x_job_cost_rate_schedule_id         in     NUMBER,
301     /* x_forecast_class_category           in     VARCHAR2, */
302     /* Bug 4576715 ends */
303     x_org_fcst_period_type              in     VARCHAR2,
304     x_start_period_name                 in     VARCHAR2,
305     x_number_of_periods                 in     NUMBER,
306     x_org_fcst_project_template_id      in     NUMBER,
307     x_weighted_or_full_code             in     VARCHAR2
308   ) AS
309   /*
310   ||  Created By :
311   ||  Created On : 16-OCT-2000
312   ||  Purpose : Handles the UPDATE DML logic for the table.
313   ||  Known limitations, enhancements or remarks :
314   ||  Change History :
315   ||  Who             When            What
316   ||  NAVEEN	     12-MAR-2001      Passing 3 more parameters namely x_key_member_role_id, x_job_cost_rate_schedule_id
317   ||                                  and x_forecast_class_category to the procedure in order to update
318   ||                                  fields key_member_role_id,job_cost_rate_schedule_id,forecast_class_category
319   ||                                  in the table
320   ||  (reverse chronological order - newest change first)
321   */
322   BEGIN
323     UPDATE pa_forecasting_options_all
324       SET
325         org_id                            = x_org_id,
326 	/* Bug 4576715 begin */
327         /* include_admin_proj_flag           = x_include_admin_proj_flag,
328         gl_period_flag                    = x_gl_period_flag,
329         pa_period_flag                    = x_pa_period_flag, */
330         forecast_thru_date                = x_forecast_thru_date,
331         actuals_thru_date                 = x_actuals_thru_date,
332         /* max_historical_versions           = x_max_historical_versions,
333         util_calc_method                  = x_util_calc_method, */
334         default_assign_exp_type_class     = x_default_assign_exp_typ_class,
335         default_assign_exp_type           = x_default_assign_exp_type,
336         default_tp_amount_type            = x_default_tp_amount_type,
337         bill_unassign_time_flag           = x_bill_unassign_time_flag,
338         nonbill_unassign_time_flag        = x_nonbill_unassign_time_flag,
339         bill_unassign_proj_id             = x_bill_unassign_proj_id,
340         bill_unassign_exp_type_class      = x_bill_unassign_exp_type_class,
341         bill_unassign_exp_type            = x_bill_unassign_exp_type,
342         nonbill_unassign_proj_id          = x_nonbill_unassign_proj_id,
343         nonbill_unassign_exp_typ_cls      = x_nonbill_unassign_exp_typ_cls,
344         nonbill_unassign_exp_type         = x_nonbill_unassign_exp_type,
345         last_update_date                  = x_last_update_date,
346         last_updated_by                   = x_last_updated_by,
347         last_update_login                 = x_last_update_login,
348         /* key_member_role_id		  = x_key_member_role_id, */
349         job_cost_rate_schedule_id	  = x_job_cost_rate_schedule_id,
350         /* forecast_class_category           = x_forecast_class_category, */
351 	/* Bug 4576715 ends */
352         org_fcst_period_type              = x_org_fcst_period_type,
353         start_period_name                 = x_start_period_name,
354         number_of_periods                 = x_number_of_periods,
355         org_fcst_project_template_id      = x_org_fcst_project_template_id,
356         weighted_or_full_code             = x_weighted_or_full_code
357       WHERE rowid = x_rowid;
358     IF (SQL%NOTFOUND) THEN
359       RAISE NO_DATA_FOUND;
360     END IF;
361   END update_row;
362   PROCEDURE delete_row ( x_rowid          IN     VARCHAR2  ) AS
363   /*
364   ||  Created By :
365   ||  Created On : 16-OCT-2000
369   ||  Who             When            What
366   ||  Purpose : Handles the DELETE DML logic for the table.
367   ||  Known limitations, enhancements or remarks :
368   ||  Change History :
370   ||  (reverse chronological order - newest change first)
371   */
372   BEGIN
373     DELETE FROM pa_forecasting_options_all
374     WHERE rowid = x_rowid;
375     IF (SQL%NOTFOUND) THEN
376       RAISE NO_DATA_FOUND;
377     END IF;
378   END delete_row;
379 END pa_forecasting_options_all_pkg;