122: IS
123: X_ERROR_MSG VARCHAR2(1000);
124:
125: BEGIN
126: cep_standard.debug('>> CE_ZBA_DEAL_GENERATION.xtr_shared_account stub <<');
127: -- cep_standard.debug('ORG_ID = '|| CE_ZBA_DEAL_GENERATION.csh_org_id);
128: -- cep_standard.debug('BANK_ACCOUNT_ID = '|| CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
129: -- cep_standard.debug('CURRENCY_CODE = '|| CE_ZBA_DEAL_GENERATION.cba_bank_currency);
130: --
123: X_ERROR_MSG VARCHAR2(1000);
124:
125: BEGIN
126: cep_standard.debug('>> CE_ZBA_DEAL_GENERATION.xtr_shared_account stub <<');
127: -- cep_standard.debug('ORG_ID = '|| CE_ZBA_DEAL_GENERATION.csh_org_id);
128: -- cep_standard.debug('BANK_ACCOUNT_ID = '|| CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
129: -- cep_standard.debug('CURRENCY_CODE = '|| CE_ZBA_DEAL_GENERATION.cba_bank_currency);
130: --
131: -- XTR_WRAPPER_API_P.bank_account_verification(
124:
125: BEGIN
126: cep_standard.debug('>> CE_ZBA_DEAL_GENERATION.xtr_shared_account stub <<');
127: -- cep_standard.debug('ORG_ID = '|| CE_ZBA_DEAL_GENERATION.csh_org_id);
128: -- cep_standard.debug('BANK_ACCOUNT_ID = '|| CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
129: -- cep_standard.debug('CURRENCY_CODE = '|| CE_ZBA_DEAL_GENERATION.cba_bank_currency);
130: --
131: -- XTR_WRAPPER_API_P.bank_account_verification(
132: -- P_ORG_ID => CE_ZBA_DEAL_GENERATION.csh_org_id,
125: BEGIN
126: cep_standard.debug('>> CE_ZBA_DEAL_GENERATION.xtr_shared_account stub <<');
127: -- cep_standard.debug('ORG_ID = '|| CE_ZBA_DEAL_GENERATION.csh_org_id);
128: -- cep_standard.debug('BANK_ACCOUNT_ID = '|| CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
129: -- cep_standard.debug('CURRENCY_CODE = '|| CE_ZBA_DEAL_GENERATION.cba_bank_currency);
130: --
131: -- XTR_WRAPPER_API_P.bank_account_verification(
132: -- P_ORG_ID => CE_ZBA_DEAL_GENERATION.csh_org_id,
133: -- P_AP_BANK_ACCOUNT_ID => CE_ZBA_DEAL_GENERATION.csh_bank_account_id,
134: -- P_CURRENCY_CODE => CE_ZBA_DEAL_GENERATION.cba_bank_currency,
135: -- P_RESULT => X_ACCOUNT_RESULT,
136: -- P_ERROR_MSG => X_ERROR_MSG);
137: --
138: -- cep_standard.debug('x_account_result = ' || x_account_result);
139: -- cep_standard.debug('x_error_msg = ' || x_error_msg);
140: EXCEPTION
141: WHEN OTHERS THEN
142: cep_standard.debug('EXCEPTION: CE_ZBA_DEAL_GENERATION.xtr_shared_account');
135: -- P_RESULT => X_ACCOUNT_RESULT,
136: -- P_ERROR_MSG => X_ERROR_MSG);
137: --
138: -- cep_standard.debug('x_account_result = ' || x_account_result);
139: -- cep_standard.debug('x_error_msg = ' || x_error_msg);
140: EXCEPTION
141: WHEN OTHERS THEN
142: cep_standard.debug('EXCEPTION: CE_ZBA_DEAL_GENERATION.xtr_shared_account');
143: RAISE;
138: -- cep_standard.debug('x_account_result = ' || x_account_result);
139: -- cep_standard.debug('x_error_msg = ' || x_error_msg);
140: EXCEPTION
141: WHEN OTHERS THEN
142: cep_standard.debug('EXCEPTION: CE_ZBA_DEAL_GENERATION.xtr_shared_account');
143: RAISE;
144: END xtr_shared_account;
145:
146:
172: FROM ce_statement_headers
173: WHERE rowid = CE_ZBA_DEAL_GENERATION.csh_rowid
174: FOR UPDATE OF statement_header_id NOWAIT;
175:
176: cep_standard.debug('Regular statement lock OK');
177: lockname := CE_ZBA_DEAL_GENERATION.csh_rowid;
178: timeout := 1;
179: lockmode := 6;
180: expiration_secs := 10;
180: expiration_secs := 10;
181: release_on_commit := FALSE;
182:
183: -- dbms_lock of row to deal with other locking
184: cep_standard.debug('Allocating unique');
185: dbms_lock.allocate_unique (lockname, lockhandle, expiration_secs);
186: lock_status := dbms_lock.request( lockhandle, lockmode, timeout, release_on_commit );
187:
188: IF (lock_status <> 0) THEN
192:
193: RETURN(TRUE);
194: EXCEPTION
195: WHEN APP_EXCEPTIONS.record_lock_exception THEN
196: cep_standard.debug('EXCEPTION: CE_ZBA_DEAL_GENERATION.lock_statement - record_lock_exception');
197: RETURN(FALSE);
198: WHEN OTHERS THEN
199: cep_standard.debug('EXCEPTION: CE_ZBA_DEAL_GENERATION.lock_statement - others');
200: RAISE;
195: WHEN APP_EXCEPTIONS.record_lock_exception THEN
196: cep_standard.debug('EXCEPTION: CE_ZBA_DEAL_GENERATION.lock_statement - record_lock_exception');
197: RETURN(FALSE);
198: WHEN OTHERS THEN
199: cep_standard.debug('EXCEPTION: CE_ZBA_DEAL_GENERATION.lock_statement - others');
200: RAISE;
201: RETURN(FALSE);
202: END lock_statement;
203:
247:
248: RETURN(TRUE);
249: EXCEPTION
250: WHEN APP_EXCEPTIONS.record_lock_exception THEN
251: cep_standard.debug('EXCEPTION: CE_ZBA_DEAL_GENERATION.lock_statement_line - record_lock_exception');
252: return(FALSE);
253: WHEN OTHERS THEN
254: cep_standard.debug('EXCEPTION: CE_ZBA_DEAL_GENERATION.lock_statement_line - others');
255: RAISE;
250: WHEN APP_EXCEPTIONS.record_lock_exception THEN
251: cep_standard.debug('EXCEPTION: CE_ZBA_DEAL_GENERATION.lock_statement_line - record_lock_exception');
252: return(FALSE);
253: WHEN OTHERS THEN
254: cep_standard.debug('EXCEPTION: CE_ZBA_DEAL_GENERATION.lock_statement_line - others');
255: RAISE;
256: return(FALSE);
257: END lock_statement_line;
258:
285:
286: RETURN (min_statement_line);
287: EXCEPTION
288: WHEN OTHERS THEN
289: cep_standard.debug('EXCEPTION: CE_ZBA_DEAL_GENERATION.get_min_statement_line_id');
290: RAISE;
291: END get_min_statement_line_id;
292:
293: /* ---------------------------------------------------------------------
345: SELECT statement_header_id
346: FROM ce_statement_headers
347: WHERE bank_account_id = p_ap_bank_account_id;
348: BEGIN
349: cep_standard.debug('<
351: INTO code_row_count
352: FROM ce_transaction_codes
353: WHERE bank_account_id = p_ap_bank_account_id
374: FROM ce_statement_lines
375: WHERE statement_header_id = p_statement_header_id
376: AND trx_type in ('SWEEP_IN', 'SWEEP_OUT');
377:
378: cep_standard.debug('line_row_count = '||line_row_count);
379:
380: IF (line_row_count > 0) THEN
381: G_sweep_flag := TRUE;
382: RETURN (FALSE);
386: EXIT WHEN G_sweep_flag = TRUE;
387: END LOOP;
388: CLOSE header_cursor;
389: END IF;
390: cep_standard.debug('<
392:
393:
394: /*========================================================================+
469: l_acct_type ce_cashpool_sub_accts.type%TYPE; -- Bug 14512483
470: l_offset_acct_type ce_cashpool_sub_accts.type%TYPE; -- Bug 14512483
471:
472: BEGIN
473: cep_standard.debug('>>CE_ZBA_DEAL_GENERATION.zba_generation');
474: cep_standard.debug('p_bank_branch_id : '|| p_bank_branch_id);
475: cep_standard.debug('p_bank_account_id : '|| p_bank_account_id);
476: cep_standard.debug('p_statement_number_from: '|| p_statement_number_from);
477: cep_standard.debug('p_statement_number_to : '|| p_statement_number_to);
470: l_offset_acct_type ce_cashpool_sub_accts.type%TYPE; -- Bug 14512483
471:
472: BEGIN
473: cep_standard.debug('>>CE_ZBA_DEAL_GENERATION.zba_generation');
474: cep_standard.debug('p_bank_branch_id : '|| p_bank_branch_id);
475: cep_standard.debug('p_bank_account_id : '|| p_bank_account_id);
476: cep_standard.debug('p_statement_number_from: '|| p_statement_number_from);
477: cep_standard.debug('p_statement_number_to : '|| p_statement_number_to);
478: cep_standard.debug('p_statement_date_from : '|| p_statement_date_from);
471:
472: BEGIN
473: cep_standard.debug('>>CE_ZBA_DEAL_GENERATION.zba_generation');
474: cep_standard.debug('p_bank_branch_id : '|| p_bank_branch_id);
475: cep_standard.debug('p_bank_account_id : '|| p_bank_account_id);
476: cep_standard.debug('p_statement_number_from: '|| p_statement_number_from);
477: cep_standard.debug('p_statement_number_to : '|| p_statement_number_to);
478: cep_standard.debug('p_statement_date_from : '|| p_statement_date_from);
479: cep_standard.debug('p_statement_date_to : '|| p_statement_date_to);
472: BEGIN
473: cep_standard.debug('>>CE_ZBA_DEAL_GENERATION.zba_generation');
474: cep_standard.debug('p_bank_branch_id : '|| p_bank_branch_id);
475: cep_standard.debug('p_bank_account_id : '|| p_bank_account_id);
476: cep_standard.debug('p_statement_number_from: '|| p_statement_number_from);
477: cep_standard.debug('p_statement_number_to : '|| p_statement_number_to);
478: cep_standard.debug('p_statement_date_from : '|| p_statement_date_from);
479: cep_standard.debug('p_statement_date_to : '|| p_statement_date_to);
480:
473: cep_standard.debug('>>CE_ZBA_DEAL_GENERATION.zba_generation');
474: cep_standard.debug('p_bank_branch_id : '|| p_bank_branch_id);
475: cep_standard.debug('p_bank_account_id : '|| p_bank_account_id);
476: cep_standard.debug('p_statement_number_from: '|| p_statement_number_from);
477: cep_standard.debug('p_statement_number_to : '|| p_statement_number_to);
478: cep_standard.debug('p_statement_date_from : '|| p_statement_date_from);
479: cep_standard.debug('p_statement_date_to : '|| p_statement_date_to);
480:
481: -- populate ce_security_profiles_gt table with ce_security_procfiles_v
474: cep_standard.debug('p_bank_branch_id : '|| p_bank_branch_id);
475: cep_standard.debug('p_bank_account_id : '|| p_bank_account_id);
476: cep_standard.debug('p_statement_number_from: '|| p_statement_number_from);
477: cep_standard.debug('p_statement_number_to : '|| p_statement_number_to);
478: cep_standard.debug('p_statement_date_from : '|| p_statement_date_from);
479: cep_standard.debug('p_statement_date_to : '|| p_statement_date_to);
480:
481: -- populate ce_security_profiles_gt table with ce_security_procfiles_v
482: CEP_STANDARD.init_security;
475: cep_standard.debug('p_bank_account_id : '|| p_bank_account_id);
476: cep_standard.debug('p_statement_number_from: '|| p_statement_number_from);
477: cep_standard.debug('p_statement_number_to : '|| p_statement_number_to);
478: cep_standard.debug('p_statement_date_from : '|| p_statement_date_from);
479: cep_standard.debug('p_statement_date_to : '|| p_statement_date_to);
480:
481: -- populate ce_security_profiles_gt table with ce_security_procfiles_v
482: CEP_STANDARD.init_security;
483:
478: cep_standard.debug('p_statement_date_from : '|| p_statement_date_from);
479: cep_standard.debug('p_statement_date_to : '|| p_statement_date_to);
480:
481: -- populate ce_security_profiles_gt table with ce_security_procfiles_v
482: CEP_STANDARD.init_security;
483:
484: set_parameters(
485: p_bank_branch_id,
486: p_bank_account_id,
491: p_display_debug,
492: p_debug_path,
493: p_debug_file);
494:
495: cep_standard.debug('Opening r_branch_cursor');
496: OPEN r_branch_cursor(
497: CE_ZBA_DEAL_GENERATION.G_bank_branch_id,
498: CE_ZBA_DEAL_GENERATION.G_bank_account_id);
499: j := 0;
497: CE_ZBA_DEAL_GENERATION.G_bank_branch_id,
498: CE_ZBA_DEAL_GENERATION.G_bank_account_id);
499: j := 0;
500: LOOP
501: cep_standard.debug('Fetching r_branch_cursor');
502: FETCH r_branch_cursor INTO CE_ZBA_DEAL_GENERATION.csh_bank_account_id;
503: cep_standard.debug('r_branch_cursor%ROWCOUNT = ' || r_branch_cursor%ROWCOUNT );
504:
505: IF (r_branch_cursor%ROWCOUNT = j)
499: j := 0;
500: LOOP
501: cep_standard.debug('Fetching r_branch_cursor');
502: FETCH r_branch_cursor INTO CE_ZBA_DEAL_GENERATION.csh_bank_account_id;
503: cep_standard.debug('r_branch_cursor%ROWCOUNT = ' || r_branch_cursor%ROWCOUNT );
504:
505: IF (r_branch_cursor%ROWCOUNT = j)
506: THEN
507: cep_standard.debug('Exiting Branch Loop...');
503: cep_standard.debug('r_branch_cursor%ROWCOUNT = ' || r_branch_cursor%ROWCOUNT );
504:
505: IF (r_branch_cursor%ROWCOUNT = j)
506: THEN
507: cep_standard.debug('Exiting Branch Loop...');
508: EXIT;
509: ELSE
510: j := r_branch_cursor%ROWCOUNT;
511: END IF;
509: ELSE
510: j := r_branch_cursor%ROWCOUNT;
511: END IF;
512:
513: cep_standard.debug('Opening r_bank_cursor');
514: cep_standard.debug('G_statement_number_from = ' || CE_ZBA_DEAL_GENERATION.G_statement_number_from);
515: cep_standard.debug('G_statement_number_to = ' || CE_ZBA_DEAL_GENERATION.G_statement_number_to);
516: cep_standard.debug('G_statement_date_from = ' || CE_ZBA_DEAL_GENERATION.G_statement_date_from);
517: cep_standard.debug('G_statement_date_to = ' || CE_ZBA_DEAL_GENERATION.G_statement_date_to);
510: j := r_branch_cursor%ROWCOUNT;
511: END IF;
512:
513: cep_standard.debug('Opening r_bank_cursor');
514: cep_standard.debug('G_statement_number_from = ' || CE_ZBA_DEAL_GENERATION.G_statement_number_from);
515: cep_standard.debug('G_statement_number_to = ' || CE_ZBA_DEAL_GENERATION.G_statement_number_to);
516: cep_standard.debug('G_statement_date_from = ' || CE_ZBA_DEAL_GENERATION.G_statement_date_from);
517: cep_standard.debug('G_statement_date_to = ' || CE_ZBA_DEAL_GENERATION.G_statement_date_to);
518: cep_standard.debug('csh_bank_account_id = ' || CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
511: END IF;
512:
513: cep_standard.debug('Opening r_bank_cursor');
514: cep_standard.debug('G_statement_number_from = ' || CE_ZBA_DEAL_GENERATION.G_statement_number_from);
515: cep_standard.debug('G_statement_number_to = ' || CE_ZBA_DEAL_GENERATION.G_statement_number_to);
516: cep_standard.debug('G_statement_date_from = ' || CE_ZBA_DEAL_GENERATION.G_statement_date_from);
517: cep_standard.debug('G_statement_date_to = ' || CE_ZBA_DEAL_GENERATION.G_statement_date_to);
518: cep_standard.debug('csh_bank_account_id = ' || CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
519:
512:
513: cep_standard.debug('Opening r_bank_cursor');
514: cep_standard.debug('G_statement_number_from = ' || CE_ZBA_DEAL_GENERATION.G_statement_number_from);
515: cep_standard.debug('G_statement_number_to = ' || CE_ZBA_DEAL_GENERATION.G_statement_number_to);
516: cep_standard.debug('G_statement_date_from = ' || CE_ZBA_DEAL_GENERATION.G_statement_date_from);
517: cep_standard.debug('G_statement_date_to = ' || CE_ZBA_DEAL_GENERATION.G_statement_date_to);
518: cep_standard.debug('csh_bank_account_id = ' || CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
519:
520: OPEN r_bank_cursor (
513: cep_standard.debug('Opening r_bank_cursor');
514: cep_standard.debug('G_statement_number_from = ' || CE_ZBA_DEAL_GENERATION.G_statement_number_from);
515: cep_standard.debug('G_statement_number_to = ' || CE_ZBA_DEAL_GENERATION.G_statement_number_to);
516: cep_standard.debug('G_statement_date_from = ' || CE_ZBA_DEAL_GENERATION.G_statement_date_from);
517: cep_standard.debug('G_statement_date_to = ' || CE_ZBA_DEAL_GENERATION.G_statement_date_to);
518: cep_standard.debug('csh_bank_account_id = ' || CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
519:
520: OPEN r_bank_cursor (
521: CE_ZBA_DEAL_GENERATION.G_statement_number_from,
514: cep_standard.debug('G_statement_number_from = ' || CE_ZBA_DEAL_GENERATION.G_statement_number_from);
515: cep_standard.debug('G_statement_number_to = ' || CE_ZBA_DEAL_GENERATION.G_statement_number_to);
516: cep_standard.debug('G_statement_date_from = ' || CE_ZBA_DEAL_GENERATION.G_statement_date_from);
517: cep_standard.debug('G_statement_date_to = ' || CE_ZBA_DEAL_GENERATION.G_statement_date_to);
518: cep_standard.debug('csh_bank_account_id = ' || CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
519:
520: OPEN r_bank_cursor (
521: CE_ZBA_DEAL_GENERATION.G_statement_number_from,
522: CE_ZBA_DEAL_GENERATION.G_statement_number_to,
524: CE_ZBA_DEAL_GENERATION.G_statement_date_to,
525: CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
526: i := 0;
527: LOOP
528: cep_standard.debug('Fetching r_bank_cursor');
529: FETCH r_bank_cursor INTO
530: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
531: CE_ZBA_DEAL_GENERATION.csh_statement_number,
532: CE_ZBA_DEAL_GENERATION.csh_statement_date,
537: CE_ZBA_DEAL_GENERATION.cba_check_digits,
538: CE_ZBA_DEAL_GENERATION.csh_rowid,
539: CE_ZBA_DEAL_GENERATION.csh_statement_complete_flag,
540: CE_ZBA_DEAL_GENERATION.csh_org_id;
541: cep_standard.debug('statement_header_id:' || CE_ZBA_DEAL_GENERATION.csh_statement_header_id );
542: cep_standard.debug('r_bank_cursor%ROWCOUNT = ' || r_bank_cursor%ROWCOUNT );
543: IF (r_bank_cursor%ROWCOUNT = i)
544: THEN
545: cep_standard.debug('Exiting Bank Loop...');
538: CE_ZBA_DEAL_GENERATION.csh_rowid,
539: CE_ZBA_DEAL_GENERATION.csh_statement_complete_flag,
540: CE_ZBA_DEAL_GENERATION.csh_org_id;
541: cep_standard.debug('statement_header_id:' || CE_ZBA_DEAL_GENERATION.csh_statement_header_id );
542: cep_standard.debug('r_bank_cursor%ROWCOUNT = ' || r_bank_cursor%ROWCOUNT );
543: IF (r_bank_cursor%ROWCOUNT = i)
544: THEN
545: cep_standard.debug('Exiting Bank Loop...');
546: EXIT;
541: cep_standard.debug('statement_header_id:' || CE_ZBA_DEAL_GENERATION.csh_statement_header_id );
542: cep_standard.debug('r_bank_cursor%ROWCOUNT = ' || r_bank_cursor%ROWCOUNT );
543: IF (r_bank_cursor%ROWCOUNT = i)
544: THEN
545: cep_standard.debug('Exiting Bank Loop...');
546: EXIT;
547: ELSE
548: i := r_bank_cursor%ROWCOUNT;
549: END IF;
546: EXIT;
547: ELSE
548: i := r_bank_cursor%ROWCOUNT;
549: END IF;
550: cep_standard.debug('Itertion Number = ' || i);
551:
552: -- Clean up error table
553: CE_ZBA_DEAL_INF_PKG.delete_row(
554: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
560: from ce_statement_lines
561: where statement_header_id = CE_ZBA_DEAL_GENERATION.csh_statement_header_id
562: and trx_type in ('SWEEP_IN', 'SWEEP_OUT');
563:
564: cep_standard.debug('sweep row_count = '||row_count);
565:
566: IF (row_count = 0)
567: THEN
568: CE_ZBA_DEAL_INF_PKG.insert_row(
570: to_number(NULL),
571: 'CE_NO_SWEEP_STMT_LINE');
572: -- Bug 11686554 CONTINUE is not supported in oracle 10g
573: -- CONTINUE; -- Bug 12854251 Changed EXIT to CONTINUE
574: cep_standard.debug('no sweep lines in statement');
575: ELSE --Validate the bank account is an authorized treasury account
576: IF fnd_profile.value('CE_BANK_ACCOUNT_TRANSFERS') = 'XTR'
577: THEN
578: SELECT count(1)
582: AND bau.bank_account_id = ba.bank_account_id
583: AND ba.xtr_use_allowed_flag = 'Y'
584: AND bau.authorized_flag = 'Y';
585:
586: cep_standard.debug('authorised l_count = '||row_count);
587: IF l_count = 0
588: THEN
589: CE_ZBA_DEAL_INF_PKG.insert_row (
590: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
589: CE_ZBA_DEAL_INF_PKG.insert_row (
590: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
591: to_number(NULL),
592: 'CE_XTR_INVALID_ACCT');
593: cep_standard.debug('Exiting For Invalid Account ...');
594: EXIT;
595: END IF;
596: END IF;
597: -- END IF; -- Bug 11686554: END IF moved to the end of the loop.
595: END IF;
596: END IF;
597: -- END IF; -- Bug 11686554: END IF moved to the end of the loop.
598:
599: cep_standard.debug('check the check digits');
600: IF(NVL(LTRIM(NVL(CE_ZBA_DEAL_GENERATION.csh_check_digits, 'NO DIGIT'),'0'),'0') =
601: NVL(LTRIM(NVL(CE_ZBA_DEAL_GENERATION.cba_check_digits, 'NO DIGIT'),'0'),'0'))
602: THEN
603: cep_standard.debug('csh_check_digits = '||csh_check_digits);
599: cep_standard.debug('check the check digits');
600: IF(NVL(LTRIM(NVL(CE_ZBA_DEAL_GENERATION.csh_check_digits, 'NO DIGIT'),'0'),'0') =
601: NVL(LTRIM(NVL(CE_ZBA_DEAL_GENERATION.cba_check_digits, 'NO DIGIT'),'0'),'0'))
602: THEN
603: cep_standard.debug('csh_check_digits = '||csh_check_digits);
604: cep_standard.debug('cba_check_digits = '||cba_check_digits);
605:
606: cep_standard.debug('Lock the statement');
607: IF (lock_statement(lockhandle))
600: IF(NVL(LTRIM(NVL(CE_ZBA_DEAL_GENERATION.csh_check_digits, 'NO DIGIT'),'0'),'0') =
601: NVL(LTRIM(NVL(CE_ZBA_DEAL_GENERATION.cba_check_digits, 'NO DIGIT'),'0'),'0'))
602: THEN
603: cep_standard.debug('csh_check_digits = '||csh_check_digits);
604: cep_standard.debug('cba_check_digits = '||cba_check_digits);
605:
606: cep_standard.debug('Lock the statement');
607: IF (lock_statement(lockhandle))
608: THEN
602: THEN
603: cep_standard.debug('csh_check_digits = '||csh_check_digits);
604: cep_standard.debug('cba_check_digits = '||cba_check_digits);
605:
606: cep_standard.debug('Lock the statement');
607: IF (lock_statement(lockhandle))
608: THEN
609: IF (csh_statement_complete_flag = 'N')
610: THEN
611: statement_line_count := 0;
612:
613: -- Read in all the lines on the statement for the selected bank
614: -- account.
615: cep_standard.debug('Opening line_cursor');
616: OPEN line_cursor (CE_ZBA_DEAL_GENERATION.csh_statement_header_id);
617: LOOP
618: FETCH line_cursor INTO
619: CE_ZBA_DEAL_GENERATION.csl_rowid,
635: CE_ZBA_DEAL_GENERATION.csl_clearing_trx_type,
636: CE_ZBA_DEAL_GENERATION.csl_original_amount,
637: CE_ZBA_DEAL_GENERATION.csl_payroll_payment_format;
638: EXIT WHEN line_cursor%NOTFOUND OR line_cursor%NOTFOUND IS NULL;
639: cep_standard.debug('csl_statement_line_id = '|| CE_ZBA_DEAL_GENERATION.csl_statement_line_id);
640:
641: cep_standard.debug('check if reconciled');
642: select count(*)
643: into rec_status
637: CE_ZBA_DEAL_GENERATION.csl_payroll_payment_format;
638: EXIT WHEN line_cursor%NOTFOUND OR line_cursor%NOTFOUND IS NULL;
639: cep_standard.debug('csl_statement_line_id = '|| CE_ZBA_DEAL_GENERATION.csl_statement_line_id);
640:
641: cep_standard.debug('check if reconciled');
642: select count(*)
643: into rec_status
644: from ce_statement_reconcils_all
645: where statement_line_id = CE_ZBA_DEAL_GENERATION.csl_statement_line_id
644: from ce_statement_reconcils_all
645: where statement_line_id = CE_ZBA_DEAL_GENERATION.csl_statement_line_id
646: and nvl(status_flag, 'U') = 'M'
647: and nvl(current_record_flag, 'Y') = 'Y';
648: cep_standard.debug('rec_status='||rec_status);
649:
650: if (rec_status = 0)
651: then
652: statement_line_count := statement_line_count + 1;
658: CE_ZBA_DEAL_GENERATION.csl_statement_line_id);
659:
660: IF (lock_statement_line)
661: THEN
662: cep_standard.debug('csl_amount = '||csl_amount);
663: --Validate zero amount line
664: IF (CE_ZBA_DEAL_GENERATION.csl_amount = 0)
665: THEN
666: CE_ZBA_DEAL_INF_PKG.insert_row (
677: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
678: CE_ZBA_DEAL_GENERATION.csl_statement_line_id,
679: 'CE_ZBA_DIFF_CURRENCY');
680: END IF;
681: cep_standard.debug('csl_currency_code = '||csl_currency_code);
682: cep_standard.debug('cba_bank_currency = '||cba_bank_currency);
683:
684: /* Bug # 7829965 Start */
685: BEGIN
678: CE_ZBA_DEAL_GENERATION.csl_statement_line_id,
679: 'CE_ZBA_DIFF_CURRENCY');
680: END IF;
681: cep_standard.debug('csl_currency_code = '||csl_currency_code);
682: cep_standard.debug('cba_bank_currency = '||cba_bank_currency);
683:
684: /* Bug # 7829965 Start */
685: BEGIN
686: SELECT bank_account_text
704: WHEN OTHERS
705: THEN
706: -- The Exception is not handled here when the agent bank account
707: -- is not found as it is already handled in the code.
708: cep_standard.debug('7829965 - Exception - Others');
709: NULL;
710: END;
711: /* Bug # 7829965 End */
712:
714: THEN -- Bug # 7829965 -- If Source and Destination Accounts are not the same
715: --
716: -- Deal Generation
717: --
718: cep_standard.debug('Check accounts and cashpool');
719: cep_standard.debug('p_header_bank_account_id=>'||CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
720: cep_standard.debug('p_offset_bank_account_num=>'||CE_ZBA_DEAL_GENERATION.csl_bank_account_text);
721: cep_standard.debug('p_trx_type=>'||CE_ZBA_DEAL_GENERATION.csl_trx_type);
722: cep_standard.debug('p_trx_date=>'||CE_ZBA_DEAL_GENERATION.csl_trx_date);
715: --
716: -- Deal Generation
717: --
718: cep_standard.debug('Check accounts and cashpool');
719: cep_standard.debug('p_header_bank_account_id=>'||CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
720: cep_standard.debug('p_offset_bank_account_num=>'||CE_ZBA_DEAL_GENERATION.csl_bank_account_text);
721: cep_standard.debug('p_trx_type=>'||CE_ZBA_DEAL_GENERATION.csl_trx_type);
722: cep_standard.debug('p_trx_date=>'||CE_ZBA_DEAL_GENERATION.csl_trx_date);
723: cep_standard.debug('p_offset_bank_account_id='||x_offset_bank_account_id);
716: -- Deal Generation
717: --
718: cep_standard.debug('Check accounts and cashpool');
719: cep_standard.debug('p_header_bank_account_id=>'||CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
720: cep_standard.debug('p_offset_bank_account_num=>'||CE_ZBA_DEAL_GENERATION.csl_bank_account_text);
721: cep_standard.debug('p_trx_type=>'||CE_ZBA_DEAL_GENERATION.csl_trx_type);
722: cep_standard.debug('p_trx_date=>'||CE_ZBA_DEAL_GENERATION.csl_trx_date);
723: cep_standard.debug('p_offset_bank_account_id='||x_offset_bank_account_id);
724: cep_standard.debug('p_cashpool_id='||x_cashpool_id);
717: --
718: cep_standard.debug('Check accounts and cashpool');
719: cep_standard.debug('p_header_bank_account_id=>'||CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
720: cep_standard.debug('p_offset_bank_account_num=>'||CE_ZBA_DEAL_GENERATION.csl_bank_account_text);
721: cep_standard.debug('p_trx_type=>'||CE_ZBA_DEAL_GENERATION.csl_trx_type);
722: cep_standard.debug('p_trx_date=>'||CE_ZBA_DEAL_GENERATION.csl_trx_date);
723: cep_standard.debug('p_offset_bank_account_id='||x_offset_bank_account_id);
724: cep_standard.debug('p_cashpool_id='||x_cashpool_id);
725: cp_match_bool := CE_LEVELING_UTILS.Match_Cashpool(
718: cep_standard.debug('Check accounts and cashpool');
719: cep_standard.debug('p_header_bank_account_id=>'||CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
720: cep_standard.debug('p_offset_bank_account_num=>'||CE_ZBA_DEAL_GENERATION.csl_bank_account_text);
721: cep_standard.debug('p_trx_type=>'||CE_ZBA_DEAL_GENERATION.csl_trx_type);
722: cep_standard.debug('p_trx_date=>'||CE_ZBA_DEAL_GENERATION.csl_trx_date);
723: cep_standard.debug('p_offset_bank_account_id='||x_offset_bank_account_id);
724: cep_standard.debug('p_cashpool_id='||x_cashpool_id);
725: cp_match_bool := CE_LEVELING_UTILS.Match_Cashpool(
726: p_header_bank_account_id => CE_ZBA_DEAL_GENERATION.csh_bank_account_id,
719: cep_standard.debug('p_header_bank_account_id=>'||CE_ZBA_DEAL_GENERATION.csh_bank_account_id);
720: cep_standard.debug('p_offset_bank_account_num=>'||CE_ZBA_DEAL_GENERATION.csl_bank_account_text);
721: cep_standard.debug('p_trx_type=>'||CE_ZBA_DEAL_GENERATION.csl_trx_type);
722: cep_standard.debug('p_trx_date=>'||CE_ZBA_DEAL_GENERATION.csl_trx_date);
723: cep_standard.debug('p_offset_bank_account_id='||x_offset_bank_account_id);
724: cep_standard.debug('p_cashpool_id='||x_cashpool_id);
725: cp_match_bool := CE_LEVELING_UTILS.Match_Cashpool(
726: p_header_bank_account_id => CE_ZBA_DEAL_GENERATION.csh_bank_account_id,
727: p_offset_bank_account_num => CE_ZBA_DEAL_GENERATION.csl_bank_account_text,
720: cep_standard.debug('p_offset_bank_account_num=>'||CE_ZBA_DEAL_GENERATION.csl_bank_account_text);
721: cep_standard.debug('p_trx_type=>'||CE_ZBA_DEAL_GENERATION.csl_trx_type);
722: cep_standard.debug('p_trx_date=>'||CE_ZBA_DEAL_GENERATION.csl_trx_date);
723: cep_standard.debug('p_offset_bank_account_id='||x_offset_bank_account_id);
724: cep_standard.debug('p_cashpool_id='||x_cashpool_id);
725: cp_match_bool := CE_LEVELING_UTILS.Match_Cashpool(
726: p_header_bank_account_id => CE_ZBA_DEAL_GENERATION.csh_bank_account_id,
727: p_offset_bank_account_num => CE_ZBA_DEAL_GENERATION.csl_bank_account_text,
728: p_trx_type => CE_ZBA_DEAL_GENERATION.csl_trx_type,
748: FROM CE_CASHPOOL_SUB_ACCTS
749: WHERE CASHPOOL_ID = X_CASHPOOL_ID
750: AND ACCOUNT_ID = X_OFFSET_BANK_ACCOUNT_ID;
751:
752: cep_standard.debug('L_ACCT_TYPE = '||L_ACCT_TYPE);
753: cep_standard.debug('L_OFFSET_ACCT_TYPE = '||L_OFFSET_ACCT_TYPE);
754: cep_standard.debug('X_CASHPOOL_ID = '||x_cashpool_id);
755: cep_standard.debug('CE_ZBA_DEAL_GENERATION.csl_trx_type = '||CE_ZBA_DEAL_GENERATION.csl_trx_type);
756:
749: WHERE CASHPOOL_ID = X_CASHPOOL_ID
750: AND ACCOUNT_ID = X_OFFSET_BANK_ACCOUNT_ID;
751:
752: cep_standard.debug('L_ACCT_TYPE = '||L_ACCT_TYPE);
753: cep_standard.debug('L_OFFSET_ACCT_TYPE = '||L_OFFSET_ACCT_TYPE);
754: cep_standard.debug('X_CASHPOOL_ID = '||x_cashpool_id);
755: cep_standard.debug('CE_ZBA_DEAL_GENERATION.csl_trx_type = '||CE_ZBA_DEAL_GENERATION.csl_trx_type);
756:
757:
750: AND ACCOUNT_ID = X_OFFSET_BANK_ACCOUNT_ID;
751:
752: cep_standard.debug('L_ACCT_TYPE = '||L_ACCT_TYPE);
753: cep_standard.debug('L_OFFSET_ACCT_TYPE = '||L_OFFSET_ACCT_TYPE);
754: cep_standard.debug('X_CASHPOOL_ID = '||x_cashpool_id);
755: cep_standard.debug('CE_ZBA_DEAL_GENERATION.csl_trx_type = '||CE_ZBA_DEAL_GENERATION.csl_trx_type);
756:
757:
758: IF (L_ACCT_TYPE = 'FUND' AND CE_ZBA_DEAL_GENERATION.csl_trx_type = 'SWEEP_IN')
751:
752: cep_standard.debug('L_ACCT_TYPE = '||L_ACCT_TYPE);
753: cep_standard.debug('L_OFFSET_ACCT_TYPE = '||L_OFFSET_ACCT_TYPE);
754: cep_standard.debug('X_CASHPOOL_ID = '||x_cashpool_id);
755: cep_standard.debug('CE_ZBA_DEAL_GENERATION.csl_trx_type = '||CE_ZBA_DEAL_GENERATION.csl_trx_type);
756:
757:
758: IF (L_ACCT_TYPE = 'FUND' AND CE_ZBA_DEAL_GENERATION.csl_trx_type = 'SWEEP_IN')
759: THEN
756:
757:
758: IF (L_ACCT_TYPE = 'FUND' AND CE_ZBA_DEAL_GENERATION.csl_trx_type = 'SWEEP_IN')
759: THEN
760: cep_standard.debug('Can not sweep in for Funding concentration account..');
761: CE_ZBA_DEAL_INF_PKG.insert_row (
762: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
763: CE_ZBA_DEAL_GENERATION.csl_statement_line_id,
764: 'CE_ZBA_NO_FUND_SWEEP_IN');
764: 'CE_ZBA_NO_FUND_SWEEP_IN');
765:
766: ELSIF (L_ACCT_TYPE = 'INV' AND CE_ZBA_DEAL_GENERATION.csl_trx_type = 'SWEEP_OUT')
767: THEN
768: cep_standard.debug('Can not sweep out for Investment concentration account..');
769: CE_ZBA_DEAL_INF_PKG.insert_row (
770: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
771: CE_ZBA_DEAL_GENERATION.csl_statement_line_id,
772: 'CE_ZBA_NO_INV_SWEEP_OUT');
772: 'CE_ZBA_NO_INV_SWEEP_OUT');
773:
774: ELSIF (L_OFFSET_ACCT_TYPE = 'FUND' AND CE_ZBA_DEAL_GENERATION.csl_trx_type = 'SWEEP_OUT' )
775: THEN
776: cep_standard.debug('Can not sweep in for Funding concentration account..');
777: CE_ZBA_DEAL_INF_PKG.insert_row (
778: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
779: CE_ZBA_DEAL_GENERATION.csl_statement_line_id,
780: 'CE_ZBA_NO_FUND_SWEEP_IN_SUB');
780: 'CE_ZBA_NO_FUND_SWEEP_IN_SUB');
781:
782: ELSIF (L_OFFSET_ACCT_TYPE = 'INV' AND CE_ZBA_DEAL_GENERATION.csl_trx_type = 'SWEEP_IN')
783: THEN
784: cep_standard.debug('Can not sweep out for Investment concentration account..');
785: CE_ZBA_DEAL_INF_PKG.insert_row (
786: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
787: CE_ZBA_DEAL_GENERATION.csl_statement_line_id,
788: 'CE_ZBA_NO_INV_SWEEP_OUT_SUB');
877: END IF;
878: END IF;
879: END IF; -- Bug 14512483 Validation for Cashpool with 2 Concntration Accounts.
880: ELSE -- cp_match_bool = false
881: cep_standard.debug('No matching cashpool found');
882: CE_ZBA_DEAL_INF_PKG.insert_row(
883: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
884: CE_ZBA_DEAL_GENERATION.csl_statement_line_id,
885: 'CE_NO_CASHPOOL_MATCH');
885: 'CE_NO_CASHPOOL_MATCH');
886: END IF;
887: /* Bug # 7829965 Start */
888: ELSE -- Source and Destination Accounts are the same
889: cep_standard.debug('Source and Destination Accounts are the same');
890: CE_ZBA_DEAL_INF_PKG.insert_row(
891: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
892: CE_ZBA_DEAL_GENERATION.csl_statement_line_id,
893: 'CE_BAT_INVALID_BACCNTS');
893: 'CE_BAT_INVALID_BACCNTS');
894: END IF;
895: /* Bug # 7829965 End */
896: ELSE -- statement line is locked
897: cep_standard.debug('statement line is locked');
898: CE_ZBA_DEAL_INF_PKG.insert_row(
899: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
900: CE_ZBA_DEAL_GENERATION.csl_statement_line_id,
901: 'CE_LINE_LOCKED');
931: 'CE_LOCK_STATEMENT_HEADER_ERR');
932: END IF; -- statement lock check
933: lock_status := dbms_lock.release(lockhandle);
934: ELSE -- check digits failed
935: cep_standard.debug('Account/Statement check digit mismatch');
936: CE_ZBA_DEAL_INF_PKG.delete_row(
937: CE_ZBA_DEAL_GENERATION.csh_statement_header_id, to_number(NULL));
938: CE_ZBA_DEAL_INF_PKG.insert_row(
939: CE_ZBA_DEAL_GENERATION.csh_statement_header_id,
959: print_style,
960: printer,
961: save_output_flag))
962: THEN
963: cep_standard.debug('zba_generation: ' || 'Message: get print options success');
964: ELSE
965: IF (save_output_flag = 'Y') THEN
966: save_output_bool := TRUE;
967: ELSE
970:
971: IF( FND_CONCURRENT.GET_PROGRAM_ATTRIBUTES (
972: 'CE', 'CEZBAERR', printer, print_style, save_output_flag))
973: THEN
974: cep_standard.debug('zba_generation: ' || 'Message: get print options failed');
975: END IF;
976: END IF;
977: -- Set print options
978: IF (NOT FND_REQUEST.set_print_options(
977: -- Set print options
978: IF (NOT FND_REQUEST.set_print_options(
979: printer, print_style, number_of_copies, save_output_bool))
980: THEN
981: cep_standard.debug('zba_generation: ' || 'Set print options failed');
982: END IF;
983: req_id := FND_REQUEST.SUBMIT_REQUEST(
984: 'CE',
985: 'CEZBAERR',
996: p_display_debug);
997: COMMIT;
998:
999: IF (req_id = 0) THEN
1000: cep_standard.debug('zba_generation: ' || 'ERROR submitting concurrent request');
1001: ELSE
1002: cep_standard.debug('zba_generation: ' || 'EXECUTION REPORT SUBMITTED');
1003: END IF;
1004:
998:
999: IF (req_id = 0) THEN
1000: cep_standard.debug('zba_generation: ' || 'ERROR submitting concurrent request');
1001: ELSE
1002: cep_standard.debug('zba_generation: ' || 'EXECUTION REPORT SUBMITTED');
1003: END IF;
1004:
1005: cep_standard.debug('<
1001: ELSE
1002: cep_standard.debug('zba_generation: ' || 'EXECUTION REPORT SUBMITTED');
1003: END IF;
1004:
1005: cep_standard.debug('<
1007: WHEN OTHERS THEN
1008: cep_standard.debug(' EXCEPTION: CE_ZBA_DEAL_GENERATION.zba_generation - OTHERS');
1009: IF r_branch_cursor%ISOPEN THEN
1004:
1005: cep_standard.debug('<
1007: WHEN OTHERS THEN
1008: cep_standard.debug(' EXCEPTION: CE_ZBA_DEAL_GENERATION.zba_generation - OTHERS');
1009: IF r_branch_cursor%ISOPEN THEN
1010: CLOSE r_branch_cursor;
1011: END IF;
1012: IF r_bank_cursor%ISOPEN THEN
1015: IF line_cursor%ISOPEN THEN
1016: CLOSE line_cursor;
1017: END IF;
1018: lock_status := dbms_lock.release(lockhandle);
1019: cep_standard.debug('DEBUG: sqlcode:' || sqlcode );
1020: cep_standard.debug('DEBUG: sqlerrm:' || sqlerrm);
1021: RAISE;
1022: END zba_generation;
1023:
1016: CLOSE line_cursor;
1017: END IF;
1018: lock_status := dbms_lock.release(lockhandle);
1019: cep_standard.debug('DEBUG: sqlcode:' || sqlcode );
1020: cep_standard.debug('DEBUG: sqlerrm:' || sqlerrm);
1021: RAISE;
1022: END zba_generation;
1023:
1024: END CE_ZBA_DEAL_GENERATION;