DBA Data[Home] [Help]

PACKAGE BODY: APPS.OZF_OBJFUNDSUM_PVT

Source


1 PACKAGE BODY OZF_OBJFUNDSUM_PVT AS
2 /* $Header: ozfvfsub.pls 120.4 2005/10/14 13:06:59 yzhao noship $ */
3 
4 ------------------------------------------------------------------------------
5 --
6 -- NAME
7 --    OZF_OBJFUNDSUM_PVT  12.0
8 --
9 -- HISTORY
10 --    06/30/2005  YZHAO     CREATION
11 --
12 
13 G_PKG_NAME CONSTANT VARCHAR2(30) := 'OZF_OBJFUNDSUM_PVT';
14 
15 OZF_DEBUG_HIGH_ON boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_HIGH);
16 OZF_DEBUG_LOW_ON boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW);
17 OZF_DEBUG_MEDIUM_ON boolean := FND_MSG_PUB.CHECK_MSG_LEVEL(FND_MSG_PUB.G_MSG_LVL_DEBUG_MEDIUM);
18 
19 g_universal_currency   CONSTANT VARCHAR2 (15) := fnd_profile.VALUE ('OZF_UNIV_CURR_CODE');
20 
21 
22 
23 -- NAME
24 --    complete_amount_fields
25 --
26 -- PURPOSE
27 --    This Procedure fills in amount in fund/object/universal currency if not passed in
28 --        x_amount_1           converted amount in p_currency_1
29 --        x_amount_2           converted amount in p_currency_2
30 --        x_amount_3           converted amount in universal_currency
31 --
32 -- NOTES
33 --
34 -- HISTORY
35 --    07/25/2005   yzhao         Created.
36 --
37 PROCEDURE complete_amount_fields (
38    p_currency_1                 IN  VARCHAR2,
39    p_amount_1                   IN  NUMBER,
40    p_currency_2                 IN  VARCHAR2,
41    p_amount_2                   IN  NUMBER,
42    p_amount_3                   IN  NUMBER,
43    x_amount_1                   OUT NOCOPY NUMBER,
44    x_amount_2                   OUT NOCOPY NUMBER,
45    x_amount_3                   OUT NOCOPY NUMBER,
46    x_return_status              OUT NOCOPY VARCHAR2,
47    x_msg_count                  OUT NOCOPY NUMBER,
48    x_msg_data                   OUT NOCOPY VARCHAR2
49 )
50 IS
51   l_return_status               VARCHAR2(30);
52 BEGIN
53    x_amount_1 := p_amount_1;
54    x_amount_2 := p_amount_2;
55    x_amount_3 := p_amount_3;
56 
57    IF NVL(p_amount_1, 0) <> 0 THEN
58       IF NVL(p_amount_2, 0) = 0 THEN
59           -- fill in amount 2 from amount 1
60           IF p_currency_1 = p_currency_2 THEN
61              x_amount_2 := p_amount_1;
62           ELSE
63              ozf_utility_pvt.convert_currency (
64                      x_return_status=> l_return_status
65                     ,p_from_currency=> p_currency_1
66                     ,p_to_currency=> p_currency_2
67                     ,p_from_amount=> p_amount_1
68                     ,x_to_amount=> x_amount_2
69              );
70              IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
71                 RAISE fnd_api.g_exc_unexpected_error;
72              ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
73                 RAISE fnd_api.g_exc_error;
74              END IF;
75           END IF;
76       END IF;
77 
78       IF NVL(p_amount_3, 0) = 0 THEN
79           -- fill in amount in universal currency from amount 1
80           IF g_universal_currency = p_currency_1 THEN
81              x_amount_3 := p_amount_1;
82           ELSE
83              ozf_utility_pvt.convert_currency (
84                      x_return_status=> l_return_status
85                     ,p_from_currency=> p_currency_1
86                     ,p_to_currency=> g_universal_currency
87                     ,p_from_amount=> p_amount_1
88                     ,x_to_amount=> x_amount_3
89              );
90              IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
91                 RAISE fnd_api.g_exc_unexpected_error;
92              ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
93                 RAISE fnd_api.g_exc_error;
94              END IF;
95           END IF;
96       END IF;
97    ELSE
98       IF NVL(p_amount_2, 0) <> 0 THEN
99           -- fill in amount 1 from amount 2
100           IF p_currency_1 = p_currency_2 THEN
101              x_amount_1 := p_amount_2;
102           ELSE
103              ozf_utility_pvt.convert_currency (
104                      x_return_status=> l_return_status
105                     ,p_from_currency=> p_currency_2
106                     ,p_to_currency=> p_currency_1
107                     ,p_from_amount=> p_amount_2
108                     ,x_to_amount=> x_amount_1
109              );
110              IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
111                 RAISE fnd_api.g_exc_unexpected_error;
112              ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
113                 RAISE fnd_api.g_exc_error;
114              END IF;
115           END IF;
116 
117           IF NVL(p_amount_3, 0) = 0 THEN
118               -- fill in amount in universal currency from amount 2
119               IF g_universal_currency = p_currency_2 THEN
120                  x_amount_3 := p_amount_2;
121               ELSE
122                  ozf_utility_pvt.convert_currency (
123                          x_return_status=> l_return_status
124                         ,p_from_currency=> p_currency_2
125                         ,p_to_currency=> g_universal_currency
126                         ,p_from_amount=> p_amount_2
127                         ,x_to_amount=> x_amount_3
128                  );
129                  IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
130                     RAISE fnd_api.g_exc_unexpected_error;
131                  ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
132                     RAISE fnd_api.g_exc_error;
133                  END IF;
134               END IF;
135           END IF;
136       END IF;
137    END IF;
138 END complete_amount_fields;
139 
140 
141 -- NAME
142 --    create_objfundsum
143 --
144 -- PURPOSE
145 --    This Procedure creates a record in object fund summary table.
146 --
147 -- NOTES
148 --
149 -- HISTORY
150 --    06/30/2005   yzhao         Created.
151 --
152 PROCEDURE Create_objfundsum (
153    p_api_version                IN  NUMBER,
154    p_init_msg_list              IN  VARCHAR2 := Fnd_Api.G_FALSE,
155    p_validation_level           IN  NUMBER   := Fnd_Api.G_Valid_Level_Full,
156    p_objfundsum_rec             IN  objfundsum_rec_type,
157    x_return_status              OUT NOCOPY VARCHAR2,
158    x_msg_count                  OUT NOCOPY NUMBER,
159    x_msg_data                   OUT NOCOPY VARCHAR2,
160    x_objfundsum_id              OUT NOCOPY NUMBER
161 )
162 IS
163    L_API_VERSION     CONSTANT NUMBER := 1.0;
164    L_API_NAME        CONSTANT VARCHAR2(30) := 'CREATE_OBJFUNDSUM';
165    L_FULL_NAME       CONSTANT VARCHAR2(60) := G_PKG_NAME ||'.'|| L_API_NAME;
166 
167    l_return_status            VARCHAR2(1);
168    l_objfundsum_rec           objfundsum_rec_type := p_objfundsum_rec;
169    l_objfundsum_count         NUMBER := NULL;
170    l_amount_1                 NUMBER;
171    l_amount_2                 NUMBER;
172    l_amount_3                 NUMBER;
173 
174    CURSOR c_objfundsum_seq IS
175       SELECT   ozf_object_fund_summary_s.nextval
176       FROM     dual;
177 
178    CURSOR c_objfundsum_count(p_objfundsum_id   IN   NUMBER) IS
179       SELECT   COUNT(objfundsum_id)
180       FROM     ozf_object_fund_summary
181       WHERE    objfundsum_id = p_objfundsum_id;
182 
183    CURSOR c_get_fund_currency(p_fund_id IN NUMBER) IS
184       SELECT   currency_code_tc
185       FROM     ozf_funds_all_b
186       WHERE    fund_id = p_fund_id;
187 
188    CURSOR c_get_reference(p_offer_id IN NUMBER) IS
189       SELECT arc_act_offer_used_by,act_offer_used_by_id
190       FROM ozf_act_offers
191       WHERE qp_list_header_id = p_offer_id;
192 
193 BEGIN
194 
195    IF (OZF_DEBUG_HIGH_ON) THEN
196       ozf_utility_pvt.Debug_Message(l_full_name||': start');
197    END IF;
198 
199    IF Fnd_Api.To_Boolean (p_init_msg_list) THEN
200       Fnd_Msg_Pub.Initialize;
201    END IF;
202 
203    IF NOT Fnd_Api.Compatible_API_Call (L_API_VERSION, p_api_version, L_API_NAME, G_PKG_NAME) THEN
204       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
205    END IF;
206 
207    SAVEPOINT  sp_create_objfundsum;
208 
209    x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
210    x_objfundsum_id := NULL;
211 
212    IF l_objfundsum_rec.fund_currency IS NULL THEN
213       OPEN c_get_fund_currency(l_objfundsum_rec.fund_id);
214       FETCH c_get_fund_currency INTO l_objfundsum_rec.fund_currency;
215       CLOSE c_get_fund_currency;
216    END IF;
217 
218    IF l_objfundsum_rec.object_currency IS NULL THEN
219       l_objfundsum_rec.object_currency := ozf_actbudgets_pvt.get_object_currency (
220                                                p_object          => l_objfundsum_rec.object_type
221                                              , p_object_id       => l_objfundsum_rec.object_id
222                                              , x_return_status   => l_return_status
223                                          );
224       IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
225          RAISE Fnd_Api.G_EXC_ERROR;
226       ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
227          RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
228       END IF;
229    END IF;
230 
231    -- currency conversion for planned amount
232    complete_amount_fields (
233        p_currency_1                 => l_objfundsum_rec.object_currency,
234        p_amount_1                   => l_objfundsum_rec.plan_curr_planned_amt,
235        p_currency_2                 => l_objfundsum_rec.fund_currency,
236        p_amount_2                   => l_objfundsum_rec.planned_amt,
237        p_amount_3                   => l_objfundsum_rec.univ_curr_planned_amt,
238        x_amount_1                   => l_amount_1,
239        x_amount_2                   => l_amount_2,
240        x_amount_3                   => l_amount_3,
241        x_return_status              => l_return_status,
242        x_msg_count                  => x_msg_count,
243        x_msg_data                   => x_msg_data
244    );
245    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
246       RAISE Fnd_Api.G_EXC_ERROR;
247    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
248       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
249    END IF;
250    l_objfundsum_rec.plan_curr_planned_amt := l_amount_1;
251    l_objfundsum_rec.planned_amt := l_amount_2;
252    l_objfundsum_rec.univ_curr_planned_amt := l_amount_3;
253 
254    -- currency conversion for committed amount
255    complete_amount_fields (
256        p_currency_1                 => l_objfundsum_rec.object_currency,
257        p_amount_1                   => l_objfundsum_rec.plan_curr_committed_amt,
258        p_currency_2                 => l_objfundsum_rec.fund_currency,
259        p_amount_2                   => l_objfundsum_rec.committed_amt,
260        p_amount_3                   => l_objfundsum_rec.univ_curr_committed_amt,
261        x_amount_1                   => l_amount_1,
262        x_amount_2                   => l_amount_2,
263        x_amount_3                   => l_amount_3,
264        x_return_status              => l_return_status,
265        x_msg_count                  => x_msg_count,
266        x_msg_data                   => x_msg_data
267    );
268    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
269       RAISE Fnd_Api.G_EXC_ERROR;
270    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
271       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
272    END IF;
273    l_objfundsum_rec.plan_curr_committed_amt := l_amount_1;
274    l_objfundsum_rec.committed_amt := l_amount_2;
275    l_objfundsum_rec.univ_curr_committed_amt := l_amount_3;
276 
277    -- currency conversion for recal committed amount
278    complete_amount_fields (
279        p_currency_1                 => l_objfundsum_rec.object_currency,
280        p_amount_1                   => l_objfundsum_rec.plan_curr_recal_committed_amt,
281        p_currency_2                 => l_objfundsum_rec.fund_currency,
282        p_amount_2                   => l_objfundsum_rec.recal_committed_amt,
283        p_amount_3                   => l_objfundsum_rec.univ_curr_recal_committed_amt,
284        x_amount_1                   => l_amount_1,
285        x_amount_2                   => l_amount_2,
286        x_amount_3                   => l_amount_3,
287        x_return_status              => l_return_status,
288        x_msg_count                  => x_msg_count,
289        x_msg_data                   => x_msg_data
290    );
291    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
292       RAISE Fnd_Api.G_EXC_ERROR;
293    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
294       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
295    END IF;
296    l_objfundsum_rec.plan_curr_recal_committed_amt := l_amount_1;
297    l_objfundsum_rec.recal_committed_amt := l_amount_2;
298    l_objfundsum_rec.univ_curr_recal_committed_amt := l_amount_3;
299 
300    -- currency conversion for utilized amount
301    complete_amount_fields (
302        p_currency_1                 => l_objfundsum_rec.object_currency,
303        p_amount_1                   => l_objfundsum_rec.plan_curr_utilized_amt,
304        p_currency_2                 => l_objfundsum_rec.fund_currency,
305        p_amount_2                   => l_objfundsum_rec.utilized_amt,
306        p_amount_3                   => l_objfundsum_rec.univ_curr_utilized_amt,
310        x_return_status              => l_return_status,
307        x_amount_1                   => l_amount_1,
308        x_amount_2                   => l_amount_2,
309        x_amount_3                   => l_amount_3,
311        x_msg_count                  => x_msg_count,
312        x_msg_data                   => x_msg_data
313    );
314    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
315       RAISE Fnd_Api.G_EXC_ERROR;
316    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
317       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
318    END IF;
319    l_objfundsum_rec.plan_curr_utilized_amt := l_amount_1;
320    l_objfundsum_rec.utilized_amt := l_amount_2;
321    l_objfundsum_rec.univ_curr_utilized_amt := l_amount_3;
322 
323    -- currency conversion for earned amount
324    complete_amount_fields (
325        p_currency_1                 => l_objfundsum_rec.object_currency,
326        p_amount_1                   => l_objfundsum_rec.plan_curr_earned_amt,
327        p_currency_2                 => l_objfundsum_rec.fund_currency,
328        p_amount_2                   => l_objfundsum_rec.earned_amt,
329        p_amount_3                   => l_objfundsum_rec.univ_curr_earned_amt,
330        x_amount_1                   => l_amount_1,
331        x_amount_2                   => l_amount_2,
332        x_amount_3                   => l_amount_3,
333        x_return_status              => l_return_status,
334        x_msg_count                  => x_msg_count,
335        x_msg_data                   => x_msg_data
336    );
337    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
338       RAISE Fnd_Api.G_EXC_ERROR;
339    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
340       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
341    END IF;
342    l_objfundsum_rec.plan_curr_earned_amt := l_amount_1;
343    l_objfundsum_rec.earned_amt := l_amount_2;
344    l_objfundsum_rec.univ_curr_earned_amt := l_amount_3;
345 
346    -- currency conversion for paid amount
347    complete_amount_fields (
348        p_currency_1                 => l_objfundsum_rec.object_currency,
349        p_amount_1                   => l_objfundsum_rec.plan_curr_paid_amt,
350        p_currency_2                 => l_objfundsum_rec.fund_currency,
351        p_amount_2                   => l_objfundsum_rec.paid_amt,
352        p_amount_3                   => l_objfundsum_rec.univ_curr_paid_amt,
353        x_amount_1                   => l_amount_1,
354        x_amount_2                   => l_amount_2,
355        x_amount_3                   => l_amount_3,
356        x_return_status              => l_return_status,
357        x_msg_count                  => x_msg_count,
358        x_msg_data                   => x_msg_data
359    );
360    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
361       RAISE Fnd_Api.G_EXC_ERROR;
362    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
363       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
364    END IF;
365    l_objfundsum_rec.plan_curr_paid_amt := l_amount_1;
366    l_objfundsum_rec.paid_amt := l_amount_2;
367    l_objfundsum_rec.univ_curr_paid_amt := l_amount_3;
368 
369    validate_objfundsum (
370       p_api_version               => l_api_version,
371       p_init_msg_list             => p_init_msg_list,
372       p_validation_level          => p_validation_level,
373       p_objfundsum_rec            => l_objfundsum_rec,
374       x_msg_count                 => x_msg_count,
375       x_msg_data                  => x_msg_data,
376       x_return_status             => l_return_status
377    );
378 
379    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
380       RAISE Fnd_Api.G_EXC_ERROR;
381    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
382       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
383    END IF;
384 
385    IF (OZF_DEBUG_HIGH_ON) THEN
386        ozf_utility_pvt.debug_message(l_full_name ||': insert');
387    END IF;
388 
389    IF l_objfundsum_rec.objfundsum_id IS NULL THEN
390       LOOP
391          OPEN c_objfundsum_seq;
392          FETCH c_objfundsum_seq INTO l_objfundsum_rec.objfundsum_id;
393          CLOSE c_objfundsum_seq;
394 
395          OPEN  c_objfundsum_count(l_objfundsum_rec.objfundsum_id);
396          FETCH c_objfundsum_count INTO l_objfundsum_count ;
397          CLOSE c_objfundsum_count ;
398 
399          EXIT WHEN l_objfundsum_count = 0 ;
400       END LOOP ;
401    END IF;
402 
403    IF l_objfundsum_rec.reference_object_type IS NULL
404       AND l_objfundsum_rec.object_type = 'OFFR' THEN
405       OPEN c_get_reference(l_objfundsum_rec.object_id);
406       FETCH c_get_reference INTO l_objfundsum_rec.reference_object_type, l_objfundsum_rec.reference_object_id;
407       CLOSE c_get_reference;
408    END IF;
409 
410    --dbms_output.put_line('Stat Before Insert : '||l_return_status);
411 
412    INSERT INTO ozf_object_fund_summary(
413          objfundsum_id,
414          creation_date,
415          created_by,
416          last_update_date,
417          last_updated_by,
418          last_update_login,
419          object_version_number,
420          fund_id,
421          fund_currency,
422          object_type,
423          object_id,
424          object_currency,
425          reference_object_type,
426          reference_object_id,
427 	 source_from_parent,
428          planned_amt,
429          committed_amt,
430          recal_committed_amt,
431          utilized_amt,
432          earned_amt,
433          paid_amt,
434          plan_curr_planned_amt,
435          plan_curr_committed_amt,
436          plan_curr_recal_committed_amt,
437          plan_curr_utilized_amt,
438          plan_curr_earned_amt,
439          plan_curr_paid_amt,
440          univ_curr_planned_amt,
441          univ_curr_committed_amt,
445          univ_curr_paid_amt,
442          univ_curr_recal_committed_amt,
443          univ_curr_utilized_amt,
444          univ_curr_earned_amt,
446          attribute_category,
447          attribute1,
448          attribute2,
449          attribute3,
450          attribute4,
451          attribute5,
452          attribute6,
453          attribute7,
454          attribute8,
455          attribute9,
456          attribute10,
457          attribute11,
458          attribute12,
459          attribute13,
460          attribute14,
461          attribute15
462    )
463    VALUES (
464         l_objfundsum_rec.objfundsum_id,
465         sysdate,
466         Fnd_Global.User_ID,
467         sysdate,
468         Fnd_Global.User_ID,
469         Fnd_Global.Conc_Login_ID,
470         1, --Object Version Number
471         l_objfundsum_rec.fund_id,
472         l_objfundsum_rec.fund_currency,
473         l_objfundsum_rec.object_type,
474         l_objfundsum_rec.object_id,
475         l_objfundsum_rec.object_currency,
476         l_objfundsum_rec.reference_object_type,
477         l_objfundsum_rec.reference_object_id,
478 	l_objfundsum_rec.source_from_parent,
479         l_objfundsum_rec.planned_amt,
480         l_objfundsum_rec.committed_amt,
481         l_objfundsum_rec.recal_committed_amt,
482         l_objfundsum_rec.utilized_amt,
483         l_objfundsum_rec.earned_amt,
484         l_objfundsum_rec.paid_amt,
485         l_objfundsum_rec.plan_curr_planned_amt,
486         l_objfundsum_rec.plan_curr_committed_amt,
487         l_objfundsum_rec.plan_curr_recal_committed_amt,
488         l_objfundsum_rec.plan_curr_utilized_amt,
489         l_objfundsum_rec.plan_curr_earned_amt,
490         l_objfundsum_rec.plan_curr_paid_amt,
491         l_objfundsum_rec.univ_curr_planned_amt,
492         l_objfundsum_rec.univ_curr_committed_amt,
493         l_objfundsum_rec.univ_curr_recal_committed_amt,
494         l_objfundsum_rec.univ_curr_utilized_amt,
495         l_objfundsum_rec.univ_curr_earned_amt,
496         l_objfundsum_rec.univ_curr_paid_amt,
497         l_objfundsum_rec.attribute_category,
498         l_objfundsum_rec.attribute1,
499         l_objfundsum_rec.attribute2,
500         l_objfundsum_rec.attribute3,
501         l_objfundsum_rec.attribute4,
502         l_objfundsum_rec.attribute5,
503         l_objfundsum_rec.attribute6,
504         l_objfundsum_rec.attribute7,
505         l_objfundsum_rec.attribute8,
506         l_objfundsum_rec.attribute9,
507         l_objfundsum_rec.attribute10,
508         l_objfundsum_rec.attribute11,
509         l_objfundsum_rec.attribute12,
510         l_objfundsum_rec.attribute13,
511         l_objfundsum_rec.attribute14,
512         l_objfundsum_rec.attribute15
513      );
514 
515    x_objfundsum_id := l_objfundsum_rec.objfundsum_id;
516 
517    Fnd_Msg_Pub.Count_And_Get (
518       p_count           =>    x_msg_count,
519       p_data            =>    x_msg_data,
520       p_encoded         =>    Fnd_Api.G_FALSE
521    );
522 
523    IF (OZF_DEBUG_HIGH_ON) THEN
524       ozf_utility_pvt.debug_message(l_full_name ||': end Success');
525    END IF;
526 
527 EXCEPTION
528    WHEN Fnd_Api.G_EXC_ERROR THEN
529       ROLLBACK TO sp_create_objfundsum;
530       x_return_status := Fnd_Api.G_RET_STS_ERROR;
531       Fnd_Msg_Pub.Count_And_Get (
532          p_count         =>     x_msg_count,
533          p_data          =>     x_msg_data,
534          p_encoded       =>     FND_API.G_FALSE
535       );
536    WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
537       ROLLBACK TO sp_create_objfundsum;
538       x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
539       Fnd_Msg_Pub.Count_And_Get (
540          p_count         =>     x_msg_count,
541          p_data          =>     x_msg_data,
542          p_encoded       =>     FND_API.G_FALSE
543       );
544    WHEN OTHERS THEN
545       ROLLBACK TO sp_create_objfundsum;
546       x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
547       IF Fnd_Msg_Pub.Check_Msg_Level (Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR) THEN
548          Fnd_Msg_Pub.Add_Exc_Msg (G_PKG_NAME, L_API_NAME);
549       END IF;
550       Fnd_Msg_Pub.Count_And_Get (
551          p_count         =>     x_msg_count,
552          p_data          =>     x_msg_data,
553          p_encoded       =>     FND_API.G_FALSE
554       );
555 END Create_objfundsum;
556 
557 
558 -- NAME
559 --    update_objfundsum
560 --
561 -- PURPOSE
562 --    This Procedure updates record in object fund summary table.
563 --
564 -- NOTES
565 --
566 -- HISTORY
567 -- 05/26/1999   choang         Created.
568 PROCEDURE Update_objfundsum (
569    p_api_version                IN  NUMBER,
570    p_init_msg_list              IN  VARCHAR2 := Fnd_Api.G_FALSE,
571    p_validation_level           IN  NUMBER := Fnd_Api.G_VALID_LEVEL_FULL,
572    p_objfundsum_rec             IN  objfundsum_rec_type,
573    x_return_status              OUT NOCOPY VARCHAR2,
574    x_msg_count                  OUT NOCOPY NUMBER,
575    x_msg_data                   OUT NOCOPY VARCHAR2
576 )
577 IS
578    L_API_VERSION    CONSTANT NUMBER := 1.0;
579    L_API_NAME       CONSTANT VARCHAR2(30) := 'UPDATE_objfundsum';
580    L_FULL_NAME      CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
581 
582    l_return_status   VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
583    l_objfundsum_rec  objfundsum_rec_type := p_objfundsum_rec;
584    l_amount_1                 NUMBER;
585    l_amount_2                 NUMBER;
586    l_amount_3                 NUMBER;
587 
588 BEGIN
589 
590    IF (OZF_DEBUG_HIGH_ON) THEN
594    SAVEPOINT sp_Update_objfundsum;
591       ozf_utility_pvt.debug_message('Now updating objfundsum_id: '||p_objfundsum_rec.objfundsum_id);
592    END IF;
593 
595 
596    IF (OZF_DEBUG_HIGH_ON) THEN
597        ozf_utility_pvt.debug_message(l_full_name||': start');
598    END IF;
599 
600    IF Fnd_Api.To_Boolean (p_init_msg_list) THEN
601       Fnd_Msg_Pub.Initialize;
602    END IF;
603 
604    IF NOT Fnd_Api.Compatible_API_Call (L_API_VERSION,
605                                        p_api_version,
606                                        L_API_NAME,
607                                        G_PKG_NAME)
608    THEN
609       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
610    END IF;
611 
612    x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
613 
614    IF (OZF_DEBUG_HIGH_ON) THEN
615       ozf_utility_pvt.debug_message(l_full_name ||': validate');
616    END IF;
617 
618    -- replace g_miss_char/num/date with current column values
619    Complete_objfundsum_Rec(p_objfundsum_rec, l_objfundsum_rec);
620 
621    -- currency conversion for planned amount
622    complete_amount_fields (
623        p_currency_1                 => l_objfundsum_rec.object_currency,
624        p_amount_1                   => l_objfundsum_rec.plan_curr_planned_amt,
625        p_currency_2                 => l_objfundsum_rec.fund_currency,
626        p_amount_2                   => l_objfundsum_rec.planned_amt,
627        p_amount_3                   => l_objfundsum_rec.univ_curr_planned_amt,
628        x_amount_1                   => l_amount_1,
629        x_amount_2                   => l_amount_2,
630        x_amount_3                   => l_amount_3,
631        x_return_status              => l_return_status,
632        x_msg_count                  => x_msg_count,
633        x_msg_data                   => x_msg_data
634    );
635    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
636       RAISE Fnd_Api.G_EXC_ERROR;
637    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
638       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
639    END IF;
640    l_objfundsum_rec.plan_curr_planned_amt := l_amount_1;
641    l_objfundsum_rec.planned_amt := l_amount_2;
642    l_objfundsum_rec.univ_curr_planned_amt := l_amount_3;
643 
644    -- currency conversion for committed amount
645    complete_amount_fields (
646        p_currency_1                 => l_objfundsum_rec.object_currency,
647        p_amount_1                   => l_objfundsum_rec.plan_curr_committed_amt,
648        p_currency_2                 => l_objfundsum_rec.fund_currency,
649        p_amount_2                   => l_objfundsum_rec.committed_amt,
650        p_amount_3                   => l_objfundsum_rec.univ_curr_committed_amt,
651        x_amount_1                   => l_amount_1,
652        x_amount_2                   => l_amount_2,
653        x_amount_3                   => l_amount_3,
654        x_return_status              => l_return_status,
655        x_msg_count                  => x_msg_count,
656        x_msg_data                   => x_msg_data
657    );
658    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
659       RAISE Fnd_Api.G_EXC_ERROR;
660    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
661       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
662    END IF;
663    l_objfundsum_rec.plan_curr_committed_amt := l_amount_1;
664    l_objfundsum_rec.committed_amt := l_amount_2;
665    l_objfundsum_rec.univ_curr_committed_amt := l_amount_3;
666 
667    -- currency conversion for recal committed amount
668    complete_amount_fields (
669        p_currency_1                 => l_objfundsum_rec.object_currency,
670        p_amount_1                   => l_objfundsum_rec.plan_curr_recal_committed_amt,
671        p_currency_2                 => l_objfundsum_rec.fund_currency,
672        p_amount_2                   => l_objfundsum_rec.recal_committed_amt,
673        p_amount_3                   => l_objfundsum_rec.univ_curr_recal_committed_amt,
674        x_amount_1                   => l_amount_1,
675        x_amount_2                   => l_amount_2,
676        x_amount_3                   => l_amount_3,
677        x_return_status              => l_return_status,
678        x_msg_count                  => x_msg_count,
679        x_msg_data                   => x_msg_data
680    );
681    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
682       RAISE Fnd_Api.G_EXC_ERROR;
683    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
684       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
685    END IF;
686    l_objfundsum_rec.plan_curr_recal_committed_amt := l_amount_1;
687    l_objfundsum_rec.recal_committed_amt := l_amount_2;
688    l_objfundsum_rec.univ_curr_recal_committed_amt := l_amount_3;
689 
690    -- currency conversion for utilized amount
691    complete_amount_fields (
692        p_currency_1                 => l_objfundsum_rec.object_currency,
693        p_amount_1                   => l_objfundsum_rec.plan_curr_utilized_amt,
694        p_currency_2                 => l_objfundsum_rec.fund_currency,
695        p_amount_2                   => l_objfundsum_rec.utilized_amt,
696        p_amount_3                   => l_objfundsum_rec.univ_curr_utilized_amt,
697        x_amount_1                   => l_amount_1,
698        x_amount_2                   => l_amount_2,
699        x_amount_3                   => l_amount_3,
700        x_return_status              => l_return_status,
701        x_msg_count                  => x_msg_count,
702        x_msg_data                   => x_msg_data
703    );
704    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
705       RAISE Fnd_Api.G_EXC_ERROR;
706    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
707       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
708    END IF;
709    l_objfundsum_rec.plan_curr_utilized_amt := l_amount_1;
710    l_objfundsum_rec.utilized_amt := l_amount_2;
714    complete_amount_fields (
711    l_objfundsum_rec.univ_curr_utilized_amt := l_amount_3;
712 
713    -- currency conversion for earned amount
715        p_currency_1                 => l_objfundsum_rec.object_currency,
716        p_amount_1                   => l_objfundsum_rec.plan_curr_earned_amt,
717        p_currency_2                 => l_objfundsum_rec.fund_currency,
718        p_amount_2                   => l_objfundsum_rec.earned_amt,
719        p_amount_3                   => l_objfundsum_rec.univ_curr_earned_amt,
720        x_amount_1                   => l_amount_1,
721        x_amount_2                   => l_amount_2,
722        x_amount_3                   => l_amount_3,
723        x_return_status              => l_return_status,
724        x_msg_count                  => x_msg_count,
725        x_msg_data                   => x_msg_data
726    );
727    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
728       RAISE Fnd_Api.G_EXC_ERROR;
729    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
730       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
731    END IF;
732    l_objfundsum_rec.plan_curr_earned_amt := l_amount_1;
733    l_objfundsum_rec.earned_amt := l_amount_2;
734    l_objfundsum_rec.univ_curr_earned_amt := l_amount_3;
735 
736    -- currency conversion for paid amount
737    complete_amount_fields (
738        p_currency_1                 => l_objfundsum_rec.object_currency,
739        p_amount_1                   => l_objfundsum_rec.plan_curr_paid_amt,
740        p_currency_2                 => l_objfundsum_rec.fund_currency,
741        p_amount_2                   => l_objfundsum_rec.paid_amt,
742        p_amount_3                   => l_objfundsum_rec.univ_curr_paid_amt,
743        x_amount_1                   => l_amount_1,
744        x_amount_2                   => l_amount_2,
745        x_amount_3                   => l_amount_3,
746        x_return_status              => l_return_status,
747        x_msg_count                  => x_msg_count,
748        x_msg_data                   => x_msg_data
749    );
750    IF l_return_status = Fnd_Api.G_RET_STS_ERROR THEN
751       RAISE Fnd_Api.G_EXC_ERROR;
752    ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR THEN
753       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
754    END IF;
755    l_objfundsum_rec.plan_curr_paid_amt := l_amount_1;
756    l_objfundsum_rec.paid_amt := l_amount_2;
757    l_objfundsum_rec.univ_curr_paid_amt := l_amount_3;
758 
759    IF p_validation_level >= Jtf_Plsql_Api.g_valid_level_item THEN
760       Validate_objfundsum (
761           p_api_version               => l_api_version,
762           p_init_msg_list             => p_init_msg_list,
763           p_validation_level          => p_validation_level,
764           p_objfundsum_rec            => l_objfundsum_rec,
765           x_msg_count                 => x_msg_count,
766           x_msg_data                  => x_msg_data,
767           x_return_status             => l_return_status
768       );
769       IF l_return_status = Fnd_Api.g_ret_sts_unexp_error THEN
770          RAISE Fnd_Api.g_exc_unexpected_error;
771       ELSIF l_return_status = Fnd_Api.g_ret_sts_error THEN
772          RAISE Fnd_Api.g_exc_error;
773       END IF;
774    END IF;
775 
776 
777    IF (OZF_DEBUG_HIGH_ON) THEN
778      ozf_utility_pvt.debug_message(l_full_name ||': update object fund summary Table');
779    END IF;
780 
781    UPDATE ozf_object_fund_summary
782       SET object_version_number= object_version_number + 1,
783           last_update_date         = SYSDATE,
784           last_updated_by          = Fnd_Global.User_ID,
785           last_update_login        = Fnd_Global.Conc_Login_ID,
786           fund_id                  = l_objfundsum_rec.fund_id,
787           fund_currency            = l_objfundsum_rec.fund_currency,
788           object_type              = l_objfundsum_rec.object_type,
789           object_id                = l_objfundsum_rec.object_id,
790           object_currency          = l_objfundsum_rec.object_currency,
791           reference_object_type    = l_objfundsum_rec.reference_object_type,
792           reference_object_id      = l_objfundsum_rec.reference_object_id,
793 	  source_from_parent       = l_objfundsum_rec.source_from_parent,
794           planned_amt              = l_objfundsum_rec.planned_amt,
795           committed_amt            = l_objfundsum_rec.committed_amt,
796           recal_committed_amt      = l_objfundsum_rec.recal_committed_amt,
797           utilized_amt             = l_objfundsum_rec.utilized_amt,
798           earned_amt               = l_objfundsum_rec.earned_amt,
799           paid_amt                 = l_objfundsum_rec.paid_amt,
800           plan_curr_planned_amt    = l_objfundsum_rec.plan_curr_planned_amt,
801           plan_curr_committed_amt  = l_objfundsum_rec.plan_curr_committed_amt,
802           plan_curr_recal_committed_amt  = l_objfundsum_rec.plan_curr_recal_committed_amt,
803           plan_curr_utilized_amt   = l_objfundsum_rec.plan_curr_utilized_amt,
804           plan_curr_earned_amt     = l_objfundsum_rec.plan_curr_earned_amt,
805           plan_curr_paid_amt       = l_objfundsum_rec.plan_curr_paid_amt,
806           univ_curr_planned_amt    = l_objfundsum_rec.univ_curr_planned_amt,
807           univ_curr_committed_amt  = l_objfundsum_rec.univ_curr_committed_amt,
808           univ_curr_recal_committed_amt  = l_objfundsum_rec.univ_curr_recal_committed_amt,
809           univ_curr_utilized_amt   = l_objfundsum_rec.univ_curr_utilized_amt,
810           univ_curr_earned_amt     = l_objfundsum_rec.univ_curr_earned_amt,
811           univ_curr_paid_amt       = l_objfundsum_rec.univ_curr_paid_amt,
812           attribute_category       = l_objfundsum_rec.attribute_category,
813           attribute1               = l_objfundsum_rec.attribute1,
814           attribute2               = l_objfundsum_rec.attribute2,
815           attribute3               = l_objfundsum_rec.attribute3,
816           attribute4               = l_objfundsum_rec.attribute4,
820           attribute8               = l_objfundsum_rec.attribute8,
817           attribute5               = l_objfundsum_rec.attribute5,
818           attribute6               = l_objfundsum_rec.attribute6,
819           attribute7               = l_objfundsum_rec.attribute7,
821           attribute9               = l_objfundsum_rec.attribute9,
822           attribute10              = l_objfundsum_rec.attribute10,
823           attribute11              = l_objfundsum_rec.attribute11,
824           attribute12              = l_objfundsum_rec.attribute12,
825           attribute13              = l_objfundsum_rec.attribute13,
826           attribute14              = l_objfundsum_rec.attribute14,
827           attribute15              = l_objfundsum_rec.attribute15
828     WHERE objfundsum_id = l_objfundsum_rec.objfundsum_id
829     AND   object_version_number = l_objfundsum_rec.object_version_number;
830 
831    IF  (SQL%NOTFOUND) THEN
832       IF Fnd_Msg_Pub.check_msg_level(Fnd_Msg_Pub.g_msg_lvl_error) THEN
833          Fnd_Message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
834          Fnd_Msg_Pub.ADD;
835       END IF;
836       RAISE Fnd_Api.g_exc_error;
837    END IF;
838 
839    Fnd_Msg_Pub.Count_And_Get (
840       p_count           =>    x_msg_count,
841       p_data            =>    x_msg_data,
842       p_encoded         =>    Fnd_Api.G_FALSE
843    );
844 
845    IF (OZF_DEBUG_HIGH_ON) THEN
846       ozf_utility_pvt.debug_message(l_full_name ||': end');
847    END IF;
848 
849 
850 EXCEPTION
851    WHEN Fnd_Api.G_EXC_ERROR THEN
852       ROLLBACK TO SP_Update_objfundsum;
853       x_return_status := Fnd_Api.G_RET_STS_ERROR;
854       Fnd_Msg_Pub.Count_And_Get (
855          p_count         =>     x_msg_count,
856          p_data          =>     x_msg_data,
857          p_encoded       =>     FND_API.G_FALSE
858       );
859    WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
860       ROLLBACK TO SP_Update_objfundsum;
861       x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
862       Fnd_Msg_Pub.Count_And_Get (
863          p_count         =>     x_msg_count,
864          p_data          =>     x_msg_data,
865          p_encoded       =>   FND_API.G_FALSE
866       );
867    WHEN OTHERS THEN
868       ROLLBACK TO SP_Update_objfundsum;
869       x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
870       IF Fnd_Msg_Pub.Check_Msg_Level (Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR) THEN
871          Fnd_Msg_Pub.Add_Exc_Msg (G_PKG_NAME, L_API_NAME);
872       END IF;
873       Fnd_Msg_Pub.Count_And_Get (
874          p_count         =>     x_msg_count,
875          p_data          =>     x_msg_data,
876          p_encoded       =>   FND_API.G_FALSE
877       );
878 END Update_objfundsum;
879 
880 
881 -- NAME
882 --    process_objfundsum
883 --
884 -- PURPOSE
885 --    This Procedure creates a record in object fund summary table if it's not there.
886 --                   update  a record in object fund summary table if it's already there
887 --                   for update, it does cumulative update. E.g. existing record has earned_amount=$100
888 --                               if p_objfundsum_rec.earned_amount=$50, after this call earned_amount=$150
889 --
890 -- NOTES
891 --
892 --
893 PROCEDURE process_objfundsum (
894    p_api_version                IN      NUMBER,
895    p_init_msg_list              IN  VARCHAR2 := Fnd_Api.G_FALSE,
896    p_validation_level           IN  NUMBER   := Fnd_Api.G_Valid_Level_Full,
897    p_objfundsum_rec             IN  objfundsum_rec_type,
898    x_return_status              OUT NOCOPY VARCHAR2,
899    x_msg_count                  OUT NOCOPY NUMBER,
900    x_msg_data                   OUT NOCOPY VARCHAR2,
901    x_objfundsum_id              OUT NOCOPY NUMBER
902 )
903 IS
904    L_API_NAME        CONSTANT VARCHAR2(30) := 'CREATE_OBJFUNDSUM';
905    l_tmp_objfundsum_rec         ozf_objfundsum_pvt.objfundsum_rec_type := NULL;
906    l_objfundsum_rec             ozf_objfundsum_pvt.objfundsum_rec_type := p_objfundsum_rec;
907    l_objfundsum_id              NUMBER;
908    l_msg_count                  NUMBER;
909    l_msg_data                   VARCHAR2(240);
910    l_return_status              VARCHAR2(30);
911 
912   CURSOR c_get_objfundsum_rec(p_object_type IN VARCHAR2, p_object_id IN NUMBER, p_fund_id IN NUMBER) IS
913      SELECT objfundsum_id
914           , object_version_number
915           , planned_amt
916           , plan_curr_planned_amt
917           , univ_curr_planned_amt
918           , committed_amt
919           , plan_curr_committed_amt
920           , univ_curr_committed_amt
921           , recal_committed_amt
922           , plan_curr_recal_committed_amt
923           , univ_curr_recal_committed_amt
924           , utilized_amt
925           , plan_curr_utilized_amt
926           , univ_curr_utilized_amt
927           , earned_amt
928           , plan_curr_earned_amt
929           , univ_curr_earned_amt
930           , paid_amt
931           , plan_curr_paid_amt
932           , univ_curr_paid_amt
933      FROM   ozf_object_fund_summary
934      WHERE  object_type = p_object_type
935      AND    object_id = p_object_id
936      AND    fund_id = p_fund_id;
937 
938 BEGIN
939    SAVEPOINT SP_process_objfundsum;
940 
941    -- dbms_output.put_line('process_objfunsum: id=' || p_objfundsum_rec.objfundsum_id);
942    IF p_objfundsum_rec.objfundsum_id IS NULL THEN
943        OPEN c_get_objfundsum_rec(p_objfundsum_rec.object_type
944                                , p_objfundsum_rec.object_id
945                                , p_objfundsum_rec.fund_id);
946        FETCH c_get_objfundsum_rec INTO l_objfundsum_rec.objfundsum_id
947                                      , l_objfundsum_rec.object_version_number
948                                      , l_tmp_objfundsum_rec.planned_amt
952                                      , l_tmp_objfundsum_rec.plan_curr_committed_amt
949                                      , l_tmp_objfundsum_rec.plan_curr_planned_amt
950                                      , l_tmp_objfundsum_rec.univ_curr_planned_amt
951                                      , l_tmp_objfundsum_rec.committed_amt
953                                      , l_tmp_objfundsum_rec.univ_curr_committed_amt
954                                      , l_tmp_objfundsum_rec.recal_committed_amt
955                                      , l_tmp_objfundsum_rec.plan_curr_recal_committed_amt
956                                      , l_tmp_objfundsum_rec.univ_curr_recal_committed_amt
957                                      , l_tmp_objfundsum_rec.utilized_amt
958                                      , l_tmp_objfundsum_rec.plan_curr_utilized_amt
959                                      , l_tmp_objfundsum_rec.univ_curr_utilized_amt
960                                      , l_tmp_objfundsum_rec.earned_amt
961                                      , l_tmp_objfundsum_rec.plan_curr_earned_amt
962                                      , l_tmp_objfundsum_rec.univ_curr_earned_amt
963                                      , l_tmp_objfundsum_rec.paid_amt
964                                      , l_tmp_objfundsum_rec.plan_curr_paid_amt
965                                      , l_tmp_objfundsum_rec.univ_curr_paid_amt;
966        IF c_get_objfundsum_rec%NOTFOUND THEN
967            CLOSE c_get_objfundsum_rec;
968            ozf_objfundsum_pvt.create_objfundsum(
969                p_api_version                => 1.0,
970                p_init_msg_list              => p_init_msg_list,
971                p_validation_level           => p_validation_level,
972                p_objfundsum_rec             => p_objfundsum_rec,
973                x_return_status              => x_return_status,
974                x_msg_count                  => x_msg_count,
975                x_msg_data                   => x_msg_data,
976                x_objfundsum_id              => l_objfundsum_id
977            );
978            -- dbms_output.put_line('process_objfunsum: create_objfunsum returns ' || l_return_status);
979            IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
980               RAISE fnd_api.g_exc_unexpected_error;
981            ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
982               RAISE fnd_api.g_exc_error;
983            END IF;
984            RETURN;
985        ELSE
986            CLOSE c_get_objfundsum_rec;
987        END IF;  -- IF c_get_objfundsum_rec%NOTFOUND THEN
988    END IF;  -- IF p_objfundsum_rec.objfundsum_id IS NULL
989 
990    IF NVL(p_objfundsum_rec.planned_amt, 0) <> 0 THEN
991        l_objfundsum_rec.planned_amt := NVL(l_tmp_objfundsum_rec.planned_amt, 0) + p_objfundsum_rec.planned_amt;
992    END IF;
993    IF NVL(p_objfundsum_rec.plan_curr_planned_amt, 0) <> 0 THEN
994        l_objfundsum_rec.plan_curr_planned_amt := NVL(l_tmp_objfundsum_rec.plan_curr_planned_amt, 0)
995                                            + p_objfundsum_rec.plan_curr_planned_amt;
996    END IF;
997    IF NVL(p_objfundsum_rec.univ_curr_planned_amt, 0) <> 0 THEN
998        l_objfundsum_rec.univ_curr_planned_amt := NVL(l_tmp_objfundsum_rec.univ_curr_planned_amt, 0)
999                                            + p_objfundsum_rec.univ_curr_planned_amt;
1000    END IF;
1001    IF NVL(p_objfundsum_rec.committed_amt, 0) <> 0 THEN
1002        l_objfundsum_rec.committed_amt := NVL(l_tmp_objfundsum_rec.committed_amt, 0) + p_objfundsum_rec.committed_amt;
1003    END IF;
1004    IF NVL(p_objfundsum_rec.plan_curr_committed_amt, 0) <> 0 THEN
1005        l_objfundsum_rec.plan_curr_committed_amt := NVL(l_tmp_objfundsum_rec.plan_curr_committed_amt, 0)
1006                                            + p_objfundsum_rec.plan_curr_committed_amt;
1007    END IF;
1008    IF NVL(p_objfundsum_rec.univ_curr_committed_amt, 0) <> 0 THEN
1009        l_objfundsum_rec.univ_curr_committed_amt := NVL(l_tmp_objfundsum_rec.univ_curr_committed_amt, 0)
1010                                            + p_objfundsum_rec.univ_curr_committed_amt;
1011    END IF;
1012    IF NVL(p_objfundsum_rec.recal_committed_amt, 0) <> 0 THEN
1013        l_objfundsum_rec.recal_committed_amt := NVL(l_tmp_objfundsum_rec.recal_committed_amt, 0)
1014                                           + p_objfundsum_rec.recal_committed_amt;
1015    END IF;
1016    IF NVL(p_objfundsum_rec.plan_curr_recal_committed_amt, 0) <> 0 THEN
1017        l_objfundsum_rec.plan_curr_recal_committed_amt := NVL(l_tmp_objfundsum_rec.plan_curr_recal_committed_amt, 0)
1018                                            + p_objfundsum_rec.plan_curr_recal_committed_amt;
1019    END IF;
1020    IF NVL(p_objfundsum_rec.univ_curr_recal_committed_amt, 0) <> 0 THEN
1021        l_objfundsum_rec.univ_curr_recal_committed_amt := NVL(l_tmp_objfundsum_rec.univ_curr_recal_committed_amt, 0)
1022                                            + p_objfundsum_rec.univ_curr_recal_committed_amt;
1023    END IF;
1024    IF NVL(p_objfundsum_rec.utilized_amt, 0) <> 0 THEN
1025        l_objfundsum_rec.utilized_amt := NVL(l_tmp_objfundsum_rec.utilized_amt, 0) + p_objfundsum_rec.utilized_amt;
1026    END IF;
1027    IF NVL(p_objfundsum_rec.plan_curr_utilized_amt, 0) <> 0 THEN
1028        l_objfundsum_rec.plan_curr_utilized_amt := NVL(l_tmp_objfundsum_rec.plan_curr_utilized_amt, 0)
1029                                            + p_objfundsum_rec.plan_curr_utilized_amt;
1030    END IF;
1031    IF NVL(p_objfundsum_rec.univ_curr_utilized_amt, 0) <> 0 THEN
1032        l_objfundsum_rec.univ_curr_utilized_amt := NVL(l_tmp_objfundsum_rec.univ_curr_utilized_amt, 0)
1033                                            + p_objfundsum_rec.univ_curr_utilized_amt;
1034    END IF;
1035    IF NVL(p_objfundsum_rec.earned_amt, 0) <> 0 THEN
1036        l_objfundsum_rec.earned_amt := NVL(l_tmp_objfundsum_rec.earned_amt, 0) + p_objfundsum_rec.earned_amt;
1037    END IF;
1038    IF NVL(p_objfundsum_rec.plan_curr_earned_amt, 0) <> 0 THEN
1039        l_objfundsum_rec.plan_curr_earned_amt := NVL(l_tmp_objfundsum_rec.plan_curr_earned_amt, 0)
1040                                            + p_objfundsum_rec.plan_curr_earned_amt;
1044                                            + p_objfundsum_rec.univ_curr_earned_amt;
1041    END IF;
1042    IF NVL(p_objfundsum_rec.univ_curr_earned_amt, 0) <> 0 THEN
1043        l_objfundsum_rec.univ_curr_earned_amt := NVL(l_tmp_objfundsum_rec.univ_curr_earned_amt, 0)
1045    END IF;
1046    IF NVL(p_objfundsum_rec.paid_amt, 0) <> 0 THEN
1047        l_objfundsum_rec.paid_amt := NVL(l_tmp_objfundsum_rec.paid_amt, 0) + p_objfundsum_rec.paid_amt;
1048    END IF;
1049    IF NVL(p_objfundsum_rec.plan_curr_paid_amt, 0) <> 0 THEN
1050        l_objfundsum_rec.plan_curr_paid_amt := NVL(l_tmp_objfundsum_rec.plan_curr_paid_amt, 0)
1051                                            + p_objfundsum_rec.plan_curr_paid_amt;
1052    END IF;
1053    IF NVL(p_objfundsum_rec.univ_curr_paid_amt, 0) <> 0 THEN
1054        l_objfundsum_rec.univ_curr_paid_amt := NVL(l_tmp_objfundsum_rec.univ_curr_paid_amt, 0)
1055                                            + p_objfundsum_rec.univ_curr_paid_amt;
1056    END IF;
1057 
1058    ozf_objfundsum_pvt.update_objfundsum(
1059        p_api_version                => p_api_version,
1060        p_init_msg_list              => p_init_msg_list,
1061        p_validation_level           => p_validation_level,
1062        p_objfundsum_rec             => l_objfundsum_rec,
1063        x_return_status              => x_return_status,
1064        x_msg_count                  => x_msg_count,
1065        x_msg_data                   => x_msg_data
1066    );
1067    -- dbms_output.put_line('process_objfunsum: update_objfunsum returns ' || x_return_status);
1068    IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1069       RAISE fnd_api.g_exc_unexpected_error;
1070    ELSIF l_return_status = fnd_api.g_ret_sts_error THEN
1071       RAISE fnd_api.g_exc_error;
1072    END IF;
1073 
1074 EXCEPTION
1075    WHEN Fnd_Api.G_EXC_ERROR THEN
1076       ROLLBACK TO SP_process_objfundsum;
1077       x_return_status := Fnd_Api.G_RET_STS_ERROR;
1078       Fnd_Msg_Pub.Count_And_Get (
1079          p_count         =>     x_msg_count,
1080          p_data          =>     x_msg_data,
1081          p_encoded       =>     FND_API.G_FALSE
1082       );
1083    WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1084       ROLLBACK TO SP_process_objfundsum;
1085       x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1086       Fnd_Msg_Pub.Count_And_Get (
1087          p_count         =>     x_msg_count,
1088          p_data          =>     x_msg_data,
1089          p_encoded       =>   FND_API.G_FALSE
1090       );
1091    WHEN OTHERS THEN
1092       ROLLBACK TO SP_process_objfundsum;
1093       x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1094       IF Fnd_Msg_Pub.Check_Msg_Level (Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR) THEN
1095          Fnd_Msg_Pub.Add_Exc_Msg (G_PKG_NAME, L_API_NAME);
1096       END IF;
1097       Fnd_Msg_Pub.Count_And_Get (
1098          p_count         =>     x_msg_count,
1099          p_data          =>     x_msg_data,
1100          p_encoded       =>   FND_API.G_FALSE
1101       );
1102 END process_objfundsum;
1103 
1104 
1105 -- NAME
1106 --    Validate_objfundsum
1107 --
1108 -- PURPOSE
1109 --   Validation API for Activity metrics.
1110 --
1111 -- NOTES
1112 --
1113 -- HISTORY
1114 --   06/30/2005   yzhao         Created.
1115 
1116 PROCEDURE Validate_objfundsum (
1117    p_api_version                IN  NUMBER,
1118    p_init_msg_list              IN  VARCHAR2 := Fnd_Api.G_FALSE,
1119    p_validation_level           IN  NUMBER   := Fnd_Api.G_Valid_Level_Full,
1120    p_objfundsum_rec             IN  objfundsum_rec_type,
1121    x_return_status              OUT NOCOPY VARCHAR2,
1122    x_msg_count                  OUT NOCOPY NUMBER,
1123    x_msg_data                   OUT NOCOPY VARCHAR2
1124 )
1125 IS
1126    L_API_VERSION    CONSTANT NUMBER := 1.0;
1127    L_API_NAME       CONSTANT VARCHAR2(30) := 'VALIDATE_OBJFUNDSUM';
1128    L_FULL_NAME      CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
1129 
1130    l_table_name   VARCHAR2 (30);
1131    l_pk_name      VARCHAR2 (30);
1132    l_pk_value     VARCHAR2 (30);
1133    l_return_status  VARCHAR2(1);
1134 
1135 BEGIN
1136    IF (OZF_DEBUG_HIGH_ON) THEN
1137       ozf_utility_pvt.debug_message(l_full_name||': start');
1138    END IF;
1139 
1140    IF Fnd_Api.To_Boolean (p_init_msg_list) THEN
1141       Fnd_Msg_Pub.Initialize;
1142    END IF;
1143 
1144    IF NOT Fnd_Api.Compatible_API_Call (L_API_VERSION,
1145                                        p_api_version,
1146                                        L_API_NAME,
1147                                        G_PKG_NAME)
1148    THEN
1149       RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
1150    END IF;
1151 
1152    x_return_status := NULL;
1153 
1154    IF (OZF_DEBUG_HIGH_ON) THEN
1155       ozf_utility_pvt.debug_message(l_full_name||': Validation');
1156    END IF;
1157 
1158    IF p_validation_level >= Jtf_Plsql_Api.g_valid_level_item THEN
1159        -- fund_id is required
1160        IF p_objfundsum_rec.fund_id IS NULL OR
1161           p_objfundsum_rec.fund_id = fnd_api.g_miss_num
1162        THEN
1163           IF Fnd_Msg_Pub.Check_Msg_Level (Fnd_Msg_Pub.G_MSG_LVL_ERROR)
1164           THEN
1165              Fnd_Message.Set_Name('OZF', 'OZF_OBJFUNDSUM_MISSING_FUND_ID');
1166              Fnd_Msg_Pub.ADD;
1167           END IF;
1168           RAISE Fnd_Api.G_EXC_ERROR;
1169        END IF;
1170 
1171        -- fund_currency is required
1172        IF p_objfundsum_rec.fund_currency IS NULL OR
1173           p_objfundsum_rec.fund_currency = fnd_api.g_miss_char
1174        THEN
1175           IF Fnd_Msg_Pub.Check_Msg_Level (Fnd_Msg_Pub.G_MSG_LVL_ERROR)
1176           THEN
1177              Fnd_Message.Set_Name('OZF', 'OZF_OBJFUNDSUM_MISSING_FUND_CURRENCY');
1178              Fnd_Msg_Pub.ADD;
1179           END IF;
1180           RAISE Fnd_Api.G_EXC_ERROR;
1184        IF p_objfundsum_rec.object_type IS NULL OR
1181        END IF;
1182 
1183        -- object_type is required
1185           p_objfundsum_rec.object_type = fnd_api.g_miss_char
1186        THEN
1187           IF Fnd_Msg_Pub.Check_Msg_Level (Fnd_Msg_Pub.G_MSG_LVL_ERROR)
1188           THEN
1189              Fnd_Message.Set_Name('OZF', 'OZF_OBJFUNDSUM_MISSING_OBJECT_TYPE');
1190              Fnd_Msg_Pub.ADD;
1191           END IF;
1192           RAISE Fnd_Api.G_EXC_ERROR;
1193        END IF;
1194 
1195        -- object_id is required
1196        IF p_objfundsum_rec.object_id IS NULL OR
1197           p_objfundsum_rec.object_id = fnd_api.g_miss_num
1198        THEN
1199           IF Fnd_Msg_Pub.Check_Msg_Level (Fnd_Msg_Pub.G_MSG_LVL_ERROR)
1200           THEN
1201              Fnd_Message.Set_Name('OZF', 'OZF_OBJFUNDSUM_MISSING_OBJECT_ID');
1202              Fnd_Msg_Pub.ADD;
1203           END IF;
1204           RAISE Fnd_Api.G_EXC_ERROR;
1205        END IF;
1206 
1207        -- object_currency is required
1208        IF p_objfundsum_rec.object_currency IS NULL OR
1209           p_objfundsum_rec.object_currency = fnd_api.g_miss_char
1210        THEN
1211           IF Fnd_Msg_Pub.Check_Msg_Level (Fnd_Msg_Pub.G_MSG_LVL_ERROR)
1212           THEN
1213              Fnd_Message.Set_Name('OZF', 'OZF_OBJFUNDSUM_MISSING_OBJECT_CURRENCY');
1214              Fnd_Msg_Pub.ADD;
1215           END IF;
1216           RAISE Fnd_Api.G_EXC_ERROR;
1217        END IF;
1218 
1219        -- object_type should be valid code in lookup type OZF_FUND_TYPE
1220        IF ozf_utility_pvt.check_lookup_exists (
1221             p_lookup_type=> 'OZF_FUND_SOURCE'
1222            ,p_lookup_code=> p_objfundsum_rec.object_type
1223           ) = fnd_api.g_false THEN
1224           IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_error) THEN
1225              fnd_message.set_name ('OZF', 'OZF_OBJFUNDSUM_BAD_OBJTYPE');
1226              fnd_msg_pub.ADD;
1227           END IF;
1228           RAISE Fnd_Api.G_EXC_ERROR;
1229        END IF;
1230 
1231        -- fund_id should be valid in ozf_funds_all_b
1232        IF ozf_utility_pvt.check_fk_exists (
1233                p_table_name=> 'OZF_FUNDS_ALL_B'
1234               ,p_pk_name=> 'FUND_ID'
1235               ,p_pk_value=> p_objfundsum_rec.fund_id
1236           ) = fnd_api.g_false THEN
1237           IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_error) THEN
1238              fnd_message.set_name ('OZF', 'OZF_OBJFUNDSUM_BAD_FUNDID');
1239              fnd_msg_pub.ADD;
1240           END IF;
1241           RAISE Fnd_Api.G_EXC_ERROR;
1242        END IF;
1243 
1244        -- Check FK parameter: object_id
1245        IF p_objfundsum_rec.object_type = ('EVEH') THEN
1246           l_table_name               := 'AMS_EVENT_HEADERS_B';
1247           l_pk_name                  := 'EVENT_HEADER_ID';
1248         ELSIF p_objfundsum_rec.object_type IN ( 'EVEO','EONE') THEN
1249           l_table_name               := 'AMS_EVENT_OFFERS_B';
1250           l_pk_name                  := 'EVENT_OFFER_ID';
1251        ELSIF p_objfundsum_rec.object_type = 'DELV' THEN
1252           l_table_name               := 'AMS_DELIVERABLES_B';
1253           l_pk_name                  := 'DELIVERABLE_ID';
1254        ELSIF p_objfundsum_rec.object_type = 'CAMP' THEN
1255           l_table_name               := 'AMS_CAMPAIGNS_B';
1256           l_pk_name                  := 'CAMPAIGN_ID';
1257        ELSIF p_objfundsum_rec.object_type = 'CSCH' THEN
1258           l_table_name               := 'AMS_CAMPAIGN_SCHEDULES_B';
1259           l_pk_name                  := 'SCHEDULE_ID';
1260        ELSIF p_objfundsum_rec.object_type = 'OFFR'
1261           OR p_objfundsum_rec.object_type = 'PRIC' THEN
1262           l_table_name               := 'QP_LIST_HEADERS';
1263           l_pk_name                  := 'LIST_HEADER_ID';
1264        END IF;
1265        l_pk_value                 := p_objfundsum_rec.object_id;
1266        IF ozf_utility_pvt.check_fk_exists (
1267                p_table_name=> l_table_name
1268               ,p_pk_name=> l_pk_name
1269               ,p_pk_value=> l_pk_value
1270           ) = fnd_api.g_false THEN
1271           IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_error) THEN
1272              fnd_message.set_name ('OZF', 'OZF_OBJFUNDSUM_BAD_OBJID');
1273              fnd_msg_pub.ADD;
1274           END IF;
1275           RAISE Fnd_Api.G_EXC_ERROR;
1276        END IF;
1277 
1278    END IF;
1279 
1280    x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
1281 
1282    Fnd_Msg_Pub.Count_And_Get (
1283       p_count           =>    x_msg_count,
1284       p_data            =>    x_msg_data,
1285       p_encoded         =>    Fnd_Api.G_FALSE
1286    );
1287 
1288    IF (OZF_DEBUG_HIGH_ON) THEN
1289       ozf_utility_pvt.debug_message(l_full_name ||': end');
1290    END IF;
1291 
1292 EXCEPTION
1293    WHEN Fnd_Api.G_EXC_ERROR THEN
1294       x_return_status := Fnd_Api.G_RET_STS_ERROR;
1295       Fnd_Msg_Pub.Count_And_Get (
1296          p_count         =>     x_msg_count,
1297          p_data          =>     x_msg_data,
1298          p_encoded       =>   FND_API.G_FALSE
1299       );
1300    WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1301       x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1302       Fnd_Msg_Pub.Count_And_Get (
1303          p_count         =>     x_msg_count,
1304          p_data          =>     x_msg_data,
1305          p_encoded       =>   FND_API.G_FALSE
1306       );
1307    WHEN OTHERS THEN
1308       x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1309       IF Fnd_Msg_Pub.Check_Msg_Level (Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR) THEN
1310          Fnd_Msg_Pub.Add_Exc_Msg (G_PKG_NAME, L_API_NAME);
1311       END IF;
1312       Fnd_Msg_Pub.Count_And_Get (
1313          p_count         =>     x_msg_count,
1314          p_data          =>     x_msg_data,
1318 
1315          p_encoded       =>   FND_API.G_FALSE
1316       );
1317 END Validate_objfundsum;
1319 
1320 
1321 --
1322 -- NAME
1323 --    Complete_objfundsum_Rec
1324 --
1325 -- PURPOSE
1326 --   Returns the Initialized objectfundsummary Record
1327 --
1328 -- NOTES
1329 --
1330 -- HISTORY
1331 -- 07/19/1999   choang         Created.
1332 --
1333 PROCEDURE Complete_objfundsum_Rec(
1334    p_objfundsum_rec      IN  objfundsum_rec_type,
1335    x_complete_rec        IN OUT NOCOPY objfundsum_rec_type
1336 )
1337 IS
1338    CURSOR c_objfundsum IS
1339    SELECT *
1340      FROM ozf_object_fund_summary
1341     WHERE objfundsum_id = p_objfundsum_rec.objfundsum_id;
1342 
1343    l_objfundsum_rec  c_objfundsum%ROWTYPE;
1344 BEGIN
1345 
1346    x_complete_rec := p_objfundsum_rec;
1347 
1348    OPEN c_objfundsum;
1349    FETCH c_objfundsum INTO l_objfundsum_rec;
1350    IF c_objfundsum%NOTFOUND THEN
1351       CLOSE c_objfundsum;
1352       IF Fnd_Msg_Pub.check_msg_level(Fnd_Msg_Pub.g_msg_lvl_error) THEN
1353          Fnd_Message.set_name('OZF', 'OZF_API_RECORD_NOT_FOUND');
1354          Fnd_Msg_Pub.ADD;
1355       END IF;
1356       RAISE Fnd_Api.g_exc_error;
1357    END IF;
1358    CLOSE c_objfundsum;
1359 
1360    IF p_objfundsum_rec.fund_id = Fnd_Api.G_MISS_NUM THEN
1361       x_complete_rec.fund_id := NULL;
1362    END IF;
1363    IF p_objfundsum_rec.fund_id IS NULL THEN
1364       x_complete_rec.fund_id := l_objfundsum_rec.fund_id;
1365    END IF;
1366 
1367    IF p_objfundsum_rec.fund_currency = Fnd_Api.G_MISS_CHAR THEN
1368       x_complete_rec.fund_currency := NULL;
1369    END IF;
1370    IF p_objfundsum_rec.fund_currency IS NULL THEN
1371       x_complete_rec.fund_currency := l_objfundsum_rec.fund_currency;
1372    END IF;
1373 
1374    IF p_objfundsum_rec.object_type = Fnd_Api.G_MISS_CHAR THEN
1375       x_complete_rec.object_type := NULL;
1376    END IF;
1377    IF p_objfundsum_rec.object_type IS NULL THEN
1378       x_complete_rec.object_type := l_objfundsum_rec.object_type;
1379    END IF;
1380 
1381    IF p_objfundsum_rec.object_id = Fnd_Api.G_MISS_NUM THEN
1382       x_complete_rec.object_id := NULL;
1383    END IF;
1384    IF p_objfundsum_rec.object_id IS NULL THEN
1385       x_complete_rec.object_id := l_objfundsum_rec.object_id;
1386    END IF;
1387 
1388    IF p_objfundsum_rec.object_currency = Fnd_Api.G_MISS_CHAR THEN
1389       x_complete_rec.object_currency := NULL;
1390    END IF;
1391    IF p_objfundsum_rec.object_currency IS NULL THEN
1392       x_complete_rec.object_currency := l_objfundsum_rec.object_currency;
1393    END IF;
1394 
1395    IF p_objfundsum_rec.reference_object_type = Fnd_Api.G_MISS_CHAR THEN
1396       x_complete_rec.reference_object_type := NULL;
1397    END IF;
1398    IF p_objfundsum_rec.reference_object_type IS NULL THEN
1399       x_complete_rec.reference_object_type := l_objfundsum_rec.reference_object_type;
1400    END IF;
1401 
1402    IF p_objfundsum_rec.reference_object_id = Fnd_Api.G_MISS_NUM THEN
1403       x_complete_rec.reference_object_id := NULL;
1404    END IF;
1405    IF p_objfundsum_rec.reference_object_id IS NULL THEN
1406       x_complete_rec.reference_object_id := l_objfundsum_rec.reference_object_id;
1407    END IF;
1408 
1409    IF p_objfundsum_rec.source_from_parent = Fnd_Api.G_MISS_CHAR THEN
1410       x_complete_rec.source_from_parent := NULL;
1411    END IF;
1412    IF p_objfundsum_rec.source_from_parent IS NULL THEN
1413       x_complete_rec.source_from_parent := l_objfundsum_rec.source_from_parent;
1414    END IF;
1415 
1416    IF p_objfundsum_rec.planned_amt = Fnd_Api.G_MISS_NUM THEN
1417       x_complete_rec.planned_amt := NULL;
1418    END IF;
1419    IF p_objfundsum_rec.planned_amt IS NULL THEN
1420       x_complete_rec.planned_amt := l_objfundsum_rec.planned_amt;
1421    END IF;
1422 
1423    IF p_objfundsum_rec.committed_amt = Fnd_Api.G_MISS_NUM THEN
1424       x_complete_rec.committed_amt := NULL;
1425    END IF;
1426    IF p_objfundsum_rec.committed_amt IS NULL THEN
1427       x_complete_rec.committed_amt := l_objfundsum_rec.committed_amt;
1428    END IF;
1429 
1430    IF p_objfundsum_rec.recal_committed_amt = Fnd_Api.G_MISS_NUM THEN
1431       x_complete_rec.recal_committed_amt := NULL;
1432    END IF;
1433    IF p_objfundsum_rec.recal_committed_amt IS NULL THEN
1434       x_complete_rec.recal_committed_amt := l_objfundsum_rec.recal_committed_amt;
1435    END IF;
1436 
1437    IF p_objfundsum_rec.utilized_amt = Fnd_Api.G_MISS_NUM THEN
1438       x_complete_rec.utilized_amt := NULL;
1439    END IF;
1440    IF p_objfundsum_rec.utilized_amt IS NULL THEN
1441       x_complete_rec.utilized_amt := l_objfundsum_rec.utilized_amt;
1442    END IF;
1443 
1444    IF p_objfundsum_rec.earned_amt = Fnd_Api.G_MISS_NUM THEN
1445       x_complete_rec.earned_amt := NULL;
1446    END IF;
1447    IF p_objfundsum_rec.earned_amt IS NULL THEN
1448       x_complete_rec.earned_amt := l_objfundsum_rec.earned_amt;
1449    END IF;
1450 
1451    IF p_objfundsum_rec.paid_amt = Fnd_Api.G_MISS_NUM THEN
1452       x_complete_rec.paid_amt := NULL;
1453    END IF;
1454    IF p_objfundsum_rec.paid_amt IS NULL THEN
1455       x_complete_rec.paid_amt := l_objfundsum_rec.paid_amt;
1456    END IF;
1457 
1458    IF p_objfundsum_rec.plan_curr_planned_amt = Fnd_Api.G_MISS_NUM THEN
1459       x_complete_rec.plan_curr_planned_amt := NULL;
1460    END IF;
1461    IF p_objfundsum_rec.plan_curr_planned_amt IS NULL THEN
1462       x_complete_rec.plan_curr_planned_amt := l_objfundsum_rec.plan_curr_planned_amt;
1463    END IF;
1464 
1465    IF p_objfundsum_rec.plan_curr_committed_amt = Fnd_Api.G_MISS_NUM THEN
1466       x_complete_rec.plan_curr_committed_amt := NULL;
1467    END IF;
1471 
1468    IF p_objfundsum_rec.plan_curr_committed_amt IS NULL THEN
1469       x_complete_rec.plan_curr_committed_amt := l_objfundsum_rec.plan_curr_committed_amt;
1470    END IF;
1472    IF p_objfundsum_rec.plan_curr_recal_committed_amt = Fnd_Api.G_MISS_NUM THEN
1473       x_complete_rec.plan_curr_recal_committed_amt := NULL;
1474    END IF;
1475    IF p_objfundsum_rec.plan_curr_recal_committed_amt IS NULL THEN
1476       x_complete_rec.plan_curr_recal_committed_amt := l_objfundsum_rec.plan_curr_recal_committed_amt;
1477    END IF;
1478 
1479    IF p_objfundsum_rec.plan_curr_utilized_amt = Fnd_Api.G_MISS_NUM THEN
1480       x_complete_rec.plan_curr_utilized_amt := NULL;
1481    END IF;
1482    IF p_objfundsum_rec.plan_curr_utilized_amt IS NULL THEN
1483       x_complete_rec.plan_curr_utilized_amt := l_objfundsum_rec.plan_curr_utilized_amt;
1484    END IF;
1485 
1486    IF p_objfundsum_rec.plan_curr_earned_amt = Fnd_Api.G_MISS_NUM THEN
1487       x_complete_rec.plan_curr_earned_amt := NULL;
1488    END IF;
1489    IF p_objfundsum_rec.plan_curr_earned_amt IS NULL THEN
1490       x_complete_rec.plan_curr_earned_amt := l_objfundsum_rec.plan_curr_earned_amt;
1491    END IF;
1492 
1493    IF p_objfundsum_rec.plan_curr_paid_amt = Fnd_Api.G_MISS_NUM THEN
1494       x_complete_rec.plan_curr_paid_amt := NULL;
1495    END IF;
1496    IF p_objfundsum_rec.plan_curr_paid_amt IS NULL THEN
1497       x_complete_rec.plan_curr_paid_amt := l_objfundsum_rec.plan_curr_paid_amt;
1498    END IF;
1499 
1500    IF p_objfundsum_rec.univ_curr_planned_amt = Fnd_Api.G_MISS_NUM THEN
1501       x_complete_rec.univ_curr_planned_amt := NULL;
1502    END IF;
1503    IF p_objfundsum_rec.univ_curr_planned_amt IS NULL THEN
1504       x_complete_rec.univ_curr_planned_amt := l_objfundsum_rec.univ_curr_planned_amt;
1505    END IF;
1506 
1507    IF p_objfundsum_rec.univ_curr_committed_amt = Fnd_Api.G_MISS_NUM THEN
1508       x_complete_rec.univ_curr_committed_amt := NULL;
1509    END IF;
1510    IF p_objfundsum_rec.univ_curr_committed_amt IS NULL THEN
1511       x_complete_rec.univ_curr_committed_amt := l_objfundsum_rec.univ_curr_committed_amt;
1512    END IF;
1513 
1514    IF p_objfundsum_rec.univ_curr_recal_committed_amt = Fnd_Api.G_MISS_NUM THEN
1515       x_complete_rec.univ_curr_recal_committed_amt := NULL;
1516    END IF;
1517    IF p_objfundsum_rec.univ_curr_recal_committed_amt IS NULL THEN
1518       x_complete_rec.univ_curr_recal_committed_amt := l_objfundsum_rec.univ_curr_recal_committed_amt;
1519    END IF;
1520 
1521    IF p_objfundsum_rec.univ_curr_utilized_amt = Fnd_Api.G_MISS_NUM THEN
1522       x_complete_rec.univ_curr_utilized_amt := NULL;
1523    END IF;
1524    IF p_objfundsum_rec.univ_curr_utilized_amt IS NULL THEN
1525       x_complete_rec.univ_curr_utilized_amt := l_objfundsum_rec.univ_curr_utilized_amt;
1526    END IF;
1527 
1528    IF p_objfundsum_rec.univ_curr_earned_amt = Fnd_Api.G_MISS_NUM THEN
1529       x_complete_rec.univ_curr_earned_amt := NULL;
1530    END IF;
1531    IF p_objfundsum_rec.univ_curr_earned_amt IS NULL THEN
1532       x_complete_rec.univ_curr_earned_amt := l_objfundsum_rec.univ_curr_earned_amt;
1533    END IF;
1534 
1535    IF p_objfundsum_rec.univ_curr_paid_amt = Fnd_Api.G_MISS_NUM THEN
1536       x_complete_rec.univ_curr_paid_amt := NULL;
1537    END IF;
1538    IF p_objfundsum_rec.univ_curr_paid_amt IS NULL THEN
1539       x_complete_rec.univ_curr_paid_amt := l_objfundsum_rec.univ_curr_paid_amt;
1540    END IF;
1541 
1542 
1543    IF p_objfundsum_rec.attribute_category = Fnd_Api.G_MISS_CHAR THEN
1544       x_complete_rec.attribute_category := NULL;
1545    END IF;
1546    IF p_objfundsum_rec.attribute_category IS NULL THEN
1547       x_complete_rec.attribute_category := l_objfundsum_rec.attribute_category;
1548    END IF;
1549 
1550    IF p_objfundsum_rec.attribute1 = Fnd_Api.G_MISS_CHAR THEN
1551       x_complete_rec.attribute1 := NULL;
1552    END IF;
1553    IF p_objfundsum_rec.attribute1 IS NULL THEN
1554       x_complete_rec.attribute1 := l_objfundsum_rec.attribute1;
1555    END IF;
1556 
1557    IF p_objfundsum_rec.attribute2 = Fnd_Api.G_MISS_CHAR THEN
1558       x_complete_rec.attribute2 := NULL;
1559    END IF;
1560    IF p_objfundsum_rec.attribute2 IS NULL THEN
1561       x_complete_rec.attribute2 := l_objfundsum_rec.attribute2;
1562    END IF;
1563 
1564    IF p_objfundsum_rec.attribute3 = Fnd_Api.G_MISS_CHAR THEN
1565       x_complete_rec.attribute3 := NULL;
1566    END IF;
1567    IF p_objfundsum_rec.attribute3 IS NULL THEN
1568       x_complete_rec.attribute3 := l_objfundsum_rec.attribute3;
1569    END IF;
1570 
1571    IF p_objfundsum_rec.attribute4 = Fnd_Api.G_MISS_CHAR THEN
1572       x_complete_rec.attribute4 := NULL;
1573    END IF;
1574    IF p_objfundsum_rec.attribute4 IS NULL THEN
1575       x_complete_rec.attribute4 := l_objfundsum_rec.attribute4;
1576    END IF;
1577 
1578    IF p_objfundsum_rec.attribute5 = Fnd_Api.G_MISS_CHAR THEN
1579       x_complete_rec.attribute5 := NULL;
1580    END IF;
1581    IF p_objfundsum_rec.attribute5 IS NULL THEN
1582       x_complete_rec.attribute5 := l_objfundsum_rec.attribute5;
1583    END IF;
1584 
1585    IF p_objfundsum_rec.attribute6 = Fnd_Api.G_MISS_CHAR THEN
1586       x_complete_rec.attribute6 := NULL;
1587    END IF;
1588    IF p_objfundsum_rec.attribute6 IS NULL THEN
1589       x_complete_rec.attribute6 := l_objfundsum_rec.attribute6;
1590    END IF;
1591 
1592    IF p_objfundsum_rec.attribute7 = Fnd_Api.G_MISS_CHAR THEN
1593       x_complete_rec.attribute7 := NULL;
1594    END IF;
1595    IF p_objfundsum_rec.attribute7 IS NULL THEN
1596       x_complete_rec.attribute7 := l_objfundsum_rec.attribute7;
1597    END IF;
1598 
1599    IF p_objfundsum_rec.attribute8 = Fnd_Api.G_MISS_CHAR THEN
1600       x_complete_rec.attribute8 := NULL;
1601    END IF;
1602    IF p_objfundsum_rec.attribute8 IS NULL THEN
1603       x_complete_rec.attribute8 := l_objfundsum_rec.attribute8;
1604    END IF;
1605 
1606    IF p_objfundsum_rec.attribute9 = Fnd_Api.G_MISS_CHAR THEN
1607       x_complete_rec.attribute9 := NULL;
1608    END IF;
1609    IF p_objfundsum_rec.attribute9 IS NULL THEN
1610       x_complete_rec.attribute9 := l_objfundsum_rec.attribute9;
1611    END IF;
1612 
1613    IF p_objfundsum_rec.attribute10 = Fnd_Api.G_MISS_CHAR THEN
1614       x_complete_rec.attribute10 := NULL;
1615    END IF;
1616    IF p_objfundsum_rec.attribute10 IS NULL THEN
1617       x_complete_rec.attribute10 := l_objfundsum_rec.attribute10;
1618    END IF;
1619 
1620    IF p_objfundsum_rec.attribute11 = Fnd_Api.G_MISS_CHAR THEN
1621       x_complete_rec.attribute11 := NULL;
1622    END IF;
1623    IF p_objfundsum_rec.attribute11 IS NULL THEN
1624       x_complete_rec.attribute11 := l_objfundsum_rec.attribute11;
1625    END IF;
1626 
1627    IF p_objfundsum_rec.attribute12 = Fnd_Api.G_MISS_CHAR THEN
1628       x_complete_rec.attribute12 := NULL;
1629    END IF;
1630    IF p_objfundsum_rec.attribute12 IS NULL THEN
1631       x_complete_rec.attribute12 := l_objfundsum_rec.attribute12;
1632    END IF;
1633 
1634    IF p_objfundsum_rec.attribute13 = Fnd_Api.G_MISS_CHAR THEN
1635       x_complete_rec.attribute13 := NULL;
1636    END IF;
1637    IF p_objfundsum_rec.attribute13 IS NULL THEN
1638       x_complete_rec.attribute13 := l_objfundsum_rec.attribute13;
1639    END IF;
1640 
1641    IF p_objfundsum_rec.attribute14 = Fnd_Api.G_MISS_CHAR THEN
1642       x_complete_rec.attribute14 := NULL;
1643    END IF;
1644    IF p_objfundsum_rec.attribute14 IS NULL THEN
1645       x_complete_rec.attribute14 := l_objfundsum_rec.attribute14;
1646    END IF;
1647 
1648    IF p_objfundsum_rec.attribute15 = Fnd_Api.G_MISS_CHAR THEN
1649       x_complete_rec.attribute15 := NULL;
1650    END IF;
1651    IF p_objfundsum_rec.attribute15 IS NULL THEN
1652       x_complete_rec.attribute15 := l_objfundsum_rec.attribute15;
1653    END IF;
1654 
1655 END Complete_objfundsum_Rec ;
1656 
1657 
1658 END Ozf_objfundsum_Pvt;