1 PACKAGE BODY CSD_ANALYSIS_PVT AS
2 /* $Header: csdvanab.pls 115.0 2002/11/19 22:29:09 swai noship $ */
3
4 G_PKG_NAME CONSTANT VARCHAR2(30) := 'CSD_ANALYSIS_PVT';
5 G_FILE_NAME CONSTANT VARCHAR2(12) := 'csdvanab.pls';
6 l_debug NUMBER := fnd_profile.value('CSD_DEBUG_LEVEL');
7
8 /*----------------------------------------------------------------*/
9 /* procedure name: Get_TotalActCharges */
10 /* description : procedure used to get total actual charges */
11 /* */
12 /* p_api_version Standard IN param */
13 /* p_commit Standard IN param */
14 /* p_init_msg_list Standard IN param */
15 /* p_validation_level Standard IN param */
16 /* p_repair_line_id Repair Line ID to get act charges */
17 /* x_charges Total MLE charges for repair line */
18 /* x_return_status Standard OUT param */
19 /* x_msg_count Standard OUT param */
20 /* x_msg_data Standard OUT param */
21 /* */
22 /*----------------------------------------------------------------*/
23 PROCEDURE Get_TotalActCharges
24 (
25 p_api_version IN NUMBER,
26 p_commit IN VARCHAR2,
27 p_init_msg_list IN VARCHAR2,
28 p_validation_level IN NUMBER,
29 p_repair_line_id IN NUMBER,
30 x_charges OUT NOCOPY CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
31 x_return_status OUT NOCOPY VARCHAR2,
32 x_msg_count OUT NOCOPY NUMBER,
33 x_msg_data OUT NOCOPY VARCHAR2
34 )
35 IS
36 l_api_name CONSTANT VARCHAR2(30) := 'Get_TotalActCharges';
37 l_api_version CONSTANT NUMBER := 1.0;
38 BEGIN
39 -- Standard Start of API savepoint
40 SAVEPOINT Get_TotalActCharges_Pvt;
41
42 -- Standard call to check for call compatibility.
43 IF NOT FND_API.Compatible_API_Call (l_api_version,
44 p_api_version,
45 l_api_name,
46 G_PKG_NAME)
47 THEN
48 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
49 END IF;
50
51 -- Initialize message list if p_init_msg_list is set to TRUE.
52 IF FND_API.to_Boolean(p_init_msg_list) THEN
53 FND_MSG_PUB.initialize;
54 END IF;
55
56 -- Initialize API return status to success
57 x_return_status := FND_API.G_RET_STS_SUCCESS;
58
59 --
60 -- Begin API Body
61 --
62
63 --
64 -- End API Body
65 --
66
67 -- Standard check of p_commit.
68 IF FND_API.To_Boolean( p_commit ) THEN
69 COMMIT WORK;
70 END IF;
71
72 -- Standard call to get message count and IF count is get message info.
73 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
74 p_data => x_msg_data );
75 EXCEPTION
76 WHEN FND_API.G_EXC_ERROR THEN
77 ROLLBACK TO Get_TotalActCharges_Pvt;
78 x_return_status := FND_API.G_RET_STS_ERROR ;
79 FND_MSG_PUB.Count_And_Get
80 (p_count => x_msg_count,
81 p_data => x_msg_data
82 );
83 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
84 ROLLBACK TO Get_TotalActCharges_Pvt;
85 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
86 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
87 p_data => x_msg_data );
88 WHEN OTHERS THEN
89 ROLLBACK TO Get_TotalActCharges_Pvt;
90 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
91 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
92 THEN
93 FND_MSG_PUB.Add_Exc_Msg (G_PKG_NAME ,
94 l_api_name );
95 END IF;
96 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
97 p_data => x_msg_data );
98 END Get_TotalActCharges;
99
100 /*----------------------------------------------------------------*/
101 /* procedure name: Get_TotalEstCharges */
102 /* description : procedure used to get total estimated charges */
103 /* */
104 /* p_api_version Standard IN param */
105 /* p_commit Standard IN param */
106 /* p_init_msg_list Standard IN param */
107 /* p_validation_level Standard IN param */
108 /* p_estimate_header_id Est Header ID to get est charges */
109 /* x_charges Total MLE charges for repair line */
110 /* x_return_status Standard OUT param */
111 /* x_msg_count Standard OUT param */
112 /* x_msg_data Standard OUT param */
113 /* */
114 /*----------------------------------------------------------------*/
115 PROCEDURE Get_TotalEstCharges
116 (
117 p_api_version IN NUMBER,
118 p_commit IN VARCHAR2,
119 p_init_msg_list IN VARCHAR2,
120 p_validation_level IN NUMBER,
121 p_estimate_header_id IN NUMBER,
122 x_charges OUT NOCOPY CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
123 x_return_status OUT NOCOPY VARCHAR2,
124 x_msg_count OUT NOCOPY NUMBER,
125 x_msg_data OUT NOCOPY VARCHAR2
126 )
127 IS
128 l_api_name CONSTANT VARCHAR2(30) := 'Get_TotalEstCharges';
129 l_api_version CONSTANT NUMBER := 1.0;
130 BEGIN
131 -- Standard Start of API savepoint
132 SAVEPOINT Get_TotalEstCharges_Pvt;
133
134 -- Standard call to check for call compatibility.
135 IF NOT FND_API.Compatible_API_Call (l_api_version,
136 p_api_version,
137 l_api_name,
138 G_PKG_NAME)
139 THEN
140 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
141 END IF;
142
143 -- Initialize message list if p_init_msg_list is set to TRUE.
144 IF FND_API.to_Boolean(p_init_msg_list) THEN
145 FND_MSG_PUB.initialize;
146 END IF;
147
148 -- Initialize API return status to success
149 x_return_status := FND_API.G_RET_STS_SUCCESS;
150
151 --
152 -- Begin API Body
153 --
154
155 --
156 -- End API Body
157 --
158
159 -- Standard check of p_commit.
160 IF FND_API.To_Boolean( p_commit ) THEN
161 COMMIT WORK;
162 END IF;
163
164 -- Standard call to get message count and IF count is get message info.
165 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
166 p_data => x_msg_data );
167 EXCEPTION
168 WHEN FND_API.G_EXC_ERROR THEN
169 ROLLBACK TO Get_TotalEstCharges_Pvt;
170 x_return_status := FND_API.G_RET_STS_ERROR ;
171 FND_MSG_PUB.Count_And_Get
172 (p_count => x_msg_count,
173 p_data => x_msg_data
174 );
175 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
176 ROLLBACK TO Get_TotalEstCharges_Pvt;
177 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
178 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
179 p_data => x_msg_data );
180 WHEN OTHERS THEN
181 ROLLBACK TO Get_TotalEstCharges_Pvt;
182 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
183 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
184 THEN
185 FND_MSG_PUB.Add_Exc_Msg (G_PKG_NAME ,
186 l_api_name );
187 END IF;
188 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
189 p_data => x_msg_data );
190 END Get_TotalEstCharges;
191
192 /*----------------------------------------------------------------*/
193 /* procedure name: Compare_EstChargesAndCosts */
194 /* description : procedure used to compare estimated charges to */
195 /* estimated costs */
196 /* */
197 /* p_api_version Standard IN param */
198 /* p_commit Standard IN param */
199 /* p_init_msg_list Standard IN param */
200 /* p_validation_level Standard IN param */
201 /* p_estimate_header_id Est Header ID to get est charges */
202 /* p_charges Total MLE charges for estimate */
203 /* x_costs MLE Costs for estimate */
204 /* x_profit MLE Profit */
205 /* x_profit_margin MLE Profit Margin (%) */
206 /* x_return_status Standard OUT param */
207 /* x_msg_count Standard OUT param */
208 /* x_msg_data Standard OUT param */
209 /* */
210 /*----------------------------------------------------------------*/
211 PROCEDURE Compare_EstChargesAndCosts
212 (
213 p_api_version IN NUMBER,
214 p_commit IN VARCHAR2,
215 p_init_msg_list IN VARCHAR2,
216 p_validation_level IN NUMBER,
217 p_estimate_header_id IN NUMBER,
218 p_charges IN CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
219 x_costs OUT NOCOPY CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
220 x_profit OUT NOCOPY CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
221 x_profit_margin OUT NOCOPY CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
222 x_return_status OUT NOCOPY VARCHAR2,
223 x_msg_count OUT NOCOPY NUMBER,
224 x_msg_data OUT NOCOPY VARCHAR2
225 )
226 IS
227 l_api_name CONSTANT VARCHAR2(30) := 'Compare_EstChargesAndCosts';
228 l_api_version CONSTANT NUMBER := 1.0;
229 BEGIN
230 -- Standard Start of API savepoint
231 SAVEPOINT Compare_EstChargesAndCosts_Pvt;
232
233 -- Standard call to check for call compatibility.
234 IF NOT FND_API.Compatible_API_Call (l_api_version,
235 p_api_version,
236 l_api_name,
237 G_PKG_NAME)
238 THEN
239 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
240 END IF;
241
242 -- Initialize message list if p_init_msg_list is set to TRUE.
243 IF FND_API.to_Boolean(p_init_msg_list) THEN
244 FND_MSG_PUB.initialize;
245 END IF;
246
247 -- Initialize API return status to success
248 x_return_status := FND_API.G_RET_STS_SUCCESS;
249
250 --
251 -- Begin API Body
252 --
253
254 --
255 -- End API Body
256 --
257
258 -- Standard check of p_commit.
259 IF FND_API.To_Boolean( p_commit ) THEN
260 COMMIT WORK;
261 END IF;
262
263 -- Standard call to get message count and IF count is get message info.
264 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
265 p_data => x_msg_data );
266 EXCEPTION
267 WHEN FND_API.G_EXC_ERROR THEN
268 ROLLBACK TO Compare_EstChargesAndCosts_Pvt;
269 x_return_status := FND_API.G_RET_STS_ERROR ;
270 FND_MSG_PUB.Count_And_Get
271 (p_count => x_msg_count,
272 p_data => x_msg_data
273 );
274 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
275 ROLLBACK TO Compare_EstChargesAndCosts_Pvt;
276 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
277 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
278 p_data => x_msg_data );
279 WHEN OTHERS THEN
280 ROLLBACK TO Compare_EstChargesAndCosts_Pvt;
281 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
282 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
283 THEN
284 FND_MSG_PUB.Add_Exc_Msg (G_PKG_NAME ,
285 l_api_name );
286 END IF;
287 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
288 p_data => x_msg_data );
289 END Compare_EstChargesAndCosts;
290
291 /*----------------------------------------------------------------*/
292 /* procedure name: Compare_ActChargesAndCosts */
293 /* description : procedure used to compare actual charges to */
294 /* actual costs */
295 /* */
296 /* p_api_version Standard IN param */
297 /* p_commit Standard IN param */
298 /* p_init_msg_list Standard IN param */
299 /* p_validation_level Standard IN param */
300 /* p_repair_line_id Repair Line ID to get act charges */
301 /* p_charges Total MLE charges for actuals */
302 /* x_costs MLE Costs for estimate */
306 /* x_msg_count Standard OUT param */
303 /* x_profit MLE Profit */
304 /* x_profit_margin MLE Profit Margin (%) */
305 /* x_return_status Standard OUT param */
307 /* x_msg_data Standard OUT param */
308 /* */
309 /*----------------------------------------------------------------*/
310 PROCEDURE Compare_ActChargesAndCosts
311 (
312 p_api_version IN NUMBER,
313 p_commit IN VARCHAR2,
314 p_init_msg_list IN VARCHAR2,
315 p_validation_level IN NUMBER,
316 p_repair_line_id IN NUMBER,
317 p_charges IN CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
318 x_costs OUT NOCOPY CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
319 x_profit OUT NOCOPY CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
320 x_profit_margin OUT NOCOPY CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
321 x_return_status OUT NOCOPY VARCHAR2,
322 x_msg_count OUT NOCOPY NUMBER,
323 x_msg_data OUT NOCOPY VARCHAR2
324 )
325 IS
326 l_api_name CONSTANT VARCHAR2(30) := 'Compare_ActChargesAndCosts';
327 l_api_version CONSTANT NUMBER := 1.0;
328 BEGIN
329 -- Standard Start of API savepoint
330 SAVEPOINT Compare_ActChargesAndCosts_Pvt;
331
332 -- Standard call to check for call compatibility.
333 IF NOT FND_API.Compatible_API_Call (l_api_version,
334 p_api_version,
335 l_api_name,
336 G_PKG_NAME)
337 THEN
338 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
339 END IF;
340
341 -- Initialize message list if p_init_msg_list is set to TRUE.
342 IF FND_API.to_Boolean(p_init_msg_list) THEN
343 FND_MSG_PUB.initialize;
344 END IF;
345
346 -- Initialize API return status to success
347 x_return_status := FND_API.G_RET_STS_SUCCESS;
348
349 --
350 -- Begin API Body
351 --
352
353 --
354 -- End API Body
355 --
356
357 -- Standard check of p_commit.
358 IF FND_API.To_Boolean( p_commit ) THEN
359 COMMIT WORK;
360 END IF;
361
362 -- Standard call to get message count and IF count is get message info.
363 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
364 p_data => x_msg_data );
365 EXCEPTION
366 WHEN FND_API.G_EXC_ERROR THEN
367 ROLLBACK TO Compare_ActChargesAndCosts_Pvt;
368 x_return_status := FND_API.G_RET_STS_ERROR ;
369 FND_MSG_PUB.Count_And_Get
370 (p_count => x_msg_count,
371 p_data => x_msg_data
372 );
373 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
374 ROLLBACK TO Compare_ActChargesAndCosts_Pvt;
375 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
376 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
377 p_data => x_msg_data );
378 WHEN OTHERS THEN
379 ROLLBACK TO Compare_ActChargesAndCosts_Pvt;
380 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
381 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
382 THEN
383 FND_MSG_PUB.Add_Exc_Msg (G_PKG_NAME ,
384 l_api_name );
385 END IF;
386 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
387 p_data => x_msg_data );
388 END Compare_ActChargesAndCosts;
389
390 /*----------------------------------------------------------------*/
391 /* procedure name: Compare_ActChargesAndCosts */
392 /* description : procedure used to compare actual charges to */
393 /* actual costs */
394 /* */
395 /* p_api_version Standard IN param */
396 /* p_commit Standard IN param */
397 /* p_init_msg_list Standard IN param */
398 /* p_validation_level Standard IN param */
399 /* p_repair_line_id Repair Line ID to get act charges */
400 /* p_charges Total MLE charges for actuals */
401 /* x_costs MLE Costs for estimate */
402 /* x_profit MLE Profit */
403 /* x_profit_margin MLE Profit Margin (%) */
404 /* x_return_status Standard OUT param */
405 /* x_msg_count Standard OUT param */
406 /* x_msg_data Standard OUT param */
407 /* */
408 /*----------------------------------------------------------------*/
409 PROCEDURE Compare_EstAndActCharges
410 (
411 p_api_version IN NUMBER,
412 p_commit IN VARCHAR2,
413 p_init_msg_list IN VARCHAR2,
414 p_validation_level IN NUMBER,
415 p_estimate_header_id IN NUMBER,
416 p_repair_line_id IN NUMBER,
417 p_act_charges IN CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
418 x_est_charges IN CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
419 x_diff OUT NOCOPY CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
420 x_pct_diff OUT NOCOPY CSD_ANALYSIS_UTIL.MLE_TOTALS_REC_TYPE,
421 x_return_status OUT NOCOPY VARCHAR2,
422 x_msg_count OUT NOCOPY NUMBER,
423 x_msg_data OUT NOCOPY VARCHAR2
427 l_api_version CONSTANT NUMBER := 1.0;
424 )
425 IS
426 l_api_name CONSTANT VARCHAR2(30) := 'Compare_EstAndActCharges';
428 BEGIN
429 -- Standard Start of API savepoint
430 SAVEPOINT Compare_EstAndActCharges_Pvt;
431
432 -- Standard call to check for call compatibility.
433 IF NOT FND_API.Compatible_API_Call (l_api_version,
434 p_api_version,
435 l_api_name,
436 G_PKG_NAME)
437 THEN
438 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
439 END IF;
440
441 -- Initialize message list if p_init_msg_list is set to TRUE.
442 IF FND_API.to_Boolean(p_init_msg_list) THEN
443 FND_MSG_PUB.initialize;
444 END IF;
445
446 -- Initialize API return status to success
447 x_return_status := FND_API.G_RET_STS_SUCCESS;
448
449 --
450 -- Begin API Body
451 --
452
453 --
454 -- End API Body
455 --
456
457 -- Standard check of p_commit.
458 IF FND_API.To_Boolean( p_commit ) THEN
459 COMMIT WORK;
460 END IF;
461
462 -- Standard call to get message count and IF count is get message info.
463 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
464 p_data => x_msg_data );
465 EXCEPTION
466 WHEN FND_API.G_EXC_ERROR THEN
467 ROLLBACK TO Compare_EstAndActCharges_Pvt;
468 x_return_status := FND_API.G_RET_STS_ERROR ;
469 FND_MSG_PUB.Count_And_Get
470 (p_count => x_msg_count,
471 p_data => x_msg_data
472 );
473 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
474 ROLLBACK TO Compare_EstAndActCharges_Pvt;
475 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
476 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
477 p_data => x_msg_data );
478 WHEN OTHERS THEN
479 ROLLBACK TO Compare_EstAndActCharges_Pvt;
480 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
481 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
482 THEN
483 FND_MSG_PUB.Add_Exc_Msg (G_PKG_NAME ,
484 l_api_name );
485 END IF;
486 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
487 p_data => x_msg_data );
488 END Compare_EstAndActCharges;
489
490 /*----------------------------------------------------------------*/
491 /* procedure name: Get_InvItemCostAnalysis */
492 /* description : procedure used get item cost, extended cost, */
493 /* profit, and profit margin (%) */
494 /* for an inventory item */
495 /* */
496 /* p_api_version Standard IN param */
497 /* p_commit Standard IN param */
498 /* p_init_msg_list Standard IN param */
499 /* p_validation_level Standard IN param */
500 /* p_inventory_item_id Inventory Item ID */
501 /* p_quantity Quantity of Inventory Items */
502 /* p_organization_id Inventory Organization ID */
503 /* p_charge_amt Total Charge Amt to compare to */
504 /* p_currency_code Currency of Charge Amt */
505 /* x_item_cost Item cost of Inv Item */
506 /* x_total_cost Extended cost of Inv Item */
507 /* x_profit x_total_cost - p_charge_amt */
508 /* x_profit_margin x_profit*100/x_item_cost */
509 /* x_return_status Standard OUT param */
510 /* x_msg_count Standard OUT param */
511 /* x_msg_data Standard OUT param */
512 /* */
513 /*----------------------------------------------------------------*/
514 PROCEDURE Get_InvItemCostAnalysis
515 (
516 p_api_version IN NUMBER,
517 p_commit IN VARCHAR2,
518 p_init_msg_list IN VARCHAR2,
519 p_validation_level IN NUMBER,
520 p_inventory_item_id IN NUMBER,
521 p_quantity IN NUMBER,
522 p_organization_id IN NUMBER,
523 p_charge_amt IN NUMBER,
524 p_currency_code IN VARCHAR2,
525 x_item_cost OUT NOCOPY NUMBER,
526 x_total_cost OUT NOCOPY NUMBER,
527 x_profit OUT NOCOPY NUMBER,
528 x_profit_margin OUT NOCOPY NUMBER,
529 x_return_status OUT NOCOPY VARCHAR2,
530 x_msg_count OUT NOCOPY NUMBER,
531 x_msg_data OUT NOCOPY VARCHAR2
532 )
533 IS
534 l_api_name CONSTANT VARCHAR2(30) := 'Get_InvItemCostAnalysis';
535 l_api_version CONSTANT NUMBER := 1.0;
536 BEGIN
537 -- Standard Start of API savepoint
538 SAVEPOINT Get_InvItemCostAnalysis_Pvt;
539
540 -- Standard call to check for call compatibility.
541 IF NOT FND_API.Compatible_API_Call (l_api_version,
542 p_api_version,
543 l_api_name,
544 G_PKG_NAME)
545 THEN
546 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
547 END IF;
548
549 -- Initialize message list if p_init_msg_list is set to TRUE.
550 IF FND_API.to_Boolean(p_init_msg_list) THEN
551 FND_MSG_PUB.initialize;
555 x_return_status := FND_API.G_RET_STS_SUCCESS;
552 END IF;
553
554 -- Initialize API return status to success
556
557 --
558 -- Begin API Body
559 --
560
561 --
562 -- End API Body
563 --
564
565 -- Standard check of p_commit.
566 IF FND_API.To_Boolean( p_commit ) THEN
567 COMMIT WORK;
568 END IF;
569
570 -- Standard call to get message count and IF count is get message info.
571 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
572 p_data => x_msg_data );
573 EXCEPTION
574 WHEN FND_API.G_EXC_ERROR THEN
575 ROLLBACK TO Get_InvItemCostAnalysis_Pvt;
576 x_return_status := FND_API.G_RET_STS_ERROR ;
577 FND_MSG_PUB.Count_And_Get
578 (p_count => x_msg_count,
579 p_data => x_msg_data
580 );
581 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
582 ROLLBACK TO Get_InvItemCostAnalysis_Pvt;
583 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
584 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
585 p_data => x_msg_data );
586 WHEN OTHERS THEN
587 ROLLBACK TO Get_InvItemCostAnalysis_Pvt;
588 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
589 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
590 THEN
591 FND_MSG_PUB.Add_Exc_Msg (G_PKG_NAME ,
592 l_api_name );
593 END IF;
594 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
595 p_data => x_msg_data );
596 END Get_InvItemCostAnalysis;
597
598 /*----------------------------------------------------------------*/
599 /* procedure name: Get_ResItemCostAnalysis */
600 /* description : procedure used get item cost, extended cost, */
601 /* profit, and profit margin (%) */
602 /* for a bom resource */
603 /* */
604 /* p_api_version Standard IN param */
605 /* p_commit Standard IN param */
606 /* p_init_msg_list Standard IN param */
607 /* p_validation_level Standard IN param */
608 /* p_bom_resource_id BOM Resource ID */
609 /* p_quantity Quantity of resource */
610 /* p_organization_id Inventory Organization ID */
611 /* p_charge_amt Total Charge Amt to compare to */
612 /* p_currency_code Currency of Charge Amt */
613 /* x_item_cost Resource rate of BOM resource */
614 /* x_total_cost Extended cost of Resource */
615 /* x_profit x_total_cost - p_charge_amt */
616 /* x_profit_margin x_profit*100/x_item_cost */
617 /* x_return_status Standard OUT param */
618 /* x_msg_count Standard OUT param */
619 /* x_msg_data Standard OUT param */
620 /* */
621 /*----------------------------------------------------------------*/
622 PROCEDURE Get_ResItemCostAnalysis
623 (
624 p_api_version IN NUMBER,
625 p_commit IN VARCHAR2,
626 p_init_msg_list IN VARCHAR2,
627 p_validation_level IN NUMBER,
628 p_bom_resource_id IN NUMBER,
629 p_quantity IN NUMBER,
630 p_organization_id IN NUMBER,
631 p_charge_amt IN NUMBER,
632 p_currency_code IN VARCHAR2,
633 x_item_cost OUT NOCOPY NUMBER,
634 x_total_cost OUT NOCOPY NUMBER,
635 x_profit OUT NOCOPY NUMBER,
636 x_profit_margin OUT NOCOPY NUMBER,
637 x_return_status OUT NOCOPY VARCHAR2,
638 x_msg_count OUT NOCOPY NUMBER,
639 x_msg_data OUT NOCOPY VARCHAR2
640 )
641 IS
642 l_api_name CONSTANT VARCHAR2(30) := 'Get_ResItemCostAnalysis';
643 l_api_version CONSTANT NUMBER := 1.0;
644 BEGIN
645 -- Standard Start of API savepoint
646 SAVEPOINT Get_ResItemCostAnalysis_Pvt;
647
648 -- Standard call to check for call compatibility.
649 IF NOT FND_API.Compatible_API_Call (l_api_version,
650 p_api_version,
651 l_api_name,
652 G_PKG_NAME)
653 THEN
654 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
655 END IF;
656
657 -- Initialize message list if p_init_msg_list is set to TRUE.
658 IF FND_API.to_Boolean(p_init_msg_list) THEN
659 FND_MSG_PUB.initialize;
660 END IF;
661
662 -- Initialize API return status to success
663 x_return_status := FND_API.G_RET_STS_SUCCESS;
664
665 --
666 -- Begin API Body
667 --
668
669 --
670 -- End API Body
671 --
672
673 -- Standard check of p_commit.
674 IF FND_API.To_Boolean( p_commit ) THEN
675 COMMIT WORK;
676 END IF;
677
678 -- Standard call to get message count and IF count is get message info.
679 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
680 p_data => x_msg_data );
681 EXCEPTION
682 WHEN FND_API.G_EXC_ERROR THEN
683 ROLLBACK TO Get_ResItemCostAnalysis_Pvt;
684 x_return_status := FND_API.G_RET_STS_ERROR ;
685 FND_MSG_PUB.Count_And_Get
686 (p_count => x_msg_count,
687 p_data => x_msg_data
688 );
689 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
690 ROLLBACK TO Get_ResItemCostAnalysis_Pvt;
691 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
692 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
693 p_data => x_msg_data );
694 WHEN OTHERS THEN
695 ROLLBACK TO Get_ResItemCostAnalysis_Pvt;
696 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
697 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
698 THEN
699 FND_MSG_PUB.Add_Exc_Msg (G_PKG_NAME ,
700 l_api_name );
701 END IF;
702 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
703 p_data => x_msg_data );
704 END Get_ResItemCostAnalysis;
705
706 END CSD_ANALYSIS_PVT ;