[Home] [Help]
PACKAGE BODY: APPS.HZ_CUSTOMER_PROFILE_V2PUB
Source
1 PACKAGE BODY HZ_CUSTOMER_PROFILE_V2PUB AS
2 /*$Header: ARH2CFSB.pls 120.26.12000000.5 2007/10/19 07:05:10 rgokavar ship $ */
3
4 --------------------------------------
5 -- declaration of private global varibles
6 --------------------------------------
7
8 G_DEBUG_COUNT NUMBER := 0;
9 --G_DEBUG BOOLEAN := FALSE;
10
11 --------------------------------------
12 -- declaration of private procedures and functions
13 --------------------------------------
14
15 /*PROCEDURE enable_debug;
16
17 PROCEDURE disable_debug;
18 */
19
20
21 PROCEDURE do_create_customer_profile (
22 p_customer_profile_rec IN OUT NOCOPY CUSTOMER_PROFILE_REC_TYPE,
23 p_create_profile_amt IN VARCHAR2,
24 x_cust_account_profile_id OUT NOCOPY NUMBER,
25 x_return_status IN OUT NOCOPY VARCHAR2
26 );
27
28 PROCEDURE do_update_customer_profile (
29 p_customer_profile_rec IN OUT NOCOPY CUSTOMER_PROFILE_REC_TYPE,
30 p_object_version_number IN OUT NOCOPY NUMBER,
31 x_return_status IN OUT NOCOPY VARCHAR2
32 );
33
34 PROCEDURE do_create_cust_profile_amt (
35 p_check_foreign_key IN VARCHAR2,
36 p_cust_profile_amt_rec IN OUT NOCOPY CUST_PROFILE_AMT_REC_TYPE,
37 x_cust_acct_profile_amt_id OUT NOCOPY NUMBER,
38 x_return_status IN OUT NOCOPY VARCHAR2
39 );
40
41 PROCEDURE do_update_cust_profile_amt (
42 p_cust_profile_amt_rec IN OUT NOCOPY CUST_PROFILE_AMT_REC_TYPE,
43 p_object_version_number IN OUT NOCOPY NUMBER,
44 x_return_status IN OUT NOCOPY VARCHAR2
45 );
46
47 FUNCTION compute_next_date
48 ( p_date IN DATE,
49 p_period IN VARCHAR2)
50 RETURN DATE;
51
52 FUNCTION party_id_value
53 ( p_cust_account_id IN NUMBER,
54 p_active IN VARCHAR2 )
55 RETURN NUMBER;
56
57 FUNCTION party_exist
58 ( p_party_id IN NUMBER,
59 p_active IN VARCHAR2)
60 RETURN VARCHAR2;
61
62 --------------------------------------
63 -- private procedures and functions
64 --------------------------------------
65 --2310474{
66 /**
67 * Private Function compute_next_date
68 *
69 * Description
70 * Compute the next review date
71 *
72 * MODIFICATION HISTORY
73 * 04-19-2002 Herve Yu o Created
74 *
75 */
76 FUNCTION compute_next_date
77 ( p_date IN DATE,
78 p_period IN VARCHAR2)
79 RETURN DATE
80 IS
81 l_date DATE;
82 BEGIN
83 IF p_period = 'WEEKLY' THEN
84 l_date := p_date + 7;
85 ELSIF p_period = 'MONTHLY' THEN
86 l_date := add_months(p_date,1);
87 ELSIF p_period = 'QUARTERLY' THEN
88 l_date := add_months(p_date,3);
89 ELSIF p_period = 'HALF_YEARLY' THEN
90 l_date := add_months(p_date,6);
91 ELSIF p_period = 'YEARLY' THEN
92 l_date := add_months(p_date,12);
93 ELSE
94 l_date := p_date;
95 END IF;
96 RETURN l_date;
97 END;
98
99 /**
100 * Private Function Party_id_value
101 *
102 * Description
103 * Provide the party_id for a cust_account_id
104 *
105 * MODIFICATION HISTORY
106 * 04-19-2002 Herve Yu o Created
107 *
108 */
109 FUNCTION party_id_value
110 ( p_cust_account_id IN NUMBER,
111 p_active IN VARCHAR2 )
112 RETURN NUMBER
113 IS
114 CURSOR c1 IS
115 SELECT a.party_id
116 FROM hz_cust_accounts a,
117 hz_parties b
118 WHERE a.cust_account_id = p_cust_account_id
119 AND a.party_id = b.party_id
120 AND b.status = DECODE(p_active,'ALL',b.status,p_active);
121 l_party_id NUMBER;
122 BEGIN
123 OPEN c1;
124 FETCH c1 INTO l_party_id;
125 IF c1%NOTFOUND OR l_party_id IS NULL THEN
126 l_party_id := -99999;
127 END IF;
128 CLOSE c1;
129 RETURN l_party_id;
130 END;
131
132 FUNCTION party_exist
133 ( p_party_id IN NUMBER,
134 p_active IN VARCHAR2)
135 RETURN VARCHAR2
136 IS
137 CURSOR c1 IS
138 SELECT 'Y'
139 FROM hz_parties
140 WHERE party_id = p_party_id
141 AND status = DECODE(p_active,'ALL',status,p_active);
142 lact VARCHAR2(1);
143 ret VARCHAR2(1);
144 BEGIN
145 OPEN c1;
146 FETCH c1 INTO lact;
147 IF c1%NOTFOUND THEN
148 ret := 'N';
149 ELSE
150 ret := 'Y';
151 END IF;
152 CLOSE c1;
153 RETURN ret;
154 END;
155
156 /**
157 * Private Function class_review_cycle
158 *
159 * Description
160 * RETURN the Reveiew_Cycle of a Profile Class
161 *
162 * MODIFICATION HISTORY
163 * 04-19-2002 Herve Yu o Created
164 *
165 */
166 FUNCTION class_review_cycle
167 ( p_cust_prof_class_id IN NUMBER)
168 RETURN VARCHAR2
169 IS
170 CURSOR c1 IS
171 SELECT review_cycle
172 FROM hz_cust_profile_classes
173 WHERE profile_class_id = p_cust_prof_class_id;
174 l_review_cycle VARCHAR2(30);
175 BEGIN
176 OPEN c1;
177 FETCH c1 INTO l_review_cycle;
178 IF c1%NOTFOUND THEN
179 l_review_cycle := 'NO_DATA_FOUND';
180 END IF;
181 CLOSE c1;
182 RETURN l_review_cycle;
183 END;
184
185
186 --}
187
188 /**
189 * PRIVATE PROCEDURE enable_debug
190 *
191 * DESCRIPTION
192 * Turn on debug mode.
193 *
194 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
195 * HZ_UTILITY_V2PUB.enable_debug
196 *
197 * MODIFICATION HISTORY
198 *
199 * 07-23-2001 Jianying Huang o Created.
200 *
201 */
202
203 /*PROCEDURE enable_debug IS
204
205 BEGIN
206
207 G_DEBUG_COUNT := G_DEBUG_COUNT + 1;
208
209 IF G_DEBUG_COUNT = 1 THEN
210 IF FND_PROFILE.value( 'HZ_API_FILE_DEBUG_ON' ) = 'Y' OR
211 FND_PROFILE.value( 'HZ_API_DBMS_DEBUG_ON' ) = 'Y'
212 THEN
213 HZ_UTILITY_V2PUB.enable_debug;
214 G_DEBUG := TRUE;
215 END IF;
216 END IF;
217
218 END enable_debug;
219 */
220
221
222 /**
223 * PRIVATE PROCEDURE disable_debug
224 *
225 * DESCRIPTION
226 * Turn off debug mode.
227 *
228 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
229 * HZ_UTILITY_V2PUB.disable_debug
230 *
231 * MODIFICATION HISTORY
232 *
233 * 07-23-2001 Jianying Huang o Created.
234 *
235 */
236
237 /*PROCEDURE disable_debug IS
238
239 BEGIN
240
241 IF G_DEBUG THEN
242 G_DEBUG_COUNT := G_DEBUG_COUNT - 1;
243
244 IF G_DEBUG_COUNT = 0 THEN
245 HZ_UTILITY_V2PUB.disable_debug;
246 G_DEBUG := FALSE;
247 END IF;
248 END IF;
249
250 END disable_debug;
251 */
252
253 /**
254 * PRIVATE PROCEDURE do_create_customer_profile
255 *
256 * DESCRIPTION
257 * Private procedure to create customer profile.
258 *
259 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
260 * HZ_ACCOUNT_VALIDATE_V2PUB.validate_customer_profile
261 * HZ_CUSTOMER_PROFILES_PKG.Insert_Row
262 * HZ_CUST_PROF_CLASS_AMTS_PKG.Select_Row
263 *
264 * ARGUMENTS
265 * IN:
266 * p_create_profile_amt If it is set to FND_API.G_TRUE, API create customer
267 * profile amounts by copying corresponding data
268 * from customer profile class amounts.
269 * IN/OUT:
270 * p_customer_profile_rec Customer profile record. One customer account
271 * must have a customer profile. One account site
272 * use can optionally have one customer profile.
273 * x_return_status Return status after the call. The status can
274 * be FND_API.G_RET_STS_SUCCESS (success),
275 * FND_API.G_RET_STS_ERROR (error),
276 * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
277 * OUT:
278 * x_cust_account_profile_id Customer account profile ID.
279 *
280 * NOTES
281 *
282 * MODIFICATION HISTORY
283 *
284 * 07-23-2001 Jianying Huang o Created.
285 * 07-15-2004 Rajib Ranjan Borah o Bug 3767719. Used variable l_default_profile_class_id
286 * instead of using the hard-coded value 0 to improve
287 * performance. This query and the one in package
288 * HZ_ACCOUNT_VALIDATE_V2PUB.validate_customer_profile
289 * will be parsed only once.
290 */
291
292 PROCEDURE do_create_customer_profile (
293 p_customer_profile_rec IN OUT NOCOPY CUSTOMER_PROFILE_REC_TYPE,
294 p_create_profile_amt IN VARCHAR2,
295 x_cust_account_profile_id OUT NOCOPY NUMBER,
296 x_return_status IN OUT NOCOPY VARCHAR2
297 ) IS
298
299 l_debug_prefix VARCHAR2(30) := ''; --'do_create_customer_profile';
300
301 l_is_first BOOLEAN := TRUE;
302 l_return_status VARCHAR2(1);
303 l_msg_count NUMBER;
304 l_msg_data VARCHAR2(2000);
305
306 l_cust_profile_amt_rec CUST_PROFILE_AMT_REC_TYPE;
307 l_status HZ_CUST_PROFILE_CLASSES.status%TYPE;
308 l_profile_class_name HZ_CUST_PROFILE_CLASSES.name%TYPE;
309 l_profile_class_amount_id NUMBER;
310 l_profile_class_id NUMBER;
311
312 -- 2310474 {
313 l_party_id NUMBER;
314 l_review_cycle VARCHAR2(30);
315 l_last_credit_review_date DATE;
316 -- }
317
318 -- Bug 3767719
319 l_default_profile_class_id NUMBER :=0;
320
321 CURSOR c_profile_class_amts IS
322 SELECT PROFILE_CLASS_AMOUNT_ID
323 FROM HZ_CUST_PROF_CLASS_AMTS
324 WHERE PROFILE_CLASS_ID = p_customer_profile_rec.profile_class_id;
325
326 cursor c_acct_use_profile_dtls IS
327 select cons_bill_level, cons_inv_type
328 from hz_customer_profiles
329 where cust_account_id = p_customer_profile_rec.cust_account_id
330 and site_use_id is NULL
331 and cons_inv_flag = 'Y';
332
333 l_cons_bill_level varchar2(30);
334 l_cons_inv_type varchar2(30);
335 v_action VARCHAR2(10);
336 v_entity_code VARCHAR2(1);
337 v_entity_id NUMBER(15);
338 l_profile_class_rec HZ_CUST_PROFILE_CLASSES%ROWTYPE;
339
340 BEGIN
341
342 -- Debug info.
343 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
344 hz_utility_v2pub.debug(p_message=>'do_create_customer_profile (+)',
345 p_prefix=>l_debug_prefix,
346 p_msg_level=>fnd_log.level_procedure);
347 END IF;
348
349 -- Default profile_class_id.
350 IF p_customer_profile_rec.profile_class_id IS NULL OR
351 p_customer_profile_rec.profile_class_id = FND_API.G_MISS_NUM
352 THEN
353 BEGIN
354 SELECT STATUS, NAME INTO l_status, l_profile_class_name
355 FROM HZ_CUST_PROFILE_CLASSES
356 WHERE PROFILE_CLASS_ID = l_default_profile_class_id; -- Bug 3767719.
357
358 IF l_status = 'I' THEN
359 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_INACTIVE_PROFILE_CLASS' );
360 FND_MESSAGE.SET_TOKEN( 'NAME', l_profile_class_name );
361 FND_MSG_PUB.ADD;
362 RAISE FND_API.G_EXC_ERROR;
363 END IF;
364
365 -- Setup profile_class_id.
366 p_customer_profile_rec.profile_class_id := 0;
367
368 EXCEPTION
369 WHEN NO_DATA_FOUND THEN
370 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_NO_DEFAULT_PROF_CLASS' );
371 FND_MSG_PUB.ADD;
372 RAISE FND_API.G_EXC_ERROR;
373 END;
374 END IF;
375
376 -- Debug info.
377 IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
378 hz_utility_v2pub.debug(p_message=>'get default active profile class (id = 0)',
379 p_prefix =>l_debug_prefix,
380 p_msg_level=>fnd_log.level_statement);
381 END IF;
382
383
384 --{
385 -- 2310474 a value for party_id associated with the customer account
386 -- Algorithm :
387 -- A) Creation mode
388 -- If party_id is null and cust_account_id is null then
389 -- error
390 -- If party_id is not null and cust_account_id is null then
391 -- party_id must be active
392 -- cust_account_id = -1
396 -- If party_id is not null and cust_account_id is not null then
393 -- If party_id is null and cust_account_id is not null then
394 -- cust_account_id must be associated with an active party_id
395 -- party_id = this active party_id
397 -- party_id must be active
398 -- cust_account_id and party_id must be associated in hz_cust_accounts.
399 --
400 IF ( p_customer_profile_rec.party_id IS NULL OR
401 p_customer_profile_rec.party_id = FND_API.G_MISS_NUM )
402 THEN
403
404 IF ( p_customer_profile_rec.cust_account_id IS NULL OR
405 p_customer_profile_rec.cust_account_id = FND_API.G_MISS_NUM )
406 THEN
407 FND_MESSAGE.SET_NAME('AR','HZ_API_CF_ASS_PTY_OR_ACCT');
408 FND_MSG_PUB.ADD;
409 x_return_status := FND_API.G_RET_STS_ERROR;
410 ELSE
411 l_party_id := party_id_value(p_customer_profile_rec.cust_account_id, 'A');
412 IF l_party_id = -99999 THEN
413 FND_MESSAGE.SET_NAME('AR','HZ_API_NO_A_PTY_ASS_ACCT');
414 FND_MESSAGE.SET_TOKEN('ACCT_ID',p_customer_profile_rec.cust_account_id);
415 FND_MSG_PUB.ADD;
416 x_return_status := FND_API.G_RET_STS_ERROR;
417 END IF;
418 p_customer_profile_rec.party_id := l_party_id;
419 END IF;
420
421 ELSE
422
423 IF party_exist( p_customer_profile_rec.party_id, 'A' ) <> 'Y' THEN
424 FND_MESSAGE.SET_NAME('AR','HZ_API_NO_A_PTY');
425 FND_MESSAGE.SET_TOKEN( 'PARTY_ID', p_customer_profile_rec.party_id);
426 FND_MSG_PUB.ADD;
427 x_return_status := FND_API.G_RET_STS_ERROR;
428 END IF;
429
430 IF ( p_customer_profile_rec.cust_account_id IS NULL OR
431 p_customer_profile_rec.cust_account_id = FND_API.G_MISS_NUM )
432 THEN
433 p_customer_profile_rec.cust_account_id := -1;
434 ELSE
435 IF party_id_value(p_customer_profile_rec.cust_account_id, 'A')
436 <> p_customer_profile_rec.party_id
437 THEN
438 FND_MESSAGE.SET_NAME('AR','HZ_API_ACCT_NOT_ASS_PTY');
439 FND_MESSAGE.SET_TOKEN( 'ACCT_ID', p_customer_profile_rec.cust_account_id );
440 FND_MESSAGE.SET_TOKEN( 'PARTY_ID', p_customer_profile_rec.party_id);
441 FND_MSG_PUB.ADD;
442 x_return_status := FND_API.G_RET_STS_ERROR;
443 END IF;
444 END IF;
445
446 END IF;
447 -- }
448 --------------
449 -- to get the default values from profile class
450 SELECT * INTO l_profile_class_rec
451 FROM HZ_CUST_PROFILE_CLASSES
452 WHERE PROFILE_CLASS_ID = p_customer_profile_rec.profile_class_id;
453
454 -- if cons_inv_flag is NULL, get it defaulted from profile class
455 -- if it is still NULL, assign it as 'N'
456 if p_customer_profile_rec.cons_inv_flag is NULl then
457 if l_profile_class_rec.cons_inv_flag is NOT NULL then
458 p_customer_profile_rec.cons_inv_flag := l_profile_class_rec.cons_inv_flag;
459 else
460 p_customer_profile_rec.cons_inv_flag := 'N';
461 end if;
462 end if;
463
464 -- if cons_inv_flag is 'N', make cons_bill_level and cons_inv_type to NULL
465 if p_customer_profile_rec.cons_inv_flag = 'N' then
466 p_customer_profile_rec.cons_inv_type := NULL;
467 p_customer_profile_rec.cons_bill_level := NULL;
468 elsif p_customer_profile_rec.cons_inv_flag = 'Y' then
469 -- If site_use_id is NOT NULL, then it is for Site use profile
470 -- For site use profile, passed value for bill level should be NULL
471 -- and it should get defaulted from account use profile. Also,
472 -- if cons_inv_type is NULL , it should get defaulted from account use profile.
473 if p_customer_profile_rec.site_use_id is NOT NULL then
474 /*
475 if p_customer_profile_rec.cons_bill_level is NOT NULL then
476 FND_MESSAGE.SET_NAME('AR', 'HZ_API_SITE_BILL_LVL_NULL');
477 FND_MSG_PUB.ADD;
478 x_return_status := FND_API.G_RET_STS_ERROR;
479 end if;
480 */
481 OPEN c_acct_use_profile_dtls;
482 FETCH c_acct_use_profile_dtls INTO l_cons_bill_level, l_cons_inv_type;
483 IF c_acct_use_profile_dtls%NOTFOUND THEN
484 FND_MESSAGE.SET_NAME('AR', 'HZ_API_ENABLE_ACC_BAL_FWD_BILL');
485 FND_MSG_PUB.ADD;
486 x_return_status := FND_API.G_RET_STS_ERROR;
487 END IF;
488 p_customer_profile_rec.cons_bill_level := l_cons_bill_level;
489 if p_customer_profile_rec.cons_inv_type is NULL then
490 p_customer_profile_rec.cons_inv_type := l_cons_inv_type;
491 end if;
492 CLOSE c_acct_use_profile_dtls;
493 -- Else for account use profile, getbthe value from profile class
494 -- if cons_bill_level or cons_inv_type is passed as NULL.
495 else
496 if p_customer_profile_rec.cons_bill_level is NULL then
497 p_customer_profile_rec.cons_bill_level := l_profile_class_rec.cons_bill_level;
498 end if;
499 if p_customer_profile_rec.cons_inv_type is NULL then
500 p_customer_profile_rec.cons_inv_type := l_profile_class_rec.cons_inv_type;
501 end if;
502 end if;
503 end if;
504
505 -- if standard terms is NULL, get it defaulted from profile class
506 if p_customer_profile_rec.standard_terms is NULL then
510 -- if late charge payment term or late charge type or message_text_id is NULL, get it defaulted from profile class
507 p_customer_profile_rec.standard_terms := l_profile_class_rec.standard_terms;
508 end if;
509
511 if p_customer_profile_rec.late_charge_term_id is NULL then
512 p_customer_profile_rec.late_charge_term_id := l_profile_class_rec.late_charge_term_id;
513 end if;
514 if p_customer_profile_rec.late_charge_type is NULL then
515 p_customer_profile_rec.late_charge_type := l_profile_class_rec.late_charge_type;
516 end if;
517 if p_customer_profile_rec.message_text_id is NULL then
518 p_customer_profile_rec.message_text_id := l_profile_class_rec.message_text_id;
519 end if;
520
521 -- if p_customer_profile_rec.late_charge_type = 'ADJ' then
522 -- p_customer_profile_rec.late_charge_term_id := NULL;
523 -- p_customer_profile_rec.message_text_id := NULL;
524 -- end if;
525 -----------
526 -- Validate customer profile record
527 HZ_ACCOUNT_VALIDATE_V2PUB.validate_customer_profile (
528 p_create_update_flag => 'C',
529 p_customer_profile_rec => p_customer_profile_rec,
530 p_rowid => NULL,
531 x_return_status => x_return_status );
532
533 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
534 RAISE FND_API.G_EXC_ERROR;
535 END IF;
536
537 -- Added rounding of payment_grace_days to integer for Late charge project.
538 IF p_customer_profile_rec.payment_grace_days is NOT NULL then
539 p_customer_profile_rec.payment_grace_days := ROUND(p_customer_profile_rec.payment_grace_days,0);
540 END IF;
541
542 -- Added rounding of interest_period_days to integer for Late charge project.
543 IF p_customer_profile_rec.interest_period_days is NOT NULL then
544 p_customer_profile_rec.interest_period_days := ROUND(p_customer_profile_rec.interest_period_days,0);
545 END IF;
546
547 -- Add logic for global holds
548
549 IF p_customer_profile_rec.credit_hold = 'Y' THEN
550 v_action := 'APPLY';
551 IF p_customer_profile_rec.site_use_id IS NULL THEN
552 v_entity_code := 'C';
553 v_entity_id := p_customer_profile_rec.cust_account_id;
554 ELSE
555 v_entity_code := 'S';
556 v_entity_id := p_customer_profile_rec.site_use_id;
557 END IF;
558
559 -- Debug info.
560 IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
561 hz_utility_v2pub.debug(p_message=>'Before call OE_HOLDS... '||
562 'v_action = '||v_action||' '||
563 'v_entity_code = '||v_entity_code||' '||
564 'v_entity_id = '||v_entity_id,
565 p_prefix=>l_debug_prefix,
566 p_msg_level=>fnd_log.level_statement);
567 END IF;
568
569 BEGIN
570 OE_Holds_PUB.Process_Holds (
571 p_api_version => 1.0,
572 p_init_msg_list => FND_API.G_FALSE,
573 p_hold_entity_code => v_entity_code,
574 p_hold_entity_id => v_entity_id,
575 p_hold_id => 1,
576 p_release_reason_code => 'AR_AUTOMATIC',
577 p_action => v_action,
578 x_return_status => l_return_status,
579 x_msg_count => l_msg_count,
580 x_msg_data => l_msg_data);
581
582 -- Debug info.
583 IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
584 hz_utility_v2pub.debug(p_message=>'After call OE_HOLDS... '||
585 'l_return_status = '||l_return_status||' '||
586 'l_msg_count = '||l_msg_count||' '||
587 'l_msg_data = '||l_msg_data,
588 p_prefix=>l_debug_prefix,
589 p_msg_level=>fnd_log.level_statement);
590 END IF;
591 EXCEPTION
592 WHEN OTHERS THEN
593 -- Debug info.
594 IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
595 hz_utility_v2pub.debug(p_message=>'Exception raised from OE_HOLDS... '||SQLERRM,
596 p_prefix=>l_debug_prefix,
597 p_msg_level=>fnd_log.level_statement);
598 END IF;
599
600 l_return_status := 'S';
601 END;
602
603 --
604 -- only raise unexpected error
605 --
606 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
607 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
608 END IF;
609 END IF;
610
611 -- Call table-handler.
612 -- Table_handler is taking care of default customer profile to profile class.
613
614 -- Debug info.
615 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
616 hz_utility_v2pub.debug(p_message=>'HZ_CUSTOMER_PROFILES_PKG.Insert_Row (+)',
617 p_prefix=>l_debug_prefix,
618 p_msg_level=>fnd_log.level_procedure);
619 END IF;
620
621 HZ_CUSTOMER_PROFILES_PKG.Insert_Row (
625 X_COLLECTOR_ID => p_customer_profile_rec.collector_id,
622 X_CUST_ACCOUNT_PROFILE_ID => p_customer_profile_rec.cust_account_profile_id,
623 X_CUST_ACCOUNT_ID => p_customer_profile_rec.cust_account_id,
624 X_STATUS => p_customer_profile_rec.status,
626 X_CREDIT_ANALYST_ID => p_customer_profile_rec.credit_analyst_id,
627 X_CREDIT_CHECKING => p_customer_profile_rec.credit_checking,
628 X_NEXT_CREDIT_REVIEW_DATE => p_customer_profile_rec.next_credit_review_date,
629 X_TOLERANCE => p_customer_profile_rec.tolerance,
630 X_DISCOUNT_TERMS => p_customer_profile_rec.discount_terms,
631 X_DUNNING_LETTERS => p_customer_profile_rec.dunning_letters,
632 X_INTEREST_CHARGES => p_customer_profile_rec.interest_charges,
633 X_SEND_STATEMENTS => p_customer_profile_rec.send_statements,
634 X_CREDIT_BALANCE_STATEMENTS => p_customer_profile_rec.credit_balance_statements,
635 X_CREDIT_HOLD => p_customer_profile_rec.credit_hold,
636 X_PROFILE_CLASS_ID => p_customer_profile_rec.profile_class_id,
637 X_SITE_USE_ID => p_customer_profile_rec.site_use_id,
638 X_CREDIT_RATING => p_customer_profile_rec.credit_rating,
639 X_RISK_CODE => p_customer_profile_rec.risk_code,
640 X_STANDARD_TERMS => p_customer_profile_rec.standard_terms,
641 X_OVERRIDE_TERMS => p_customer_profile_rec.override_terms,
642 X_DUNNING_LETTER_SET_ID => p_customer_profile_rec.dunning_letter_set_id,
643 X_INTEREST_PERIOD_DAYS => p_customer_profile_rec.interest_period_days,
644 X_PAYMENT_GRACE_DAYS => p_customer_profile_rec.payment_grace_days,
645 X_DISCOUNT_GRACE_DAYS => p_customer_profile_rec.discount_grace_days,
646 X_STATEMENT_CYCLE_ID => p_customer_profile_rec.statement_cycle_id,
647 X_ACCOUNT_STATUS => p_customer_profile_rec.account_status,
648 X_PERCENT_COLLECTABLE => p_customer_profile_rec.percent_collectable,
649 X_AUTOCASH_HIERARCHY_ID => p_customer_profile_rec.autocash_hierarchy_id,
650 X_ATTRIBUTE_CATEGORY => p_customer_profile_rec.attribute_category,
651 X_ATTRIBUTE1 => p_customer_profile_rec.attribute1,
652 X_ATTRIBUTE2 => p_customer_profile_rec.attribute2,
653 X_ATTRIBUTE3 => p_customer_profile_rec.attribute3,
654 X_ATTRIBUTE4 => p_customer_profile_rec.attribute4,
655 X_ATTRIBUTE5 => p_customer_profile_rec.attribute5,
656 X_ATTRIBUTE6 => p_customer_profile_rec.attribute6,
657 X_ATTRIBUTE7 => p_customer_profile_rec.attribute7,
658 X_ATTRIBUTE8 => p_customer_profile_rec.attribute8,
659 X_ATTRIBUTE9 => p_customer_profile_rec.attribute9,
660 X_ATTRIBUTE10 => p_customer_profile_rec.attribute10,
661 X_ATTRIBUTE11 => p_customer_profile_rec.attribute11,
662 X_ATTRIBUTE12 => p_customer_profile_rec.attribute12,
663 X_ATTRIBUTE13 => p_customer_profile_rec.attribute13,
664 X_ATTRIBUTE14 => p_customer_profile_rec.attribute14,
665 X_ATTRIBUTE15 => p_customer_profile_rec.attribute15,
666 X_AUTO_REC_INCL_DISPUTED_FLAG => p_customer_profile_rec.auto_rec_incl_disputed_flag,
667 X_TAX_PRINTING_OPTION => p_customer_profile_rec.tax_printing_option,
668 X_CHARGE_ON_FINANCE_CHARGE_FG => p_customer_profile_rec.charge_on_finance_charge_flag,
669 X_GROUPING_RULE_ID => p_customer_profile_rec.grouping_rule_id,
670 X_CLEARING_DAYS => p_customer_profile_rec.clearing_days,
671 X_JGZZ_ATTRIBUTE_CATEGORY => p_customer_profile_rec.jgzz_attribute_category,
672 X_JGZZ_ATTRIBUTE1 => p_customer_profile_rec.jgzz_attribute1,
673 X_JGZZ_ATTRIBUTE2 => p_customer_profile_rec.jgzz_attribute2,
674 X_JGZZ_ATTRIBUTE3 => p_customer_profile_rec.jgzz_attribute3,
675 X_JGZZ_ATTRIBUTE4 => p_customer_profile_rec.jgzz_attribute4,
676 X_JGZZ_ATTRIBUTE5 => p_customer_profile_rec.jgzz_attribute5,
677 X_JGZZ_ATTRIBUTE6 => p_customer_profile_rec.jgzz_attribute6,
678 X_JGZZ_ATTRIBUTE7 => p_customer_profile_rec.jgzz_attribute7,
679 X_JGZZ_ATTRIBUTE8 => p_customer_profile_rec.jgzz_attribute8,
680 X_JGZZ_ATTRIBUTE9 => p_customer_profile_rec.jgzz_attribute9,
681 X_JGZZ_ATTRIBUTE10 => p_customer_profile_rec.jgzz_attribute10,
682 X_JGZZ_ATTRIBUTE11 => p_customer_profile_rec.jgzz_attribute11,
683 X_JGZZ_ATTRIBUTE12 => p_customer_profile_rec.jgzz_attribute12,
684 X_JGZZ_ATTRIBUTE13 => p_customer_profile_rec.jgzz_attribute13,
685 X_JGZZ_ATTRIBUTE14 => p_customer_profile_rec.jgzz_attribute14,
686 X_JGZZ_ATTRIBUTE15 => p_customer_profile_rec.jgzz_attribute15,
690 X_GLOBAL_ATTRIBUTE4 => p_customer_profile_rec.global_attribute4,
687 X_GLOBAL_ATTRIBUTE1 => p_customer_profile_rec.global_attribute1,
688 X_GLOBAL_ATTRIBUTE2 => p_customer_profile_rec.global_attribute2,
689 X_GLOBAL_ATTRIBUTE3 => p_customer_profile_rec.global_attribute3,
691 X_GLOBAL_ATTRIBUTE5 => p_customer_profile_rec.global_attribute5,
692 X_GLOBAL_ATTRIBUTE6 => p_customer_profile_rec.global_attribute6,
693 X_GLOBAL_ATTRIBUTE7 => p_customer_profile_rec.global_attribute7,
694 X_GLOBAL_ATTRIBUTE8 => p_customer_profile_rec.global_attribute8,
695 X_GLOBAL_ATTRIBUTE9 => p_customer_profile_rec.global_attribute9,
696 X_GLOBAL_ATTRIBUTE10 => p_customer_profile_rec.global_attribute10,
697 X_GLOBAL_ATTRIBUTE11 => p_customer_profile_rec.global_attribute11,
698 X_GLOBAL_ATTRIBUTE12 => p_customer_profile_rec.global_attribute12,
699 X_GLOBAL_ATTRIBUTE13 => p_customer_profile_rec.global_attribute13,
700 X_GLOBAL_ATTRIBUTE14 => p_customer_profile_rec.global_attribute14,
701 X_GLOBAL_ATTRIBUTE15 => p_customer_profile_rec.global_attribute15,
702 X_GLOBAL_ATTRIBUTE16 => p_customer_profile_rec.global_attribute16,
703 X_GLOBAL_ATTRIBUTE17 => p_customer_profile_rec.global_attribute17,
704 X_GLOBAL_ATTRIBUTE18 => p_customer_profile_rec.global_attribute18,
705 X_GLOBAL_ATTRIBUTE19 => p_customer_profile_rec.global_attribute19,
706 X_GLOBAL_ATTRIBUTE20 => p_customer_profile_rec.global_attribute20,
707 X_GLOBAL_ATTRIBUTE_CATEGORY => p_customer_profile_rec.global_attribute_category,
708 X_CONS_INV_FLAG => p_customer_profile_rec.cons_inv_flag,
709 X_CONS_INV_TYPE => p_customer_profile_rec.cons_inv_type,
710 X_AUTOCASH_HIERARCHY_ID_ADR => p_customer_profile_rec.autocash_hierarchy_id_for_adr,
711 X_LOCKBOX_MATCHING_OPTION => p_customer_profile_rec.lockbox_matching_option,
712 X_OBJECT_VERSION_NUMBER => 1,
713 X_CREATED_BY_MODULE => p_customer_profile_rec.created_by_module,
714 X_APPLICATION_ID => p_customer_profile_rec.application_id,
715 X_REVIEW_CYCLE => p_customer_profile_rec.review_cycle,
716 X_last_credit_review_date => p_customer_profile_rec.last_credit_review_date,
717 X_party_id => p_customer_profile_rec.party_id,
718 X_CREDIT_CLASSIFICATION => p_customer_profile_rec.credit_classification,
719 X_CONS_BILL_LEVEL => p_customer_profile_rec.cons_bill_level,
720 X_LATE_CHARGE_CALCULATION_TRX => p_customer_profile_rec.late_charge_calculation_trx,
721 X_CREDIT_ITEMS_FLAG => p_customer_profile_rec.credit_items_flag,
722 X_DISPUTED_TRANSACTIONS_FLAG => p_customer_profile_rec.disputed_transactions_flag,
723 X_LATE_CHARGE_TYPE => p_customer_profile_rec.late_charge_type,
724 X_LATE_CHARGE_TERM_ID => p_customer_profile_rec.late_charge_term_id,
725 X_INTEREST_CALCULATION_PERIOD => p_customer_profile_rec.interest_calculation_period,
726 X_HOLD_CHARGED_INVOICES_FLAG => p_customer_profile_rec.hold_charged_invoices_flag,
727 X_MESSAGE_TEXT_ID => p_customer_profile_rec.message_text_id,
728 X_MULTIPLE_INTEREST_RATES_FLAG => p_customer_profile_rec.multiple_interest_rates_flag,
729 X_CHARGE_BEGIN_DATE => p_customer_profile_rec.charge_begin_date
730 );
731
732 --raji
733
734 x_cust_account_profile_id := p_customer_profile_rec.cust_account_profile_id;
735
736 -- Debug info.
737 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
738 hz_utility_v2pub.debug(p_message=>'HZ_CUSTOMER_PROFILES_PKG.Insert_Row (-) ' ||
739 'x_cust_account_profile_id = ' || x_cust_account_profile_id,
740 p_prefix=>l_debug_prefix,
741 p_msg_level=>fnd_log.level_procedure);
742 END IF;
743
744 -- Now default in the profile amounts only if
745 -- p_create_profile_amt is TRUE. Otherwise, simply return.
746
747 IF p_create_profile_amt = FND_API.G_FALSE THEN
748 RETURN;
749 END IF;
750
751 BEGIN
752
753 -- could have several records in profile_class_amts for a given
754 -- profile_class_id.
755
756 OPEN c_profile_class_amts;
757 LOOP
758 FETCH c_profile_class_amts INTO l_profile_class_amount_id;
759 EXIT WHEN c_profile_class_amts%NOTFOUND;
760
761 -- Setup profile amount record if it is the first run.
762 IF l_is_first THEN
763 l_cust_profile_amt_rec.cust_account_profile_id := p_customer_profile_rec.cust_account_profile_id;
764 l_cust_profile_amt_rec.cust_account_id := p_customer_profile_rec.cust_account_id;
765 l_cust_profile_amt_rec.site_use_id := p_customer_profile_rec.site_use_id;
766 l_cust_profile_amt_rec.created_by_module := p_customer_profile_rec.created_by_module;
767 l_cust_profile_amt_rec.application_id := p_customer_profile_rec.application_id;
768
769 l_is_first := FALSE;
770 END IF;
771
772 -- Debug info.
773 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
777 END IF;
774 hz_utility_v2pub.debug(p_message=>'HZ_CUST_PROF_CLASS_AMTS_PKG.Select_Row (+)',
775 p_prefix=>l_debug_prefix,
776 p_msg_level=>fnd_log.level_procedure);
778
779 -- Call table-handler.
780 HZ_CUST_PROF_CLASS_AMTS_PKG.Select_Row (
781 X_PROFILE_CLASS_AMOUNT_ID => l_profile_class_amount_id,
782 X_PROFILE_CLASS_ID => l_profile_class_id,
783 X_CURRENCY_CODE => l_cust_profile_amt_rec.currency_code,
784 X_TRX_CREDIT_LIMIT => l_cust_profile_amt_rec.trx_credit_limit,
785 X_OVERALL_CREDIT_LIMIT => l_cust_profile_amt_rec.overall_credit_limit,
786 X_MIN_DUNNING_AMOUNT => l_cust_profile_amt_rec.min_dunning_amount,
787 X_MAX_INTEREST_CHARGE => l_cust_profile_amt_rec.max_interest_charge,
788 X_MIN_STATEMENT_AMOUNT => l_cust_profile_amt_rec.min_statement_amount,
789 X_AUTO_REC_MIN_RECEIPT_AMOUNT => l_cust_profile_amt_rec.auto_rec_min_receipt_amount,
790 X_ATTRIBUTE_CATEGORY => l_cust_profile_amt_rec.attribute_category,
791 X_ATTRIBUTE1 => l_cust_profile_amt_rec.attribute1,
792 X_ATTRIBUTE2 => l_cust_profile_amt_rec.attribute2,
793 X_ATTRIBUTE3 => l_cust_profile_amt_rec.attribute3,
794 X_ATTRIBUTE4 => l_cust_profile_amt_rec.attribute4,
795 X_ATTRIBUTE5 => l_cust_profile_amt_rec.attribute5,
796 X_ATTRIBUTE6 => l_cust_profile_amt_rec.attribute6,
797 X_ATTRIBUTE7 => l_cust_profile_amt_rec.attribute7,
798 X_ATTRIBUTE8 => l_cust_profile_amt_rec.attribute8,
799 X_ATTRIBUTE9 => l_cust_profile_amt_rec.attribute9,
800 X_ATTRIBUTE10 => l_cust_profile_amt_rec.attribute10,
801 X_ATTRIBUTE11 => l_cust_profile_amt_rec.attribute11,
802 X_ATTRIBUTE12 => l_cust_profile_amt_rec.attribute12,
803 X_ATTRIBUTE13 => l_cust_profile_amt_rec.attribute13,
804 X_ATTRIBUTE14 => l_cust_profile_amt_rec.attribute14,
805 X_ATTRIBUTE15 => l_cust_profile_amt_rec.attribute15,
806 X_INTEREST_RATE => l_cust_profile_amt_rec.interest_rate,
807 X_MIN_FC_BALANCE_AMOUNT => l_cust_profile_amt_rec.min_fc_balance_amount,
808 X_MIN_FC_INVOICE_AMOUNT => l_cust_profile_amt_rec.min_fc_invoice_amount,
809 X_MIN_DUNNING_INVOICE_AMOUNT => l_cust_profile_amt_rec.min_dunning_invoice_amount,
810 X_EXPIRATION_DATE => l_cust_profile_amt_rec.expiration_date,
811 X_JGZZ_ATTRIBUTE_CATEGORY => l_cust_profile_amt_rec.jgzz_attribute_category,
812 X_JGZZ_ATTRIBUTE1 => l_cust_profile_amt_rec.jgzz_attribute1,
813 X_JGZZ_ATTRIBUTE2 => l_cust_profile_amt_rec.jgzz_attribute2,
814 X_JGZZ_ATTRIBUTE3 => l_cust_profile_amt_rec.jgzz_attribute3,
815 X_JGZZ_ATTRIBUTE4 => l_cust_profile_amt_rec.jgzz_attribute4,
816 X_JGZZ_ATTRIBUTE5 => l_cust_profile_amt_rec.jgzz_attribute5,
817 X_JGZZ_ATTRIBUTE6 => l_cust_profile_amt_rec.jgzz_attribute6,
818 X_JGZZ_ATTRIBUTE7 => l_cust_profile_amt_rec.jgzz_attribute7,
819 X_JGZZ_ATTRIBUTE8 => l_cust_profile_amt_rec.jgzz_attribute8,
820 X_JGZZ_ATTRIBUTE9 => l_cust_profile_amt_rec.jgzz_attribute9,
821 X_JGZZ_ATTRIBUTE10 => l_cust_profile_amt_rec.jgzz_attribute10,
822 X_JGZZ_ATTRIBUTE11 => l_cust_profile_amt_rec.jgzz_attribute11,
823 X_JGZZ_ATTRIBUTE12 => l_cust_profile_amt_rec.jgzz_attribute12,
824 X_JGZZ_ATTRIBUTE13 => l_cust_profile_amt_rec.jgzz_attribute13,
825 X_JGZZ_ATTRIBUTE14 => l_cust_profile_amt_rec.jgzz_attribute14,
826 X_JGZZ_ATTRIBUTE15 => l_cust_profile_amt_rec.jgzz_attribute15,
827 X_GLOBAL_ATTRIBUTE1 => l_cust_profile_amt_rec.global_attribute1,
828 X_GLOBAL_ATTRIBUTE2 => l_cust_profile_amt_rec.global_attribute2,
829 X_GLOBAL_ATTRIBUTE3 => l_cust_profile_amt_rec.global_attribute3,
830 X_GLOBAL_ATTRIBUTE4 => l_cust_profile_amt_rec.global_attribute4,
831 X_GLOBAL_ATTRIBUTE5 => l_cust_profile_amt_rec.global_attribute5,
832 X_GLOBAL_ATTRIBUTE6 => l_cust_profile_amt_rec.global_attribute6,
833 X_GLOBAL_ATTRIBUTE7 => l_cust_profile_amt_rec.global_attribute7,
834 X_GLOBAL_ATTRIBUTE8 => l_cust_profile_amt_rec.global_attribute8,
835 X_GLOBAL_ATTRIBUTE9 => l_cust_profile_amt_rec.global_attribute9,
836 X_GLOBAL_ATTRIBUTE10 => l_cust_profile_amt_rec.global_attribute10,
837 X_GLOBAL_ATTRIBUTE11 => l_cust_profile_amt_rec.global_attribute11,
841 X_GLOBAL_ATTRIBUTE15 => l_cust_profile_amt_rec.global_attribute15,
838 X_GLOBAL_ATTRIBUTE12 => l_cust_profile_amt_rec.global_attribute12,
839 X_GLOBAL_ATTRIBUTE13 => l_cust_profile_amt_rec.global_attribute13,
840 X_GLOBAL_ATTRIBUTE14 => l_cust_profile_amt_rec.global_attribute14,
842 X_GLOBAL_ATTRIBUTE16 => l_cust_profile_amt_rec.global_attribute16,
843 X_GLOBAL_ATTRIBUTE17 => l_cust_profile_amt_rec.global_attribute17,
844 X_GLOBAL_ATTRIBUTE18 => l_cust_profile_amt_rec.global_attribute18,
845 X_GLOBAL_ATTRIBUTE19 => l_cust_profile_amt_rec.global_attribute19,
846 X_GLOBAL_ATTRIBUTE20 => l_cust_profile_amt_rec.global_attribute20,
847 X_GLOBAL_ATTRIBUTE_CATEGORY => l_cust_profile_amt_rec.global_attribute_category,
848 X_EXCHANGE_RATE_TYPE => l_cust_profile_amt_rec.exchange_rate_type,
849 X_MIN_FC_INVOICE_OVERDUE_TYPE => l_cust_profile_amt_rec.min_fc_invoice_overdue_type,
850 X_MIN_FC_INVOICE_PERCENT => l_cust_profile_amt_rec.min_fc_invoice_percent,
851 X_MIN_FC_BALANCE_OVERDUE_TYPE => l_cust_profile_amt_rec.min_fc_balance_overdue_type,
852 X_MIN_FC_BALANCE_PERCENT => l_cust_profile_amt_rec.min_fc_balance_percent,
853 X_INTEREST_TYPE => l_cust_profile_amt_rec.interest_type,
854 X_INTEREST_FIXED_AMOUNT => l_cust_profile_amt_rec.interest_fixed_amount,
855 X_INTEREST_SCHEDULE_ID => l_cust_profile_amt_rec.interest_schedule_id,
856 X_PENALTY_TYPE => l_cust_profile_amt_rec.penalty_type,
857 X_PENALTY_RATE => l_cust_profile_amt_rec.penalty_rate,
858 X_MIN_INTEREST_CHARGE => l_cust_profile_amt_rec.min_interest_charge,
859 X_PENALTY_FIXED_AMOUNT => l_cust_profile_amt_rec.penalty_fixed_amount,
860 X_PENALTY_SCHEDULE_ID => l_cust_profile_amt_rec.penalty_schedule_id
861 );
862
863 -- Debug info.
864 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
865 hz_utility_v2pub.debug(p_message=>'HZ_CUST_PROF_CLASS_AMTS_PKG.Select_Row (-)',
866 p_prefix=>l_debug_prefix,
867 p_msg_level=>fnd_log.level_procedure);
868 END IF;
869
870 l_cust_profile_amt_rec.cust_acct_profile_amt_id := NULL;
871
872 -- Call public API to create cust profile amount.
873 create_cust_profile_amt (
874 p_cust_profile_amt_rec => l_cust_profile_amt_rec,
875 x_cust_acct_profile_amt_id => l_cust_profile_amt_rec.cust_acct_profile_amt_id,
876 x_return_status => x_return_status,
877 x_msg_count => l_msg_count,
878 x_msg_data => l_msg_data );
879
880 -- Bug#2219199 Procedure call added to cascade profile class amount -- multi currency
881
882 IF x_return_status = 'S' THEN
883 HZ_CREDIT_USAGES_CASCADE_PKG.cascade_credit_usage_rules (
884 l_cust_profile_amt_rec.cust_acct_profile_amt_id,
885 l_cust_profile_amt_rec.cust_account_profile_id,
886 l_profile_class_amount_id,
887 l_profile_class_id,
888 x_return_status,
889 l_msg_count,
890 l_msg_data );
891 END IF;
892
893 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
894 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
895 RAISE FND_API.G_EXC_ERROR;
896 ELSE
897 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
898 END IF;
899 END IF;
900
901 END LOOP;
902 CLOSE c_profile_class_amts;
903
904 EXCEPTION
905 WHEN OTHERS THEN
906 IF c_profile_class_amts%ISOPEN THEN
907 CLOSE c_profile_class_amts;
908 END IF;
909
910 RAISE;
911 END;
912
913 -- Debug info.
914 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
915 hz_utility_v2pub.debug(p_message=>'do_create_customer_profile (-)',
916 p_prefix=>l_debug_prefix,
917 p_msg_level=>fnd_log.level_procedure);
918 END IF;
919
920 END do_create_customer_profile;
921
922
923 /**
924 * PRIVATE PROCEDURE do_update_customer_profile
925 *
926 * DESCRIPTION
927 * Private procedure to update customer profile.
928 *
929 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
930 * HZ_ACCOUNT_VALIDATE_V2PUB.validate_customer_profile
931 * HZ_CUSTOMER_PROFILES_PKG.Update_Row
932 * HZ_CUST_PROF_CLASS_AMTS_PKG.Select_Row
933 *
934 * ARGUMENTS
935 * IN/OUT:
936 * p_customer_profile_rec Customer profile record. One customer account
937 * must have a customer profile. One account site
938 * use can optionally have one customer profile.
939 * p_object_version_number Used for locking the being updated record.
940 * x_return_status Return status after the call. The status can
944 *
941 * be FND_API.G_RET_STS_SUCCESS (success),
942 * FND_API.G_RET_STS_ERROR (error),
943 * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
945 * NOTES
946 *
947 * MODIFICATION HISTORY
948 *
949 * 07-23-2001 Jianying Huang o Created.
950 *
951 */
952
953 PROCEDURE do_update_customer_profile (
954 p_customer_profile_rec IN OUT NOCOPY CUSTOMER_PROFILE_REC_TYPE,
955 p_object_version_number IN OUT NOCOPY NUMBER,
956 x_return_status IN OUT NOCOPY VARCHAR2
957 ) IS
958
959 l_debug_prefix VARCHAR2(30) := ''; --'do_update_customer_profile'
960
961 l_rowid ROWID := NULL;
962 l_is_first BOOLEAN := TRUE;
963 l_return_status VARCHAR2(1);
964 l_msg_count NUMBER;
965 l_msg_data VARCHAR2(2000);
966
967 l_cust_profile_amt_rec CUST_PROFILE_AMT_REC_TYPE;
968 l_cust_account_id NUMBER;
969 l_site_use_id NUMBER;
970 l_profile_class_amount_id NUMBER;
971 l_profile_class_id NUMBER;
972 l_cust_acct_profile_amt_id NUMBER;
973 l_object_version_number NUMBER;
974 l_amt_object_version_number NUMBER;
975 l_created_by_module HZ_CUSTOMER_PROFILES.created_by_module%TYPE;
976 l_application_id NUMBER;
977
978 l_party_id NUMBER;
979 l_last_credit_review_date DATE;
980
981 l_credit_hold VARCHAR2(30); -- Bug 4115750
982
983 CURSOR c_profile_class_amts IS
984 SELECT PROFILE_CLASS_AMOUNT_ID
985 FROM HZ_CUST_PROF_CLASS_AMTS
986 WHERE PROFILE_CLASS_ID = p_customer_profile_rec.profile_class_id;
987
988 v_action VARCHAR2(10);
989 v_entity_code VARCHAR2(1);
990 v_entity_id NUMBER(15);
991 l_cons_inv_flag VARCHAR2(1);
992 l_cons_inv_type VARCHAR2(30);
993 l_cons_bill_level VARCHAR2(30);
994 l_late_charge_type HZ_CUSTOMER_PROFILES.LATE_CHARGE_TYPE%TYPE;
995 l_late_charge_term_id HZ_CUSTOMER_PROFILES.LATE_CHARGE_TERM_ID%TYPE;
996 l_message_text_id HZ_CUSTOMER_PROFILES.MESSAGE_TEXT_ID%TYPE;
997 l_profile_class_rec HZ_CUST_PROFILE_CLASSES%ROWTYPE;
998 l_standard_terms NUMBER;
999 l_profile_class_changed VARCHAR2(10);
1000
1001 cursor c_acct_use_profile_dtls IS
1002 select cons_bill_level, cons_inv_type
1003 from hz_customer_profiles
1004 where cust_account_id = l_cust_account_id
1005 and site_use_id is NULL
1006 and cons_inv_flag = 'Y';
1007
1008 ll_cons_bill_level varchar2(30);
1009 ll_cons_inv_type varchar2(30);
1010
1011 BEGIN
1012
1013 -- Debug info.
1014 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1015 hz_utility_v2pub.debug(p_message=>'do_update_customer_profile (+)',
1016 p_prefix=>l_debug_prefix,
1017 p_msg_level=>fnd_log.level_procedure);
1018 END IF;
1019
1020 -- Lock record.
1021 BEGIN
1022 SELECT ROWID, OBJECT_VERSION_NUMBER, CUST_ACCOUNT_ID, SITE_USE_ID,
1023 CREATED_BY_MODULE, APPLICATION_ID,PROFILE_CLASS_ID, PARTY_ID,
1024 CREDIT_HOLD , CONS_INV_FLAG, CONS_INV_TYPE, CONS_BILL_LEVEL,
1025 LATE_CHARGE_TYPE, LATE_CHARGE_TERM_ID, MESSAGE_TEXT_ID, STANDARD_TERMS
1026 INTO l_rowid, l_object_version_number, l_cust_account_id, l_site_use_id,
1027 l_created_by_module, l_application_id,l_profile_class_id, l_party_id,
1028 l_credit_hold, l_cons_inv_flag, l_cons_inv_type, l_cons_bill_level,
1029 l_late_charge_type, l_late_charge_term_id, l_message_text_id, l_standard_terms
1030 FROM HZ_CUSTOMER_PROFILES
1031 WHERE CUST_ACCOUNT_PROFILE_ID = p_customer_profile_rec.cust_account_profile_id
1032 FOR UPDATE NOWAIT;
1033
1034 IF NOT (
1035 ( p_object_version_number IS NULL AND l_object_version_number IS NULL ) OR
1036 ( p_object_version_number IS NOT NULL AND
1037 l_object_version_number IS NOT NULL AND
1038 p_object_version_number = l_object_version_number ) )
1039 THEN
1040 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_RECORD_CHANGED' );
1041 FND_MESSAGE.SET_TOKEN( 'TABLE', 'hz_customer_profiles' );
1042 FND_MSG_PUB.ADD;
1043 RAISE FND_API.G_EXC_ERROR;
1044 END IF;
1045
1046 p_object_version_number := NVL( l_object_version_number, 1 ) + 1;
1047
1048 EXCEPTION
1049 WHEN NO_DATA_FOUND THEN
1050 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_NO_RECORD' );
1051 FND_MESSAGE.SET_TOKEN( 'RECORD', 'customer profile' );
1052 FND_MESSAGE.SET_TOKEN( 'VALUE',
1056 END;
1053 NVL( TO_CHAR( p_customer_profile_rec.cust_account_profile_id ), 'null' ) );
1054 FND_MSG_PUB.ADD;
1055 RAISE FND_API.G_EXC_ERROR;
1057
1058 l_profile_class_changed := 'N';
1059
1060 -- If the profile_class_id is changed get profile class rec into l_profile_class_rec
1061 IF (p_customer_profile_rec.profile_class_id IS NOT NULL AND
1062 p_customer_profile_rec.profile_class_id <> FND_API.G_MISS_NUM AND
1063 p_customer_profile_rec.profile_class_id <> NVL(l_profile_class_id, FND_API.G_MISS_NUM)) then
1064
1065 l_profile_class_changed := 'Y';
1066
1067 SELECT * INTO l_profile_class_rec
1068 FROM HZ_CUST_PROFILE_CLASSES
1069 WHERE PROFILE_CLASS_ID = p_customer_profile_rec.profile_class_id;
1070
1071 -- While changing the profile class for an existing cusromer profile record
1072 -- it should do the validations based on the new input parameters.
1073 -- If the input parameters are passed NULL or G_MISS, get the value from profile class.
1074 if ( p_customer_profile_rec.cons_inv_flag is NULL OR
1075 p_customer_profile_rec.cons_inv_flag = FND_API.G_MISS_CHAR) then
1076 p_customer_profile_rec.cons_inv_flag := l_profile_class_rec.cons_inv_flag;
1077 end if;
1078 if ( p_customer_profile_rec.cons_bill_level is NULL OR
1079 p_customer_profile_rec.cons_bill_level = FND_API.G_MISS_CHAR) then
1080 p_customer_profile_rec.cons_bill_level := l_profile_class_rec.cons_bill_level;
1081 end if;
1082 if ( p_customer_profile_rec.cons_inv_type is NULL OR
1083 p_customer_profile_rec.cons_inv_type = FND_API.G_MISS_CHAR) then
1084 p_customer_profile_rec.cons_inv_type := l_profile_class_rec.cons_inv_type;
1085 end if;
1086 if ( p_customer_profile_rec.standard_terms is NULL OR
1087 p_customer_profile_rec.standard_terms = FND_API.G_MISS_NUM) then
1088 p_customer_profile_rec.standard_terms := l_profile_class_rec.standard_terms;
1089 end if;
1090 END IF;
1091
1092 -- Value for cons_inv_flag should be Y or N
1093 if p_customer_profile_rec.cons_inv_flag is NULL then
1094 p_customer_profile_rec.cons_inv_flag := l_cons_inv_flag;
1095 elsif p_customer_profile_rec.cons_inv_flag = FND_API.G_MISS_CHAR then
1096 p_customer_profile_rec.cons_inv_flag := 'N';
1097 end if;
1098
1099 -- If user passes NULL in update set value as in database
1100 if p_customer_profile_rec.cons_bill_level is NULL then
1101 p_customer_profile_rec.cons_bill_level := l_cons_bill_level;
1102 end if;
1103
1104 -- if cons_inv_flag is 'N', make cons_bill_level and cons_inv_type to NULL
1105 if p_customer_profile_rec.cons_inv_flag = 'N' then
1106 p_customer_profile_rec.cons_bill_level := FND_API.G_MISS_CHAR;
1107 p_customer_profile_rec.cons_inv_type := FND_API.G_MISS_CHAR;
1108 end if;
1109
1110 -- Bill level is non updatable at site level
1111 /*
1112 if l_site_use_id is NOT NULL AND
1113 p_customer_profile_rec.cons_bill_level <> FND_API.G_MISS_CHAR AND
1114 p_customer_profile_rec.cons_bill_level <> NVL(l_cons_bill_level, FND_API.G_MISS_CHAR) then
1115 FND_MESSAGE.SET_NAME('AR', 'HZ_API_SITE_BILL_LVL_NULL');
1116 FND_MSG_PUB.ADD;
1117 x_return_status := FND_API.G_RET_STS_ERROR;
1118 end if;
1119 */
1120
1121 -- if cons_inv_flag is changed from N to Y for a site level,
1122 -- get the bill level from account level
1123 if (p_customer_profile_rec.cons_inv_flag = 'Y' and
1124 l_cons_inv_flag = 'N' and
1125 l_site_use_id is NOT NULL) then
1126 -- For site use profile, passed value for bill level should be NULL
1127 -- and it should get defaulted from account use profile.
1128 OPEN c_acct_use_profile_dtls;
1129 FETCH c_acct_use_profile_dtls INTO ll_cons_bill_level, ll_cons_inv_type;
1130 IF c_acct_use_profile_dtls%NOTFOUND THEN
1131 FND_MESSAGE.SET_NAME('AR', 'HZ_API_ENABLE_ACC_BAL_FWD_BILL');
1132 FND_MSG_PUB.ADD;
1133 x_return_status := FND_API.G_RET_STS_ERROR;
1134 END IF;
1135 p_customer_profile_rec.cons_bill_level := ll_cons_bill_level;
1136 if ( p_customer_profile_rec.cons_inv_type is NULL OR
1137 p_customer_profile_rec.cons_inv_type = FND_API.G_MISS_CHAR) then
1138 p_customer_profile_rec.cons_inv_type := ll_cons_inv_type;
1139 end if;
1140 CLOSE c_acct_use_profile_dtls;
1141 end if;
1142
1143 -- If user passes NULL in update set value as in database
1144 if p_customer_profile_rec.cons_inv_type is NULL then
1145 p_customer_profile_rec.cons_inv_type := l_cons_inv_type;
1146 end if;
1147
1148 -- Added the below IF condition for Balance Forwarded Billing
1149 -- When cons_inv_flag is changed from 'N' to 'Y' or 'Y' to 'N'
1150 -- and profile class is not changed
1151 -- update the standard_terms of the profile to null
1152 if p_customer_profile_rec.cons_inv_flag IS NOT NULL AND
1153 p_customer_profile_rec.cons_inv_flag <> FND_API.G_MISS_CHAR AND
1154 p_customer_profile_rec.cons_inv_flag <> NVL(l_cons_inv_flag, FND_API.G_MISS_CHAR) AND
1155 l_profile_class_changed = 'N' then
1156 if (p_customer_profile_rec.standard_terms is NULL OR
1157 p_customer_profile_rec.standard_terms = nvl(l_standard_terms,-999111))
1158 then
1159 --l_standard_terms
1160 p_customer_profile_rec.standard_terms := FND_API.G_MISS_NUM;
1164 -- if late charge payment term or late charge type or message_text_id is NULL, get value from database.
1161 end if;
1162 end if;
1163
1165 if p_customer_profile_rec.late_charge_term_id is NULL then
1166 p_customer_profile_rec.late_charge_term_id := l_late_charge_term_id;
1167 elsif p_customer_profile_rec.late_charge_term_id = FND_API.G_MISS_NUM then
1168 p_customer_profile_rec.late_charge_term_id := l_profile_class_rec.late_charge_term_id;
1169 end if;
1170 if p_customer_profile_rec.late_charge_type is NULL then
1171 p_customer_profile_rec.late_charge_type := l_late_charge_type;
1172 elsif p_customer_profile_rec.late_charge_type = FND_API.G_MISS_CHAR then
1173 p_customer_profile_rec.late_charge_type := l_profile_class_rec.late_charge_type;
1174 end if;
1175 if p_customer_profile_rec.message_text_id is NULL then
1176 p_customer_profile_rec.message_text_id := l_message_text_id;
1177 elsif p_customer_profile_rec.message_text_id = FND_API.G_MISS_NUM then
1178 p_customer_profile_rec.message_text_id := l_profile_class_rec.message_text_id;
1179 end if;
1180
1181 if p_customer_profile_rec.late_charge_type = 'ADJ' then
1182 p_customer_profile_rec.late_charge_term_id := FND_API.G_MISS_NUM;
1183 p_customer_profile_rec.message_text_id := FND_API.G_MISS_NUM;
1184 end if;
1185
1186 -- Validate customer profile record
1187 HZ_ACCOUNT_VALIDATE_V2PUB.validate_customer_profile (
1188 p_create_update_flag => 'U',
1189 p_customer_profile_rec => p_customer_profile_rec,
1190 p_rowid => l_rowid,
1191 x_return_status => x_return_status );
1192
1193 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1194 RAISE FND_API.G_EXC_ERROR;
1195 END IF;
1196
1197 -- Added rounding of payment_grace_days to integer for Late charge project.
1198 IF (p_customer_profile_rec.payment_grace_days is NOT NULL AND
1199 p_customer_profile_rec.payment_grace_days <> FND_API.G_MISS_NUM) then
1200 p_customer_profile_rec.payment_grace_days := ROUND(p_customer_profile_rec.payment_grace_days,0);
1201 END IF;
1202
1203 -- Added rounding of interest_period_days to integer for Late charge project.
1204 IF (p_customer_profile_rec.interest_period_days is NOT NULL AND
1205 p_customer_profile_rec.interest_period_days <> FND_API.G_MISS_NUM) then
1206 p_customer_profile_rec.interest_period_days := ROUND(p_customer_profile_rec.interest_period_days,0);
1207 END IF;
1208
1209 -- Add logic for global holds
1210 IF p_customer_profile_rec.credit_hold is not null THEN --Bug5606895
1211 IF nvl(l_credit_hold,'N') <> nvl(p_customer_profile_rec.credit_hold,'N') THEN
1212 if p_customer_profile_rec.credit_hold = 'Y' THEN
1213 v_action := 'APPLY';
1214 ELSE
1215 v_action := 'RELEASE';
1216 END IF;
1217 IF l_site_use_id IS NULL THEN
1218 v_entity_code := 'C';
1219 v_entity_id := l_cust_account_id;
1220 ELSE
1221 v_entity_code := 'S';
1222 v_entity_id := l_site_use_id;
1223 END IF;
1224
1225 -- Debug info.
1226 IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
1227 hz_utility_v2pub.debug(p_message=>'Before call OE_HOLDS... '||
1228 'v_action = '||v_action||' '||
1229 'v_entity_code = '||v_entity_code||' '||
1230 'v_entity_id = '||v_entity_id,
1231 p_prefix=>l_debug_prefix,
1232 p_msg_level=>fnd_log.level_statement);
1233 END IF;
1234
1235 BEGIN
1236 OE_Holds_PUB.Process_Holds (
1237 p_api_version => 1.0,
1238 p_init_msg_list => FND_API.G_FALSE,
1239 p_hold_entity_code => v_entity_code,
1240 p_hold_entity_id => v_entity_id,
1241 p_hold_id => 1,
1242 p_release_reason_code => 'AR_AUTOMATIC',
1243 p_action => v_action,
1244 x_return_status => l_return_status,
1245 x_msg_count => l_msg_count,
1246 x_msg_data => l_msg_data);
1247
1248 -- Debug info.
1249 IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
1250 hz_utility_v2pub.debug(p_message=>'After call OE_HOLDS... '||
1251 'l_return_status = '||l_return_status||' '||
1252 'l_msg_count = '||l_msg_count||' '||
1253 'l_msg_data = '||l_msg_data,
1254 p_prefix=>l_debug_prefix,
1255 p_msg_level=>fnd_log.level_statement);
1256 END IF;
1257 EXCEPTION
1258 WHEN OTHERS THEN
1259 -- Debug info.
1260 IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
1261 hz_utility_v2pub.debug(p_message=>'Exception raised from OE_HOLDS... '||SQLERRM,
1262 p_prefix=>l_debug_prefix,
1263 p_msg_level=>fnd_log.level_statement);
1264 END IF;
1265
1266 l_return_status := 'S';
1267 END;
1268
1269 --
1270 -- only raise unexpected error
1274 END IF;
1271 --
1272 IF l_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
1273 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1275 END IF;
1276 END IF; -- Bug 5606895
1277 -- Call table-handler.
1278 -- Table_handler is taking care of default customer profile to profile class.
1279
1280 -- Debug info.
1281 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1282 hz_utility_v2pub.debug(p_message=>'HZ_CUSTOMER_PROFILES_PKG.Update_Row (+)',
1283 p_prefix=>l_debug_prefix,
1284 p_msg_level=>fnd_log.level_procedure);
1285 END IF;
1286
1287 HZ_CUSTOMER_PROFILES_PKG.Update_Row (
1288 X_Rowid => l_rowid,
1289 X_CUST_ACCOUNT_PROFILE_ID => p_customer_profile_rec.cust_account_profile_id,
1290 X_CUST_ACCOUNT_ID => p_customer_profile_rec.cust_account_id,
1291 X_STATUS => p_customer_profile_rec.status,
1292 X_COLLECTOR_ID => p_customer_profile_rec.collector_id,
1293 X_CREDIT_ANALYST_ID => p_customer_profile_rec.credit_analyst_id,
1294 X_CREDIT_CHECKING => p_customer_profile_rec.credit_checking,
1295 X_NEXT_CREDIT_REVIEW_DATE => p_customer_profile_rec.next_credit_review_date,
1296 X_TOLERANCE => p_customer_profile_rec.tolerance,
1297 X_DISCOUNT_TERMS => p_customer_profile_rec.discount_terms,
1298 X_DUNNING_LETTERS => p_customer_profile_rec.dunning_letters,
1299 X_INTEREST_CHARGES => p_customer_profile_rec.interest_charges,
1300 X_SEND_STATEMENTS => p_customer_profile_rec.send_statements,
1301 X_CREDIT_BALANCE_STATEMENTS => p_customer_profile_rec.credit_balance_statements,
1302 X_CREDIT_HOLD => p_customer_profile_rec.credit_hold,
1303 X_PROFILE_CLASS_ID => p_customer_profile_rec.profile_class_id,
1304 X_SITE_USE_ID => p_customer_profile_rec.site_use_id,
1305 X_CREDIT_RATING => p_customer_profile_rec.credit_rating,
1306 X_RISK_CODE => p_customer_profile_rec.risk_code,
1307 X_STANDARD_TERMS => p_customer_profile_rec.standard_terms,
1308 X_OVERRIDE_TERMS => p_customer_profile_rec.override_terms,
1309 X_DUNNING_LETTER_SET_ID => p_customer_profile_rec.dunning_letter_set_id,
1310 X_INTEREST_PERIOD_DAYS => p_customer_profile_rec.interest_period_days,
1311 X_PAYMENT_GRACE_DAYS => p_customer_profile_rec.payment_grace_days,
1312 X_DISCOUNT_GRACE_DAYS => p_customer_profile_rec.discount_grace_days,
1313 X_STATEMENT_CYCLE_ID => p_customer_profile_rec.statement_cycle_id,
1314 X_ACCOUNT_STATUS => p_customer_profile_rec.account_status,
1315 X_PERCENT_COLLECTABLE => p_customer_profile_rec.percent_collectable,
1316 X_AUTOCASH_HIERARCHY_ID => p_customer_profile_rec.autocash_hierarchy_id,
1317 X_ATTRIBUTE_CATEGORY => p_customer_profile_rec.attribute_category,
1318 X_ATTRIBUTE1 => p_customer_profile_rec.attribute1,
1319 X_ATTRIBUTE2 => p_customer_profile_rec.attribute2,
1320 X_ATTRIBUTE3 => p_customer_profile_rec.attribute3,
1321 X_ATTRIBUTE4 => p_customer_profile_rec.attribute4,
1322 X_ATTRIBUTE5 => p_customer_profile_rec.attribute5,
1323 X_ATTRIBUTE6 => p_customer_profile_rec.attribute6,
1324 X_ATTRIBUTE7 => p_customer_profile_rec.attribute7,
1325 X_ATTRIBUTE8 => p_customer_profile_rec.attribute8,
1326 X_ATTRIBUTE9 => p_customer_profile_rec.attribute9,
1327 X_ATTRIBUTE10 => p_customer_profile_rec.attribute10,
1328 X_ATTRIBUTE11 => p_customer_profile_rec.attribute11,
1329 X_ATTRIBUTE12 => p_customer_profile_rec.attribute12,
1330 X_ATTRIBUTE13 => p_customer_profile_rec.attribute13,
1331 X_ATTRIBUTE14 => p_customer_profile_rec.attribute14,
1332 X_ATTRIBUTE15 => p_customer_profile_rec.attribute15,
1333 X_AUTO_REC_INCL_DISPUTED_FLAG => p_customer_profile_rec.auto_rec_incl_disputed_flag,
1334 X_TAX_PRINTING_OPTION => p_customer_profile_rec.tax_printing_option,
1335 X_CHARGE_ON_FINANCE_CHARGE_FG => p_customer_profile_rec.charge_on_finance_charge_flag,
1336 X_GROUPING_RULE_ID => p_customer_profile_rec.grouping_rule_id,
1337 X_CLEARING_DAYS => p_customer_profile_rec.clearing_days,
1338 X_JGZZ_ATTRIBUTE_CATEGORY => p_customer_profile_rec.jgzz_attribute_category,
1339 X_JGZZ_ATTRIBUTE1 => p_customer_profile_rec.jgzz_attribute1,
1340 X_JGZZ_ATTRIBUTE2 => p_customer_profile_rec.jgzz_attribute2,
1341 X_JGZZ_ATTRIBUTE3 => p_customer_profile_rec.jgzz_attribute3,
1342 X_JGZZ_ATTRIBUTE4 => p_customer_profile_rec.jgzz_attribute4,
1343 X_JGZZ_ATTRIBUTE5 => p_customer_profile_rec.jgzz_attribute5,
1344 X_JGZZ_ATTRIBUTE6 => p_customer_profile_rec.jgzz_attribute6,
1348 X_JGZZ_ATTRIBUTE10 => p_customer_profile_rec.jgzz_attribute10,
1345 X_JGZZ_ATTRIBUTE7 => p_customer_profile_rec.jgzz_attribute7,
1346 X_JGZZ_ATTRIBUTE8 => p_customer_profile_rec.jgzz_attribute8,
1347 X_JGZZ_ATTRIBUTE9 => p_customer_profile_rec.jgzz_attribute9,
1349 X_JGZZ_ATTRIBUTE11 => p_customer_profile_rec.jgzz_attribute11,
1350 X_JGZZ_ATTRIBUTE12 => p_customer_profile_rec.jgzz_attribute12,
1351 X_JGZZ_ATTRIBUTE13 => p_customer_profile_rec.jgzz_attribute13,
1352 X_JGZZ_ATTRIBUTE14 => p_customer_profile_rec.jgzz_attribute14,
1353 X_JGZZ_ATTRIBUTE15 => p_customer_profile_rec.jgzz_attribute15,
1354 X_GLOBAL_ATTRIBUTE1 => p_customer_profile_rec.global_attribute1,
1355 X_GLOBAL_ATTRIBUTE2 => p_customer_profile_rec.global_attribute2,
1356 X_GLOBAL_ATTRIBUTE3 => p_customer_profile_rec.global_attribute3,
1357 X_GLOBAL_ATTRIBUTE4 => p_customer_profile_rec.global_attribute4,
1358 X_GLOBAL_ATTRIBUTE5 => p_customer_profile_rec.global_attribute5,
1359 X_GLOBAL_ATTRIBUTE6 => p_customer_profile_rec.global_attribute6,
1360 X_GLOBAL_ATTRIBUTE7 => p_customer_profile_rec.global_attribute7,
1361 X_GLOBAL_ATTRIBUTE8 => p_customer_profile_rec.global_attribute8,
1362 X_GLOBAL_ATTRIBUTE9 => p_customer_profile_rec.global_attribute9,
1363 X_GLOBAL_ATTRIBUTE10 => p_customer_profile_rec.global_attribute10,
1364 X_GLOBAL_ATTRIBUTE11 => p_customer_profile_rec.global_attribute11,
1365 X_GLOBAL_ATTRIBUTE12 => p_customer_profile_rec.global_attribute12,
1366 X_GLOBAL_ATTRIBUTE13 => p_customer_profile_rec.global_attribute13,
1367 X_GLOBAL_ATTRIBUTE14 => p_customer_profile_rec.global_attribute14,
1368 X_GLOBAL_ATTRIBUTE15 => p_customer_profile_rec.global_attribute15,
1369 X_GLOBAL_ATTRIBUTE16 => p_customer_profile_rec.global_attribute16,
1370 X_GLOBAL_ATTRIBUTE17 => p_customer_profile_rec.global_attribute17,
1371 X_GLOBAL_ATTRIBUTE18 => p_customer_profile_rec.global_attribute18,
1372 X_GLOBAL_ATTRIBUTE19 => p_customer_profile_rec.global_attribute19,
1373 X_GLOBAL_ATTRIBUTE20 => p_customer_profile_rec.global_attribute20,
1374 X_GLOBAL_ATTRIBUTE_CATEGORY => p_customer_profile_rec.global_attribute_category,
1375 X_CONS_INV_FLAG => p_customer_profile_rec.cons_inv_flag,
1376 X_CONS_INV_TYPE => p_customer_profile_rec.cons_inv_type,
1377 X_AUTOCASH_HIERARCHY_ID_ADR => p_customer_profile_rec.autocash_hierarchy_id_for_adr,
1378 X_LOCKBOX_MATCHING_OPTION => p_customer_profile_rec.lockbox_matching_option,
1379 X_OBJECT_VERSION_NUMBER => p_object_version_number,
1380 X_CREATED_BY_MODULE => p_customer_profile_rec.created_by_module,
1381 X_APPLICATION_ID => p_customer_profile_rec.application_id,
1382 X_review_cycle => p_customer_profile_rec.review_cycle,
1383 X_last_credit_review_date => p_customer_profile_rec.last_credit_review_date,
1384 X_party_id => p_customer_profile_rec.party_id,
1385 X_CREDIT_CLASSIFICATION => p_customer_profile_rec.credit_classification,
1386 X_CONS_BILL_LEVEL => p_customer_profile_rec.cons_bill_level,
1387 X_LATE_CHARGE_CALCULATION_TRX => p_customer_profile_rec.late_charge_calculation_trx,
1388 X_CREDIT_ITEMS_FLAG => p_customer_profile_rec.credit_items_flag,
1389 X_DISPUTED_TRANSACTIONS_FLAG => p_customer_profile_rec.disputed_transactions_flag,
1390 X_LATE_CHARGE_TYPE => p_customer_profile_rec.late_charge_type,
1391 X_LATE_CHARGE_TERM_ID => p_customer_profile_rec.late_charge_term_id,
1392 X_INTEREST_CALCULATION_PERIOD => p_customer_profile_rec.interest_calculation_period,
1393 X_HOLD_CHARGED_INVOICES_FLAG => p_customer_profile_rec.hold_charged_invoices_flag,
1394 X_MESSAGE_TEXT_ID => p_customer_profile_rec.message_text_id,
1395 X_MULTIPLE_INTEREST_RATES_FLAG => p_customer_profile_rec.multiple_interest_rates_flag,
1396 X_CHARGE_BEGIN_DATE => p_customer_profile_rec.charge_begin_date
1397 );
1398
1399 --raji
1400
1401 -- Debug info.
1402 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1403 hz_utility_v2pub.debug(p_message=>'HZ_CUSTOMER_PROFILES_PKG.Update_Row (-)',
1404 p_prefix=>l_debug_prefix,
1405 p_msg_level=>fnd_log.level_procedure);
1406 END IF;
1407
1408 -- When the bill_level at the account profile is changed from 'ACCOUNT' to 'SITE',
1409 -- the bill_level for all the associated BFB enabled site uses should be
1410 -- updated to 'SITE' and the rest of the BFB attributes can be updated
1411 -- while updating the individual site use records.
1412 if (l_site_use_id is NULL and
1413 p_customer_profile_rec.cons_bill_level = 'SITE' and
1414 l_cons_bill_level = 'ACCOUNT') then
1415 begin
1419 and cons_inv_flag = 'Y'
1416 update HZ_CUSTOMER_PROFILES
1417 set cons_bill_level = 'SITE'
1418 where site_use_id is NOT NULL
1420 and cust_account_id = l_cust_account_id;
1421 exception when NO_DATA_FOUND then
1422 null;
1423 end;
1424 end if;
1425
1426 -- Update profile amt.
1427
1428 -- If profile_class_id has been changed, we have to update/copy the profile
1429 -- amount under new profile class. Please note, profile_class_id cannot be
1430 -- updated to null.
1431
1432 IF (p_customer_profile_rec.profile_class_id IS NOT NULL
1433 AND p_customer_profile_rec.profile_class_id <> l_profile_class_id )
1434 THEN
1435 BEGIN
1436
1437 -- could have several records in profile_class_amts for a given
1438 -- profile_class_id.
1439
1440 OPEN c_profile_class_amts;
1441 LOOP
1442 FETCH c_profile_class_amts INTO l_profile_class_amount_id;
1443 EXIT WHEN c_profile_class_amts%NOTFOUND;
1444
1445 -- Setup profile amount record if it is the first run.
1446 IF l_is_first THEN
1447 -- cust_account_id, site_use_id are non-updateable.
1448 -- Setup profile amount record
1449 l_cust_profile_amt_rec.cust_account_profile_id := p_customer_profile_rec.cust_account_profile_id;
1450 l_cust_profile_amt_rec.cust_account_id := l_cust_account_id;
1451 l_cust_profile_amt_rec.site_use_id := l_site_use_id;
1452
1453 l_is_first := FALSE;
1454 END IF;
1455
1456 -- Debug info.
1457 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1458 hz_utility_v2pub.debug(p_message=>'HZ_CUST_PROF_CLASS_AMTS_PKG.Select_Row (+)',
1459 p_prefix=>l_debug_prefix,
1460 p_msg_level=>fnd_log.level_procedure);
1461 END IF;
1462
1463 -- Call table-handler
1464 HZ_CUST_PROF_CLASS_AMTS_PKG.Select_Row (
1465 X_PROFILE_CLASS_AMOUNT_ID => l_profile_class_amount_id,
1466 X_PROFILE_CLASS_ID => l_profile_class_id,
1467 X_CURRENCY_CODE => l_cust_profile_amt_rec.currency_code,
1468 X_TRX_CREDIT_LIMIT => l_cust_profile_amt_rec.trx_credit_limit,
1469 X_OVERALL_CREDIT_LIMIT => l_cust_profile_amt_rec.overall_credit_limit,
1470 X_MIN_DUNNING_AMOUNT => l_cust_profile_amt_rec.min_dunning_amount,
1471 X_MAX_INTEREST_CHARGE => l_cust_profile_amt_rec.max_interest_charge,
1472 X_MIN_STATEMENT_AMOUNT => l_cust_profile_amt_rec.min_statement_amount,
1473 X_AUTO_REC_MIN_RECEIPT_AMOUNT => l_cust_profile_amt_rec.auto_rec_min_receipt_amount,
1474 X_ATTRIBUTE_CATEGORY => l_cust_profile_amt_rec.attribute_category,
1475 X_ATTRIBUTE1 => l_cust_profile_amt_rec.attribute1,
1476 X_ATTRIBUTE2 => l_cust_profile_amt_rec.attribute2,
1477 X_ATTRIBUTE3 => l_cust_profile_amt_rec.attribute3,
1478 X_ATTRIBUTE4 => l_cust_profile_amt_rec.attribute4,
1479 X_ATTRIBUTE5 => l_cust_profile_amt_rec.attribute5,
1480 X_ATTRIBUTE6 => l_cust_profile_amt_rec.attribute6,
1481 X_ATTRIBUTE7 => l_cust_profile_amt_rec.attribute7,
1482 X_ATTRIBUTE8 => l_cust_profile_amt_rec.attribute8,
1483 X_ATTRIBUTE9 => l_cust_profile_amt_rec.attribute9,
1484 X_ATTRIBUTE10 => l_cust_profile_amt_rec.attribute10,
1485 X_ATTRIBUTE11 => l_cust_profile_amt_rec.attribute11,
1486 X_ATTRIBUTE12 => l_cust_profile_amt_rec.attribute12,
1487 X_ATTRIBUTE13 => l_cust_profile_amt_rec.attribute13,
1488 X_ATTRIBUTE14 => l_cust_profile_amt_rec.attribute14,
1489 X_ATTRIBUTE15 => l_cust_profile_amt_rec.attribute15,
1490 X_INTEREST_RATE => l_cust_profile_amt_rec.interest_rate,
1491 X_MIN_FC_BALANCE_AMOUNT => l_cust_profile_amt_rec.min_fc_balance_amount,
1492 X_MIN_FC_INVOICE_AMOUNT => l_cust_profile_amt_rec.min_fc_invoice_amount,
1493 X_MIN_DUNNING_INVOICE_AMOUNT => l_cust_profile_amt_rec.min_dunning_invoice_amount,
1494 X_EXPIRATION_DATE => l_cust_profile_amt_rec.expiration_date,
1495 X_JGZZ_ATTRIBUTE_CATEGORY => l_cust_profile_amt_rec.jgzz_attribute_category,
1496 X_JGZZ_ATTRIBUTE1 => l_cust_profile_amt_rec.jgzz_attribute1,
1497 X_JGZZ_ATTRIBUTE2 => l_cust_profile_amt_rec.jgzz_attribute2,
1498 X_JGZZ_ATTRIBUTE3 => l_cust_profile_amt_rec.jgzz_attribute3,
1499 X_JGZZ_ATTRIBUTE4 => l_cust_profile_amt_rec.jgzz_attribute4,
1500 X_JGZZ_ATTRIBUTE5 => l_cust_profile_amt_rec.jgzz_attribute5,
1501 X_JGZZ_ATTRIBUTE6 => l_cust_profile_amt_rec.jgzz_attribute6,
1505 X_JGZZ_ATTRIBUTE10 => l_cust_profile_amt_rec.jgzz_attribute10,
1502 X_JGZZ_ATTRIBUTE7 => l_cust_profile_amt_rec.jgzz_attribute7,
1503 X_JGZZ_ATTRIBUTE8 => l_cust_profile_amt_rec.jgzz_attribute8,
1504 X_JGZZ_ATTRIBUTE9 => l_cust_profile_amt_rec.jgzz_attribute9,
1506 X_JGZZ_ATTRIBUTE11 => l_cust_profile_amt_rec.jgzz_attribute11,
1507 X_JGZZ_ATTRIBUTE12 => l_cust_profile_amt_rec.jgzz_attribute12,
1508 X_JGZZ_ATTRIBUTE13 => l_cust_profile_amt_rec.jgzz_attribute13,
1509 X_JGZZ_ATTRIBUTE14 => l_cust_profile_amt_rec.jgzz_attribute14,
1510 X_JGZZ_ATTRIBUTE15 => l_cust_profile_amt_rec.jgzz_attribute15,
1511 X_GLOBAL_ATTRIBUTE1 => l_cust_profile_amt_rec.global_attribute1,
1512 X_GLOBAL_ATTRIBUTE2 => l_cust_profile_amt_rec.global_attribute2,
1513 X_GLOBAL_ATTRIBUTE3 => l_cust_profile_amt_rec.global_attribute3,
1514 X_GLOBAL_ATTRIBUTE4 => l_cust_profile_amt_rec.global_attribute4,
1515 X_GLOBAL_ATTRIBUTE5 => l_cust_profile_amt_rec.global_attribute5,
1516 X_GLOBAL_ATTRIBUTE6 => l_cust_profile_amt_rec.global_attribute6,
1517 X_GLOBAL_ATTRIBUTE7 => l_cust_profile_amt_rec.global_attribute7,
1518 X_GLOBAL_ATTRIBUTE8 => l_cust_profile_amt_rec.global_attribute8,
1519 X_GLOBAL_ATTRIBUTE9 => l_cust_profile_amt_rec.global_attribute9,
1520 X_GLOBAL_ATTRIBUTE10 => l_cust_profile_amt_rec.global_attribute10,
1521 X_GLOBAL_ATTRIBUTE11 => l_cust_profile_amt_rec.global_attribute11,
1522 X_GLOBAL_ATTRIBUTE12 => l_cust_profile_amt_rec.global_attribute12,
1523 X_GLOBAL_ATTRIBUTE13 => l_cust_profile_amt_rec.global_attribute13,
1524 X_GLOBAL_ATTRIBUTE14 => l_cust_profile_amt_rec.global_attribute14,
1525 X_GLOBAL_ATTRIBUTE15 => l_cust_profile_amt_rec.global_attribute15,
1526 X_GLOBAL_ATTRIBUTE16 => l_cust_profile_amt_rec.global_attribute16,
1527 X_GLOBAL_ATTRIBUTE17 => l_cust_profile_amt_rec.global_attribute17,
1528 X_GLOBAL_ATTRIBUTE18 => l_cust_profile_amt_rec.global_attribute18,
1529 X_GLOBAL_ATTRIBUTE19 => l_cust_profile_amt_rec.global_attribute19,
1530 X_GLOBAL_ATTRIBUTE20 => l_cust_profile_amt_rec.global_attribute20,
1531 X_GLOBAL_ATTRIBUTE_CATEGORY => l_cust_profile_amt_rec.global_attribute_category,
1532 X_EXCHANGE_RATE_TYPE => l_cust_profile_amt_rec.exchange_rate_type,
1533 X_MIN_FC_INVOICE_OVERDUE_TYPE => l_cust_profile_amt_rec.min_fc_invoice_overdue_type,
1534 X_MIN_FC_INVOICE_PERCENT => l_cust_profile_amt_rec.min_fc_invoice_percent,
1535 X_MIN_FC_BALANCE_OVERDUE_TYPE => l_cust_profile_amt_rec.min_fc_balance_overdue_type,
1536 X_MIN_FC_BALANCE_PERCENT => l_cust_profile_amt_rec.min_fc_balance_percent,
1537 X_INTEREST_TYPE => l_cust_profile_amt_rec.interest_type,
1538 X_INTEREST_FIXED_AMOUNT => l_cust_profile_amt_rec.interest_fixed_amount,
1539 X_INTEREST_SCHEDULE_ID => l_cust_profile_amt_rec.interest_schedule_id,
1540 X_PENALTY_TYPE => l_cust_profile_amt_rec.penalty_type,
1541 X_PENALTY_RATE => l_cust_profile_amt_rec.penalty_rate,
1542 X_MIN_INTEREST_CHARGE => l_cust_profile_amt_rec.min_interest_charge,
1543 X_PENALTY_FIXED_AMOUNT => l_cust_profile_amt_rec.penalty_fixed_amount,
1544 X_PENALTY_SCHEDULE_ID => l_cust_profile_amt_rec.penalty_schedule_id
1545 );
1546
1547 -- Debug info.
1548 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1549 hz_utility_v2pub.debug(p_message=>'HZ_CUST_PROF_CLASS_AMTS_PKG.Select_Row (-)',
1550 p_prefix=>l_debug_prefix,
1551 p_msg_level=>fnd_log.level_procedure);
1552 END IF;
1553
1554 -- Check if a currency code already exist for this profile.
1555 -- If yes, update that amount. If not, create a new amount.
1556
1557 BEGIN
1558 SELECT CUST_ACCT_PROFILE_AMT_ID, OBJECT_VERSION_NUMBER
1559 INTO l_cust_acct_profile_amt_id, l_amt_object_version_number
1560 FROM HZ_CUST_PROFILE_AMTS
1561 WHERE CUST_ACCOUNT_PROFILE_ID = p_customer_profile_rec.cust_account_profile_id
1562 AND CURRENCY_CODE = l_cust_profile_amt_rec.currency_code;
1563
1564 -- The currency exist for the customer profile. Update it.
1565 l_cust_profile_amt_rec.cust_acct_profile_amt_id := l_cust_acct_profile_amt_id;
1566
1567 -- Call public API to update cust profile amount.
1568 update_cust_profile_amt (
1569 p_cust_profile_amt_rec => l_cust_profile_amt_rec,
1570 p_object_version_number => l_amt_object_version_number,
1571 x_return_status => x_return_status,
1575 hz_credit_usages_cascade_pkg.delete_credit_usages(
1572 x_msg_count => l_msg_count,
1573 x_msg_data => l_msg_data );
1574
1576 l_cust_profile_amt_rec.cust_acct_profile_amt_id
1577 , x_return_status
1578 , l_msg_count
1579 , l_msg_data);
1580
1581 EXCEPTION
1582 WHEN NO_DATA_FOUND THEN
1583 -- The currency does not exist, create new amount
1584 l_cust_profile_amt_rec.cust_acct_profile_amt_id := NULL;
1585
1586 IF p_customer_profile_rec.created_by_module IS NOT NULL
1587 and p_customer_profile_rec.created_by_module <> fnd_api.g_miss_char THEN
1588 l_cust_profile_amt_rec.created_by_module := p_customer_profile_rec.created_by_module;
1589 ELSE
1590 -- if l_created_by_module is null, default to TCA_V2_API
1591 l_cust_profile_amt_rec.created_by_module := nvl(l_created_by_module, 'TCA_V2_API');
1592 END IF;
1593
1594 IF p_customer_profile_rec.application_id IS NOT NULL THEN
1595 l_cust_profile_amt_rec.application_id := p_customer_profile_rec.application_id;
1596 ELSE
1597 l_cust_profile_amt_rec.application_id := l_application_id;
1598 END IF;
1599
1600 -- Call public API to create cust profile amount.
1601 create_cust_profile_amt (
1602 p_cust_profile_amt_rec => l_cust_profile_amt_rec,
1603 x_cust_acct_profile_amt_id => l_cust_profile_amt_rec.cust_acct_profile_amt_id,
1604 x_return_status => x_return_status,
1605 x_msg_count => l_msg_count,
1606 x_msg_data => l_msg_data );
1607 END;
1608
1609 IF x_return_status = 'S' THEN
1610 HZ_CREDIT_USAGES_CASCADE_PKG.cascade_credit_usage_rules (
1611 l_cust_profile_amt_rec.cust_acct_profile_amt_id,
1612 l_cust_profile_amt_rec.cust_account_profile_id,
1613 l_profile_class_amount_id,
1614 l_profile_class_id,
1615 x_return_status,
1616 l_msg_count,
1617 l_msg_data );
1618 END IF;
1619
1620
1621 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1622 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
1623 RAISE FND_API.G_EXC_ERROR;
1624 ELSE
1625 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1626 END IF;
1627 END IF;
1628
1629 END LOOP;
1630 CLOSE c_profile_class_amts;
1631
1632 EXCEPTION
1633 WHEN OTHERS THEN
1634 IF c_profile_class_amts%ISOPEN THEN
1635 CLOSE c_profile_class_amts;
1636 END IF;
1637
1638 RAISE;
1639 END;
1640 END IF;
1641
1642 -- Debug info.
1643 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1644 hz_utility_v2pub.debug(p_message=>'do_update_customer_profile (-)',
1645 p_prefix=>l_debug_prefix,
1646 p_msg_level=>fnd_log.level_procedure);
1647 END IF;
1648
1649 END do_update_customer_profile;
1650
1651 /**
1652 * PRIVATE PROCEDURE do_create_cust_profile_amt
1653 *
1654 * DESCRIPTION
1655 * Private procedure to create customer profile amount.
1656 *
1657 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
1658 * HZ_ACCOUNT_VALIDATE_V2PUB.validate_cust_profile_amt
1659 * HZ_CUST_PROFILE_AMTS_PKG.Insert_Row
1660 *
1661 * ARGUMENTS
1662 * IN:
1663 * p_check_foreign_key If do foreign key checking on cust_account_id
1664 * and cust_account_profile_id or not. Defaut value
1665 * is FND_API.G_TRUE, which means API will do foreign
1666 * key checking on these 2 columns.
1667 * IN/OUT:
1668 * p_cust_profile_amt_rec Customer profile amount record.
1669 * x_return_status Return status after the call. The status can
1670 * be FND_API.G_RET_STS_SUCCESS (success),
1671 * FND_API.G_RET_STS_ERROR (error),
1672 * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1673 * OUT:
1674 * x_cust_acct_profile_amt_id Customer account profile amount ID.
1675 *
1676 * NOTES
1677 *
1678 * MODIFICATION HISTORY
1679 *
1680 * 07-23-2001 Jianying Huang o Created.
1681 *
1682 */
1683
1684 PROCEDURE do_create_cust_profile_amt (
1685 p_check_foreign_key IN VARCHAR2,
1686 p_cust_profile_amt_rec IN OUT NOCOPY CUST_PROFILE_AMT_REC_TYPE,
1687 x_cust_acct_profile_amt_id OUT NOCOPY NUMBER,
1688 x_return_status IN OUT NOCOPY VARCHAR2
1689 ) IS
1690
1694
1691 l_debug_prefix VARCHAR2(30) := ''; --'do_create_cust_profile_amt'
1692 l_site_use_id HZ_CUST_PROFILE_AMTS.SITE_USE_ID%TYPE;
1693 BEGIN
1695 -- Debug info.
1696 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1697 hz_utility_v2pub.debug(p_message=>'do_create_cust_profile_amt (+)' ,
1698 p_prefix=>l_debug_prefix,
1699 p_msg_level=>fnd_log.level_procedure);
1700 END IF;
1701
1702 -- Validate cust profile amt record
1703 HZ_ACCOUNT_VALIDATE_V2PUB.validate_cust_profile_amt (
1704 p_create_update_flag => 'C',
1705 p_check_foreign_key => p_check_foreign_key,
1706 p_cust_profile_amt_rec => p_cust_profile_amt_rec,
1707 p_rowid => NULL,
1708 x_return_status => x_return_status );
1709
1710 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1711 RAISE FND_API.G_EXC_ERROR;
1712 END IF;
1713
1714 -- Added rounding of min_fc_invoice_amount, min_fc_balance_amount, min_interest_charge,
1715 -- min_interest_charge, interest_fixed_amount and penalty_fixed_amount to 2 decimal places for Late charge project.
1716 IF p_cust_profile_amt_rec.min_fc_invoice_amount is NOT NULL then
1717 p_cust_profile_amt_rec.min_fc_invoice_amount := ROUND(p_cust_profile_amt_rec.min_fc_invoice_amount,2);
1718 END IF;
1719 IF p_cust_profile_amt_rec.min_fc_balance_amount is NOT NULL then
1720 p_cust_profile_amt_rec.min_fc_balance_amount := ROUND(p_cust_profile_amt_rec.min_fc_balance_amount,2);
1721 END IF;
1722 IF p_cust_profile_amt_rec.max_interest_charge is NOT NULL then
1723 p_cust_profile_amt_rec.max_interest_charge := ROUND(p_cust_profile_amt_rec.max_interest_charge,2);
1724 END IF;
1725 IF p_cust_profile_amt_rec.min_interest_charge is NOT NULL then
1726 p_cust_profile_amt_rec.min_interest_charge := ROUND(p_cust_profile_amt_rec.min_interest_charge,2);
1727 END IF;
1728 IF p_cust_profile_amt_rec.interest_fixed_amount is NOT NULL then
1729 p_cust_profile_amt_rec.interest_fixed_amount := ROUND(p_cust_profile_amt_rec.interest_fixed_amount,2);
1730 END IF;
1731 IF p_cust_profile_amt_rec.penalty_fixed_amount is NOT NULL then
1732 p_cust_profile_amt_rec.penalty_fixed_amount := ROUND(p_cust_profile_amt_rec.penalty_fixed_amount,2);
1733 END IF;
1734
1735 -- Debug info.
1736 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1737 hz_utility_v2pub.debug(p_message=>'HZ_CUST_PROFILE_AMTS_PKG.Insert_Row (+)',
1738 p_prefix=>l_debug_prefix,
1739 p_msg_level=>fnd_log.level_procedure);
1740 END IF;
1741
1742 -- Bug 6472676
1743 -- Changed do_create_cust_profile_amt Procudure to get SITE_USE_ID value from Customer Profiles if
1744 -- Parameter CUST_PROFILE_AMT_REC containing null value in SITE_USE_ID.
1745
1746 IF p_cust_profile_amt_rec.site_use_id IS NULL OR p_CUST_PROFILE_AMT_REC.site_use_id = FND_API.G_MISS_NUM THEN
1747 BEGIN
1748 SELECT site_use_id
1749 INTO l_site_use_id
1750 FROM hz_customer_profiles
1751 WHERE cust_account_id = p_cust_profile_amt_rec.cust_account_id
1752 AND cust_account_profile_id = p_cust_profile_amt_rec.cust_account_profile_id ;
1753
1754 p_cust_profile_amt_rec.site_use_id := l_site_use_id ;
1755
1756 EXCEPTION
1757 WHEN OTHERS THEN
1758 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1759 END;
1760 END IF;
1761
1762 -- Call table-handler.
1763 HZ_CUST_PROFILE_AMTS_PKG.Insert_Row (
1764 X_CUST_ACCT_PROFILE_AMT_ID => p_cust_profile_amt_rec.cust_acct_profile_amt_id,
1765 X_CUST_ACCOUNT_PROFILE_ID => p_cust_profile_amt_rec.cust_account_profile_id,
1766 X_CURRENCY_CODE => p_cust_profile_amt_rec.currency_code,
1767 X_TRX_CREDIT_LIMIT => p_cust_profile_amt_rec.trx_credit_limit,
1768 X_OVERALL_CREDIT_LIMIT => p_cust_profile_amt_rec.overall_credit_limit,
1769 X_MIN_DUNNING_AMOUNT => p_cust_profile_amt_rec.min_dunning_amount,
1770 X_MIN_DUNNING_INVOICE_AMOUNT => p_cust_profile_amt_rec.min_dunning_invoice_amount,
1771 X_MAX_INTEREST_CHARGE => p_cust_profile_amt_rec.max_interest_charge,
1772 X_MIN_STATEMENT_AMOUNT => p_cust_profile_amt_rec.min_statement_amount,
1773 X_AUTO_REC_MIN_RECEIPT_AMOUNT => p_cust_profile_amt_rec.auto_rec_min_receipt_amount,
1774 X_INTEREST_RATE => p_cust_profile_amt_rec.interest_rate,
1775 X_ATTRIBUTE_CATEGORY => p_cust_profile_amt_rec.attribute_category,
1776 X_ATTRIBUTE1 => p_cust_profile_amt_rec.attribute1,
1777 X_ATTRIBUTE2 => p_cust_profile_amt_rec.attribute2,
1778 X_ATTRIBUTE3 => p_cust_profile_amt_rec.attribute3,
1779 X_ATTRIBUTE4 => p_cust_profile_amt_rec.attribute4,
1780 X_ATTRIBUTE5 => p_cust_profile_amt_rec.attribute5,
1781 X_ATTRIBUTE6 => p_cust_profile_amt_rec.attribute6,
1782 X_ATTRIBUTE7 => p_cust_profile_amt_rec.attribute7,
1783 X_ATTRIBUTE8 => p_cust_profile_amt_rec.attribute8,
1784 X_ATTRIBUTE9 => p_cust_profile_amt_rec.attribute9,
1788 X_ATTRIBUTE13 => p_cust_profile_amt_rec.attribute13,
1785 X_ATTRIBUTE10 => p_cust_profile_amt_rec.attribute10,
1786 X_ATTRIBUTE11 => p_cust_profile_amt_rec.attribute11,
1787 X_ATTRIBUTE12 => p_cust_profile_amt_rec.attribute12,
1789 X_ATTRIBUTE14 => p_cust_profile_amt_rec.attribute14,
1790 X_ATTRIBUTE15 => p_cust_profile_amt_rec.attribute15,
1791 X_MIN_FC_BALANCE_AMOUNT => p_cust_profile_amt_rec.min_fc_balance_amount,
1792 X_MIN_FC_INVOICE_AMOUNT => p_cust_profile_amt_rec.min_fc_invoice_amount,
1793 X_CUST_ACCOUNT_ID => p_cust_profile_amt_rec.cust_account_id,
1794 X_SITE_USE_ID => p_cust_profile_amt_rec.site_use_id,
1795 X_EXPIRATION_DATE => p_cust_profile_amt_rec.expiration_date,
1796 X_JGZZ_ATTRIBUTE_CATEGORY => p_cust_profile_amt_rec.jgzz_attribute_category,
1797 X_JGZZ_ATTRIBUTE1 => p_cust_profile_amt_rec.jgzz_attribute1,
1798 X_JGZZ_ATTRIBUTE2 => p_cust_profile_amt_rec.jgzz_attribute2,
1799 X_JGZZ_ATTRIBUTE3 => p_cust_profile_amt_rec.jgzz_attribute3,
1800 X_JGZZ_ATTRIBUTE4 => p_cust_profile_amt_rec.jgzz_attribute4,
1801 X_JGZZ_ATTRIBUTE5 => p_cust_profile_amt_rec.jgzz_attribute5,
1802 X_JGZZ_ATTRIBUTE6 => p_cust_profile_amt_rec.jgzz_attribute6,
1803 X_JGZZ_ATTRIBUTE7 => p_cust_profile_amt_rec.jgzz_attribute7,
1804 X_JGZZ_ATTRIBUTE8 => p_cust_profile_amt_rec.jgzz_attribute8,
1805 X_JGZZ_ATTRIBUTE9 => p_cust_profile_amt_rec.jgzz_attribute9,
1806 X_JGZZ_ATTRIBUTE10 => p_cust_profile_amt_rec.jgzz_attribute10,
1807 X_JGZZ_ATTRIBUTE11 => p_cust_profile_amt_rec.jgzz_attribute11,
1808 X_JGZZ_ATTRIBUTE12 => p_cust_profile_amt_rec.jgzz_attribute12,
1809 X_JGZZ_ATTRIBUTE13 => p_cust_profile_amt_rec.jgzz_attribute13,
1810 X_JGZZ_ATTRIBUTE14 => p_cust_profile_amt_rec.jgzz_attribute14,
1811 X_JGZZ_ATTRIBUTE15 => p_cust_profile_amt_rec.jgzz_attribute15,
1812 X_GLOBAL_ATTRIBUTE1 => p_cust_profile_amt_rec.global_attribute1,
1813 X_GLOBAL_ATTRIBUTE2 => p_cust_profile_amt_rec.global_attribute2,
1814 X_GLOBAL_ATTRIBUTE3 => p_cust_profile_amt_rec.global_attribute3,
1815 X_GLOBAL_ATTRIBUTE4 => p_cust_profile_amt_rec.global_attribute4,
1816 X_GLOBAL_ATTRIBUTE5 => p_cust_profile_amt_rec.global_attribute5,
1817 X_GLOBAL_ATTRIBUTE6 => p_cust_profile_amt_rec.global_attribute6,
1818 X_GLOBAL_ATTRIBUTE7 => p_cust_profile_amt_rec.global_attribute7,
1819 X_GLOBAL_ATTRIBUTE8 => p_cust_profile_amt_rec.global_attribute8,
1820 X_GLOBAL_ATTRIBUTE9 => p_cust_profile_amt_rec.global_attribute9,
1821 X_GLOBAL_ATTRIBUTE10 => p_cust_profile_amt_rec.global_attribute10,
1822 X_GLOBAL_ATTRIBUTE11 => p_cust_profile_amt_rec.global_attribute11,
1823 X_GLOBAL_ATTRIBUTE12 => p_cust_profile_amt_rec.global_attribute12,
1824 X_GLOBAL_ATTRIBUTE13 => p_cust_profile_amt_rec.global_attribute13,
1825 X_GLOBAL_ATTRIBUTE14 => p_cust_profile_amt_rec.global_attribute14,
1826 X_GLOBAL_ATTRIBUTE15 => p_cust_profile_amt_rec.global_attribute15,
1827 X_GLOBAL_ATTRIBUTE16 => p_cust_profile_amt_rec.global_attribute16,
1828 X_GLOBAL_ATTRIBUTE17 => p_cust_profile_amt_rec.global_attribute17,
1829 X_GLOBAL_ATTRIBUTE18 => p_cust_profile_amt_rec.global_attribute18,
1830 X_GLOBAL_ATTRIBUTE19 => p_cust_profile_amt_rec.global_attribute19,
1831 X_GLOBAL_ATTRIBUTE20 => p_cust_profile_amt_rec.global_attribute20,
1832 X_GLOBAL_ATTRIBUTE_CATEGORY => p_cust_profile_amt_rec.global_attribute_category,
1833 X_OBJECT_VERSION_NUMBER => 1,
1834 X_CREATED_BY_MODULE => p_cust_profile_amt_rec.created_by_module,
1835 X_APPLICATION_ID => p_cust_profile_amt_rec.application_id,
1836 X_EXCHANGE_RATE_TYPE => p_cust_profile_amt_rec.exchange_rate_type,
1837 X_MIN_FC_INVOICE_OVERDUE_TYPE => p_cust_profile_amt_rec.min_fc_invoice_overdue_type,
1838 X_MIN_FC_INVOICE_PERCENT => p_cust_profile_amt_rec.min_fc_invoice_percent,
1839 X_MIN_FC_BALANCE_OVERDUE_TYPE => p_cust_profile_amt_rec.min_fc_balance_overdue_type,
1840 X_MIN_FC_BALANCE_PERCENT => p_cust_profile_amt_rec.min_fc_balance_percent,
1841 X_INTEREST_TYPE => p_cust_profile_amt_rec.interest_type,
1842 X_INTEREST_FIXED_AMOUNT => p_cust_profile_amt_rec.interest_fixed_amount,
1843 X_INTEREST_SCHEDULE_ID => p_cust_profile_amt_rec.interest_schedule_id,
1844 X_PENALTY_TYPE => p_cust_profile_amt_rec.penalty_type,
1845 X_PENALTY_RATE => p_cust_profile_amt_rec.penalty_rate,
1846 X_MIN_INTEREST_CHARGE => p_cust_profile_amt_rec.min_interest_charge,
1847 X_PENALTY_FIXED_AMOUNT => p_cust_profile_amt_rec.penalty_fixed_amount,
1851 x_cust_acct_profile_amt_id := p_cust_profile_amt_rec.cust_acct_profile_amt_id;
1848 X_PENALTY_SCHEDULE_ID => p_cust_profile_amt_rec.penalty_schedule_id
1849 );
1850
1852
1853 -- Debug info.
1854 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1855 hz_utility_v2pub.debug(p_message=>'HZ_CUST_PROFILE_AMTS_PKG.Insert_Row (-) ' ||
1856 'x_cust_acct_profile_amt_id = ' || x_cust_acct_profile_amt_id,
1857 p_prefix=>l_debug_prefix,
1858 p_msg_level=>fnd_log.level_procedure);
1859 END IF;
1860
1861 -- Debug info.
1862 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1863 hz_utility_v2pub.debug(p_message=>'do_create_cust_profile_amt (-)',
1864 p_prefix=>l_debug_prefix,
1865 p_msg_level=>fnd_log.level_procedure);
1866 END IF;
1867
1868 END do_create_cust_profile_amt;
1869
1870 /**
1871 * PRIVATE PROCEDURE do_update_cust_profile_amt
1872 *
1873 * DESCRIPTION
1874 * Private procedure to update customer profile amount.
1875 *
1876 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
1877 * HZ_ACCOUNT_VALIDATE_V2PUB.validate_cust_profile_amt
1878 * HZ_CUST_PROFILE_AMTS_PKG.Update_Row
1879 *
1880 * ARGUMENTS
1881 * IN/OUT:
1882 * p_cust_profile_amt_rec Customer profile amount record.
1883 * p_object_version_number Used for locking the being updated record.
1884 * x_return_status Return status after the call. The status can
1885 * be FND_API.G_RET_STS_SUCCESS (success),
1886 * FND_API.G_RET_STS_ERROR (error),
1887 * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1888 *
1889 * NOTES
1890 *
1891 * MODIFICATION HISTORY
1892 *
1893 * 07-23-2001 Jianying Huang o Created.
1894 *
1895 */
1896
1897 PROCEDURE do_update_cust_profile_amt (
1898 p_cust_profile_amt_rec IN OUT NOCOPY CUST_PROFILE_AMT_REC_TYPE,
1899 p_object_version_number IN OUT NOCOPY NUMBER,
1900 x_return_status IN OUT NOCOPY VARCHAR2
1901 ) IS
1902
1903 l_debug_prefix VARCHAR2(30) := ''; --'do_update_cust_profile_amt';
1904
1905 l_rowid ROWID := NULL;
1906 l_object_version_number NUMBER;
1907
1908 BEGIN
1909
1910 -- Debug info.
1911 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1912 hz_utility_v2pub.debug(p_message=>'do_update_cust_profile_amt (+)',
1913 p_prefix=>l_debug_prefix,
1914 p_msg_level=>fnd_log.level_procedure);
1915 END IF;
1916
1917 -- Lock record.
1918 BEGIN
1919 SELECT ROWID, OBJECT_VERSION_NUMBER
1920 INTO l_rowid, l_object_version_number
1921 FROM HZ_CUST_PROFILE_AMTS
1922 WHERE CUST_ACCT_PROFILE_AMT_ID = p_cust_profile_amt_rec.cust_acct_profile_amt_id
1923 FOR UPDATE NOWAIT;
1924
1925 IF NOT (
1926 ( p_object_version_number IS NULL AND l_object_version_number IS NULL ) OR
1927 ( p_object_version_number IS NOT NULL AND
1928 l_object_version_number IS NOT NULL AND
1929 p_object_version_number = l_object_version_number ) )
1930 THEN
1931 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_RECORD_CHANGED' );
1932 FND_MESSAGE.SET_TOKEN( 'TABLE', 'hz_cust_profile_amts' );
1933 FND_MSG_PUB.ADD;
1934 RAISE FND_API.G_EXC_ERROR;
1935 END IF;
1936
1937 p_object_version_number := NVL( l_object_version_number, 1 ) + 1;
1938
1939 EXCEPTION
1940 WHEN NO_DATA_FOUND THEN
1941 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_NO_RECORD' );
1942 FND_MESSAGE.SET_TOKEN( 'RECORD', 'customer account profile amount' );
1943 FND_MESSAGE.SET_TOKEN( 'VALUE',
1944 NVL( TO_CHAR( p_cust_profile_amt_rec.cust_acct_profile_amt_id ), 'null' ) );
1945 FND_MSG_PUB.ADD;
1946 RAISE FND_API.G_EXC_ERROR;
1947 END;
1948
1949 -- Validate cust profile amt record
1950 HZ_ACCOUNT_VALIDATE_V2PUB.validate_cust_profile_amt (
1951 p_create_update_flag => 'U',
1952 p_check_foreign_key => NULL,
1953 p_cust_profile_amt_rec => p_cust_profile_amt_rec,
1954 p_rowid => l_rowid,
1955 x_return_status => x_return_status );
1956
1957 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1958 RAISE FND_API.G_EXC_ERROR;
1959 END IF;
1960
1961 -- Added rounding of min_fc_invoice_amount, min_fc_balance_amount, min_interest_charge,
1962 -- min_interest_charge, interest_fixed_amount and penalty_fixed_amount to 2 decimal places for Late charge project.
1963 IF p_cust_profile_amt_rec.min_fc_invoice_amount is NOT NULL then
1964 p_cust_profile_amt_rec.min_fc_invoice_amount := ROUND(p_cust_profile_amt_rec.min_fc_invoice_amount,2);
1965 END IF;
1966 IF p_cust_profile_amt_rec.min_fc_balance_amount is NOT NULL then
1967 p_cust_profile_amt_rec.min_fc_balance_amount := ROUND(p_cust_profile_amt_rec.min_fc_balance_amount,2);
1968 END IF;
1969 IF p_cust_profile_amt_rec.max_interest_charge is NOT NULL then
1973 p_cust_profile_amt_rec.min_interest_charge := ROUND(p_cust_profile_amt_rec.min_interest_charge,2);
1970 p_cust_profile_amt_rec.max_interest_charge := ROUND(p_cust_profile_amt_rec.max_interest_charge,2);
1971 END IF;
1972 IF p_cust_profile_amt_rec.min_interest_charge is NOT NULL then
1974 END IF;
1975 IF p_cust_profile_amt_rec.interest_fixed_amount is NOT NULL then
1976 p_cust_profile_amt_rec.interest_fixed_amount := ROUND(p_cust_profile_amt_rec.interest_fixed_amount,2);
1977 END IF;
1978 IF p_cust_profile_amt_rec.penalty_fixed_amount is NOT NULL then
1979 p_cust_profile_amt_rec.penalty_fixed_amount := ROUND(p_cust_profile_amt_rec.penalty_fixed_amount,2);
1980 END IF;
1981
1982 -- Debug info.
1983 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1984 hz_utility_v2pub.debug(p_message=>'HZ_CUST_PROFILE_AMTS_PKG.Update_Row (+)',
1985 p_prefix=>l_debug_prefix,
1986 p_msg_level=>fnd_log.level_procedure);
1987 END IF;
1988
1989 -- Call table-handler.
1990 HZ_CUST_PROFILE_AMTS_PKG.Update_Row (
1991 X_Rowid => l_rowid,
1992 X_CUST_ACCT_PROFILE_AMT_ID => p_cust_profile_amt_rec.cust_acct_profile_amt_id,
1993 X_CUST_ACCOUNT_PROFILE_ID => p_cust_profile_amt_rec.cust_account_profile_id,
1994 X_CURRENCY_CODE => p_cust_profile_amt_rec.currency_code,
1995 X_TRX_CREDIT_LIMIT => p_cust_profile_amt_rec.trx_credit_limit,
1996 X_OVERALL_CREDIT_LIMIT => p_cust_profile_amt_rec.overall_credit_limit,
1997 X_MIN_DUNNING_AMOUNT => p_cust_profile_amt_rec.min_dunning_amount,
1998 X_MIN_DUNNING_INVOICE_AMOUNT => p_cust_profile_amt_rec.min_dunning_invoice_amount,
1999 X_MAX_INTEREST_CHARGE => p_cust_profile_amt_rec.max_interest_charge,
2000 X_MIN_STATEMENT_AMOUNT => p_cust_profile_amt_rec.min_statement_amount,
2001 X_AUTO_REC_MIN_RECEIPT_AMOUNT => p_cust_profile_amt_rec.auto_rec_min_receipt_amount,
2002 X_INTEREST_RATE => p_cust_profile_amt_rec.interest_rate,
2003 X_ATTRIBUTE_CATEGORY => p_cust_profile_amt_rec.attribute_category,
2004 X_ATTRIBUTE1 => p_cust_profile_amt_rec.attribute1,
2005 X_ATTRIBUTE2 => p_cust_profile_amt_rec.attribute2,
2006 X_ATTRIBUTE3 => p_cust_profile_amt_rec.attribute3,
2007 X_ATTRIBUTE4 => p_cust_profile_amt_rec.attribute4,
2008 X_ATTRIBUTE5 => p_cust_profile_amt_rec.attribute5,
2009 X_ATTRIBUTE6 => p_cust_profile_amt_rec.attribute6,
2010 X_ATTRIBUTE7 => p_cust_profile_amt_rec.attribute7,
2011 X_ATTRIBUTE8 => p_cust_profile_amt_rec.attribute8,
2012 X_ATTRIBUTE9 => p_cust_profile_amt_rec.attribute9,
2013 X_ATTRIBUTE10 => p_cust_profile_amt_rec.attribute10,
2014 X_ATTRIBUTE11 => p_cust_profile_amt_rec.attribute11,
2015 X_ATTRIBUTE12 => p_cust_profile_amt_rec.attribute12,
2016 X_ATTRIBUTE13 => p_cust_profile_amt_rec.attribute13,
2017 X_ATTRIBUTE14 => p_cust_profile_amt_rec.attribute14,
2018 X_ATTRIBUTE15 => p_cust_profile_amt_rec.attribute15,
2019 X_MIN_FC_BALANCE_AMOUNT => p_cust_profile_amt_rec.min_fc_balance_amount,
2020 X_MIN_FC_INVOICE_AMOUNT => p_cust_profile_amt_rec.min_fc_invoice_amount,
2021 X_CUST_ACCOUNT_ID => p_cust_profile_amt_rec.cust_account_id,
2022 X_SITE_USE_ID => p_cust_profile_amt_rec.site_use_id,
2023 X_EXPIRATION_DATE => p_cust_profile_amt_rec.expiration_date,
2024 X_JGZZ_ATTRIBUTE_CATEGORY => p_cust_profile_amt_rec.jgzz_attribute_category,
2025 X_JGZZ_ATTRIBUTE1 => p_cust_profile_amt_rec.jgzz_attribute1,
2026 X_JGZZ_ATTRIBUTE2 => p_cust_profile_amt_rec.jgzz_attribute2,
2027 X_JGZZ_ATTRIBUTE3 => p_cust_profile_amt_rec.jgzz_attribute3,
2028 X_JGZZ_ATTRIBUTE4 => p_cust_profile_amt_rec.jgzz_attribute4,
2029 X_JGZZ_ATTRIBUTE5 => p_cust_profile_amt_rec.jgzz_attribute5,
2030 X_JGZZ_ATTRIBUTE6 => p_cust_profile_amt_rec.jgzz_attribute6,
2031 X_JGZZ_ATTRIBUTE7 => p_cust_profile_amt_rec.jgzz_attribute7,
2032 X_JGZZ_ATTRIBUTE8 => p_cust_profile_amt_rec.jgzz_attribute8,
2033 X_JGZZ_ATTRIBUTE9 => p_cust_profile_amt_rec.jgzz_attribute9,
2034 X_JGZZ_ATTRIBUTE10 => p_cust_profile_amt_rec.jgzz_attribute10,
2035 X_JGZZ_ATTRIBUTE11 => p_cust_profile_amt_rec.jgzz_attribute11,
2036 X_JGZZ_ATTRIBUTE12 => p_cust_profile_amt_rec.jgzz_attribute12,
2037 X_JGZZ_ATTRIBUTE13 => p_cust_profile_amt_rec.jgzz_attribute13,
2038 X_JGZZ_ATTRIBUTE14 => p_cust_profile_amt_rec.jgzz_attribute14,
2039 X_JGZZ_ATTRIBUTE15 => p_cust_profile_amt_rec.jgzz_attribute15,
2040 X_GLOBAL_ATTRIBUTE1 => p_cust_profile_amt_rec.global_attribute1,
2041 X_GLOBAL_ATTRIBUTE2 => p_cust_profile_amt_rec.global_attribute2,
2042 X_GLOBAL_ATTRIBUTE3 => p_cust_profile_amt_rec.global_attribute3,
2046 X_GLOBAL_ATTRIBUTE7 => p_cust_profile_amt_rec.global_attribute7,
2043 X_GLOBAL_ATTRIBUTE4 => p_cust_profile_amt_rec.global_attribute4,
2044 X_GLOBAL_ATTRIBUTE5 => p_cust_profile_amt_rec.global_attribute5,
2045 X_GLOBAL_ATTRIBUTE6 => p_cust_profile_amt_rec.global_attribute6,
2047 X_GLOBAL_ATTRIBUTE8 => p_cust_profile_amt_rec.global_attribute8,
2048 X_GLOBAL_ATTRIBUTE9 => p_cust_profile_amt_rec.global_attribute9,
2049 X_GLOBAL_ATTRIBUTE10 => p_cust_profile_amt_rec.global_attribute10,
2050 X_GLOBAL_ATTRIBUTE11 => p_cust_profile_amt_rec.global_attribute11,
2051 X_GLOBAL_ATTRIBUTE12 => p_cust_profile_amt_rec.global_attribute12,
2052 X_GLOBAL_ATTRIBUTE13 => p_cust_profile_amt_rec.global_attribute13,
2053 X_GLOBAL_ATTRIBUTE14 => p_cust_profile_amt_rec.global_attribute14,
2054 X_GLOBAL_ATTRIBUTE15 => p_cust_profile_amt_rec.global_attribute15,
2055 X_GLOBAL_ATTRIBUTE16 => p_cust_profile_amt_rec.global_attribute16,
2056 X_GLOBAL_ATTRIBUTE17 => p_cust_profile_amt_rec.global_attribute17,
2057 X_GLOBAL_ATTRIBUTE18 => p_cust_profile_amt_rec.global_attribute18,
2058 X_GLOBAL_ATTRIBUTE19 => p_cust_profile_amt_rec.global_attribute19,
2059 X_GLOBAL_ATTRIBUTE20 => p_cust_profile_amt_rec.global_attribute20,
2060 X_GLOBAL_ATTRIBUTE_CATEGORY => p_cust_profile_amt_rec.global_attribute_category,
2061 X_OBJECT_VERSION_NUMBER => p_object_version_number,
2062 X_CREATED_BY_MODULE => p_cust_profile_amt_rec.created_by_module,
2063 X_APPLICATION_ID => p_cust_profile_amt_rec.application_id,
2064 X_EXCHANGE_RATE_TYPE => p_cust_profile_amt_rec.exchange_rate_type,
2065 X_MIN_FC_INVOICE_OVERDUE_TYPE => p_cust_profile_amt_rec.min_fc_invoice_overdue_type,
2066 X_MIN_FC_INVOICE_PERCENT => p_cust_profile_amt_rec.min_fc_invoice_percent,
2067 X_MIN_FC_BALANCE_OVERDUE_TYPE => p_cust_profile_amt_rec.min_fc_balance_overdue_type,
2068 X_MIN_FC_BALANCE_PERCENT => p_cust_profile_amt_rec.min_fc_balance_percent,
2069 X_INTEREST_TYPE => p_cust_profile_amt_rec.interest_type,
2070 X_INTEREST_FIXED_AMOUNT => p_cust_profile_amt_rec.interest_fixed_amount,
2071 X_INTEREST_SCHEDULE_ID => p_cust_profile_amt_rec.interest_schedule_id,
2072 X_PENALTY_TYPE => p_cust_profile_amt_rec.penalty_type,
2073 X_PENALTY_RATE => p_cust_profile_amt_rec.penalty_rate,
2074 X_MIN_INTEREST_CHARGE => p_cust_profile_amt_rec.min_interest_charge,
2075 X_PENALTY_FIXED_AMOUNT => p_cust_profile_amt_rec.penalty_fixed_amount,
2076 X_PENALTY_SCHEDULE_ID => p_cust_profile_amt_rec.penalty_schedule_id
2077 );
2078
2079 -- Debug info.
2080 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2081 hz_utility_v2pub.debug(p_message=>'HZ_CUST_PROFILE_AMTS_PKG.Update_Row (-)',
2082 p_prefix=>l_debug_prefix,
2083 p_msg_level=>fnd_log.level_procedure);
2084 END IF;
2085
2086 -- Debug info.
2087 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2088 hz_utility_v2pub.debug(p_message=>'do_update_cust_profile_amt (-)',
2089 p_prefix=>l_debug_prefix,
2090 p_msg_level=>fnd_log.level_procedure);
2091 END IF;
2092
2093 END do_update_cust_profile_amt;
2094
2095 --------------------------------------
2096 -- public procedures and functions
2097 --------------------------------------
2098 --2310474{
2099 /**
2100 * Function next_review_date_compute
2101 *
2102 * Description
2103 * Return the next_review_date
2104 *
2105 * MODIFICATION HISTORY
2106 * 04-19-2002 Herve Yu o Created
2107 *
2108 * Parameters : Review_Cycle
2109 * Last_review_date
2110 * Next_Review_Date
2111 */
2112 FUNCTION next_review_date_compute
2113 ( p_review_cycle IN VARCHAR2 ,
2114 p_last_review_date IN DATE ,
2115 p_next_review_date IN DATE )
2116 RETURN DATE
2117 IS
2118 l_last_date DATE;
2119 l_date DATE := NULL;
2120 BEGIN
2121
2122 -- Last review date is null next review date is null too
2123 IF p_last_review_date IS NULL THEN
2124 RETURN l_date;
2125 END IF;
2126
2127 -- review period is CUSTOM, API does not change next_review_date
2128 IF p_review_cycle = 'CUSTOM' THEN
2129 l_date := p_next_review_date;
2130 RETURN l_date;
2131 END IF;
2132
2133 -- if none review period provide the next review must be null
2134 IF p_review_cycle IS NULL THEN
2135 RETURN l_date;
2136 END IF;
2137
2138 l_last_date := p_last_review_date;
2139
2140 -- Compute next review date based on the period code
2141 IF l_last_date IS NOT NULL THEN
2142 l_date := compute_next_date( p_date => p_last_review_date,
2143 p_period => p_review_cycle);
2144 -- Next Review must be higher then sysdate
2145 IF l_date < SYSDATE THEN
2149 END IF;
2146 l_date := compute_next_date( p_date => sysdate,
2147 p_period => p_review_cycle);
2148 END IF;
2150
2151 RETURN l_date;
2152
2153 END;
2154
2155 /**
2156 * Function last_review_date_default
2157 *
2158 * Description
2159 * Return the last_review_date
2160 *
2161 * MODIFICATION HISTORY
2162 * 04-19-2002 Herve Yu o Created
2163 *
2164 * In parameter : Review_Cycle
2165 * Last_review_Date
2166 * p_create_update_flag
2167 */
2168 FUNCTION last_review_date_default
2169 ( p_review_cycle IN VARCHAR2 ,
2170 p_last_review_date IN DATE ,
2171 p_create_update_flag IN VARCHAR2)
2172 RETURN DATE
2173 IS
2174 l_last_review_date DATE;
2175 BEGIN
2176 IF p_create_update_flag = 'C' THEN
2177 l_last_review_date := SYSDATE;
2178 ELSIF p_create_update_flag = 'U' THEN
2179 l_last_review_date := SYSDATE;
2180 END IF;
2181 RETURN l_last_review_date;
2182 END;
2183 --}
2184
2185 /**
2186 * PROCEDURE create_customer_profile
2187 *
2188 * DESCRIPTION
2189 * Creates customer profile.
2190 *
2191 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
2192 * HZ_BUSINESS_EVENT_V2PVT.create_customer_profile_event
2193 *
2194 * ARGUMENTS
2195 * IN:
2196 * p_init_msg_list Initialize message stack if it is set to
2197 * FND_API.G_TRUE. Default is FND_API.G_FALSE.
2198 * p_customer_profile_rec Customer profile record. One customer account
2199 * must have a customer profile. One account site
2200 * use can optionally have one customer profile.
2201 * p_create_profile_amt If it is set to FND_API.G_TRUE, API create customer
2202 * profile amounts by copying corresponding data
2203 * from customer profile class amounts.
2204 * IN/OUT:
2205 * OUT:
2206 * x_cust_account_profile_id Customer account profile ID.
2207 * x_return_status Return status after the call. The status can
2208 * be FND_API.G_RET_STS_SUCCESS (success),
2209 * FND_API.G_RET_STS_ERROR (error),
2210 * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2211 * x_msg_count Number of messages in message stack.
2212 * x_msg_data Message text if x_msg_count is 1.
2213 *
2214 * NOTES
2215 *
2216 * MODIFICATION HISTORY
2217 *
2218 * 07-23-2001 Jianying Huang o Created.
2219 *
2220 */
2221
2222 PROCEDURE create_customer_profile (
2223 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
2224 p_customer_profile_rec IN CUSTOMER_PROFILE_REC_TYPE,
2225 p_create_profile_amt IN VARCHAR2 := FND_API.G_TRUE,
2226 x_cust_account_profile_id OUT NOCOPY NUMBER,
2227 x_return_status OUT NOCOPY VARCHAR2,
2228 x_msg_count OUT NOCOPY NUMBER,
2229 x_msg_data OUT NOCOPY VARCHAR2
2230 ) IS
2231
2232 l_customer_profile_rec CUSTOMER_PROFILE_REC_TYPE := p_customer_profile_rec;
2233 l_debug_prefix VARCHAR2(30) := '';
2234
2235 BEGIN
2236
2237 -- Standard start of API savepoint
2238 SAVEPOINT create_customer_profile;
2239
2240 -- Check if API is called in debug mode. If yes, enable debug.
2241 --enable_debug;
2242
2243 -- Debug info.
2244 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2245 hz_utility_v2pub.debug(p_message=>'create_customer_profile (+)',
2246 p_prefix=>l_debug_prefix,
2247 p_msg_level=>fnd_log.level_procedure);
2248 END IF;
2249
2250 -- Initialize message list if p_init_msg_list is set to TRUE.
2251 IF FND_API.to_Boolean(p_init_msg_list) THEN
2252 FND_MSG_PUB.initialize;
2253 END IF;
2254
2255 -- Initialize API return status to success.
2256 x_return_status := FND_API.G_RET_STS_SUCCESS;
2257
2258 -- Call to business logic.
2259 do_create_customer_profile (
2260 l_customer_profile_rec,
2261 p_create_profile_amt,
2262 x_cust_account_profile_id,
2263 x_return_status );
2264
2265 IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
2266 IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('Y', 'EVENTS_ENABLED')) THEN
2267 -- Invoke business event system.
2268 HZ_BUSINESS_EVENT_V2PVT.create_customer_profile_event (
2269 l_customer_profile_rec,
2270 p_create_profile_amt );
2271 END IF;
2272
2273 IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('EVENTS_ENABLED', 'BO_EVENTS_ENABLED')) THEN
2274 HZ_POPULATE_BOT_PKG.pop_hz_customer_profiles(
2275 p_operation => 'I',
2276 p_cust_account_profile_id => x_cust_account_profile_id);
2277 END IF;
2278 END IF;
2279
2280 -- Standard call to get message count and if count is 1, get message info.
2284 p_data => x_msg_data );
2281 FND_MSG_PUB.Count_And_Get(
2282 p_encoded => FND_API.G_FALSE,
2283 p_count => x_msg_count,
2285
2286 -- Debug info.
2287 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
2288 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2289 p_msg_data=>x_msg_data,
2290 p_msg_type=>'WARNING',
2291 p_msg_level=>fnd_log.level_exception);
2292 END IF;
2293 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2294 hz_utility_v2pub.debug(p_message=>'create_customer_profile (-)',
2295 p_prefix=>l_debug_prefix,
2296 p_msg_level=>fnd_log.level_procedure);
2297 END IF;
2298
2299 -- Check if API is called in debug mode. If yes, disable debug.
2300 --disable_debug;
2301
2302 EXCEPTION
2303 WHEN FND_API.G_EXC_ERROR THEN
2304 ROLLBACK TO create_customer_profile;
2305 x_return_status := FND_API.G_RET_STS_ERROR;
2306
2307 FND_MSG_PUB.Count_And_Get(
2308 p_encoded => FND_API.G_FALSE,
2309 p_count => x_msg_count,
2310 p_data => x_msg_data );
2311
2312 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
2313 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2314 p_msg_data=>x_msg_data,
2315 p_msg_type=>'ERROR',
2316 p_msg_level=>fnd_log.level_error);
2317 END IF;
2318 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2319 hz_utility_v2pub.debug(p_message=>'create_customer_profile (-)',
2320 p_prefix=>l_debug_prefix,
2321 p_msg_level=>fnd_log.level_procedure);
2322 END IF;
2323
2324 -- Check if API is called in debug mode. If yes, disable debug.
2325 --disable_debug;
2326
2327 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2328 ROLLBACK TO create_customer_profile;
2329 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2330
2331 FND_MSG_PUB.Count_And_Get(
2332 p_encoded => FND_API.G_FALSE,
2333 p_count => x_msg_count,
2334 p_data => x_msg_data );
2335
2336 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
2337 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2338 p_msg_data=>x_msg_data,
2339 p_msg_type=>'UNEXPECTED ERROR',
2340 p_msg_level=>fnd_log.level_error);
2341 END IF;
2342 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2343 hz_utility_v2pub.debug(p_message=>'create_customer_profile (-)',
2344 p_prefix=>l_debug_prefix,
2345 p_msg_level=>fnd_log.level_procedure);
2346 END IF;
2347
2348 -- Check if API is called in debug mode. If yes, disable debug.
2349 --disable_debug;
2350
2351 WHEN OTHERS THEN
2352 ROLLBACK TO create_customer_profile;
2353 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2354
2355 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
2356 FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
2357 FND_MSG_PUB.ADD;
2358
2359 FND_MSG_PUB.Count_And_Get(
2360 p_encoded => FND_API.G_FALSE,
2361 p_count => x_msg_count,
2362 p_data => x_msg_data );
2363
2364 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
2365 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2366 p_msg_data=>x_msg_data,
2367 p_msg_type=>'SQL ERROR',
2368 p_msg_level=>fnd_log.level_error);
2369 END IF;
2370 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2371 hz_utility_v2pub.debug(p_message=>'create_customer_profile (-)',
2372 p_prefix=>l_debug_prefix,
2373 p_msg_level=>fnd_log.level_procedure);
2374 END IF;
2375
2376 -- Check if API is called in debug mode. If yes, disable debug.
2377 --disable_debug;
2378
2379 END create_customer_profile;
2380
2381 /**
2382 * PROCEDURE update_customer_profile
2383 *
2384 * DESCRIPTION
2385 * Updates customer profile.
2386 *
2387 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
2388 * HZ_BUSINESS_EVENT_V2PVT.update_customer_profile_event
2389 *
2390 * ARGUMENTS
2391 * IN:
2392 * p_init_msg_list Initialize message stack if it is set to
2393 * FND_API.G_TRUE. Default is FND_API.G_FALSE.
2394 * p_customer_profile_rec Customer profile record. One customer account
2395 * must have a customer profile. One account site
2396 * use can optionally have one customer profile.
2397 * IN/OUT:
2398 * p_object_version_number Used for locking the being updated record.
2399 * OUT:
2400 * x_return_status Return status after the call. The status can
2404 * x_msg_count Number of messages in message stack.
2401 * be FND_API.G_RET_STS_SUCCESS (success),
2402 * FND_API.G_RET_STS_ERROR (error),
2403 * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2405 * x_msg_data Message text if x_msg_count is 1.
2406 *
2407 * NOTES
2408 *
2409 * MODIFICATION HISTORY
2410 *
2411 * 07-23-2001 Jianying Huang o Created.
2412 *
2413 */
2414
2415 PROCEDURE update_customer_profile (
2416 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
2417 p_customer_profile_rec IN CUSTOMER_PROFILE_REC_TYPE,
2418 p_object_version_number IN OUT NOCOPY NUMBER,
2419 x_return_status OUT NOCOPY VARCHAR2,
2420 x_msg_count OUT NOCOPY NUMBER,
2421 x_msg_data OUT NOCOPY VARCHAR2
2422 ) IS
2423
2424 l_customer_profile_rec CUSTOMER_PROFILE_REC_TYPE := p_customer_profile_rec;
2425 l_old_customer_profile_rec CUSTOMER_PROFILE_REC_TYPE ;
2426 l_debug_prefix VARCHAR2(30) := '';
2427
2428 BEGIN
2429
2430 -- Standard start of API savepoint
2431 SAVEPOINT update_customer_profile;
2432
2433 -- Check if API is called in debug mode. If yes, enable debug.
2434 --enable_debug;
2435
2436 -- Debug info.
2437 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2438 hz_utility_v2pub.debug(p_message=>'update_customer_profile (+)',
2439 p_prefix=>l_debug_prefix,
2440 p_msg_level=>fnd_log.level_procedure);
2441 END IF;
2442
2443 -- Initialize message list if p_init_msg_list is set to TRUE.
2444 IF FND_API.to_Boolean(p_init_msg_list) THEN
2445 FND_MSG_PUB.initialize;
2446 END IF;
2447
2448 -- Initialize API return status to success.
2449 x_return_status := FND_API.G_RET_STS_SUCCESS;
2450
2451 --2290537
2452 get_customer_profile_rec (
2453 p_cust_account_profile_id => p_customer_profile_rec.cust_account_profile_id,
2454 x_customer_profile_rec => l_old_customer_profile_rec,
2455 x_return_status => x_return_status,
2456 x_msg_count => x_msg_count,
2457 x_msg_data => x_msg_data);
2458
2459 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
2460 RAISE FND_API.G_EXC_ERROR;
2461 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
2462 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2463 END IF;
2464
2465 -- Call to business logic.
2466 do_update_customer_profile (
2467 l_customer_profile_rec,
2468 p_object_version_number,
2469 x_return_status );
2470
2471 IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
2472 IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('Y', 'EVENTS_ENABLED')) THEN
2473 -- Invoke business event system.
2474 HZ_BUSINESS_EVENT_V2PVT.update_customer_profile_event (
2475 l_customer_profile_rec , l_old_customer_profile_rec);
2476 END IF;
2477
2478 IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('EVENTS_ENABLED', 'BO_EVENTS_ENABLED')) THEN
2479 HZ_POPULATE_BOT_PKG.pop_hz_customer_profiles(
2480 p_operation => 'U',
2481 p_cust_account_profile_id => l_customer_profile_rec.cust_account_profile_id);
2482 END IF;
2483 END IF;
2484
2485 -- Standard call to get message count and if count is 1, get message info.
2486 FND_MSG_PUB.Count_And_Get(
2487 p_encoded => FND_API.G_FALSE,
2488 p_count => x_msg_count,
2489 p_data => x_msg_data );
2490
2491 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
2492 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2493 p_msg_data=>x_msg_data,
2494 p_msg_type=>'WARNING',
2495 p_msg_level=>fnd_log.level_exception);
2496 END IF;
2497 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2498 hz_utility_v2pub.debug(p_message=>'update_customer_profile (-)',
2499 p_prefix=>l_debug_prefix,
2500 p_msg_level=>fnd_log.level_procedure);
2501 END IF;
2502
2503 -- Check if API is called in debug mode. If yes, disable debug.
2504 --disable_debug;
2505
2506 EXCEPTION
2507 WHEN FND_API.G_EXC_ERROR THEN
2508 ROLLBACK TO update_customer_profile;
2509 x_return_status := FND_API.G_RET_STS_ERROR;
2510
2511 FND_MSG_PUB.Count_And_Get(
2512 p_encoded => FND_API.G_FALSE,
2513 p_count => x_msg_count,
2514 p_data => x_msg_data );
2515
2516 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
2517 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2518 p_msg_data=>x_msg_data,
2519 p_msg_type=>'ERROR',
2520 p_msg_level=>fnd_log.level_error);
2521 END IF;
2522 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2526 END IF;
2523 hz_utility_v2pub.debug(p_message=>'update_customer_profile (-)',
2524 p_prefix=>l_debug_prefix,
2525 p_msg_level=>fnd_log.level_procedure);
2527
2528 -- Check if API is called in debug mode. If yes, disable debug.
2529 --disable_debug;
2530
2531 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2532 ROLLBACK TO update_customer_profile;
2533 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2534
2535 FND_MSG_PUB.Count_And_Get(
2536 p_encoded => FND_API.G_FALSE,
2537 p_count => x_msg_count,
2538 p_data => x_msg_data );
2539
2540 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
2541 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2542 p_msg_data=>x_msg_data,
2543 p_msg_type=>'UNEXPECTED ERROR',
2544 p_msg_level=>fnd_log.level_error);
2545 END IF;
2546 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2547 hz_utility_v2pub.debug(p_message=>'update_customer_profile (-)',
2548 p_prefix=>l_debug_prefix,
2549 p_msg_level=>fnd_log.level_procedure);
2550 END IF;
2551
2552 -- Check if API is called in debug mode. If yes, disable debug.
2553 --disable_debug;
2554
2555 WHEN OTHERS THEN
2556 ROLLBACK TO update_customer_profile;
2557 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2558
2559 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
2560 FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
2561 FND_MSG_PUB.ADD;
2562
2563 FND_MSG_PUB.Count_And_Get(
2564 p_encoded => FND_API.G_FALSE,
2565 p_count => x_msg_count,
2566 p_data => x_msg_data );
2567
2568 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
2569 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2570 p_msg_data=>x_msg_data,
2571 p_msg_type=>'SQL ERROR',
2572 p_msg_level=>fnd_log.level_error);
2573 END IF;
2574 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2575 hz_utility_v2pub.debug(p_message=>'update_customer_profile (-)',
2576 p_prefix=>l_debug_prefix,
2577 p_msg_level=>fnd_log.level_procedure);
2578 END IF;
2579
2580 -- Check if API is called in debug mode. If yes, disable debug.
2581 --disable_debug;
2582
2583 END update_customer_profile;
2584
2585 /**
2586 * PROCEDURE get_customer_profile_rec
2587 *
2588 * DESCRIPTION
2589 * Gets customer profile record
2590 *
2591 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
2592 * HZ_CUSTOMER_PROFILES_PKG.Select_Row
2593 *
2594 * ARGUMENTS
2595 * IN:
2596 * p_init_msg_list Initialize message stack if it is set to
2597 * FND_API.G_TRUE. Default is FND_API.G_FALSE.
2598 * p_cust_account_profile_id Customer account profile id.
2599 * IN/OUT:
2600 * OUT:
2601 * x_customer_profile_rec Returned customer profile record.
2602 * x_return_status Return status after the call. The status can
2603 * be FND_API.G_RET_STS_SUCCESS (success),
2604 * FND_API.G_RET_STS_ERROR (error),
2605 * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2606 * x_msg_count Number of messages in message stack.
2607 * x_msg_data Message text if x_msg_count is 1.
2608 *
2609 * NOTES
2610 *
2611 * MODIFICATION HISTORY
2612 *
2613 * 07-23-2001 Jianying Huang o Created.
2614 *
2615 */
2616
2617 PROCEDURE get_customer_profile_rec (
2618 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
2619 p_cust_account_profile_id IN NUMBER,
2620 x_customer_profile_rec OUT NOCOPY CUSTOMER_PROFILE_REC_TYPE,
2621 x_return_status OUT NOCOPY VARCHAR2,
2622 x_msg_count OUT NOCOPY NUMBER,
2623 x_msg_data OUT NOCOPY VARCHAR2
2624 ) IS
2625 l_debug_prefix VARCHAR2(30) := '';
2626 BEGIN
2627
2628 -- Check if API is called in debug mode. If yes, enable debug.
2629 --enable_debug;
2630
2631 -- Debug info.
2632 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2633 hz_utility_v2pub.debug(p_message=>'get_customer_profile_rec (+)',
2634 p_prefix=>l_debug_prefix,
2635 p_msg_level=>fnd_log.level_procedure);
2636 END IF;
2637
2638 -- Initialize message list if p_init_msg_list is set to TRUE.
2639 IF FND_API.to_Boolean(p_init_msg_list) THEN
2640 FND_MSG_PUB.initialize;
2641 END IF;
2642
2643 -- Initialize API return status to success.
2644 x_return_status := FND_API.G_RET_STS_SUCCESS;
2645
2646 -- Check whether primary key has been passed in.
2647 IF p_cust_account_profile_id IS NULL OR
2648 p_cust_account_profile_id = FND_API.G_MISS_NUM THEN
2649 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
2653 END IF;
2650 FND_MESSAGE.SET_TOKEN( 'COLUMN', 'cust_account_profile_id' );
2651 FND_MSG_PUB.ADD;
2652 RAISE FND_API.G_EXC_ERROR;
2654
2655 x_customer_profile_rec.cust_account_profile_id := p_cust_account_profile_id;
2656
2657 -- Debug info.
2658 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2659 hz_utility_v2pub.debug(p_message=>'HZ_CUSTOMER_PROFILES_PKG.Select_Row (+)',
2660 p_prefix=>l_debug_prefix,
2661 p_msg_level=>fnd_log.level_procedure);
2662 END IF;
2663
2664 -- Call table-handler.
2665 HZ_CUSTOMER_PROFILES_PKG.Select_Row (
2666 X_CUST_ACCOUNT_PROFILE_ID => x_customer_profile_rec.cust_account_profile_id,
2667 X_CUST_ACCOUNT_ID => x_customer_profile_rec.cust_account_id,
2668 X_STATUS => x_customer_profile_rec.status,
2669 X_COLLECTOR_ID => x_customer_profile_rec.collector_id,
2670 X_CREDIT_ANALYST_ID => x_customer_profile_rec.credit_analyst_id,
2671 X_CREDIT_CHECKING => x_customer_profile_rec.credit_checking,
2672 X_NEXT_CREDIT_REVIEW_DATE => x_customer_profile_rec.next_credit_review_date,
2673 X_TOLERANCE => x_customer_profile_rec.tolerance,
2674 X_DISCOUNT_TERMS => x_customer_profile_rec.discount_terms,
2675 X_DUNNING_LETTERS => x_customer_profile_rec.dunning_letters,
2676 X_INTEREST_CHARGES => x_customer_profile_rec.interest_charges,
2677 X_SEND_STATEMENTS => x_customer_profile_rec.send_statements,
2678 X_CREDIT_BALANCE_STATEMENTS => x_customer_profile_rec.credit_balance_statements,
2679 X_CREDIT_HOLD => x_customer_profile_rec.credit_hold,
2680 X_PROFILE_CLASS_ID => x_customer_profile_rec.profile_class_id,
2681 X_SITE_USE_ID => x_customer_profile_rec.site_use_id,
2682 X_CREDIT_RATING => x_customer_profile_rec.credit_rating,
2683 X_RISK_CODE => x_customer_profile_rec.risk_code,
2684 X_STANDARD_TERMS => x_customer_profile_rec.standard_terms,
2685 X_OVERRIDE_TERMS => x_customer_profile_rec.override_terms,
2686 X_DUNNING_LETTER_SET_ID => x_customer_profile_rec.dunning_letter_set_id,
2687 X_INTEREST_PERIOD_DAYS => x_customer_profile_rec.interest_period_days,
2688 X_PAYMENT_GRACE_DAYS => x_customer_profile_rec.payment_grace_days,
2689 X_DISCOUNT_GRACE_DAYS => x_customer_profile_rec.discount_grace_days,
2690 X_STATEMENT_CYCLE_ID => x_customer_profile_rec.statement_cycle_id,
2691 X_ACCOUNT_STATUS => x_customer_profile_rec.account_status,
2692 X_PERCENT_COLLECTABLE => x_customer_profile_rec.percent_collectable,
2693 X_AUTOCASH_HIERARCHY_ID => x_customer_profile_rec.autocash_hierarchy_id,
2694 X_ATTRIBUTE_CATEGORY => x_customer_profile_rec.attribute_category,
2695 X_ATTRIBUTE1 => x_customer_profile_rec.attribute1,
2696 X_ATTRIBUTE2 => x_customer_profile_rec.attribute2,
2697 X_ATTRIBUTE3 => x_customer_profile_rec.attribute3,
2698 X_ATTRIBUTE4 => x_customer_profile_rec.attribute4,
2699 X_ATTRIBUTE5 => x_customer_profile_rec.attribute5,
2700 X_ATTRIBUTE6 => x_customer_profile_rec.attribute6,
2701 X_ATTRIBUTE7 => x_customer_profile_rec.attribute7,
2702 X_ATTRIBUTE8 => x_customer_profile_rec.attribute8,
2703 X_ATTRIBUTE9 => x_customer_profile_rec.attribute9,
2704 X_ATTRIBUTE10 => x_customer_profile_rec.attribute10,
2705 X_ATTRIBUTE11 => x_customer_profile_rec.attribute11,
2706 X_ATTRIBUTE12 => x_customer_profile_rec.attribute12,
2707 X_ATTRIBUTE13 => x_customer_profile_rec.attribute13,
2708 X_ATTRIBUTE14 => x_customer_profile_rec.attribute14,
2709 X_ATTRIBUTE15 => x_customer_profile_rec.attribute15,
2710 X_AUTO_REC_INCL_DISPUTED_FLAG => x_customer_profile_rec.auto_rec_incl_disputed_flag,
2711 X_TAX_PRINTING_OPTION => x_customer_profile_rec.tax_printing_option,
2712 X_CHARGE_ON_FINANCE_CHARGE_FG => x_customer_profile_rec.charge_on_finance_charge_flag,
2713 X_GROUPING_RULE_ID => x_customer_profile_rec.grouping_rule_id,
2714 X_CLEARING_DAYS => x_customer_profile_rec.clearing_days,
2715 X_JGZZ_ATTRIBUTE_CATEGORY => x_customer_profile_rec.jgzz_attribute_category,
2716 X_JGZZ_ATTRIBUTE1 => x_customer_profile_rec.jgzz_attribute1,
2717 X_JGZZ_ATTRIBUTE2 => x_customer_profile_rec.jgzz_attribute2,
2718 X_JGZZ_ATTRIBUTE3 => x_customer_profile_rec.jgzz_attribute3,
2719 X_JGZZ_ATTRIBUTE4 => x_customer_profile_rec.jgzz_attribute4,
2720 X_JGZZ_ATTRIBUTE5 => x_customer_profile_rec.jgzz_attribute5,
2721 X_JGZZ_ATTRIBUTE6 => x_customer_profile_rec.jgzz_attribute6,
2725 X_JGZZ_ATTRIBUTE10 => x_customer_profile_rec.jgzz_attribute10,
2722 X_JGZZ_ATTRIBUTE7 => x_customer_profile_rec.jgzz_attribute7,
2723 X_JGZZ_ATTRIBUTE8 => x_customer_profile_rec.jgzz_attribute8,
2724 X_JGZZ_ATTRIBUTE9 => x_customer_profile_rec.jgzz_attribute9,
2726 X_JGZZ_ATTRIBUTE11 => x_customer_profile_rec.jgzz_attribute11,
2727 X_JGZZ_ATTRIBUTE12 => x_customer_profile_rec.jgzz_attribute12,
2728 X_JGZZ_ATTRIBUTE13 => x_customer_profile_rec.jgzz_attribute13,
2729 X_JGZZ_ATTRIBUTE14 => x_customer_profile_rec.jgzz_attribute14,
2730 X_JGZZ_ATTRIBUTE15 => x_customer_profile_rec.jgzz_attribute15,
2731 X_GLOBAL_ATTRIBUTE1 => x_customer_profile_rec.global_attribute1,
2732 X_GLOBAL_ATTRIBUTE2 => x_customer_profile_rec.global_attribute2,
2733 X_GLOBAL_ATTRIBUTE3 => x_customer_profile_rec.global_attribute3,
2734 X_GLOBAL_ATTRIBUTE4 => x_customer_profile_rec.global_attribute4,
2735 X_GLOBAL_ATTRIBUTE5 => x_customer_profile_rec.global_attribute5,
2736 X_GLOBAL_ATTRIBUTE6 => x_customer_profile_rec.global_attribute6,
2737 X_GLOBAL_ATTRIBUTE7 => x_customer_profile_rec.global_attribute7,
2738 X_GLOBAL_ATTRIBUTE8 => x_customer_profile_rec.global_attribute8,
2739 X_GLOBAL_ATTRIBUTE9 => x_customer_profile_rec.global_attribute9,
2740 X_GLOBAL_ATTRIBUTE10 => x_customer_profile_rec.global_attribute10,
2741 X_GLOBAL_ATTRIBUTE11 => x_customer_profile_rec.global_attribute11,
2742 X_GLOBAL_ATTRIBUTE12 => x_customer_profile_rec.global_attribute12,
2743 X_GLOBAL_ATTRIBUTE13 => x_customer_profile_rec.global_attribute13,
2744 X_GLOBAL_ATTRIBUTE14 => x_customer_profile_rec.global_attribute14,
2745 X_GLOBAL_ATTRIBUTE15 => x_customer_profile_rec.global_attribute15,
2746 X_GLOBAL_ATTRIBUTE16 => x_customer_profile_rec.global_attribute16,
2747 X_GLOBAL_ATTRIBUTE17 => x_customer_profile_rec.global_attribute17,
2748 X_GLOBAL_ATTRIBUTE18 => x_customer_profile_rec.global_attribute18,
2749 X_GLOBAL_ATTRIBUTE19 => x_customer_profile_rec.global_attribute19,
2750 X_GLOBAL_ATTRIBUTE20 => x_customer_profile_rec.global_attribute20,
2751 X_GLOBAL_ATTRIBUTE_CATEGORY => x_customer_profile_rec.global_attribute_category,
2752 X_CONS_INV_FLAG => x_customer_profile_rec.cons_inv_flag,
2753 X_CONS_INV_TYPE => x_customer_profile_rec.cons_inv_type,
2754 X_AUTOCASH_HIERARCHY_ID_ADR => x_customer_profile_rec.autocash_hierarchy_id_for_adr,
2755 X_LOCKBOX_MATCHING_OPTION => x_customer_profile_rec.lockbox_matching_option,
2756 X_CREATED_BY_MODULE => x_customer_profile_rec.created_by_module,
2757 X_APPLICATION_ID => x_customer_profile_rec.application_id,
2758 X_review_cycle => x_customer_profile_rec.review_cycle,
2759 X_last_credit_review_date => x_customer_profile_rec.last_credit_review_date,
2760 X_party_id => x_customer_profile_rec.party_id,
2761 X_CREDIT_CLASSIFICATION => x_customer_profile_rec.credit_classification,
2762 X_CONS_BILL_LEVEL => x_customer_profile_rec.cons_bill_level,
2763 X_LATE_CHARGE_CALCULATION_TRX => x_customer_profile_rec.late_charge_calculation_trx,
2764 X_CREDIT_ITEMS_FLAG => x_customer_profile_rec.credit_items_flag,
2765 X_DISPUTED_TRANSACTIONS_FLAG => x_customer_profile_rec.disputed_transactions_flag,
2766 X_LATE_CHARGE_TYPE => x_customer_profile_rec.late_charge_type,
2767 X_LATE_CHARGE_TERM_ID => x_customer_profile_rec.late_charge_term_id,
2768 X_INTEREST_CALCULATION_PERIOD => x_customer_profile_rec.interest_calculation_period,
2769 X_HOLD_CHARGED_INVOICES_FLAG => x_customer_profile_rec.hold_charged_invoices_flag,
2770 X_MESSAGE_TEXT_ID => x_customer_profile_rec.message_text_id,
2771 X_MULTIPLE_INTEREST_RATES_FLAG => x_customer_profile_rec.multiple_interest_rates_flag,
2772 X_CHARGE_BEGIN_DATE => x_customer_profile_rec.charge_begin_date
2773 );
2774
2775 --raji
2776
2777 -- Debug info.
2778 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2779 hz_utility_v2pub.debug(p_message=>'HZ_CUSTOMER_PROFILES_PKG.Select_Row (-)',
2780 p_prefix=>l_debug_prefix,
2781 p_msg_level=>fnd_log.level_procedure);
2782 END IF;
2783
2784 -- Standard call to get message count and if count is 1, get message info.
2785 FND_MSG_PUB.Count_And_Get(
2786 p_encoded => FND_API.G_FALSE,
2787 p_count => x_msg_count,
2788 p_data => x_msg_data );
2789
2790 -- Debug info.
2791 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
2792 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2793 p_msg_data=>x_msg_data,
2794 p_msg_type=>'WARNING',
2795 p_msg_level=>fnd_log.level_exception);
2796 END IF;
2797 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2801 END IF;
2798 hz_utility_v2pub.debug(p_message=>'get_customer_profile_rec (-)',
2799 p_prefix=>l_debug_prefix,
2800 p_msg_level=>fnd_log.level_procedure);
2802
2803 -- Check if API is called in debug mode. If yes, disable debug.
2804 --disable_debug;
2805
2806 EXCEPTION
2807 WHEN FND_API.G_EXC_ERROR THEN
2808 x_return_status := FND_API.G_RET_STS_ERROR;
2809
2810 FND_MSG_PUB.Count_And_Get(
2811 p_encoded => FND_API.G_FALSE,
2812 p_count => x_msg_count,
2813 p_data => x_msg_data );
2814
2815 -- Debug info.
2816 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
2817 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2818 p_msg_data=>x_msg_data,
2819 p_msg_type=>'ERROR',
2820 p_msg_level=>fnd_log.level_error);
2821 END IF;
2822 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2823 hz_utility_v2pub.debug(p_message=>'get_customer_profile_rec (-)',
2824 p_prefix=>l_debug_prefix,
2825 p_msg_level=>fnd_log.level_procedure);
2826 END IF;
2827
2828 -- Check if API is called in debug mode. If yes, disable debug.
2829 --disable_debug;
2830
2831 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2832 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2833
2834 FND_MSG_PUB.Count_And_Get(
2835 p_encoded => FND_API.G_FALSE,
2836 p_count => x_msg_count,
2837 p_data => x_msg_data );
2838
2839 -- Debug info.
2840 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
2841 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2842 p_msg_data=>x_msg_data,
2843 p_msg_type=>'UNEXPECTED ERROR',
2844 p_msg_level=>fnd_log.level_error);
2845 END IF;
2846 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2847 hz_utility_v2pub.debug(p_message=>'get_customer_profile_rec (-)',
2848 p_prefix=>l_debug_prefix,
2849 p_msg_level=>fnd_log.level_procedure);
2850 END IF;
2851
2852 -- Check if API is called in debug mode. If yes, disable debug.
2853 --disable_debug;
2854
2855 WHEN OTHERS THEN
2856 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2857
2858 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
2859 FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
2860 FND_MSG_PUB.ADD;
2861
2862 FND_MSG_PUB.Count_And_Get(
2863 p_encoded => FND_API.G_FALSE,
2864 p_count => x_msg_count,
2865 p_data => x_msg_data );
2866
2867 -- Debug info.
2868 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
2869 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2870 p_msg_data=>x_msg_data,
2871 p_msg_type=>'SQL ERROR',
2872 p_msg_level=>fnd_log.level_error);
2873 END IF;
2874 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2875 hz_utility_v2pub.debug(p_message=>'get_customer_profile_rec (-)',
2876 p_prefix=>l_debug_prefix,
2877 p_msg_level=>fnd_log.level_procedure);
2878 END IF;
2879
2880 -- Check if API is called in debug mode. If yes, disable debug.
2881 --disable_debug;
2882
2883 END get_customer_profile_rec;
2884
2885 /**
2886 * PROCEDURE create_cust_profile_amt
2887 *
2888 * DESCRIPTION
2889 * Creates customer profile amounts.
2890 *
2891 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
2892 * HZ_BUSINESS_EVENT_V2PVT.create_cust_profile_amt_event
2893 *
2894 * ARGUMENTS
2895 * IN:
2896 * p_init_msg_list Initialize message stack if it is set to
2897 * FND_API.G_TRUE. Default is FND_API.G_FALSE.
2898 * p_check_foreign_key If do foreign key checking on cust_account_id
2899 * and cust_account_profile_id or not. Defaut value
2900 * is FND_API.G_TRUE, which means API will do foreign
2901 * key checking on these 2 columns.
2902 * p_cust_profile_amt_rec Customer profile amount record.
2903 * IN/OUT:
2904 * OUT:
2905 * x_cust_acct_profile_amt_id Customer account profile amount ID.
2906 * x_return_status Return status after the call. The status can
2907 * be FND_API.G_RET_STS_SUCCESS (success),
2908 * FND_API.G_RET_STS_ERROR (error),
2909 * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2910 * x_msg_count Number of messages in message stack.
2911 * x_msg_data Message text if x_msg_count is 1.
2912 *
2913 * NOTES
2914 *
2915 * MODIFICATION HISTORY
2916 *
2917 * 07-23-2001 Jianying Huang o Created.
2918 *
2919 */
2920
2921
2925 p_cust_profile_amt_rec IN CUST_PROFILE_AMT_REC_TYPE,
2922 PROCEDURE create_cust_profile_amt (
2923 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
2924 p_check_foreign_key IN VARCHAR2 := FND_API.G_TRUE,
2926 x_cust_acct_profile_amt_id OUT NOCOPY NUMBER,
2927 x_return_status OUT NOCOPY VARCHAR2,
2928 x_msg_count OUT NOCOPY NUMBER,
2929 x_msg_data OUT NOCOPY VARCHAR2
2930 ) IS
2931
2932 l_cust_profile_amt_rec CUST_PROFILE_AMT_REC_TYPE := p_cust_profile_amt_rec;
2933 l_debug_prefix VARCHAR2(30) := '';
2934
2935 BEGIN
2936
2937 -- Standard start of API savepoint
2938 SAVEPOINT create_cust_profile_amt;
2939
2940 -- Check if API is called in debug mode. If yes, enable debug.
2941 --enable_debug;
2942
2943 -- Debug info.
2944 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2945 hz_utility_v2pub.debug(p_message=>'create_cust_profile_amt (+)',
2946 p_prefix=>l_debug_prefix,
2947 p_msg_level=>fnd_log.level_procedure);
2948 END IF;
2949
2950 -- Initialize message list if p_init_msg_list is set to TRUE.
2951 IF FND_API.to_Boolean(p_init_msg_list) THEN
2952 FND_MSG_PUB.initialize;
2953 END IF;
2954
2955 -- Initialize API return status to success.
2956 x_return_status := FND_API.G_RET_STS_SUCCESS;
2957
2958 -- Call to business logic.
2959 do_create_cust_profile_amt (
2960 p_check_foreign_key,
2961 l_cust_profile_amt_rec,
2962 x_cust_acct_profile_amt_id,
2963 x_return_status );
2964
2965 IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
2966 IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('Y', 'EVENTS_ENABLED')) THEN
2967 -- Invoke business event system.
2968 HZ_BUSINESS_EVENT_V2PVT.create_cust_profile_amt_event (
2969 l_cust_profile_amt_rec );
2970 END IF;
2971
2972 IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('EVENTS_ENABLED', 'BO_EVENTS_ENABLED')) THEN
2973 HZ_POPULATE_BOT_PKG.pop_hz_cust_profile_amts(
2974 p_operation => 'I',
2975 p_cust_acct_profile_amt_id => x_cust_acct_profile_amt_id);
2976 END IF;
2977 END IF;
2978
2979 -- Standard call to get message count and if count is 1, get message info.
2980 FND_MSG_PUB.Count_And_Get(
2981 p_encoded => FND_API.G_FALSE,
2982 p_count => x_msg_count,
2983 p_data => x_msg_data );
2984
2985 -- Debug info.
2986 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
2987 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2988 p_msg_data=>x_msg_data,
2989 p_msg_type=>'WARNING',
2990 p_msg_level=>fnd_log.level_exception);
2991 END IF;
2992 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2993 hz_utility_v2pub.debug(p_message=>'create_cust_profile_amt (-)',
2994 p_prefix=>l_debug_prefix,
2995 p_msg_level=>fnd_log.level_procedure);
2996 END IF;
2997
2998 -- Check if API is called in debug mode. If yes, disable debug.
2999 --disable_debug;
3000
3001 EXCEPTION
3002 WHEN FND_API.G_EXC_ERROR THEN
3003 ROLLBACK TO create_cust_profile_amt;
3004 x_return_status := FND_API.G_RET_STS_ERROR;
3005
3006 FND_MSG_PUB.Count_And_Get(
3007 p_encoded => FND_API.G_FALSE,
3008 p_count => x_msg_count,
3009 p_data => x_msg_data );
3010
3011 -- Debug info.
3012 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
3013 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
3014 p_msg_data=>x_msg_data,
3015 p_msg_type=>'ERROR',
3016 p_msg_level=>fnd_log.level_error);
3017 END IF;
3018 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3019 hz_utility_v2pub.debug(p_message=>'create_cust_profile_amt (-)',
3020 p_prefix=>l_debug_prefix,
3021 p_msg_level=>fnd_log.level_procedure);
3022 END IF;
3023
3024 -- Check if API is called in debug mode. If yes, disable debug.
3025 --disable_debug;
3026
3027 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3028 ROLLBACK TO create_cust_profile_amt;
3029 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3030
3031 FND_MSG_PUB.Count_And_Get(
3032 p_encoded => FND_API.G_FALSE,
3033 p_count => x_msg_count,
3034 p_data => x_msg_data );
3035
3036 -- Debug info.
3037 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
3038 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
3039 p_msg_data=>x_msg_data,
3040 p_msg_type=>'UNEXPECTED ERROR',
3041 p_msg_level=>fnd_log.level_error);
3042 END IF;
3043 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3044 hz_utility_v2pub.debug(p_message=>'create_cust_profile_amt (-)',
3045 p_prefix=>l_debug_prefix,
3049 -- Check if API is called in debug mode. If yes, disable debug.
3046 p_msg_level=>fnd_log.level_procedure);
3047 END IF;
3048
3050 --disable_debug;
3051
3052 WHEN OTHERS THEN
3053 ROLLBACK TO create_cust_profile_amt;
3054 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3055
3056 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
3057 FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
3058 FND_MSG_PUB.ADD;
3059
3060 FND_MSG_PUB.Count_And_Get(
3061 p_encoded => FND_API.G_FALSE,
3062 p_count => x_msg_count,
3063 p_data => x_msg_data );
3064
3065 -- Debug info.
3066 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
3067 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
3068 p_msg_data=>x_msg_data,
3069 p_msg_type=>'SQL ERROR',
3070 p_msg_level=>fnd_log.level_error);
3071 END IF;
3072 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3073 hz_utility_v2pub.debug(p_message=>'create_cust_profile_amt (-)',
3074 p_prefix=>l_debug_prefix,
3075 p_msg_level=>fnd_log.level_procedure);
3076 END IF;
3077
3078 -- Check if API is called in debug mode. If yes, disable debug.
3079 --disable_debug;
3080
3081 END create_cust_profile_amt;
3082
3083
3084 /**
3085 * PROCEDURE update_cust_profile_amt
3086 *
3087 * DESCRIPTION
3088 * Updates customer profile amounts.
3089 *
3090 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
3091 * HZ_BUSINESS_EVENT_V2PVT.update_cust_profile_amt_event
3092 *
3093 * ARGUMENTS
3094 * IN:
3095 * p_init_msg_list Initialize message stack if it is set to
3096 * FND_API.G_TRUE. Default is FND_API.G_FALSE.
3097 * p_cust_profile_amt_rec Customer profile amount record.
3098 * IN/OUT:
3099 * p_object_version_number Used for locking the being updated record.
3100 * OUT:
3101 * x_return_status Return status after the call. The status can
3102 * be FND_API.G_RET_STS_SUCCESS (success),
3103 * FND_API.G_RET_STS_ERROR (error),
3104 * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3105 * x_msg_count Number of messages in message stack.
3106 * x_msg_data Message text if x_msg_count is 1.
3107 *
3108 * NOTES
3109 *
3110 * MODIFICATION HISTORY
3111 *
3112 * 07-23-2001 Jianying Huang o Created.
3113 *
3114 */
3115
3116 PROCEDURE update_cust_profile_amt (
3117 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
3118 p_cust_profile_amt_rec IN CUST_PROFILE_AMT_REC_TYPE,
3119 p_object_version_number IN OUT NOCOPY NUMBER,
3120 x_return_status OUT NOCOPY VARCHAR2,
3121 x_msg_count OUT NOCOPY NUMBER,
3122 x_msg_data OUT NOCOPY VARCHAR2
3123 ) IS
3124
3125 l_cust_profile_amt_rec CUST_PROFILE_AMT_REC_TYPE := p_cust_profile_amt_rec;
3126 l_old_cust_profile_amt_rec CUST_PROFILE_AMT_REC_TYPE;
3127 l_debug_prefix VARCHAR2(30) := '';
3128
3129 BEGIN
3130
3131 -- Standard start of API savepoint
3132 SAVEPOINT update_cust_profile_amt;
3133
3134 -- Check if API is called in debug mode. If yes, enable debug.
3135 --enable_debug;
3136
3137 -- Debug info.
3138 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3139 hz_utility_v2pub.debug(p_message=>'update_cust_profile_amt (+)',
3140 p_prefix=>l_debug_prefix,
3141 p_msg_level=>fnd_log.level_procedure);
3142 END IF;
3143
3144 -- Initialize message list if p_init_msg_list is set to TRUE.
3145 IF FND_API.to_Boolean(p_init_msg_list) THEN
3146 FND_MSG_PUB.initialize;
3147 END IF;
3148
3149 -- Initialize API return status to success.
3150 x_return_status := FND_API.G_RET_STS_SUCCESS;
3151
3152 --2290537
3153 get_cust_profile_amt_rec (
3154 p_cust_acct_profile_amt_id => p_cust_profile_amt_rec.cust_acct_profile_amt_id,
3155 x_cust_profile_amt_rec => l_old_cust_profile_amt_rec,
3156 x_return_status => x_return_status,
3157 x_msg_count => x_msg_count,
3158 x_msg_data => x_msg_data);
3159
3160 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
3161 RAISE FND_API.G_EXC_ERROR;
3162 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
3163 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3164 END IF;
3165
3166 -- Call to business logic.
3167 do_update_cust_profile_amt (
3168 l_cust_profile_amt_rec,
3169 p_object_version_number,
3170 x_return_status );
3171
3172 IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
3173 IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('Y', 'EVENTS_ENABLED')) THEN
3177 END IF;
3174 -- Invoke business event system.
3175 HZ_BUSINESS_EVENT_V2PVT.update_cust_profile_amt_event (
3176 l_cust_profile_amt_rec , l_old_cust_profile_amt_rec );
3178
3179 IF(HZ_UTILITY_V2PUB.G_EXECUTE_API_CALLOUTS in ('EVENTS_ENABLED', 'BO_EVENTS_ENABLED')) THEN
3180 HZ_POPULATE_BOT_PKG.pop_hz_cust_profile_amts(
3181 p_operation => 'U',
3182 p_cust_acct_profile_amt_id => l_cust_profile_amt_rec.cust_acct_profile_amt_id);
3183 END IF;
3184 END IF;
3185
3186 -- Standard call to get message count and if count is 1, get message info.
3187 FND_MSG_PUB.Count_And_Get(
3188 p_encoded => FND_API.G_FALSE,
3189 p_count => x_msg_count,
3190 p_data => x_msg_data );
3191
3192 -- Debug info.
3193 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
3194 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
3195 p_msg_data=>x_msg_data,
3196 p_msg_type=>'WARNING',
3197 p_msg_level=>fnd_log.level_exception);
3198 END IF;
3199 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3200 hz_utility_v2pub.debug(p_message=>'update_cust_profile_amt (-)',
3201 p_prefix=>l_debug_prefix,
3202 p_msg_level=>fnd_log.level_procedure);
3203 END IF;
3204
3205
3206 -- Check if API is called in debug mode. If yes, disable debug.
3207 --disable_debug;
3208
3209 EXCEPTION
3210 WHEN FND_API.G_EXC_ERROR THEN
3211 ROLLBACK TO update_cust_profile_amt;
3212 x_return_status := FND_API.G_RET_STS_ERROR;
3213
3214 FND_MSG_PUB.Count_And_Get(
3215 p_encoded => FND_API.G_FALSE,
3216 p_count => x_msg_count,
3217 p_data => x_msg_data );
3218
3219 -- Debug info.
3220 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
3221 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
3222 p_msg_data=>x_msg_data,
3223 p_msg_type=>'ERROR',
3224 p_msg_level=>fnd_log.level_error);
3225 END IF;
3226 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3227 hz_utility_v2pub.debug(p_message=>'update_cust_profile_amt (-)',
3228 p_prefix=>l_debug_prefix,
3229 p_msg_level=>fnd_log.level_procedure);
3230 END IF;
3231
3232 -- Check if API is called in debug mode. If yes, disable debug.
3233 --disable_debug;
3234
3235 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3236 ROLLBACK TO update_cust_profile_amt;
3237 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3238
3239 FND_MSG_PUB.Count_And_Get(
3240 p_encoded => FND_API.G_FALSE,
3241 p_count => x_msg_count,
3242 p_data => x_msg_data );
3243
3244 -- Debug info.
3245 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
3246 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
3247 p_msg_data=>x_msg_data,
3248 p_msg_type=>'UNEXPECTED ERROR',
3249 p_msg_level=>fnd_log.level_error);
3250 END IF;
3251 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3252 hz_utility_v2pub.debug(p_message=>'update_cust_profile_amt (-)',
3253 p_prefix=>l_debug_prefix,
3254 p_msg_level=>fnd_log.level_procedure);
3255 END IF;
3256
3257 -- Check if API is called in debug mode. If yes, disable debug.
3258 --disable_debug;
3259
3260 WHEN OTHERS THEN
3261 ROLLBACK TO update_cust_profile_amt;
3262 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3263
3264 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
3265 FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
3266 FND_MSG_PUB.ADD;
3267
3268 FND_MSG_PUB.Count_And_Get(
3269 p_encoded => FND_API.G_FALSE,
3270 p_count => x_msg_count,
3271 p_data => x_msg_data );
3272
3273 -- Debug info.
3274 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
3275 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
3276 p_msg_data=>x_msg_data,
3277 p_msg_type=>'SQL ERROR',
3278 p_msg_level=>fnd_log.level_error);
3279 END IF;
3280 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3281 hz_utility_v2pub.debug(p_message=>'update_cust_profile_amt (-)',
3282 p_prefix=>l_debug_prefix,
3283 p_msg_level=>fnd_log.level_procedure);
3284 END IF;
3285
3286 -- Check if API is called in debug mode. If yes, disable debug.
3287 --disable_debug;
3288
3289 END update_cust_profile_amt;
3290
3291 /**
3292 * PROCEDURE get_cust_profile_amt_rec
3293 *
3294 * DESCRIPTION
3295 * Gets customer profile amount record
3296 *
3297 * EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
3298 * HZ_CUST_PROFILE_AMTS_PKG.Select_Row
3299 *
3300 * ARGUMENTS
3301 * IN:
3302 * p_init_msg_list Initialize message stack if it is set to
3303 * FND_API.G_TRUE. Default is FND_API.G_FALSE.
3304 * p_cust_acct_profile_amt_id Customer account profile amount id.
3305 * IN/OUT:
3306 * OUT:
3307 * x_cust_profile_amt_rec Returned customer profile amount record.
3308 * x_return_status Return status after the call. The status can
3309 * be FND_API.G_RET_STS_SUCCESS (success),
3310 * FND_API.G_RET_STS_ERROR (error),
3311 * FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
3312 * x_msg_count Number of messages in message stack.
3313 * x_msg_data Message text if x_msg_count is 1.
3314 *
3315 * NOTES
3316 *
3317 * MODIFICATION HISTORY
3318 *
3319 * 07-23-2001 Jianying Huang o Created.
3320 *
3321 */
3322
3323 PROCEDURE get_cust_profile_amt_rec (
3324 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
3325 p_cust_acct_profile_amt_id IN NUMBER,
3326 x_cust_profile_amt_rec OUT NOCOPY CUST_PROFILE_AMT_REC_TYPE,
3327 x_return_status OUT NOCOPY VARCHAR2,
3328 x_msg_count OUT NOCOPY NUMBER,
3329 x_msg_data OUT NOCOPY VARCHAR2
3330 ) IS
3331 l_debug_prefix VARCHAR2(30) := '';
3332 BEGIN
3333
3334 -- Check if API is called in debug mode. If yes, enable debug.
3335 --enable_debug;
3336
3337 -- Debug info.
3338 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3339 hz_utility_v2pub.debug(p_message=>'get_cust_profile_amt_rec (+)',
3340 p_prefix=>l_debug_prefix,
3341 p_msg_level=>fnd_log.level_procedure);
3342 END IF;
3343
3344 -- Initialize message list if p_init_msg_list is set to TRUE.
3345 IF FND_API.to_Boolean(p_init_msg_list) THEN
3346 FND_MSG_PUB.initialize;
3347 END IF;
3348
3349 -- Initialize API return status to success.
3350 x_return_status := FND_API.G_RET_STS_SUCCESS;
3351
3352 -- Check whether primary key has been passed in.
3353 IF p_cust_acct_profile_amt_id IS NULL OR
3354 p_cust_acct_profile_amt_id = FND_API.G_MISS_NUM THEN
3355 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_MISSING_COLUMN' );
3356 FND_MESSAGE.SET_TOKEN( 'COLUMN', 'cust_acct_profile_amt_id' );
3357 FND_MSG_PUB.ADD;
3358 RAISE FND_API.G_EXC_ERROR;
3359 END IF;
3360
3361 x_cust_profile_amt_rec.cust_acct_profile_amt_id := p_cust_acct_profile_amt_id;
3362
3363 -- Debug info.
3364 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3365 hz_utility_v2pub.debug(p_message=>'HZ_CUST_PROFILE_AMTS_PKG.Select_Row (+)',
3366 p_prefix=>l_debug_prefix,
3367 p_msg_level=>fnd_log.level_procedure);
3368 END IF;
3369
3370 -- Call table-handler.
3371 HZ_CUST_PROFILE_AMTS_PKG.Select_Row (
3372 X_CUST_ACCT_PROFILE_AMT_ID => x_cust_profile_amt_rec.cust_acct_profile_amt_id,
3373 X_CUST_ACCOUNT_PROFILE_ID => x_cust_profile_amt_rec.cust_account_profile_id,
3374 X_CURRENCY_CODE => x_cust_profile_amt_rec.currency_code,
3375 X_TRX_CREDIT_LIMIT => x_cust_profile_amt_rec.trx_credit_limit,
3376 X_OVERALL_CREDIT_LIMIT => x_cust_profile_amt_rec.overall_credit_limit,
3377 X_MIN_DUNNING_AMOUNT => x_cust_profile_amt_rec.min_dunning_amount,
3378 X_MIN_DUNNING_INVOICE_AMOUNT => x_cust_profile_amt_rec.min_dunning_invoice_amount,
3379 X_MAX_INTEREST_CHARGE => x_cust_profile_amt_rec.max_interest_charge,
3380 X_MIN_STATEMENT_AMOUNT => x_cust_profile_amt_rec.min_statement_amount,
3381 X_AUTO_REC_MIN_RECEIPT_AMOUNT => x_cust_profile_amt_rec.auto_rec_min_receipt_amount,
3382 X_INTEREST_RATE => x_cust_profile_amt_rec.interest_rate,
3383 X_ATTRIBUTE_CATEGORY => x_cust_profile_amt_rec.attribute_category,
3384 X_ATTRIBUTE1 => x_cust_profile_amt_rec.attribute1,
3385 X_ATTRIBUTE2 => x_cust_profile_amt_rec.attribute2,
3386 X_ATTRIBUTE3 => x_cust_profile_amt_rec.attribute3,
3387 X_ATTRIBUTE4 => x_cust_profile_amt_rec.attribute4,
3388 X_ATTRIBUTE5 => x_cust_profile_amt_rec.attribute5,
3389 X_ATTRIBUTE6 => x_cust_profile_amt_rec.attribute6,
3390 X_ATTRIBUTE7 => x_cust_profile_amt_rec.attribute7,
3391 X_ATTRIBUTE8 => x_cust_profile_amt_rec.attribute8,
3392 X_ATTRIBUTE9 => x_cust_profile_amt_rec.attribute9,
3393 X_ATTRIBUTE10 => x_cust_profile_amt_rec.attribute10,
3394 X_ATTRIBUTE11 => x_cust_profile_amt_rec.attribute11,
3398 X_ATTRIBUTE15 => x_cust_profile_amt_rec.attribute15,
3395 X_ATTRIBUTE12 => x_cust_profile_amt_rec.attribute12,
3396 X_ATTRIBUTE13 => x_cust_profile_amt_rec.attribute13,
3397 X_ATTRIBUTE14 => x_cust_profile_amt_rec.attribute14,
3399 X_MIN_FC_BALANCE_AMOUNT => x_cust_profile_amt_rec.min_fc_balance_amount,
3400 X_MIN_FC_INVOICE_AMOUNT => x_cust_profile_amt_rec.min_fc_invoice_amount,
3401 X_CUST_ACCOUNT_ID => x_cust_profile_amt_rec.cust_account_id,
3402 X_SITE_USE_ID => x_cust_profile_amt_rec.site_use_id,
3403 X_EXPIRATION_DATE => x_cust_profile_amt_rec.expiration_date,
3404 X_JGZZ_ATTRIBUTE_CATEGORY => x_cust_profile_amt_rec.jgzz_attribute_category,
3405 X_JGZZ_ATTRIBUTE1 => x_cust_profile_amt_rec.jgzz_attribute1,
3406 X_JGZZ_ATTRIBUTE2 => x_cust_profile_amt_rec.jgzz_attribute2,
3407 X_JGZZ_ATTRIBUTE3 => x_cust_profile_amt_rec.jgzz_attribute3,
3408 X_JGZZ_ATTRIBUTE4 => x_cust_profile_amt_rec.jgzz_attribute4,
3409 X_JGZZ_ATTRIBUTE5 => x_cust_profile_amt_rec.jgzz_attribute5,
3410 X_JGZZ_ATTRIBUTE6 => x_cust_profile_amt_rec.jgzz_attribute6,
3411 X_JGZZ_ATTRIBUTE7 => x_cust_profile_amt_rec.jgzz_attribute7,
3412 X_JGZZ_ATTRIBUTE8 => x_cust_profile_amt_rec.jgzz_attribute8,
3413 X_JGZZ_ATTRIBUTE9 => x_cust_profile_amt_rec.jgzz_attribute9,
3414 X_JGZZ_ATTRIBUTE10 => x_cust_profile_amt_rec.jgzz_attribute10,
3415 X_JGZZ_ATTRIBUTE11 => x_cust_profile_amt_rec.jgzz_attribute11,
3416 X_JGZZ_ATTRIBUTE12 => x_cust_profile_amt_rec.jgzz_attribute12,
3417 X_JGZZ_ATTRIBUTE13 => x_cust_profile_amt_rec.jgzz_attribute13,
3418 X_JGZZ_ATTRIBUTE14 => x_cust_profile_amt_rec.jgzz_attribute14,
3419 X_JGZZ_ATTRIBUTE15 => x_cust_profile_amt_rec.jgzz_attribute15,
3420 X_GLOBAL_ATTRIBUTE1 => x_cust_profile_amt_rec.global_attribute1,
3421 X_GLOBAL_ATTRIBUTE2 => x_cust_profile_amt_rec.global_attribute2,
3422 X_GLOBAL_ATTRIBUTE3 => x_cust_profile_amt_rec.global_attribute3,
3423 X_GLOBAL_ATTRIBUTE4 => x_cust_profile_amt_rec.global_attribute4,
3424 X_GLOBAL_ATTRIBUTE5 => x_cust_profile_amt_rec.global_attribute5,
3425 X_GLOBAL_ATTRIBUTE6 => x_cust_profile_amt_rec.global_attribute6,
3426 X_GLOBAL_ATTRIBUTE7 => x_cust_profile_amt_rec.global_attribute7,
3427 X_GLOBAL_ATTRIBUTE8 => x_cust_profile_amt_rec.global_attribute8,
3428 X_GLOBAL_ATTRIBUTE9 => x_cust_profile_amt_rec.global_attribute9,
3429 X_GLOBAL_ATTRIBUTE10 => x_cust_profile_amt_rec.global_attribute10,
3430 X_GLOBAL_ATTRIBUTE11 => x_cust_profile_amt_rec.global_attribute11,
3431 X_GLOBAL_ATTRIBUTE12 => x_cust_profile_amt_rec.global_attribute12,
3432 X_GLOBAL_ATTRIBUTE13 => x_cust_profile_amt_rec.global_attribute13,
3433 X_GLOBAL_ATTRIBUTE14 => x_cust_profile_amt_rec.global_attribute14,
3434 X_GLOBAL_ATTRIBUTE15 => x_cust_profile_amt_rec.global_attribute15,
3435 X_GLOBAL_ATTRIBUTE16 => x_cust_profile_amt_rec.global_attribute16,
3436 X_GLOBAL_ATTRIBUTE17 => x_cust_profile_amt_rec.global_attribute17,
3437 X_GLOBAL_ATTRIBUTE18 => x_cust_profile_amt_rec.global_attribute18,
3438 X_GLOBAL_ATTRIBUTE19 => x_cust_profile_amt_rec.global_attribute19,
3439 X_GLOBAL_ATTRIBUTE20 => x_cust_profile_amt_rec.global_attribute20,
3440 X_GLOBAL_ATTRIBUTE_CATEGORY => x_cust_profile_amt_rec.global_attribute_category,
3441 X_CREATED_BY_MODULE => x_cust_profile_amt_rec.created_by_module,
3442 X_APPLICATION_ID => x_cust_profile_amt_rec.application_id,
3443 X_EXCHANGE_RATE_TYPE => x_cust_profile_amt_rec.exchange_rate_type,
3444 X_MIN_FC_INVOICE_OVERDUE_TYPE => x_cust_profile_amt_rec.min_fc_invoice_overdue_type,
3445 X_MIN_FC_INVOICE_PERCENT => x_cust_profile_amt_rec.min_fc_invoice_percent,
3446 X_MIN_FC_BALANCE_OVERDUE_TYPE => x_cust_profile_amt_rec.min_fc_balance_overdue_type,
3447 X_MIN_FC_BALANCE_PERCENT => x_cust_profile_amt_rec.min_fc_balance_percent,
3448 X_INTEREST_TYPE => x_cust_profile_amt_rec.interest_type,
3449 X_INTEREST_FIXED_AMOUNT => x_cust_profile_amt_rec.interest_fixed_amount,
3450 X_INTEREST_SCHEDULE_ID => x_cust_profile_amt_rec.interest_schedule_id,
3451 X_PENALTY_TYPE => x_cust_profile_amt_rec.penalty_type,
3452 X_PENALTY_RATE => x_cust_profile_amt_rec.penalty_rate,
3453 X_MIN_INTEREST_CHARGE => x_cust_profile_amt_rec.min_interest_charge,
3454 X_PENALTY_FIXED_AMOUNT => x_cust_profile_amt_rec.penalty_fixed_amount,
3455 X_PENALTY_SCHEDULE_ID => x_cust_profile_amt_rec.penalty_schedule_id
3456 );
3457
3458 -- Debug info.
3459 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3460 hz_utility_v2pub.debug(p_message=>'HZ_CUST_PROFILE_AMTS_PKG.Select_Row (-)',
3461 p_prefix=>l_debug_prefix,
3462 p_msg_level=>fnd_log.level_procedure);
3463 END IF;
3464
3465 -- Standard call to get message count and if count is 1, get message info.
3466 FND_MSG_PUB.Count_And_Get(
3467 p_encoded => FND_API.G_FALSE,
3468 p_count => x_msg_count,
3469 p_data => x_msg_data );
3470
3471 -- Debug info.
3472 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
3473 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
3474 p_msg_data=>x_msg_data,
3475 p_msg_type=>'WARNING',
3476 p_msg_level=>fnd_log.level_exception);
3477 END IF;
3478 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3479 hz_utility_v2pub.debug(p_message=>'get_cust_profile_amt_rec (-)',
3480 p_prefix=>l_debug_prefix,
3481 p_msg_level=>fnd_log.level_procedure);
3482 END IF;
3483
3484 -- Check if API is called in debug mode. If yes, disable debug.
3485 --disable_debug;
3486
3487 EXCEPTION
3488 WHEN FND_API.G_EXC_ERROR THEN
3489 x_return_status := FND_API.G_RET_STS_ERROR;
3490
3491 FND_MSG_PUB.Count_And_Get(
3492 p_encoded => FND_API.G_FALSE,
3493 p_count => x_msg_count,
3494 p_data => x_msg_data );
3495
3496 -- Debug info.
3497 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
3498 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
3499 p_msg_data=>x_msg_data,
3500 p_msg_type=>'ERROR',
3501 p_msg_level=>fnd_log.level_error);
3502 END IF;
3503 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3504 hz_utility_v2pub.debug(p_message=>'get_cust_profile_amt_rec (-)',
3505 p_prefix=>l_debug_prefix,
3506 p_msg_level=>fnd_log.level_procedure);
3507 END IF;
3508
3509 -- Check if API is called in debug mode. If yes, disable debug.
3510 --disable_debug;
3511
3512 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3513 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3514
3515 FND_MSG_PUB.Count_And_Get(
3516 p_encoded => FND_API.G_FALSE,
3517 p_count => x_msg_count,
3518 p_data => x_msg_data );
3519
3520 -- Debug info.
3521 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
3522 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
3523 p_msg_data=>x_msg_data,
3524 p_msg_type=>'UNEXPECTED ERROR',
3525 p_msg_level=>fnd_log.level_error);
3526 END IF;
3527 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3528 hz_utility_v2pub.debug(p_message=>'get_cust_profile_amt_rec (-)',
3529 p_prefix=>l_debug_prefix,
3530 p_msg_level=>fnd_log.level_procedure);
3531 END IF;
3532
3533 -- Check if API is called in debug mode. If yes, disable debug.
3534 --disable_debug;
3535
3536 WHEN OTHERS THEN
3537 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3538
3539 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
3540 FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
3541 FND_MSG_PUB.ADD;
3542
3543 FND_MSG_PUB.Count_And_Get(
3544 p_encoded => FND_API.G_FALSE,
3545 p_count => x_msg_count,
3546 p_data => x_msg_data );
3547
3548 -- Debug info.
3549 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
3550 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
3551 p_msg_data=>x_msg_data,
3552 p_msg_type=>'SQL ERROR',
3553 p_msg_level=>fnd_log.level_error);
3554 END IF;
3555 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
3556 hz_utility_v2pub.debug(p_message=>'get_cust_profile_amt_rec (-)',
3557 p_prefix=>l_debug_prefix,
3558 p_msg_level=>fnd_log.level_procedure);
3559 END IF;
3560
3561 -- Check if API is called in debug mode. If yes, disable debug.
3562 --disable_debug;
3563
3564 END get_cust_profile_amt_rec;
3565
3566 END HZ_CUSTOMER_PROFILE_V2PUB;