12: This function will return the "maximum line number"+1 in the input pl/sql table.
13: */
14: FUNCTION max_line_number
15: (
16: p_invoice_lines_tab IN AP_IMPORT_INVOICES_PKG.lines_table --bug 15862708
17: )
18: RETURN NUMBER IS
19: l_max_line_number NUMBER;
20:
51: p_quantity IN NUMBER,
52: p_price IN NUMBER,
53: p_invoice_currency IN VARCHAR2,
54: p_index IN NUMBER,
55: p_invoice_lines_tab IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.lines_table --bug 15862708
56: )
57: RETURN BOOLEAN IS
58:
59: CURSOR rcv_txn_cur IS
136: ---------------------------------------------------------------------------------
137: IF (p_cascade_flag = 'Y' AND (p_quantity > 0 OR p_amount > 0)) THEN
138:
139: debug_info := '(Receipt Matching 3a) Matching to receipts by Cascading';
140: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
141: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
142: END IF;
143:
144: OPEN rcv_txn_cur;
137: IF (p_cascade_flag = 'Y' AND (p_quantity > 0 OR p_amount > 0)) THEN
138:
139: debug_info := '(Receipt Matching 3a) Matching to receipts by Cascading';
140: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
141: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
142: END IF;
143:
144: OPEN rcv_txn_cur;
145:
156: AND pll.line_location_id = p_po_line_location_id;
157:
158: LOOP
159: debug_info := '(Receipt Matching 3a) Fetch into cursor rcv_txn_cur';
160: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
161: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
162: End if;
163:
164: FETCH rcv_txn_cur INTO
157:
158: LOOP
159: debug_info := '(Receipt Matching 3a) Fetch into cursor rcv_txn_cur';
160: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
161: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
162: End if;
163:
164: FETCH rcv_txn_cur INTO
165: l_rcv_txn_id,
165: l_rcv_txn_id,
166: l_rcv_uom,
167: l_match_basis;
168:
169: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
170: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
171: '------------------> l_rcv_txn_id = '||to_char(l_rcv_txn_id)
172: ||' l_rcv_uom = ' ||l_rcv_uom
173: ||' l_remain_qty = '||to_char(l_remain_qty));
166: l_rcv_uom,
167: l_match_basis;
168:
169: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
170: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
171: '------------------> l_rcv_txn_id = '||to_char(l_rcv_txn_id)
172: ||' l_rcv_uom = ' ||l_rcv_uom
173: ||' l_remain_qty = '||to_char(l_remain_qty));
174: end if;
186: end if;
187: end if;
188:
189: debug_info := '(Receipt Matching 3a) Get quantities on the rcv_transaction ';
190: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
191: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
192: End if;
193:
194: IF (l_match_basis ='QUANTITY') THEN
187: end if;
188:
189: debug_info := '(Receipt Matching 3a) Get quantities on the rcv_transaction ';
190: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
191: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
192: End if;
193:
194: IF (l_match_basis ='QUANTITY') THEN
195:
194: IF (l_match_basis ='QUANTITY') THEN
195:
196: IF NVL(l_po_uom, 'X') <> NVL(l_rcv_uom, 'X') then
197: debug_info := '(Get Item Line Info 13.7-1) Get uom conv rate';
198: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
199: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
200: End if;
201:
202: l_uom_conv_rate :=
195:
196: IF NVL(l_po_uom, 'X') <> NVL(l_rcv_uom, 'X') then
197: debug_info := '(Get Item Line Info 13.7-1) Get uom conv rate';
198: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
199: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
200: End if;
201:
202: l_uom_conv_rate :=
203: po_uom_s.po_uom_convert
213: l_remain_qty_rcv_uom := l_remain_qty;
214: END IF;
215:
216: debug_info := '(Get Item Line Info 13.7-1) call get_quantities';
217: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
218: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
219: End if;
220:
221: RCV_INVOICE_MATCHING_SV.get_quantities
214: END IF;
215:
216: debug_info := '(Get Item Line Info 13.7-1) call get_quantities';
217: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
218: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
219: End if;
220:
221: RCV_INVOICE_MATCHING_SV.get_quantities
222: (
248: - nvl(l_cancelled_txn_qty ,0)
249: - nvl(l_rtv_txn_qty,0)
250: - nvl(l_billed_txn_qty,0);
251:
252: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
253: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
254: '------------------> ordered_txn_qty = '||to_char(l_ordered_txn_qty)
255: ||' cancelled_txn_qty = '||to_char(l_cancelled_txn_qty)
256: ||' received_txn_qty = '||to_char(l_received_txn_qty)
249: - nvl(l_rtv_txn_qty,0)
250: - nvl(l_billed_txn_qty,0);
251:
252: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
253: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
254: '------------------> ordered_txn_qty = '||to_char(l_ordered_txn_qty)
255: ||' cancelled_txn_qty = '||to_char(l_cancelled_txn_qty)
256: ||' received_txn_qty = '||to_char(l_received_txn_qty)
257: ||' corrected_txn_qty = '||to_char(l_corrected_txn_qty)
273: l_match_amt :=
274: ap_utilities_pkg.ap_round_currency ((l_match_qty * (p_price * l_uom_conv_rate)), p_invoice_currency);
275:
276: debug_info := '(Receipt Match 3a) Call the receipt match package ';
277: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
278: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
279: End if;
280:
281: p_invoice_lines_tab(p_invoice_lines_tab.LAST+1):= p_invoice_lines_tab(l_index);
274: ap_utilities_pkg.ap_round_currency ((l_match_qty * (p_price * l_uom_conv_rate)), p_invoice_currency);
275:
276: debug_info := '(Receipt Match 3a) Call the receipt match package ';
277: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
278: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
279: End if;
280:
281: p_invoice_lines_tab(p_invoice_lines_tab.LAST+1):= p_invoice_lines_tab(l_index);
282:
344: - nvl(l_corrected_amt,0)
345: - nvl(l_cancelled_amt,0)
346: - nvl(l_billed_amt,0);
347:
348: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
349: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
350: '------------------> ordered_amount = '||to_char(l_ordered_amt)
351: ||' cancelled_amount = '||to_char(l_cancelled_amt)
352: ||' received_amount = ' ||to_char(l_received_amt)
345: - nvl(l_cancelled_amt,0)
346: - nvl(l_billed_amt,0);
347:
348: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
349: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
350: '------------------> ordered_amount = '||to_char(l_ordered_amt)
351: ||' cancelled_amount = '||to_char(l_cancelled_amt)
352: ||' received_amount = ' ||to_char(l_received_amt)
353: ||' corrected_amount = '||to_char(l_corrected_amt)
395:
396: If (l_remain_qty > 0 and l_match_basis ='QUANTITY') Then
397:
398: debug_info := '(Receipt Match 3a) Assign the receipt number for the overbill - Quantity Match';
399: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
400: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
401: End if;
402:
403: l_match_qty := l_remain_qty;
396: If (l_remain_qty > 0 and l_match_basis ='QUANTITY') Then
397:
398: debug_info := '(Receipt Match 3a) Assign the receipt number for the overbill - Quantity Match';
399: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
400: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
401: End if;
402:
403: l_match_qty := l_remain_qty;
404: l_match_amt :=
421:
422: Elsif (l_remain_amt > 0 and l_match_basis ='AMOUNT') Then
423:
424: debug_info := '(Receipt Match 3a) Assign the receipt number for the overbill - Amount Match';
425: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
426: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
427: End if;
428:
429: l_match_amt := l_remain_amt;
422: Elsif (l_remain_amt > 0 and l_match_basis ='AMOUNT') Then
423:
424: debug_info := '(Receipt Match 3a) Assign the receipt number for the overbill - Amount Match';
425: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
426: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
427: End if;
428:
429: l_match_amt := l_remain_amt;
430: p_invoice_lines_tab(l_index-1).amount := p_invoice_lines_tab(l_index-1).amount + l_match_amt;
441: -- we reject earlier on itself if the total quantity we are trying
442: -- to bill would reduce the total quantity billed , 0
443: ------------------------------------------------------------------------------
444: debug_info := '(Receipt match 3b) Matching to receipts by Cascading';
445: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
446: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
447: End if;
448:
449: Open rcv_txn_cur;
442: -- to bill would reduce the total quantity billed , 0
443: ------------------------------------------------------------------------------
444: debug_info := '(Receipt match 3b) Matching to receipts by Cascading';
445: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
446: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
447: End if;
448:
449: Open rcv_txn_cur;
450:
453: l_remain_amt := p_amount;
454:
455: Loop
456: debug_info := 'Fetch into cursor rcv_txn_cur';
457: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
458: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
459: End if;
460:
461: Fetch rcv_txn_cur INTO
454:
455: Loop
456: debug_info := 'Fetch into cursor rcv_txn_cur';
457: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
458: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
459: End if;
460:
461: Fetch rcv_txn_cur INTO
462: l_rcv_txn_id,
462: l_rcv_txn_id,
463: l_rcv_uom,
464: l_match_basis;
465:
466: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
467: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
468: '------------------> l_rcv_txn_id = '||to_char(l_rcv_txn_id)
469: ||' l_rcv_uom = '||l_rcv_uom
470: ||' l_remain_qty '||to_char(l_remain_qty)
463: l_rcv_uom,
464: l_match_basis;
465:
466: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
467: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
468: '------------------> l_rcv_txn_id = '||to_char(l_rcv_txn_id)
469: ||' l_rcv_uom = '||l_rcv_uom
470: ||' l_remain_qty '||to_char(l_remain_qty)
471: ||' l_match_basis = '||l_match_basis);
489:
490: IF (l_match_basis ='QUANTITY') THEN
491:
492: debug_info := '(Receipt Match 3b) Get quantities on the rcv_transaction ';
493: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
494: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
495: End if;
496:
497: RCV_INVOICE_MATCHING_SV.get_quantities
490: IF (l_match_basis ='QUANTITY') THEN
491:
492: debug_info := '(Receipt Match 3b) Get quantities on the rcv_transaction ';
493: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
494: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
495: End if;
496:
497: RCV_INVOICE_MATCHING_SV.get_quantities
498: (
519:
520: -- Calculate the billed quantity on the rcv transaction
521: l_billed_qty := nvl(l_billed_txn_qty,0);
522:
523: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
524: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
525: '------------------> ordered_txn_qty = '||to_char(l_ordered_txn_qty)
526: ||' cancelled_txn_qty = '||to_char(l_cancelled_txn_qty)
527: ||' received_txn_qty = '||to_char(l_received_txn_qty)
520: -- Calculate the billed quantity on the rcv transaction
521: l_billed_qty := nvl(l_billed_txn_qty,0);
522:
523: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
524: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
525: '------------------> ordered_txn_qty = '||to_char(l_ordered_txn_qty)
526: ||' cancelled_txn_qty = '||to_char(l_cancelled_txn_qty)
527: ||' received_txn_qty = '||to_char(l_received_txn_qty)
528: ||' corrected_txn_qty = '||to_char(l_corrected_txn_qty)
578:
579: ELSIF (l_match_basis ='AMOUNT') THEN
580:
581: debug_info := '(Receipt Match 3b) Get amounts on the rcv_transaction ';
582: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
583: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
584: End if;
585:
586: RCV_INVOICE_MATCHING_SV.Get_ReceiveAmount
579: ELSIF (l_match_basis ='AMOUNT') THEN
580:
581: debug_info := '(Receipt Match 3b) Get amounts on the rcv_transaction ';
582: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
583: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
584: End if;
585:
586: RCV_INVOICE_MATCHING_SV.Get_ReceiveAmount
587: (
610:
611: -- Calculate the billed amount on the rcv transaction
612: l_billed_amt := nvl(l_billed_amt,0);
613:
614: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
615: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
616: '------------------> ordered_amount = '||to_char(l_ordered_amt)
617: ||' cancelled_amount = '||to_char(l_cancelled_amt)
618: ||' received_amount = '||to_char(l_received_amt)
611: -- Calculate the billed amount on the rcv transaction
612: l_billed_amt := nvl(l_billed_amt,0);
613:
614: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
615: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
616: '------------------> ordered_amount = '||to_char(l_ordered_amt)
617: ||' cancelled_amount = '||to_char(l_cancelled_amt)
618: ||' received_amount = '||to_char(l_received_amt)
619: ||' corrected_amount = '||to_char(l_corrected_amt)
665: End if; -- cascade_flag = 'Y' and quantity < 0
666: RETURN(TRUE);
667: EXCEPTION
668: WHEN OTHERS THEN
669: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
670: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
671: End if;
672: -- Get Error from Matching Package
673:
666: RETURN(TRUE);
667: EXCEPTION
668: WHEN OTHERS THEN
669: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
670: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
671: End if;
672: -- Get Error from Matching Package
673:
674: AP_UTILITIES_PKG.AP_GET_MESSAGE(l_matching_error);
671: End if;
672: -- Get Error from Matching Package
673:
674: AP_UTILITIES_PKG.AP_GET_MESSAGE(l_matching_error);
675: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
676: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,l_matching_error);
677: end if;
678:
679: IF (SQLCODE < 0) then
672: -- Get Error from Matching Package
673:
674: AP_UTILITIES_PKG.AP_GET_MESSAGE(l_matching_error);
675: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
676: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,l_matching_error);
677: end if;
678:
679: IF (SQLCODE < 0) then
680: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
676: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,l_matching_error);
677: end if;
678:
679: IF (SQLCODE < 0) then
680: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
681: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
682: End if;
683: END IF;
684:
677: end if;
678:
679: IF (SQLCODE < 0) then
680: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
681: AP_IMPORT_UTILITIES_PKG.Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
682: End if;
683: END IF;
684:
685: RETURN(FALSE);
716:
717: WHEN OTHERS then
718:
719: IF (SQLCODE < 0) then
720: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
721: AP_IMPORT_UTILITIES_PKG.Print(
722: AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
723: END IF;
724: END IF;
718:
719: IF (SQLCODE < 0) then
720: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
721: AP_IMPORT_UTILITIES_PKG.Print(
722: AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
723: END IF;
724: END IF;
725: RETURN 0;
726: END copy_attachments;
780: -- insert a idential record
781: -----------------------------------------------------------------------
782:
783: debug_info := '(Check_control_table 1) Lock the control table ';
784: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
785: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
786: END IF;
787:
788: LOCK TABLE AP_INTERFACE_CONTROLS IN EXCLUSIVE MODE;
781: -----------------------------------------------------------------------
782:
783: debug_info := '(Check_control_table 1) Lock the control table ';
784: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
785: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
786: END IF;
787:
788: LOCK TABLE AP_INTERFACE_CONTROLS IN EXCLUSIVE MODE;
789:
788: LOCK TABLE AP_INTERFACE_CONTROLS IN EXCLUSIVE MODE;
789:
790: debug_info := '(Check_control_table) Open import_requests cursor';
791:
792: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
793: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
794: END IF;
795:
796: -- Bug 4145391. To improve the performance of the import program coding two
789:
790: debug_info := '(Check_control_table) Open import_requests cursor';
791:
792: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
793: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
794: END IF;
795:
796: -- Bug 4145391. To improve the performance of the import program coding two
797: -- different cursors based on the parameter p_group_id
808: -- all requests from the source will be fetched
809: -------------------------------------------------------------------------
810:
811: debug_info := '(Check_control_table 2) Fetch import_requests';
812: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
813: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
814: END IF;
815:
816: -- Bug 4145391
809: -------------------------------------------------------------------------
810:
811: debug_info := '(Check_control_table 2) Fetch import_requests';
812: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
813: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
814: END IF;
815:
816: -- Bug 4145391
817: IF (p_group_id IS NULL) THEN
835: -- Check status for the concurrent program from the request_id
836: -----------------------------------------------------------------------
837:
838: debug_info := '(Check_control_table 3) Check concurrent program status';
839: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
840: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
841: debug_info||' previous req id ='||l_previous_request_id);
842: END IF;
843:
836: -----------------------------------------------------------------------
837:
838: debug_info := '(Check_control_table 3) Check concurrent program status';
839: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
840: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
841: debug_info||' previous req id ='||l_previous_request_id);
842: END IF;
843:
844: IF (FND_CONCURRENT.GET_REQUEST_STATUS(
849: status =>l_status,
850: dev_phase =>l_dev_phase,
851: dev_status =>l_dev_status,
852: message =>l_message) <> TRUE) THEN
853: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
854: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
855: 'FUNCTION GET_REQUEST_STATUS ERROR, Reason: '||l_message);
856: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
857: 'FND_CONCURRENT.GET_REQUEST_STATUS<-'||current_calling_sequence);
850: dev_phase =>l_dev_phase,
851: dev_status =>l_dev_status,
852: message =>l_message) <> TRUE) THEN
853: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
854: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
855: 'FUNCTION GET_REQUEST_STATUS ERROR, Reason: '||l_message);
856: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
857: 'FND_CONCURRENT.GET_REQUEST_STATUS<-'||current_calling_sequence);
858: END IF;
852: message =>l_message) <> TRUE) THEN
853: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
854: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
855: 'FUNCTION GET_REQUEST_STATUS ERROR, Reason: '||l_message);
856: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
857: 'FND_CONCURRENT.GET_REQUEST_STATUS<-'||current_calling_sequence);
858: END IF;
859: RAISE Check_control_failure;
860:
861: END IF;
862:
863: -- show output values (only if debug_switch = 'Y')
864:
865: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
866: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
867: '------------------> l_dev_phase = '||l_dev_phase
868: ||' l_dev_status = '||l_dev_status
869: ||' l_previous_request_id = '||to_char(l_previous_request_id));
862:
863: -- show output values (only if debug_switch = 'Y')
864:
865: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
866: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
867: '------------------> l_dev_phase = '||l_dev_phase
868: ||' l_dev_status = '||l_dev_status
869: ||' l_previous_request_id = '||to_char(l_previous_request_id));
870: END IF;
875: -- currentlt running
876: -------------------------------------------------------------------------
877: IF (l_dev_phase in ('PENDING','RUNNING','INACTIVE')) then
878:
879: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
880: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
881: 'ERROR: There are existing import processes currently in the status '
882: ||l_dev_phase||' for this source ('||p_source||') and group_id ('
883: ||p_group_id
876: -------------------------------------------------------------------------
877: IF (l_dev_phase in ('PENDING','RUNNING','INACTIVE')) then
878:
879: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
880: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
881: 'ERROR: There are existing import processes currently in the status '
882: ||l_dev_phase||' for this source ('||p_source||') and group_id ('
883: ||p_group_id
884: ||') , please check your concurrent process requests');
893: -- is 'COMPLETE'
894: ---------------------------------------------------------------------
895: debug_info := '(Check_control_table 4.2) Delete the previous record '||
896: 'in ap_interface_controls';
897: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
898: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
899: END IF;
900:
901: -- Bug 4145391
894: ---------------------------------------------------------------------
895: debug_info := '(Check_control_table 4.2) Delete the previous record '||
896: 'in ap_interface_controls';
897: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
898: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
899: END IF;
900:
901: -- Bug 4145391
902: IF (p_group_id IS NULL) THEN
914:
915: END LOOP;
916:
917: debug_info := '(Check_control_table) CLOSE import_requests cursor';
918: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
919: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
920: END IF;
921:
922: -- Bug 4145391
915: END LOOP;
916:
917: debug_info := '(Check_control_table) CLOSE import_requests cursor';
918: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
919: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
920: END IF;
921:
922: -- Bug 4145391
923: IF (p_group_id IS NULL) THEN
931: -- Insert record into control table
932: -----------------------------------------
933:
934: debug_info := '(Check_control_table 5) Insert record into control table';
935: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
936: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
937: END IF;
938:
939: INSERT INTO AP_INTERFACE_CONTROLS(
932: -----------------------------------------
933:
934: debug_info := '(Check_control_table 5) Insert record into control table';
935: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
936: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
937: END IF;
938:
939: INSERT INTO AP_INTERFACE_CONTROLS(
940: source,
941: group_id,
942: request_id)
943: VALUES (p_source,
944: p_group_id,
945: AP_IMPORT_INVOICES_PKG.g_conc_request_id);
946:
947: ----------------------------------------------------------------------------
948: -- Step 6
949: -- Commit the change to database, it will also release the lock for the table
949: -- Commit the change to database, it will also release the lock for the table
950: ----------------------------------------------------------------------------
951:
952: debug_info := '(Check_control_table 6) Commit';
953: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
954: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
955: END IF;
956:
957: COMMIT;
950: ----------------------------------------------------------------------------
951:
952: debug_info := '(Check_control_table 6) Commit';
953: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
954: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
955: END IF;
956:
957: COMMIT;
958:
960:
961: EXCEPTION
962:
963: WHEN OTHERS then
964: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
965: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
966: END IF;
967:
968: IF (SQLCODE < 0) then
961: EXCEPTION
962:
963: WHEN OTHERS then
964: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
965: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
966: END IF;
967:
968: IF (SQLCODE < 0) then
969: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
965: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
966: END IF;
967:
968: IF (SQLCODE < 0) then
969: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
970: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
971: END IF;
972: END IF;
973:
966: END IF;
967:
968: IF (SQLCODE < 0) then
969: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
970: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
971: END IF;
972: END IF;
973:
974: -- Bug 4145391
1071:
1072: debug_info := '(Insert Rejections 1) Insert into AP_INTERFACE_REJECTIONS, '||
1073: 'REJECT CODE:'||p_reject_code;
1074:
1075: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1076: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1077: END IF;
1078:
1079: IF(AP_IMPORT_INVOICES_PKG.g_source = 'XML GATEWAY'
1072: debug_info := '(Insert Rejections 1) Insert into AP_INTERFACE_REJECTIONS, '||
1073: 'REJECT CODE:'||p_reject_code;
1074:
1075: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1076: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1077: END IF;
1078:
1079: IF(AP_IMPORT_INVOICES_PKG.g_source = 'XML GATEWAY'
1080: AND NVL(p_notify_vendor_flag,'Y') = 'Y'
1075: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1076: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1077: END IF;
1078:
1079: IF(AP_IMPORT_INVOICES_PKG.g_source = 'XML GATEWAY'
1080: AND NVL(p_notify_vendor_flag,'Y') = 'Y'
1081: AND p_reject_code in ('CAN MATCH TO ONLY 1 LINE',
1082: 'DUPLICATE INVOICE NUMBER',
1083: 'DUPLICATE LINE NUMBER',
1104: -------------------------------------------------
1105:
1106: debug_info := '(Insert Rejections 2) '||
1107: 'Set notify_vendor_flag for XML GATEWAY';
1108: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1109: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1110: END IF;
1111:
1112: INSERT INTO AP_INTERFACE_REJECTIONS(
1105:
1106: debug_info := '(Insert Rejections 2) '||
1107: 'Set notify_vendor_flag for XML GATEWAY';
1108: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1109: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1110: END IF;
1111:
1112: INSERT INTO AP_INTERFACE_REJECTIONS(
1113: parent_table,
1194: RETURN(TRUE);
1195:
1196: EXCEPTION
1197: WHEN OTHERS then
1198: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
1199: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1200: END IF;
1201:
1202: IF (SQLCODE < 0) then
1195:
1196: EXCEPTION
1197: WHEN OTHERS then
1198: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
1199: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1200: END IF;
1201:
1202: IF (SQLCODE < 0) then
1203: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
1199: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1200: END IF;
1201:
1202: IF (SQLCODE < 0) then
1203: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
1204: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
1205: END IF;
1206: END IF;
1207:
1200: END IF;
1201:
1202: IF (SQLCODE < 0) then
1203: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
1204: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
1205: END IF;
1206: END IF;
1207:
1208: RETURN (FALSE);
1239: -- Get quantity_outstanding
1240: --------------------------------------------------------------------------
1241:
1242: debug_info := '(Get Overbill for Shipment 1) Get quantity_outstanding';
1243: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
1244: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1245: END IF;
1246:
1247: --Contract Payments: modified the SELECT clause
1240: --------------------------------------------------------------------------
1241:
1242: debug_info := '(Get Overbill for Shipment 1) Get quantity_outstanding';
1243: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
1244: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1245: END IF;
1246:
1247: --Contract Payments: modified the SELECT clause
1248: SELECT decode(pod.distribution_type,'PREPAYMENT',
1281: AND pll.line_location_id = pod.line_location_id
1282: GROUP BY pod.distribution_type,pll.matching_basis ;
1283:
1284:
1285: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
1286: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,'------------------>
1287: p_quantity_outstanding = '||to_char(p_quantity_outstanding)
1288: ||' p_quantity_ordered = '||to_char(p_quantity_ordered)
1289: ||' p_qty_already_billed = '||to_char(p_qty_already_billed)
1282: GROUP BY pod.distribution_type,pll.matching_basis ;
1283:
1284:
1285: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
1286: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,'------------------>
1287: p_quantity_outstanding = '||to_char(p_quantity_outstanding)
1288: ||' p_quantity_ordered = '||to_char(p_quantity_ordered)
1289: ||' p_qty_already_billed = '||to_char(p_qty_already_billed)
1290: ||' p_amount_outstanding = '||to_char(p_amount_outstanding)
1317:
1318: EXCEPTION
1319:
1320: WHEN OTHERS THEN
1321: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1322: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1323: END IF;
1324: IF (SQLCODE < 0) THEN
1325: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1318: EXCEPTION
1319:
1320: WHEN OTHERS THEN
1321: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1322: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1323: END IF;
1324: IF (SQLCODE < 0) THEN
1325: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1326: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
1321: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1322: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1323: END IF;
1324: IF (SQLCODE < 0) THEN
1325: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1326: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
1327: END IF;
1328: END IF;
1329:
1322: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1323: END IF;
1324: IF (SQLCODE < 0) THEN
1325: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1326: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
1327: END IF;
1328: END IF;
1329:
1330: RETURN (FALSE);
1364: debug_info := 'Check batch_name existance';
1365:
1366: BEGIN
1367: debug_info := '(Get_batch_id 1) Get old batch id';
1368: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1369: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1370: END IF;
1371:
1372: SELECT 'OLD BATCH',
1365:
1366: BEGIN
1367: debug_info := '(Get_batch_id 1) Get old batch id';
1368: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1369: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1370: END IF;
1371:
1372: SELECT 'OLD BATCH',
1373: batch_id
1387: -- Get New batch_id and Batch_date
1388: ---------------------------------------------
1389:
1390: debug_info := '(Get_batch_id 2) Get New batch_id';
1391: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1392: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1393: END IF;
1394:
1395: SELECT ap_batches_s.nextval
1388: ---------------------------------------------
1389:
1390: debug_info := '(Get_batch_id 2) Get New batch_id';
1391: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1392: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1393: END IF;
1394:
1395: SELECT ap_batches_s.nextval
1396: INTO l_batch_id
1403: RETURN(TRUE);
1404:
1405: EXCEPTION
1406: WHEN OTHERS then
1407: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1408: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1409: END IF;
1410:
1411: IF (SQLCODE < 0) THEN
1404:
1405: EXCEPTION
1406: WHEN OTHERS then
1407: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1408: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1409: END IF;
1410:
1411: IF (SQLCODE < 0) THEN
1412: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1408: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1409: END IF;
1410:
1411: IF (SQLCODE < 0) THEN
1412: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1413: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
1414: END IF;
1415: END IF;
1416:
1409: END IF;
1410:
1411: IF (SQLCODE < 0) THEN
1412: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1413: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
1414: END IF;
1415: END IF;
1416:
1417: RETURN (FALSE);
1435: 'AP_Import_Utilities_Pkg.get_auto_batch_name<-' ||p_calling_sequence;
1436:
1437: debug_info := '(Get_auto_batch_name 1) automatically create batch name';
1438:
1439: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1440: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1441: END IF;
1442:
1443: SELECT ap_batches_s2.nextval
1436:
1437: debug_info := '(Get_auto_batch_name 1) automatically create batch name';
1438:
1439: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1440: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1441: END IF;
1442:
1443: SELECT ap_batches_s2.nextval
1444: INTO l_batch_num
1519: current_calling_sequence :=
1520: 'AP_Import_Utilities_Pkg.Get_info<-'||P_calling_sequence;
1521:
1522: debug_info := '(Get_info 1) Read from ap_system_parameters';
1523: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1524: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1525: END IF;
1526:
1527: SELECT
1520: 'AP_Import_Utilities_Pkg.Get_info<-'||P_calling_sequence;
1521:
1522: debug_info := '(Get_info 1) Read from ap_system_parameters';
1523: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1524: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1525: END IF;
1526:
1527: SELECT
1528: set_of_books_id,
1569: ap_product_setup aps
1570: WHERE asp.org_id = p_org_id;
1571:
1572: debug_info := '(Get_info 2) Get Batch Control Profile Option';
1573: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1574: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1575: END IF;
1576:
1577: BEGIN
1570: WHERE asp.org_id = p_org_id;
1571:
1572: debug_info := '(Get_info 2) Get Batch Control Profile Option';
1573: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1574: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1575: END IF;
1576:
1577: BEGIN
1578: FND_PROFILE.GET('AP_USE_INV_BATCH_CONTROLS',p_batch_control_flag);
1582: p_batch_control_flag := 'N';
1583: END ;
1584:
1585: debug_info := '(Get_info 3) Get encumbrance option';
1586: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1587: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1588: END IF;
1589:
1590: SELECT purch_encumbrance_flag, retainage_code_combination_id
1583: END ;
1584:
1585: debug_info := '(Get_info 3) Get encumbrance option';
1586: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1587: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1588: END IF;
1589:
1590: SELECT purch_encumbrance_flag, retainage_code_combination_id
1591: INTO p_purch_encumbrance_flag, p_retainage_ccid
1592: FROM financials_system_params_all
1593: WHERE org_id = p_org_id;
1594:
1595: debug_info := '(Get_info 4) Get minimum_accountable_unit';
1596: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
1597: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1598: END IF;
1599:
1600: FND_CURRENCY.GET_INFO(
1593: WHERE org_id = p_org_id;
1594:
1595: debug_info := '(Get_info 4) Get minimum_accountable_unit';
1596: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
1597: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1598: END IF;
1599:
1600: FND_CURRENCY.GET_INFO(
1601: p_base_currency_code ,
1603: l_ext_precision ,
1604: p_base_min_acct_unit);
1605:
1606: debug_info := '(Get_info 5) Get p_sequence_numbering';
1607: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1608: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1609: END IF;
1610:
1611: p_sequence_numbering := FND_PROFILE.VALUE('UNIQUE:SEQ_NUMBERS');
1604: p_base_min_acct_unit);
1605:
1606: debug_info := '(Get_info 5) Get p_sequence_numbering';
1607: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1608: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1609: END IF;
1610:
1611: p_sequence_numbering := FND_PROFILE.VALUE('UNIQUE:SEQ_NUMBERS');
1612:
1611: p_sequence_numbering := FND_PROFILE.VALUE('UNIQUE:SEQ_NUMBERS');
1612:
1613:
1614: debug_info := '(Get_info 6) Get gl_date based on report parameters';
1615: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1616: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
1617: END IF;
1618:
1619: -- Bug 5645581. Gl_date will calculated at the Import_Invoices
1612:
1613:
1614: debug_info := '(Get_info 6) Get gl_date based on report parameters';
1615: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1616: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
1617: END IF;
1618:
1619: -- Bug 5645581. Gl_date will calculated at the Import_Invoices
1620: -- Procedure in the Main Package
1621: /*IF p_source = 'ERS' THEN -- bug 5382889, LE TimeZone
1622:
1623: debug_info := 'Determine gl_date from ERS invoice';
1624:
1625: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1626: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
1627: END IF;
1628:
1629: l_rts_txn_le_date := INV_LE_TIMEZONE_PUB.Get_Le_Day_For_Ou(
1622:
1623: debug_info := 'Determine gl_date from ERS invoice';
1624:
1625: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1626: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
1627: END IF;
1628:
1629: l_rts_txn_le_date := INV_LE_TIMEZONE_PUB.Get_Le_Day_For_Ou(
1630: p_trxn_date => nvl(p_goods_received_date, p_invoice_date)
1647: -- Note here that the Invoice date is no longer the same as the receipt_date,
1648: -- i.e. the RETURN tranasaction_date , so case I and N are no longer the same
1649:
1650: debug_info := 'Determine invoice gl_date from LE Timezone API ';
1651: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1652: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
1653: END IF;
1654:
1655: If (p_gl_date_from_receipt_flag = 'I') Then
1648: -- i.e. the RETURN tranasaction_date , so case I and N are no longer the same
1649:
1650: debug_info := 'Determine invoice gl_date from LE Timezone API ';
1651: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1652: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
1653: END IF;
1654:
1655: If (p_gl_date_from_receipt_flag = 'I') Then
1656: l_inv_gl_date := l_inv_le_date;
1667: ELSE
1668: IF (p_gl_date IS NULL) THEN
1669: IF (p_gl_date_from_receipt_flag IN ('S','Y')) THEN
1670: debug_info := '(Get_info 6a) GL Date is Sysdate';
1671: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1672: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1673: END IF;
1674:
1675: p_gl_date := sysdate;
1668: IF (p_gl_date IS NULL) THEN
1669: IF (p_gl_date_from_receipt_flag IN ('S','Y')) THEN
1670: debug_info := '(Get_info 6a) GL Date is Sysdate';
1671: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1672: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1673: END IF;
1674:
1675: p_gl_date := sysdate;
1676:
1675: p_gl_date := sysdate;
1676:
1677: ELSE
1678: debug_info := '(Get_info 6b) GL Date should be Invoice Date';
1679: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1680: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1681: END IF;
1682: END IF;
1683: END IF;
1676:
1677: ELSE
1678: debug_info := '(Get_info 6b) GL Date should be Invoice Date';
1679: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1680: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1681: END IF;
1682: END IF;
1683: END IF;
1684: END IF;
1684: END IF;
1685:
1686: p_gl_date := trunc(p_gl_date); */
1687: debug_info := '(Get_info 7) Check if PA is installed';
1688: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1689: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1690: END IF;
1691:
1692: IF (FND_INSTALLATION.GET(275, 275, l_status, l_industry)) THEN
1685:
1686: p_gl_date := trunc(p_gl_date); */
1687: debug_info := '(Get_info 7) Check if PA is installed';
1688: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1689: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1690: END IF;
1691:
1692: IF (FND_INSTALLATION.GET(275, 275, l_status, l_industry)) THEN
1693: IF (l_status <> 'I') THEN
1693: IF (l_status <> 'I') THEN
1694: P_PA_INSTALLED := 'N';
1695: ELSE
1696: P_PA_INSTALLED := 'Y';
1697: AP_IMPORT_INVOICES_PKG.g_pa_allows_overrides :=
1698: NVL(FND_PROFILE.VALUE('PA_ALLOW_FLEXBUILDER_OVERRIDES'), 'N');
1699: END IF;
1700: ELSE
1701: RAISE get_info_failure;
1700: ELSE
1701: RAISE get_info_failure;
1702: END IF;
1703:
1704: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1705: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
1706: '------------------> l_status = '|| l_status
1707: ||' l_industry = ' ||l_industry
1708: ||' p_pa_installed = '||p_pa_installed);
1701: RAISE get_info_failure;
1702: END IF;
1703:
1704: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1705: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
1706: '------------------> l_status = '|| l_status
1707: ||' l_industry = ' ||l_industry
1708: ||' p_pa_installed = '||p_pa_installed);
1709: END IF;
1708: ||' p_pa_installed = '||p_pa_installed);
1709: END IF;
1710:
1711: debug_info := '(Get_info 8) Get chart_of_accounts_id from p_set_of_books_id';
1712: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1713: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1714: END IF;
1715:
1716: SELECT chart_of_accounts_id
1709: END IF;
1710:
1711: debug_info := '(Get_info 8) Get chart_of_accounts_id from p_set_of_books_id';
1712: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1713: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1714: END IF;
1715:
1716: SELECT chart_of_accounts_id
1717: INTO p_chart_of_accounts_id
1720:
1721: -- Bug 5448579
1722:
1723: /* debug_info := '(Get_info 9) Get Asset Book Type Code';
1724: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1725: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1726: END IF;
1727: BEGIN
1728: SELECT count(*)
1721: -- Bug 5448579
1722:
1723: /* debug_info := '(Get_info 9) Get Asset Book Type Code';
1724: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1725: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1726: END IF;
1727: BEGIN
1728: SELECT count(*)
1729: INTO l_asset_book_count
1754:
1755: p_asset_book_type := NULL; --bug 7584682
1756:
1757: debug_info := '(Get_info 9) Get system tolerances';
1758: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1759: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1760: END IF;
1761:
1762: -- For EDI transactions, if the price and qty tolerance is set to null
1755: p_asset_book_type := NULL; --bug 7584682
1756:
1757: debug_info := '(Get_info 9) Get system tolerances';
1758: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1759: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1760: END IF;
1761:
1762: -- For EDI transactions, if the price and qty tolerance is set to null
1763: -- we assume this to be zero. This is implemented as per discussion with
1794:
1795:
1796: EXCEPTION
1797: WHEN OTHERS then
1798: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1799: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1800: END IF;
1801:
1802: IF (SQLCODE < 0) then
1795:
1796: EXCEPTION
1797: WHEN OTHERS then
1798: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1799: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1800: END IF;
1801:
1802: IF (SQLCODE < 0) then
1803: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1799: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1800: END IF;
1801:
1802: IF (SQLCODE < 0) then
1803: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1804: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
1805: END IF;
1806: END IF;
1807:
1800: END IF;
1801:
1802: IF (SQLCODE < 0) then
1803: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
1804: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
1805: END IF;
1806: END IF;
1807:
1808: RETURN (FALSE);
1840: l_price_tolerance ap_tolerance_templates.price_tolerance%TYPE;
1841: BEGIN
1842:
1843: debug_info := '(Get_tolerance_info 1) Get tolerance info...';
1844: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
1845: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1846: End if;
1847:
1848: -- For EDI transactions, if the price and qty tolerance is set to null
1841: BEGIN
1842:
1843: debug_info := '(Get_tolerance_info 1) Get tolerance info...';
1844: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
1845: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1846: End if;
1847:
1848: -- For EDI transactions, if the price and qty tolerance is set to null
1849: -- we assume this to be zero. This is implemented as per discussion with
1880:
1881: EXCEPTION
1882: when no_data_found then
1883: debug_info := '(get_tolerance_info 1) NO_DATA_FOUND exception';
1884: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
1885: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1886: End if;
1887: END;
1888:
1881: EXCEPTION
1882: when no_data_found then
1883: debug_info := '(get_tolerance_info 1) NO_DATA_FOUND exception';
1884: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
1885: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1886: End if;
1887: END;
1888:
1889:
1911:
1912: EXCEPTION WHEN NO_DATA_FOUND THEN
1913:
1914: debug_info := '(get_tolerance_info 2) NO_DATA_FOUND exception';
1915: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
1916: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1917: End if;
1918:
1919: END;
1912: EXCEPTION WHEN NO_DATA_FOUND THEN
1913:
1914: debug_info := '(get_tolerance_info 2) NO_DATA_FOUND exception';
1915: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
1916: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
1917: End if;
1918:
1919: END;
1920:
1917: End if;
1918:
1919: END;
1920:
1921: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
1922: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,'------------------> p_vendor_site_id = '||
1923: to_char(p_vendor_site_id)
1924: ||' l_price_tolerance = '||to_char(l_price_tolerance)
1925: ||' l_positive_price_tolerance = '||to_char(p_positive_price_tolerance)
1918:
1919: END;
1920:
1921: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
1922: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,'------------------> p_vendor_site_id = '||
1923: to_char(p_vendor_site_id)
1924: ||' l_price_tolerance = '||to_char(l_price_tolerance)
1925: ||' l_positive_price_tolerance = '||to_char(p_positive_price_tolerance)
1926: ||' l_negative_price_tolerance = '||to_char(p_negative_price_tolerance)
1944:
1945: EXCEPTION
1946:
1947: WHEN OTHERS then
1948: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
1949: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info); End if;
1950:
1951: IF (SQLCODE < 0) then
1952: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y'
1945: EXCEPTION
1946:
1947: WHEN OTHERS then
1948: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
1949: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info); End if;
1950:
1951: IF (SQLCODE < 0) then
1952: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y'
1953: then Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM); End if;
1948: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' then
1949: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info); End if;
1950:
1951: IF (SQLCODE < 0) then
1952: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y'
1953: then Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM); End if;
1954: END IF;
1955:
1956: RETURN (FALSE);
1949: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info); End if;
1950:
1951: IF (SQLCODE < 0) then
1952: If AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y'
1953: then Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM); End if;
1954: END IF;
1955:
1956: RETURN (FALSE);
1957:
1979: FROM po_vendor_sites PVS
1980: WHERE vendor_id = p_vendor_id
1981: AND pay_site_flag = 'Y'
1982: AND primary_pay_site_flag = 'Y'
1983: AND NVL(trunc(PVS.INACTIVE_DATE),AP_IMPORT_INVOICES_PKG.g_inv_sysdate+1)
1984: > AP_IMPORT_INVOICES_PKG.g_inv_sysdate ;
1985:
1986: CURSOR pay_site_cur IS
1987: SELECT vendor_site_id
1980: WHERE vendor_id = p_vendor_id
1981: AND pay_site_flag = 'Y'
1982: AND primary_pay_site_flag = 'Y'
1983: AND NVL(trunc(PVS.INACTIVE_DATE),AP_IMPORT_INVOICES_PKG.g_inv_sysdate+1)
1984: > AP_IMPORT_INVOICES_PKG.g_inv_sysdate ;
1985:
1986: CURSOR pay_site_cur IS
1987: SELECT vendor_site_id
1988: FROM po_vendor_sites PVS
1987: SELECT vendor_site_id
1988: FROM po_vendor_sites PVS
1989: WHERE vendor_id = p_vendor_id
1990: AND pay_site_flag = 'Y'
1991: AND NVL(trunc(PVS.INACTIVE_DATE),AP_IMPORT_INVOICES_PKG.g_inv_sysdate+1)
1992: > AP_IMPORT_INVOICES_PKG.g_inv_sysdate ;
1993:
1994: l_vendor_site_id PO_VENDOR_SITES.VENDOR_SITE_ID%TYPE;
1995: l_paysite_count NUMBER;
1988: FROM po_vendor_sites PVS
1989: WHERE vendor_id = p_vendor_id
1990: AND pay_site_flag = 'Y'
1991: AND NVL(trunc(PVS.INACTIVE_DATE),AP_IMPORT_INVOICES_PKG.g_inv_sysdate+1)
1992: > AP_IMPORT_INVOICES_PKG.g_inv_sysdate ;
1993:
1994: l_vendor_site_id PO_VENDOR_SITES.VENDOR_SITE_ID%TYPE;
1995: l_paysite_count NUMBER;
1996: current_calling_sequence VARCHAR2(2000);
2003: 'AP_IMPORT_UTILITIES_PKG.find_vendor_primary_paysite<-'
2004: ||P_calling_sequence;
2005:
2006: debug_info := '(Find vendor primary paysite 1) Get the primary paysite';
2007: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
2008: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2009: END IF;
2010:
2011: OPEN primary_pay_site_cur;
2004: ||P_calling_sequence;
2005:
2006: debug_info := '(Find vendor primary paysite 1) Get the primary paysite';
2007: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
2008: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2009: END IF;
2010:
2011: OPEN primary_pay_site_cur;
2012: FETCH primary_pay_site_cur INTO l_vendor_site_id;
2018: INTO l_paysite_count
2019: FROM po_vendor_sites PVS
2020: WHERE vendor_id = p_vendor_id
2021: AND pay_site_flag = 'Y'
2022: AND NVL(trunc(PVS.INACTIVE_DATE),AP_IMPORT_INVOICES_PKG.g_inv_sysdate+1)
2023: > AP_IMPORT_INVOICES_PKG.g_inv_sysdate ;
2024:
2025: IF ( l_paysite_count = 1 ) THEN
2026: OPEN pay_site_cur;
2019: FROM po_vendor_sites PVS
2020: WHERE vendor_id = p_vendor_id
2021: AND pay_site_flag = 'Y'
2022: AND NVL(trunc(PVS.INACTIVE_DATE),AP_IMPORT_INVOICES_PKG.g_inv_sysdate+1)
2023: > AP_IMPORT_INVOICES_PKG.g_inv_sysdate ;
2024:
2025: IF ( l_paysite_count = 1 ) THEN
2026: OPEN pay_site_cur;
2027: FETCH pay_site_cur INTO l_vendor_site_id;
2038:
2039: EXCEPTION
2040:
2041: WHEN OTHERS THEN
2042: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2043: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2044: END IF;
2045: IF (SQLCODE < 0) then
2046: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2039: EXCEPTION
2040:
2041: WHEN OTHERS THEN
2042: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2043: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2044: END IF;
2045: IF (SQLCODE < 0) then
2046: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2047: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
2042: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2043: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2044: END IF;
2045: IF (SQLCODE < 0) then
2046: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2047: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
2048: END IF;
2049: END IF;
2050:
2043: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2044: END IF;
2045: IF (SQLCODE < 0) then
2046: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2047: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
2048: END IF;
2049: END IF;
2050:
2051: RETURN (FALSE);
2075: current_calling_sequence := 'get_employee_id<-'||P_calling_sequence;
2076:
2077: BEGIN
2078: debug_info := '(Get_employee_id 1) Get employee id from po_vendors';
2079: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2080: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2081: END IF;
2082:
2083: SELECT employee_id
2076:
2077: BEGIN
2078: debug_info := '(Get_employee_id 1) Get employee id from po_vendors';
2079: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2080: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2081: END IF;
2082:
2083: SELECT employee_id
2084: INTO l_employee_id
2091: -- Potentially this should never happen
2092: -- as vendor is already validated at the invoice level
2093:
2094: debug_info := '(Get_employee_id 2) Vendor Id is invalid';
2095: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
2096: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2097: END IF;
2098:
2099: -- Reject Here for Invalid Vendor
2092: -- as vendor is already validated at the invoice level
2093:
2094: debug_info := '(Get_employee_id 2) Vendor Id is invalid';
2095: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
2096: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2097: END IF;
2098:
2099: -- Reject Here for Invalid Vendor
2100:
2098:
2099: -- Reject Here for Invalid Vendor
2100:
2101: debug_info := '(Get emloyee_id 3) Check for invalid Supplier.';
2102: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2103: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2104: END IF;
2105:
2106: IF (insert_rejections(AP_IMPORT_INVOICES_PKG.g_invoices_table,
2099: -- Reject Here for Invalid Vendor
2100:
2101: debug_info := '(Get emloyee_id 3) Check for invalid Supplier.';
2102: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2103: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2104: END IF;
2105:
2106: IF (insert_rejections(AP_IMPORT_INVOICES_PKG.g_invoices_table,
2107: p_invoice_id,
2102: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2103: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2104: END IF;
2105:
2106: IF (insert_rejections(AP_IMPORT_INVOICES_PKG.g_invoices_table,
2107: p_invoice_id,
2108: 'INVALID SUPPLIER',
2109: p_default_last_updated_by,
2110: p_default_last_update_login,
2108: 'INVALID SUPPLIER',
2109: p_default_last_updated_by,
2110: p_default_last_update_login,
2111: current_calling_sequence) <> TRUE) THEN
2112: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
2113: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2114: 'insert_rejections<-'||current_calling_sequence);
2115: END IF;
2116: RAISE get_employee_failure;
2109: p_default_last_updated_by,
2110: p_default_last_update_login,
2111: current_calling_sequence) <> TRUE) THEN
2112: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
2113: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2114: 'insert_rejections<-'||current_calling_sequence);
2115: END IF;
2116: RAISE get_employee_failure;
2117: END IF;
2122:
2123: -- We shall not reject if employee id is Null
2124:
2125: debug_info := '(Get_employee_id 3) Employee_id id Null';
2126: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2127: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2128: END IF;
2129:
2130: END IF;
2123: -- We shall not reject if employee id is Null
2124:
2125: debug_info := '(Get_employee_id 3) Employee_id id Null';
2126: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2127: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2128: END IF;
2129:
2130: END IF;
2131: --
2135: RETURN(TRUE);
2136:
2137: EXCEPTION
2138: WHEN OTHERS THEN
2139: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2140: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2141: END IF;
2142:
2143: IF (SQLCODE < 0) THEN
2136:
2137: EXCEPTION
2138: WHEN OTHERS THEN
2139: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2140: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2141: END IF;
2142:
2143: IF (SQLCODE < 0) THEN
2144: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2140: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2141: END IF;
2142:
2143: IF (SQLCODE < 0) THEN
2144: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2145: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
2146: END IF;
2147: END IF;
2148:
2141: END IF;
2142:
2143: IF (SQLCODE < 0) THEN
2144: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2145: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
2146: END IF;
2147: END IF;
2148:
2149: RETURN (FALSE);
2174: --------------------------------------------------------------------------
2175:
2176: debug_info := '(Get Next Dist Line Num 1) Get the next available '||
2177: 'distribution line number';
2178: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2179: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2180: END IF;
2181:
2182: /* For bug 3929697
2175:
2176: debug_info := '(Get Next Dist Line Num 1) Get the next available '||
2177: 'distribution line number';
2178: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2179: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2180: END IF;
2181:
2182: /* For bug 3929697
2183: * Before executing the select for getting the value
2211: lg_dist_line_num := p_next_dist_num;
2212: RETURN(TRUE);
2213:
2214: WHEN OTHERS THEN
2215: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2216: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2217: END IF;
2218:
2219: IF (SQLCODE < 0) THEN
2212: RETURN(TRUE);
2213:
2214: WHEN OTHERS THEN
2215: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2216: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2217: END IF;
2218:
2219: IF (SQLCODE < 0) THEN
2220: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2216: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2217: END IF;
2218:
2219: IF (SQLCODE < 0) THEN
2220: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2221: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
2222: END IF;
2223: END IF;
2224:
2217: END IF;
2218:
2219: IF (SQLCODE < 0) THEN
2220: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2221: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
2222: END IF;
2223: END IF;
2224:
2225: RETURN (FALSE);
2252: -- Step 1
2253: -- Get quantity_outstanding
2254: ----------------------------------------------------------------------------
2255: debug_info := '(Get Overbill for PO Line 1) Get quantity_outstanding';
2256: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2257: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2258: END IF;
2259:
2260: --Contract Payments: Modified the SELECT clause
2253: -- Get quantity_outstanding
2254: ----------------------------------------------------------------------------
2255: debug_info := '(Get Overbill for PO Line 1) Get quantity_outstanding';
2256: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2257: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2258: END IF;
2259:
2260: --Contract Payments: Modified the SELECT clause
2261: /*-----------------------------------------------------------------------------------------+
2341: -- bug fix 6959362 starts
2342: group by pl.matching_basis, pll.shipment_type;
2343: -- bug fix 6959362 ends
2344:
2345: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2346: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2347: '------------------> p_outstanding = '
2348: ||to_char(p_outstanding)
2349: ||' p_ordered = '||to_char(p_ordered)
2342: group by pl.matching_basis, pll.shipment_type;
2343: -- bug fix 6959362 ends
2344:
2345: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2346: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2347: '------------------> p_outstanding = '
2348: ||to_char(p_outstanding)
2349: ||' p_ordered = '||to_char(p_ordered)
2350: ||' p_already_billed = '||to_char(p_already_billed));
2372: RETURN(TRUE);
2373:
2374: EXCEPTION
2375: WHEN OTHERS THEN
2376: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2377: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2378: END IF;
2379:
2380: IF (SQLCODE < 0) THEN
2373:
2374: EXCEPTION
2375: WHEN OTHERS THEN
2376: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2377: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2378: END IF;
2379:
2380: IF (SQLCODE < 0) THEN
2381: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2377: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2378: END IF;
2379:
2380: IF (SQLCODE < 0) THEN
2381: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2382: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
2383: END IF;
2384: END IF;
2385:
2378: END IF;
2379:
2380: IF (SQLCODE < 0) THEN
2381: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2382: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
2383: END IF;
2384: END IF;
2385:
2386: RETURN (FALSE);
2389:
2390:
2391: FUNCTION pa_flexbuild (
2392: p_invoice_rec IN
2393: AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
2394: p_invoice_lines_rec IN OUT NOCOPY
2395: AP_IMPORT_INVOICES_PKG.r_line_info_rec,
2396: p_accounting_date IN DATE,
2397: p_pa_installed IN VARCHAR2,
2391: FUNCTION pa_flexbuild (
2392: p_invoice_rec IN
2393: AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
2394: p_invoice_lines_rec IN OUT NOCOPY
2395: AP_IMPORT_INVOICES_PKG.r_line_info_rec,
2396: p_accounting_date IN DATE,
2397: p_pa_installed IN VARCHAR2,
2398: p_employee_id IN NUMBER,
2399: p_base_currency_code IN VARCHAR2,
2439: -- Step 1
2440: ----------------------------------------------------------------------------
2441:
2442: debug_info := '(PA Flexbuild 1) Check for PA installation and Project Info';
2443: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2444: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2445: END IF;
2446:
2447: IF (p_pa_installed = 'Y' AND
2440: ----------------------------------------------------------------------------
2441:
2442: debug_info := '(PA Flexbuild 1) Check for PA installation and Project Info';
2443: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2444: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2445: END IF;
2446:
2447: IF (p_pa_installed = 'Y' AND
2448: p_invoice_lines_rec.project_id is not null) THEN
2451: -- installed and there is a project_id; that is, the invoice is
2452: -- project-related.
2453:
2454: debug_info := '(PA Flexbuild 1) Get User Id';
2455: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2456: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2457: END IF;
2458:
2459: user_id := to_number(FND_GLOBAL.USER_ID);
2452: -- project-related.
2453:
2454: debug_info := '(PA Flexbuild 1) Get User Id';
2455: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2456: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2457: END IF;
2458:
2459: user_id := to_number(FND_GLOBAL.USER_ID);
2460:
2458:
2459: user_id := to_number(FND_GLOBAL.USER_ID);
2460:
2461: debug_info := '(PA Flexbuild 1) PA_TRANSACTIONS_PUB.VALIDATE_TRANSACTION';
2462: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
2463: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2464: END IF;
2465:
2466: --bugfix:5725904
2459: user_id := to_number(FND_GLOBAL.USER_ID);
2460:
2461: debug_info := '(PA Flexbuild 1) PA_TRANSACTIONS_PUB.VALIDATE_TRANSACTION';
2462: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
2463: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2464: END IF;
2465:
2466: --bugfix:5725904
2467: If (p_invoice_rec.invoice_type_lookup_code ='EXPENSE REPORT') Then
2523: IF (l_msg_data IS NOT NULL) THEN
2524: debug_info :=
2525: '(PA Flexbuild 1) PA_TRANSACTIONS_PUB.VALIDATE_TRANSACTION '||
2526: 'Failed :Insert Rejection';
2527: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2528: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2529: END IF;
2530:
2531: -- Bug 5214592 . Added the debug message.
2524: debug_info :=
2525: '(PA Flexbuild 1) PA_TRANSACTIONS_PUB.VALIDATE_TRANSACTION '||
2526: 'Failed :Insert Rejection';
2527: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2528: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2529: END IF;
2530:
2531: -- Bug 5214592 . Added the debug message.
2532: debug_info := SUBSTR(l_msg_data,1,80);
2529: END IF;
2530:
2531: -- Bug 5214592 . Added the debug message.
2532: debug_info := SUBSTR(l_msg_data,1,80);
2533: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2534: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2535: END IF;
2536:
2537:
2530:
2531: -- Bug 5214592 . Added the debug message.
2532: debug_info := SUBSTR(l_msg_data,1,80);
2533: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2534: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2535: END IF;
2536:
2537:
2538: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2535: END IF;
2536:
2537:
2538: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2539: AP_IMPORT_INVOICES_PKG.g_invoice_lines_table,
2540: p_invoice_lines_rec.invoice_line_id,
2541: 'PA FLEXBUILD FAILED',
2542: p_default_last_updated_by,
2543: p_default_last_update_login,
2541: 'PA FLEXBUILD FAILED',
2542: p_default_last_updated_by,
2543: p_default_last_update_login,
2544: current_calling_sequence) <> TRUE) THEN
2545: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2546: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2547: 'insert_rejections<- '||current_calling_sequence);
2548: END IF;
2549: RAISE pa_flexbuild_failure;
2542: p_default_last_updated_by,
2543: p_default_last_update_login,
2544: current_calling_sequence) <> TRUE) THEN
2545: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2546: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2547: 'insert_rejections<- '||current_calling_sequence);
2548: END IF;
2549: RAISE pa_flexbuild_failure;
2550: END IF;
2559: -- Step 2 - Flexbuild
2560: --------------------------------------------------------------------------
2561:
2562: debug_info := '(PA Flexbuild 2) Call for flexbuilding';
2563: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2564: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2565: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2566: '------------> '
2567: ||' P_CHART_OF_ACCOUNTS_ID = '||to_char(P_CHART_OF_ACCOUNTS_ID)
2560: --------------------------------------------------------------------------
2561:
2562: debug_info := '(PA Flexbuild 2) Call for flexbuilding';
2563: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2564: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2565: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2566: '------------> '
2567: ||' P_CHART_OF_ACCOUNTS_ID = '||to_char(P_CHART_OF_ACCOUNTS_ID)
2568: ||' PROJECT_ID = '||to_char(P_invoice_lines_rec.PROJECT_ID)
2561:
2562: debug_info := '(PA Flexbuild 2) Call for flexbuilding';
2563: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2564: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2565: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2566: '------------> '
2567: ||' P_CHART_OF_ACCOUNTS_ID = '||to_char(P_CHART_OF_ACCOUNTS_ID)
2568: ||' PROJECT_ID = '||to_char(P_invoice_lines_rec.PROJECT_ID)
2569: ||' TASK_ID = '||to_char(P_invoice_lines_rec.TASK_ID)
2579:
2580: debug_info :=
2581: '(PA Flexbuild 2) Call pa_acc_gen_wf_pkg.ap_inv_generate_account '||
2582: 'for flexbuilding';
2583: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
2584: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2585: END IF;
2586:
2587: IF ( NOT pa_acc_gen_wf_pkg.ap_inv_generate_account (
2580: debug_info :=
2581: '(PA Flexbuild 2) Call pa_acc_gen_wf_pkg.ap_inv_generate_account '||
2582: 'for flexbuilding';
2583: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
2584: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2585: END IF;
2586:
2587: IF ( NOT pa_acc_gen_wf_pkg.ap_inv_generate_account (
2588: p_project_id => p_invoice_lines_rec.project_id,
2644: fnd_message.set_encoded(l_errmsg);
2645: l_errmsg := fnd_message.get;
2646: -- CHANGES FOR BUG - 3657665 ** ENDS **
2647:
2648: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2649: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2650: '------------> l_errmsg '|| l_errmsg);
2651: END IF;
2652:
2645: l_errmsg := fnd_message.get;
2646: -- CHANGES FOR BUG - 3657665 ** ENDS **
2647:
2648: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2649: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2650: '------------> l_errmsg '|| l_errmsg);
2651: END IF;
2652:
2653: -- REJECT here
2654:
2655: debug_info :=
2656: '(PA Flexbuild 2) pa_acc_gen_wf_pkg.ap_inv_generate_account '||
2657: 'Failed :Insert Rejection';
2658: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2659: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2660: END IF;
2661:
2662: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2655: debug_info :=
2656: '(PA Flexbuild 2) pa_acc_gen_wf_pkg.ap_inv_generate_account '||
2657: 'Failed :Insert Rejection';
2658: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2659: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2660: END IF;
2661:
2662: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2663: AP_IMPORT_INVOICES_PKG.g_invoice_lines_table,
2659: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2660: END IF;
2661:
2662: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2663: AP_IMPORT_INVOICES_PKG.g_invoice_lines_table,
2664: p_invoice_lines_rec.invoice_line_id,
2665: 'PA FLEXBUILD FAILED',
2666: p_default_last_updated_by,
2667: p_default_last_update_login,
2666: p_default_last_updated_by,
2667: p_default_last_update_login,
2668: current_calling_sequence) <> TRUE) THEN
2669:
2670: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2671: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2672: 'insert_rejections<- '||current_calling_sequence);
2673: END IF;
2674: RAISE pa_flexbuild_failure;
2667: p_default_last_update_login,
2668: current_calling_sequence) <> TRUE) THEN
2669:
2670: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2671: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2672: 'insert_rejections<- '||current_calling_sequence);
2673: END IF;
2674: RAISE pa_flexbuild_failure;
2675: END IF;
2682:
2683: END IF; -- If not pa generate account
2684:
2685: debug_info := '(PA Flexbuild 2) Return Concatenated Segments';
2686: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2687: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2688: END IF;
2689:
2690: P_PA_CONCATENATED_SEGMENTS := l_concat_segs;
2683: END IF; -- If not pa generate account
2684:
2685: debug_info := '(PA Flexbuild 2) Return Concatenated Segments';
2686: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2687: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2688: END IF;
2689:
2690: P_PA_CONCATENATED_SEGMENTS := l_concat_segs;
2691: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2687: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2688: END IF;
2689:
2690: P_PA_CONCATENATED_SEGMENTS := l_concat_segs;
2691: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2692: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2693: '------------> p_pa_default_dist_ccid = '
2694: || to_char(p_pa_default_dist_ccid)
2695: ||' p_pa_concatenated_segments = '||p_pa_concatenated_segments
2688: END IF;
2689:
2690: P_PA_CONCATENATED_SEGMENTS := l_concat_segs;
2691: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2692: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
2693: '------------> p_pa_default_dist_ccid = '
2694: || to_char(p_pa_default_dist_ccid)
2695: ||' p_pa_concatenated_segments = '||p_pa_concatenated_segments
2696: ||' l_concat_segs = '||l_concat_segs
2701: END IF;
2702: END IF; -- pa installed and project id is not null
2703:
2704: debug_info := '(PA Flexbuild 3) Return Invoice Status';
2705: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2706: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2707: END IF;
2708:
2709: p_current_invoice_status := l_current_invoice_status;
2702: END IF; -- pa installed and project id is not null
2703:
2704: debug_info := '(PA Flexbuild 3) Return Invoice Status';
2705: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2706: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2707: END IF;
2708:
2709: p_current_invoice_status := l_current_invoice_status;
2710: RETURN(TRUE);
2710: RETURN(TRUE);
2711:
2712: EXCEPTION
2713: WHEN OTHERS THEN
2714: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2715: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2716: END IF;
2717: IF (SQLCODE < 0) THEN
2718: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2711:
2712: EXCEPTION
2713: WHEN OTHERS THEN
2714: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2715: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2716: END IF;
2717: IF (SQLCODE < 0) THEN
2718: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2719: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
2714: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2715: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2716: END IF;
2717: IF (SQLCODE < 0) THEN
2718: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2719: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
2720: END IF;
2721: END IF;
2722:
2715: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2716: END IF;
2717: IF (SQLCODE < 0) THEN
2718: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2719: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
2720: END IF;
2721: END IF;
2722:
2723: RETURN (FALSE);
2810: ============================================================================*/
2811:
2812: FUNCTION get_doc_sequence(
2813: p_invoice_rec IN OUT
2814: AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
2815: p_inv_doc_cat_override IN VARCHAR2,
2816: p_set_of_books_id IN NUMBER,
2817: p_sequence_numbering IN VARCHAR2,
2818: p_default_last_updated_by IN NUMBER,
2849: -- Reject if Doc category provided is provided by user in this case.
2850: --------------------------------------------------------------------------
2851:
2852: debug_info := '(Get Doc Sequence 1) Reject Seq Num is not enabled ';
2853: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2854: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2855: END IF;
2856:
2857: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2850: --------------------------------------------------------------------------
2851:
2852: debug_info := '(Get Doc Sequence 1) Reject Seq Num is not enabled ';
2853: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2854: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
2855: END IF;
2856:
2857: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2858: 'AP_INVOICE_INTERFACE',
2860: 'DOC CAT NOT REQD',
2861: p_default_last_updated_by,
2862: p_default_last_update_login,
2863: current_calling_sequence) <> TRUE) THEN
2864: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2865: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch,
2866: 'insert_rejections<- '||current_calling_sequence);
2867: END IF;
2868: RAISE get_doc_seq_failure;
2861: p_default_last_updated_by,
2862: p_default_last_update_login,
2863: current_calling_sequence) <> TRUE) THEN
2864: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2865: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch,
2866: 'insert_rejections<- '||current_calling_sequence);
2867: END IF;
2868: RAISE get_doc_seq_failure;
2869: l_current_invoice_status := 'N';
2879: -------------------------------------------------------------------------
2880: IF (p_invoice_rec.doc_category_code IS NOT NULL) THEN
2881: debug_info := '(Get Doc Sequence 2) Seq Numbering is enabled AND doc_cat'
2882: || ' is not null process doc category ';
2883: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2884: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2885: END IF;
2886:
2887: IF (p_inv_doc_cat_override = 'Y') THEN
2880: IF (p_invoice_rec.doc_category_code IS NOT NULL) THEN
2881: debug_info := '(Get Doc Sequence 2) Seq Numbering is enabled AND doc_cat'
2882: || ' is not null process doc category ';
2883: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2884: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2885: END IF;
2886:
2887: IF (p_inv_doc_cat_override = 'Y') THEN
2888: ---------------------------------------------------------------------
2889: -- Step 2.1
2890: -- Doc Category Override is allowed
2891: ---------------------------------------------------------------------
2892: debug_info := '(Get Doc Sequence 2.1) Doc Category Override allowed';
2893: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2894: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2895: END IF;
2896:
2897: -- Reject if category is a seeded one and not allowed in this case
2890: -- Doc Category Override is allowed
2891: ---------------------------------------------------------------------
2892: debug_info := '(Get Doc Sequence 2.1) Doc Category Override allowed';
2893: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2894: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2895: END IF;
2896:
2897: -- Reject if category is a seeded one and not allowed in this case
2898:
2934: 'REC INV',
2935: 'WIRE PAY'))) THEN
2936:
2937: debug_info := '(Get Doc Sequence 2.1) Reject->category seeded one';
2938: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2939: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2940: END IF;
2941:
2942: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2935: 'WIRE PAY'))) THEN
2936:
2937: debug_info := '(Get Doc Sequence 2.1) Reject->category seeded one';
2938: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2939: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2940: END IF;
2941:
2942: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2943: AP_IMPORT_INVOICES_PKG.g_invoices_table,
2939: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2940: END IF;
2941:
2942: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2943: AP_IMPORT_INVOICES_PKG.g_invoices_table,
2944: p_invoice_rec.invoice_id,
2945: 'INVALID DOC CATEGORY',
2946: p_default_last_updated_by,
2947: p_default_last_update_login,
2947: p_default_last_update_login,
2948: current_calling_sequence) <> TRUE) THEN
2949:
2950: debug_info := 'insert_rejections<- '||current_calling_sequence;
2951: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2952: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2953: END IF;
2954: RAISE get_doc_seq_failure;
2955: END IF;
2948: current_calling_sequence) <> TRUE) THEN
2949:
2950: debug_info := 'insert_rejections<- '||current_calling_sequence;
2951: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2952: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2953: END IF;
2954: RAISE get_doc_seq_failure;
2955: END IF;
2956: l_current_invoice_status := 'N';
2961: -- Validate Doc Category
2962: -----------------------------------------------------------------------
2963: debug_info := '(Get Doc Sequence 2.2) Check Doc Category ' ||
2964: 'exists and valid';
2965: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2966: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2967: END IF;
2968:
2969: BEGIN
2962: -----------------------------------------------------------------------
2963: debug_info := '(Get Doc Sequence 2.2) Check Doc Category ' ||
2964: 'exists and valid';
2965: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2966: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2967: END IF;
2968:
2969: BEGIN
2970: SELECT name, application_id
2974: AND table_name IN ('AP_INVOICES','AP_INVOICES_ALL');
2975: EXCEPTION
2976: WHEN NO_DATA_FOUND THEN
2977: debug_info := debug_info || 'Reject->Doc cat does not exist';
2978: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2979: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2980: END IF;
2981: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2982: AP_IMPORT_INVOICES_PKG.g_invoices_table,
2975: EXCEPTION
2976: WHEN NO_DATA_FOUND THEN
2977: debug_info := debug_info || 'Reject->Doc cat does not exist';
2978: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2979: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2980: END IF;
2981: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2982: AP_IMPORT_INVOICES_PKG.g_invoices_table,
2983: p_invoice_rec.invoice_id,
2978: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2979: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2980: END IF;
2981: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
2982: AP_IMPORT_INVOICES_PKG.g_invoices_table,
2983: p_invoice_rec.invoice_id,
2984: 'INVALID DOC CATEGORY',
2985: p_default_last_updated_by,
2986: p_default_last_update_login,
2986: p_default_last_update_login,
2987: current_calling_sequence) <> TRUE) THEN
2988:
2989: debug_info := 'insert_rejections<- '||current_calling_sequence;
2990: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2991: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2992: END IF;
2993: RAISE get_doc_seq_failure;
2994: END IF;
2987: current_calling_sequence) <> TRUE) THEN
2988:
2989: debug_info := 'insert_rejections<- '||current_calling_sequence;
2990: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
2991: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
2992: END IF;
2993: RAISE get_doc_seq_failure;
2994: END IF;
2995: l_current_invoice_status := 'N';
3001: -- Reject Override not allowed
3002: -----------------------------------------------------------------------
3003:
3004: debug_info := '(Get Doc Sequence 3) Reject->cat override not allowed';
3005: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3006: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3007: END IF;
3008:
3009: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
3002: -----------------------------------------------------------------------
3003:
3004: debug_info := '(Get Doc Sequence 3) Reject->cat override not allowed';
3005: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3006: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3007: END IF;
3008:
3009: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
3010: AP_IMPORT_INVOICES_PKG.g_invoices_table,
3006: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3007: END IF;
3008:
3009: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
3010: AP_IMPORT_INVOICES_PKG.g_invoices_table,
3011: p_invoice_rec.invoice_id,
3012: 'OVERRIDE DISALLOWED',
3013: p_default_last_updated_by,
3014: p_default_last_update_login,
3013: p_default_last_updated_by,
3014: p_default_last_update_login,
3015: current_calling_sequence) <> TRUE) THEN
3016: debug_info := 'insert_rejections<- '||current_calling_sequence;
3017: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3018: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3019: END IF;
3020: RAISE get_doc_seq_failure;
3021: END IF;
3014: p_default_last_update_login,
3015: current_calling_sequence) <> TRUE) THEN
3016: debug_info := 'insert_rejections<- '||current_calling_sequence;
3017: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3018: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3019: END IF;
3020: RAISE get_doc_seq_failure;
3021: END IF;
3022: l_current_invoice_status := 'N';
3027: -- Step 4
3028: -- Use Default Doc Category
3029: ---------------------------------------------------------------------
3030: debug_info := '(Get Doc Sequence 4) Use Default Category, Seq:Always';
3031: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3032: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3033: END IF;
3034:
3035: --Contract Payments: Modified the IF condition to look at the invoice_type
3028: -- Use Default Doc Category
3029: ---------------------------------------------------------------------
3030: debug_info := '(Get Doc Sequence 4) Use Default Category, Seq:Always';
3031: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3032: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3033: END IF;
3034:
3035: --Contract Payments: Modified the IF condition to look at the invoice_type
3036: --rather than the sign of the invoice_amount in deciding which category to
3054: --End of Bug8408197
3055: END IF;
3056:
3057: debug_info := '-----> l_doc_category_code = ' || l_doc_category_code ;
3058: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3059: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3060: END IF;
3061: END IF; -- end of check Doc_category_code is not null
3062:
3055: END IF;
3056:
3057: debug_info := '-----> l_doc_category_code = ' || l_doc_category_code ;
3058: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3059: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3060: END IF;
3061: END IF; -- end of check Doc_category_code is not null
3062:
3063: ---------------------------------------------------------------------------
3069: (l_current_invoice_status = 'Y')) THEN
3070:
3071: debug_info := '(Get Doc Sequence 5) Valid Category ->Check if valid ' ||
3072: ' Sequence assigned';
3073: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3074: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3075: END IF;
3076:
3077: BEGIN
3070:
3071: debug_info := '(Get Doc Sequence 5) Valid Category ->Check if valid ' ||
3072: ' Sequence assigned';
3073: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3074: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3075: END IF;
3076:
3077: BEGIN
3078: SELECT SEQ.DB_SEQUENCE_NAME,
3089: AND NVL(SA.METHOD_CODE,'A') = 'A'
3090: AND NVL(SA.SET_OF_BOOKS_ID,
3091: p_set_of_books_id) = p_set_of_books_id -- 3817492
3092: AND NVL(p_invoice_rec.gl_date,
3093: AP_IMPORT_INVOICES_PKG.g_inv_sysdate) between
3094: SA.START_DATE and
3095: NVL(SA.END_DATE, TO_DATE('31/12/4712','DD/MM/YYYY'));
3096:
3097: -- Bug 5064959 starts. Check for inconsistent Voucher info. When a valid sequence exists ,
3099:
3100: If (p_invoice_rec.voucher_num IS NOT NULL) Then
3101:
3102: debug_info := '(Get Doc Sequence 5) Reject: Inconsistent Voucher Info';
3103: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3104: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3105: END IF;
3106:
3107: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections( AP_IMPORT_INVOICES_PKG.g_invoices_table,
3100: If (p_invoice_rec.voucher_num IS NOT NULL) Then
3101:
3102: debug_info := '(Get Doc Sequence 5) Reject: Inconsistent Voucher Info';
3103: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3104: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3105: END IF;
3106:
3107: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections( AP_IMPORT_INVOICES_PKG.g_invoices_table,
3108: p_invoice_rec.invoice_id,
3103: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3104: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3105: END IF;
3106:
3107: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections( AP_IMPORT_INVOICES_PKG.g_invoices_table,
3108: p_invoice_rec.invoice_id,
3109: 'INCONSISTENT VOUCHER INFO',
3110: p_default_last_updated_by,
3111: p_default_last_update_login,
3110: p_default_last_updated_by,
3111: p_default_last_update_login,
3112: current_calling_sequence) <> TRUE) THEN
3113: debug_info := 'insert_rejections<- '||current_calling_sequence;
3114: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3115: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3116: END IF;
3117: RAISE get_doc_seq_failure;
3118:
3111: p_default_last_update_login,
3112: current_calling_sequence) <> TRUE) THEN
3113: debug_info := 'insert_rejections<- '||current_calling_sequence;
3114: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3115: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3116: END IF;
3117: RAISE get_doc_seq_failure;
3118:
3119: END IF;
3131: --Only if the Sequenctial numbering option is 'Always Used',we raise the error.
3132: IF(p_sequence_numbering='A') THEN --bug5854731.Only if the Sequenctial numbering op
3133: debug_info := '(Get Doc Sequence 5) Reject:Invalid Sequence' ||
3134: 'assignment';
3135: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3136: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3137: END IF;
3138:
3139: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
3132: IF(p_sequence_numbering='A') THEN --bug5854731.Only if the Sequenctial numbering op
3133: debug_info := '(Get Doc Sequence 5) Reject:Invalid Sequence' ||
3134: 'assignment';
3135: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3136: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3137: END IF;
3138:
3139: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
3140: AP_IMPORT_INVOICES_PKG.g_invoices_table,
3136: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3137: END IF;
3138:
3139: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
3140: AP_IMPORT_INVOICES_PKG.g_invoices_table,
3141: p_invoice_rec.invoice_id,
3142: 'INVALID ASSIGNMENT',
3143: p_default_last_updated_by,
3144: p_default_last_update_login,
3143: p_default_last_updated_by,
3144: p_default_last_update_login,
3145: current_calling_sequence) <> TRUE) THEN
3146: debug_info := 'insert_rejections<- '||current_calling_sequence;
3147: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3148: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3149: END IF;
3150: RAISE get_doc_seq_failure;
3151: END IF;
3144: p_default_last_update_login,
3145: current_calling_sequence) <> TRUE) THEN
3146: debug_info := 'insert_rejections<- '||current_calling_sequence;
3147: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3148: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3149: END IF;
3150: RAISE get_doc_seq_failure;
3151: END IF;
3152: l_current_invoice_status := 'N';
3163: -- Step 6
3164: -- Get Doc Sequence Val
3165: ----------------------------------------------------------------------
3166: debug_info := '(Get Doc Sequence 6) Get Next Val';
3167: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3168: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3169: END IF;
3170:
3171: l_return_code := FND_SEQNUM.GET_SEQ_VAL(
3164: -- Get Doc Sequence Val
3165: ----------------------------------------------------------------------
3166: debug_info := '(Get Doc Sequence 6) Get Next Val';
3167: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3168: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3169: END IF;
3170:
3171: l_return_code := FND_SEQNUM.GET_SEQ_VAL(
3172: 200,
3173: l_doc_category_code,
3174: p_set_of_books_id,
3175: 'A',
3176: NVL(p_invoice_rec.gl_date,
3177: AP_IMPORT_INVOICES_PKG.g_inv_sysdate),
3178: p_db_sequence_value,
3179: p_db_sequence_id ,
3180: 'N',
3181: 'N');
3178: p_db_sequence_value,
3179: p_db_sequence_id ,
3180: 'N',
3181: 'N');
3182: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3183: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
3184: '-----------> l_doc_category_code = '|| l_doc_category_code
3185: || ' p_set_of_books_id = '||to_char(p_set_of_books_id)
3186: || ' p_db_sequence_id = '||to_char(p_db_sequence_id )
3179: p_db_sequence_id ,
3180: 'N',
3181: 'N');
3182: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3183: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,
3184: '-----------> l_doc_category_code = '|| l_doc_category_code
3185: || ' p_set_of_books_id = '||to_char(p_set_of_books_id)
3186: || ' p_db_sequence_id = '||to_char(p_db_sequence_id )
3187: ||' p_db_seq_name = '||p_db_seq_name
3189: END IF;
3190:
3191: IF ((p_db_sequence_value IS NULL) or (l_return_code <> 0)) THEN
3192: debug_info := '(Get Doc Sequence 7) Reject:Invalid Sequence';
3193: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3194: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3195: END IF;
3196:
3197: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
3190:
3191: IF ((p_db_sequence_value IS NULL) or (l_return_code <> 0)) THEN
3192: debug_info := '(Get Doc Sequence 7) Reject:Invalid Sequence';
3193: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3194: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3195: END IF;
3196:
3197: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
3198: AP_IMPORT_INVOICES_PKG.g_invoices_table,
3194: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3195: END IF;
3196:
3197: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections(
3198: AP_IMPORT_INVOICES_PKG.g_invoices_table,
3199: p_invoice_rec.invoice_id,
3200: 'INVALID SEQUENCE',
3201: p_default_last_updated_by,
3202: p_default_last_update_login,
3201: p_default_last_updated_by,
3202: p_default_last_update_login,
3203: current_calling_sequence) <> TRUE) THEN
3204: debug_info := 'insert_rejections<- '||current_calling_sequence;
3205: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3206: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3207: END IF;
3208: RAISE get_doc_seq_failure;
3209: END IF;
3202: p_default_last_update_login,
3203: current_calling_sequence) <> TRUE) THEN
3204: debug_info := 'insert_rejections<- '||current_calling_sequence;
3205: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3206: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3207: END IF;
3208: RAISE get_doc_seq_failure;
3209: END IF;
3210: l_current_invoice_status := 'N';
3220: -- if ( ( LENGTH( nvl(p_db_sequence_value,0)) > 9 ) or --Condition value changed from 8 to 9 for BUG 5950643
3221: If ( TRANSLATE( p_db_sequence_value ,'x1234567890','x') IS NOT NULL) then
3222:
3223: debug_info := '(Get Doc Sequence 8) Reject: Invalid Voucher Number';
3224: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3225: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3226: END IF;
3227:
3228: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections( AP_IMPORT_INVOICES_PKG.g_invoices_table,
3221: If ( TRANSLATE( p_db_sequence_value ,'x1234567890','x') IS NOT NULL) then
3222:
3223: debug_info := '(Get Doc Sequence 8) Reject: Invalid Voucher Number';
3224: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3225: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3226: END IF;
3227:
3228: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections( AP_IMPORT_INVOICES_PKG.g_invoices_table,
3229: p_invoice_rec.invoice_id,
3224: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3225: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3226: END IF;
3227:
3228: IF (AP_IMPORT_UTILITIES_PKG.insert_rejections( AP_IMPORT_INVOICES_PKG.g_invoices_table,
3229: p_invoice_rec.invoice_id,
3230: 'INCONSISTENT VOUCHER INFO',
3231: p_default_last_updated_by,
3232: p_default_last_update_login,
3231: p_default_last_updated_by,
3232: p_default_last_update_login,
3233: current_calling_sequence) <> TRUE) THEN
3234: debug_info := 'insert_rejections<- '||current_calling_sequence;
3235: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3236: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3237: END IF;
3238: RAISE get_doc_seq_failure;
3239:
3232: p_default_last_update_login,
3233: current_calling_sequence) <> TRUE) THEN
3234: debug_info := 'insert_rejections<- '||current_calling_sequence;
3235: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3236: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3237: END IF;
3238: RAISE get_doc_seq_failure;
3239:
3240: END IF;
3252:
3253: EXCEPTION
3254: WHEN OTHERS THEN
3255:
3256: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3257: Print(
3258: AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3259: END IF;
3260:
3254: WHEN OTHERS THEN
3255:
3256: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3257: Print(
3258: AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3259: END IF;
3260:
3261: IF (SQLCODE < 0) THEN
3262: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3258: AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3259: END IF;
3260:
3261: IF (SQLCODE < 0) THEN
3262: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3263: Print(
3264: AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
3265: END IF;
3266: END IF;
3260:
3261: IF (SQLCODE < 0) THEN
3262: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3263: Print(
3264: AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
3265: END IF;
3266: END IF;
3267:
3268: RETURN (FALSE);
3275: =================================================================== */
3276:
3277: FUNCTION get_invoice_info(
3278: p_invoice_rec IN OUT NOCOPY
3279: AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
3280: p_default_last_updated_by IN NUMBER,
3281: p_default_last_update_login IN NUMBER,
3282: p_pay_curr_invoice_amount OUT NOCOPY NUMBER,
3283: p_payment_priority OUT NOCOPY NUMBER,
3302: ----------------------------------------------------------------------------
3303:
3304: debug_info := '(Get Invoice Info step 1) Calculate invoice amount in ' ||
3305: 'payment currency ';
3306: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3307: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3308: END IF;
3309:
3310: IF ( p_invoice_rec.payment_cross_rate is NOT NULL) THEN
3303:
3304: debug_info := '(Get Invoice Info step 1) Calculate invoice amount in ' ||
3305: 'payment currency ';
3306: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3307: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3308: END IF;
3309:
3310: IF ( p_invoice_rec.payment_cross_rate is NOT NULL) THEN
3311: p_pay_curr_invoice_amount := gl_currency_api.convert_amount(
3323: -----------------------------------------------------------------------------
3324:
3325: debug_info := '(Get Invoice Info step 2) Get amt_applicable_to_discount ' ||
3326: ' value if not given';
3327: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3328: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3329: END IF;
3330:
3331: p_invoice_rec.amount_applicable_to_discount :=
3324:
3325: debug_info := '(Get Invoice Info step 2) Get amt_applicable_to_discount ' ||
3326: ' value if not given';
3327: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3328: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3329: END IF;
3330:
3331: p_invoice_rec.amount_applicable_to_discount :=
3332: NVL(p_invoice_rec.amount_applicable_to_discount,
3348: -- Payment Requests: Added the if condition for payment requests type invoices
3349: IF (p_invoice_rec.invoice_type_lookup_code = 'PAYMENT REQUEST') THEN
3350:
3351: debug_info := '(Get Invoice Info step 3) Get payment default info ';
3352: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3353: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3354: END IF;
3355: BEGIN
3356:
3349: IF (p_invoice_rec.invoice_type_lookup_code = 'PAYMENT REQUEST') THEN
3350:
3351: debug_info := '(Get Invoice Info step 3) Get payment default info ';
3352: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3353: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3354: END IF;
3355: BEGIN
3356:
3357: SELECT DECODE(p_invoice_rec.pay_group_lookup_code,
3378: AND asp.org_id = fsp.org_id;
3379: EXCEPTION
3380: WHEN no_data_found THEN
3381: debug_info := debug_info || '->no data found in query';
3382: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3383: Print(
3384: AP_IMPORT_INVOICES_PKG.g_debug_switch,
3385: debug_info);
3386: END IF;
3380: WHEN no_data_found THEN
3381: debug_info := debug_info || '->no data found in query';
3382: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3383: Print(
3384: AP_IMPORT_INVOICES_PKG.g_debug_switch,
3385: debug_info);
3386: END IF;
3387: RAISE get_invoice_info_failure;
3388: END;
3389:
3390: ELSE
3391:
3392: debug_info := '(Get Invoice Info step 3) Get supplier site default info ';
3393: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3394: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3395: END IF;
3396: BEGIN
3397:
3390: ELSE
3391:
3392: debug_info := '(Get Invoice Info step 3) Get supplier site default info ';
3393: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3394: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3395: END IF;
3396: BEGIN
3397:
3398: SELECT DECODE(p_invoice_rec.pay_group_lookup_code,
3418: AND vendor_site_id = p_invoice_rec.vendor_site_id;
3419: EXCEPTION
3420: WHEN no_data_found THEN
3421: debug_info := debug_info || '->no data found in query';
3422: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3423: Print(
3424: AP_IMPORT_INVOICES_PKG.g_debug_switch,
3425: debug_info);
3426: END IF;
3420: WHEN no_data_found THEN
3421: debug_info := debug_info || '->no data found in query';
3422: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3423: Print(
3424: AP_IMPORT_INVOICES_PKG.g_debug_switch,
3425: debug_info);
3426: END IF;
3427: RAISE get_invoice_info_failure;
3428: END;
3432: -- Step 4
3433: -- Populate who columns if null
3434: -----------------------------------------------------------------------------
3435: debug_info := '(Get Invoice Info step 4) Get WHO columns ';
3436: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3437: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3438: END IF;
3439: p_invoice_rec.last_updated_by :=
3440: NVL(p_invoice_rec.last_updated_by,p_default_last_updated_by);
3433: -- Populate who columns if null
3434: -----------------------------------------------------------------------------
3435: debug_info := '(Get Invoice Info step 4) Get WHO columns ';
3436: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3437: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3438: END IF;
3439: p_invoice_rec.last_updated_by :=
3440: NVL(p_invoice_rec.last_updated_by,p_default_last_updated_by);
3441: p_invoice_rec.last_update_login :=
3443: p_default_last_updated_by));
3444: p_invoice_rec.created_by :=
3445: NVL(p_invoice_rec.created_by,p_default_last_updated_by);
3446: p_invoice_rec.creation_date :=
3447: NVL(p_invoice_rec.creation_date, AP_IMPORT_INVOICES_PKG.g_inv_sysdate);
3448: p_invoice_rec.last_update_date :=
3449: NVL(p_invoice_rec.last_update_date, AP_IMPORT_INVOICES_PKG.g_inv_sysdate);
3450:
3451: RETURN(TRUE);
3445: NVL(p_invoice_rec.created_by,p_default_last_updated_by);
3446: p_invoice_rec.creation_date :=
3447: NVL(p_invoice_rec.creation_date, AP_IMPORT_INVOICES_PKG.g_inv_sysdate);
3448: p_invoice_rec.last_update_date :=
3449: NVL(p_invoice_rec.last_update_date, AP_IMPORT_INVOICES_PKG.g_inv_sysdate);
3450:
3451: RETURN(TRUE);
3452: EXCEPTION
3453: WHEN OTHERS then
3451: RETURN(TRUE);
3452: EXCEPTION
3453: WHEN OTHERS then
3454: debug_info := debug_info || '->exception';
3455: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3456: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3457: END IF;
3458:
3459: IF (SQLCODE < 0) then
3452: EXCEPTION
3453: WHEN OTHERS then
3454: debug_info := debug_info || '->exception';
3455: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3456: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3457: END IF;
3458:
3459: IF (SQLCODE < 0) then
3460: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3456: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3457: END IF;
3458:
3459: IF (SQLCODE < 0) then
3460: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3461: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
3462: END IF;
3463: END IF;
3464:
3457: END IF;
3458:
3459: IF (SQLCODE < 0) then
3460: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3461: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
3462: END IF;
3463: END IF;
3464:
3465: RETURN (FALSE);
3474: =========================================================================*/
3475: -- Payment Request: Added p_needs_invoice_approval for payment request invoices
3476: FUNCTION insert_ap_invoices(
3477: p_invoice_rec IN OUT
3478: AP_IMPORT_INVOICES_PKG.r_invoice_info_rec,
3479: p_base_invoice_id OUT NOCOPY NUMBER,
3480: p_set_of_books_id IN NUMBER,
3481: p_doc_sequence_id IN
3482: AP_INVOICES.doc_sequence_id%TYPE,
3512: -----------------------------------------------------------------------------
3513:
3514: debug_info := '(Insert ap invoices step 1) Get new invoice_id for base ' ||
3515: 'table ap_invoices';
3516: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3517: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3518: END IF;
3519: -- Bug 5448579
3520: /*
3513:
3514: debug_info := '(Insert ap invoices step 1) Get new invoice_id for base ' ||
3515: 'table ap_invoices';
3516: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3517: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3518: END IF;
3519: -- Bug 5448579
3520: /*
3521: SELECT ap_invoices_s.nextval
3528: -----------------------------------------------------------------------------
3529:
3530: debug_info := '(Insert ap invoices step 2)-Get wfapproval_status ' ||
3531: 'depends on profile value';
3532: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3533: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3534: END IF;
3535:
3536: IF p_approval_workflow_flag = 'N' THEN
3529:
3530: debug_info := '(Insert ap invoices step 2)-Get wfapproval_status ' ||
3531: 'depends on profile value';
3532: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3533: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3534: END IF;
3535:
3536: IF p_approval_workflow_flag = 'N' THEN
3537: l_wfapproval_status := 'NOT REQUIRED';
3562: -- Insert jg_zz_invoice_info
3563: -----------------------------------------------------------------------------
3564: debug_info := '(Insert ap invoices step 3) - Call ' ||
3565: 'jg_globe_flex_val.insert_jg_zz_invoice_info';
3566: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3567: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3568: END IF;
3569:
3570: jg_globe_flex_val.insert_jg_zz_invoice_info(
3563: -----------------------------------------------------------------------------
3564: debug_info := '(Insert ap invoices step 3) - Call ' ||
3565: 'jg_globe_flex_val.insert_jg_zz_invoice_info';
3566: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3567: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3568: END IF;
3569:
3570: jg_globe_flex_val.insert_jg_zz_invoice_info(
3571: l_invoice_id,
3600: */
3601:
3602:
3603: debug_info := '(Insert ap invoices step 3) Calculate earliest settlement date for Prepayment type invoices';
3604: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3605: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3606: END IF;
3607:
3608: IF (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT') THEN
3601:
3602:
3603: debug_info := '(Insert ap invoices step 3) Calculate earliest settlement date for Prepayment type invoices';
3604: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3605: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3606: END IF;
3607:
3608: IF (p_invoice_rec.invoice_type_lookup_code = 'PREPAYMENT') THEN
3609: l_earliest_settlement_date := sysdate + nvl(p_add_days_settlement_date,0);
3615: -- Insert into ap_invoices table
3616: -----------------------------------------------------------------------------
3617:
3618: debug_info := '(Insert ap invoices step 4) - Insert into ap_invoices';
3619: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3620: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3621: END IF;
3622:
3623: -- Payment Requests: Added party_id, party_site_id,
3616: -----------------------------------------------------------------------------
3617:
3618: debug_info := '(Insert ap invoices step 4) - Insert into ap_invoices';
3619: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3620: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3621: END IF;
3622:
3623: -- Payment Requests: Added party_id, party_site_id,
3624: -- pay_proc_trxn_type_code, payment_function to the insert stmt
3942: -----------------------------------------------------------------------------
3943: debug_info := '(Insert ap invoices step 5) before copy attachments: '||
3944: 'source = ' || p_invoice_rec.source || ', from_invoice_id = ' ||
3945: p_invoice_rec.invoice_id || ', to_invoice_id = ' || l_invoice_id;
3946: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3947: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3948: END IF;
3949:
3950: l_attachments_count :=
3943: debug_info := '(Insert ap invoices step 5) before copy attachments: '||
3944: 'source = ' || p_invoice_rec.source || ', from_invoice_id = ' ||
3945: p_invoice_rec.invoice_id || ', to_invoice_id = ' || l_invoice_id;
3946: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3947: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3948: END IF;
3949:
3950: l_attachments_count :=
3951: copy_attachments(p_invoice_rec.invoice_id, l_invoice_id);
3950: l_attachments_count :=
3951: copy_attachments(p_invoice_rec.invoice_id, l_invoice_id);
3952: debug_info := '(Insert ap invoices step 5) copy attachments done: ' ||
3953: l_attachments_count;
3954: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3955: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3956: END IF;
3957:
3958: -----------------------------------------------------------------------------
3951: copy_attachments(p_invoice_rec.invoice_id, l_invoice_id);
3952: debug_info := '(Insert ap invoices step 5) copy attachments done: ' ||
3953: l_attachments_count;
3954: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3955: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3956: END IF;
3957:
3958: -----------------------------------------------------------------------------
3959: -- Step 6
3960: -- Assign the out parameter for new invoice_id
3961: -----------------------------------------------------------------------------
3962: debug_info := '(Insert ap invoices step 6) - Return the new invoice_id-> ' ||
3963: to_char(l_invoice_id);
3964: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3965: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3966: END IF;
3967:
3968:
3961: -----------------------------------------------------------------------------
3962: debug_info := '(Insert ap invoices step 6) - Return the new invoice_id-> ' ||
3963: to_char(l_invoice_id);
3964: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3965: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
3966: END IF;
3967:
3968:
3969: p_base_invoice_id := l_invoice_id;
3971: RETURN( TRUE );
3972: EXCEPTION
3973: WHEN OTHERS THEN
3974: debug_info := debug_info || '->exception';
3975: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3976: Print(
3977: AP_IMPORT_INVOICES_PKG.g_debug_switch,
3978: debug_info);
3979: END IF;
3973: WHEN OTHERS THEN
3974: debug_info := debug_info || '->exception';
3975: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3976: Print(
3977: AP_IMPORT_INVOICES_PKG.g_debug_switch,
3978: debug_info);
3979: END IF;
3980: IF (SQLCODE < 0) THEN
3981: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3977: AP_IMPORT_INVOICES_PKG.g_debug_switch,
3978: debug_info);
3979: END IF;
3980: IF (SQLCODE < 0) THEN
3981: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3982: Print(
3983: AP_IMPORT_INVOICES_PKG.g_debug_switch,
3984: SQLERRM);
3985: END IF;
3979: END IF;
3980: IF (SQLCODE < 0) THEN
3981: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
3982: Print(
3983: AP_IMPORT_INVOICES_PKG.g_debug_switch,
3984: SQLERRM);
3985: END IF;
3986: END IF;
3987: RETURN (FALSE);
4023: ---------------------------------------------
4024:
4025: debug_info := '(Change_invoice_status 1) Change invoice status to '||
4026: p_status;
4027: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4028: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4029: END IF;
4030:
4031: UPDATE AP_INVOICES_INTERFACE
4024:
4025: debug_info := '(Change_invoice_status 1) Change invoice status to '||
4026: p_status;
4027: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4028: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4029: END IF;
4030:
4031: UPDATE AP_INVOICES_INTERFACE
4032: SET status = p_status
4035: RETURN(TRUE);
4036:
4037: EXCEPTION
4038: WHEN OTHERS THEN
4039: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4040: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4041: END IF;
4042:
4043: IF (SQLCODE < 0) THEN
4036:
4037: EXCEPTION
4038: WHEN OTHERS THEN
4039: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4040: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4041: END IF;
4042:
4043: IF (SQLCODE < 0) THEN
4044: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4040: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4041: END IF;
4042:
4043: IF (SQLCODE < 0) THEN
4044: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4045: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
4046: END IF;
4047: END IF;
4048:
4041: END IF;
4042:
4043: IF (SQLCODE < 0) THEN
4044: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4045: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
4046: END IF;
4047: END IF;
4048:
4049: RETURN (FALSE);
4087: ---------------------------------------------
4088: debug_info := '(Update_temp_invoice_status 1) Change '||
4089: 'PROCESSING to PROCESSED ';
4090:
4091: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4092: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4093: END IF;
4094:
4095: ---------------------------------------------
4088: debug_info := '(Update_temp_invoice_status 1) Change '||
4089: 'PROCESSING to PROCESSED ';
4090:
4091: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4092: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4093: END IF;
4094:
4095: ---------------------------------------------
4096: -- 2. Change REJECTING to REJECTED
4096: -- 2. Change REJECTING to REJECTED
4097: ---------------------------------------------
4098: debug_info := '(Update_temp_invoice_status 2) Change REJECTING to REJECTED';
4099:
4100: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4101: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4102: END IF;
4103: -- Bug fix: 1952122
4104: -- Rewrite with two statements avoiding AND ((p_group_id is NULL) OR (group_id = --p_group_id))
4097: ---------------------------------------------
4098: debug_info := '(Update_temp_invoice_status 2) Change REJECTING to REJECTED';
4099:
4100: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4101: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4102: END IF;
4103: -- Bug fix: 1952122
4104: -- Rewrite with two statements avoiding AND ((p_group_id is NULL) OR (group_id = --p_group_id))
4105: --3910020, used binds in the sql below
4106:
4107: --Bug 6801046
4108: --Update statement should only update the status of Invoices
4109: --pertaining to the current request. Modified the below 4 update stmts.
4110: -- bug 7608232 added an additional or in request_id = AP_IMPORT_INVOICES_PKG.g_conc_request_id
4111: -- as (request_id = AP_IMPORT_INVOICES_PKG.g_conc_request_id or request_id is null)
4112:
4113: IF p_group_id IS NULL THEN
4114:
4107: --Bug 6801046
4108: --Update statement should only update the status of Invoices
4109: --pertaining to the current request. Modified the below 4 update stmts.
4110: -- bug 7608232 added an additional or in request_id = AP_IMPORT_INVOICES_PKG.g_conc_request_id
4111: -- as (request_id = AP_IMPORT_INVOICES_PKG.g_conc_request_id or request_id is null)
4112:
4113: IF p_group_id IS NULL THEN
4114:
4115: UPDATE AP_INVOICES_INTERFACE
4116: SET status = l_processed
4117: WHERE source = p_source
4118: AND p_group_id is NULL
4119: AND status = l_processing
4120: AND (request_id = AP_IMPORT_INVOICES_PKG.g_conc_request_id or request_id is null);
4121: -- bug 7608232
4122:
4123: UPDATE AP_INVOICES_INTERFACE
4124: SET status = l_rejected
4124: SET status = l_rejected
4125: WHERE source = p_source
4126: AND p_group_id is NULL
4127: AND status = l_rejecting
4128: AND (request_id = AP_IMPORT_INVOICES_PKG.g_conc_request_id or request_id is null);
4129: -- bug 7608232
4130: ELSE
4131:
4132: UPDATE AP_INVOICES_INTERFACE
4133: SET status = l_processed
4134: WHERE source = p_source
4135: AND group_id = p_group_id
4136: AND status = l_processing
4137: AND (request_id = AP_IMPORT_INVOICES_PKG.g_conc_request_id or request_id is null);
4138: -- bug 7608232
4139: UPDATE AP_INVOICES_INTERFACE
4140: SET status = l_rejected
4141: WHERE source = p_source
4140: SET status = l_rejected
4141: WHERE source = p_source
4142: AND group_id = p_group_id
4143: AND status = l_rejecting
4144: AND (request_id =AP_IMPORT_INVOICES_PKG.g_conc_request_id or request_id is null);
4145: -- bug 7608232
4146: END IF;
4147:
4148: RETURN(TRUE);
4148: RETURN(TRUE);
4149:
4150: EXCEPTION
4151: WHEN OTHERS THEN
4152: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4153: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4154: END IF;
4155:
4156: IF (SQLCODE < 0) THEN
4149:
4150: EXCEPTION
4151: WHEN OTHERS THEN
4152: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4153: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4154: END IF;
4155:
4156: IF (SQLCODE < 0) THEN
4157: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4153: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4154: END IF;
4155:
4156: IF (SQLCODE < 0) THEN
4157: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4158: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
4159: END IF;
4160: END IF;
4161:
4154: END IF;
4155:
4156: IF (SQLCODE < 0) THEN
4157: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4158: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
4159: END IF;
4160: END IF;
4161:
4162: RETURN (FALSE);
4225:
4226: EXCEPTION
4227:
4228: WHEN OTHERS then
4229: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4230: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4231: END IF;
4232:
4233: IF (SQLCODE < 0) THEN
4226: EXCEPTION
4227:
4228: WHEN OTHERS then
4229: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4230: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4231: END IF;
4232:
4233: IF (SQLCODE < 0) THEN
4234: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4230: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4231: END IF;
4232:
4233: IF (SQLCODE < 0) THEN
4234: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4235: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
4236: END IF;
4237: END IF;
4238:
4231: END IF;
4232:
4233: IF (SQLCODE < 0) THEN
4234: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4235: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
4236: END IF;
4237: END IF;
4238:
4239: RETURN (FALSE);
4288: RETURN(TRUE);
4289:
4290: EXCEPTION
4291: WHEN OTHERS THEN
4292: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4293: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4294: END IF;
4295:
4296: IF (SQLCODE<0) THEN
4289:
4290: EXCEPTION
4291: WHEN OTHERS THEN
4292: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4293: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4294: END IF;
4295:
4296: IF (SQLCODE<0) THEN
4297: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4293: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4294: END IF;
4295:
4296: IF (SQLCODE<0) THEN
4297: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4298: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
4299: END IF;
4300: END IF;
4301:
4294: END IF;
4295:
4296: IF (SQLCODE<0) THEN
4297: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4298: Print(AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
4299: END IF;
4300: END IF;
4301:
4302: RETURN(FALSE);
4321: /*=========================================================================*/
4322:
4323: FUNCTION insert_ap_invoice_lines(
4324: p_base_invoice_id IN NUMBER,
4325: p_invoice_lines_tab IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.LINES_TABLE, --bug 15862708
4326: p_set_of_books_id IN NUMBER,
4327: p_approval_workflow_flag IN VARCHAR2,
4328: p_tax_only_flag IN VARCHAR2,
4329: p_tax_only_rcv_matched_flag IN VARCHAR2,
4376: -----------------------------------------------------------------------------
4377:
4378: debug_info := '(Insert ap invoice lines step 2) - Loop the Pl/sql table';
4379:
4380: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4381: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4382: END IF;
4383:
4384: --bug 15862708
4377:
4378: debug_info := '(Insert ap invoice lines step 2) - Loop the Pl/sql table';
4379:
4380: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4381: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4382: END IF;
4383:
4384: --bug 15862708
4385: /*
4403: RETURN( TRUE );
4404: EXCEPTION
4405: WHEN OTHERS THEN
4406: debug_info := debug_info || '->exception';
4407: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4408: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4409: END IF;
4410:
4411: IF (SQLCODE < 0) THEN
4404: EXCEPTION
4405: WHEN OTHERS THEN
4406: debug_info := debug_info || '->exception';
4407: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4408: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4409: END IF;
4410:
4411: IF (SQLCODE < 0) THEN
4412: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4408: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4409: END IF;
4410:
4411: IF (SQLCODE < 0) THEN
4412: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4413: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
4414: END IF;
4415: END IF;
4416:
4409: END IF;
4410:
4411: IF (SQLCODE < 0) THEN
4412: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4413: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
4414: END IF;
4415: END IF;
4416:
4417: RETURN (FALSE);
4443:
4444: FUNCTION Create_Lines(
4445: p_batch_id IN NUMBER,
4446: p_base_invoice_id IN NUMBER,
4447: p_invoice_lines_tab IN OUT NOCOPY AP_IMPORT_INVOICES_PKG.lines_table, --bug 15862708
4448: p_base_currency_code IN VARCHAR2,
4449: p_set_of_books_id IN NUMBER,
4450: p_approval_workflow_flag IN VARCHAR2,
4451: p_tax_only_flag IN VARCHAR2,
4518: -- Call API that Bulk insert invoice lines regardless of line type.
4519: --------------------------------------------------------------------------
4520:
4521: debug_info := '(Create lines 1) Call API to Insert all the lines ';
4522: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4523: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4524: END IF;
4525:
4526: IF ( insert_ap_invoice_lines(
4519: --------------------------------------------------------------------------
4520:
4521: debug_info := '(Create lines 1) Call API to Insert all the lines ';
4522: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4523: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4524: END IF;
4525:
4526: IF ( insert_ap_invoice_lines(
4527: p_base_invoice_id => p_base_invoice_id,
4534: p_default_last_update_login => p_default_last_update_login,
4535: p_calling_sequence => current_calling_sequence )<>TRUE) THEN
4536:
4537: debug_info := debug_info || 'exceptions';
4538: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4539: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4540: RAISE create_lines_failure;
4541: END IF;
4542: END IF;
4535: p_calling_sequence => current_calling_sequence )<>TRUE) THEN
4536:
4537: debug_info := debug_info || 'exceptions';
4538: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4539: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4540: RAISE create_lines_failure;
4541: END IF;
4542: END IF;
4543:
4548: --------------------------------------------------------------------------
4549:
4550: debug_info := '(Create lines 2) Call Utility function to round the line '||
4551: ' before create distributions';
4552: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4553: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4554: END IF;
4555:
4556: /* modifying following code as per the bug 6892789 as there is a chance
4549:
4550: debug_info := '(Create lines 2) Call Utility function to round the line '||
4551: ' before create distributions';
4552: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4553: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4554: END IF;
4555:
4556: /* modifying following code as per the bug 6892789 as there is a chance
4557: that line base amt goes to -ve value (line amount being +ve) so in such
4611: -- or call allocations package if allocation rule/lines need to be created
4612: --------------------------------------------------------------------------
4613: debug_info := '(Create lines 3) Call Matching or Allocations';
4614:
4615: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4616: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4617: END IF;
4618:
4619: BEGIN
4612: --------------------------------------------------------------------------
4613: debug_info := '(Create lines 3) Call Matching or Allocations';
4614:
4615: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4616: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4617: END IF;
4618:
4619: BEGIN
4620:
4625: IF (p_invoice_lines_tab(i).po_line_location_id IS NOT NULL) THEN
4626: debug_info := '(Create Lines 3.1) Check for quantity overbill '
4627: ||'for PO Shipment';
4628:
4629: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
4630: AP_IMPORT_UTILITIES_PKG.Print(
4631: AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4632: END IF;
4633:
4627: ||'for PO Shipment';
4628:
4629: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') then
4630: AP_IMPORT_UTILITIES_PKG.Print(
4631: AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4632: END IF;
4633:
4634: IF (AP_IMPORT_UTILITIES_PKG.get_overbill_for_shipment(
4635: p_invoice_lines_tab(i).po_line_location_id, -- IN
4643: l_amount_ordered, -- OUT NOCOPY
4644: l_amt_already_billed, -- OUT NOCOPY
4645: current_calling_sequence) <> TRUE) THEN
4646:
4647: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4648: AP_IMPORT_UTILITIES_PKG.Print(
4649: AP_IMPORT_INVOICES_PKG.g_debug_switch,
4650: 'get_overbill_for_shipment<-'||current_calling_sequence);
4651: END IF;
4645: current_calling_sequence) <> TRUE) THEN
4646:
4647: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4648: AP_IMPORT_UTILITIES_PKG.Print(
4649: AP_IMPORT_INVOICES_PKG.g_debug_switch,
4650: 'get_overbill_for_shipment<-'||current_calling_sequence);
4651: END IF;
4652: RAISE create_lines_failure;
4653: END IF;
4671: p_invoice_lines_tab(i).line_number,
4672: l_error_code))) THEN
4673:
4674: debug_info := '(Create lines 5) Error encountered: '||l_error_code;
4675: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4676: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4677: END IF;
4678: RETURN(FALSE);
4679:
4672: l_error_code))) THEN
4673:
4674: debug_info := '(Create lines 5) Error encountered: '||l_error_code;
4675: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4676: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4677: END IF;
4678: RETURN(FALSE);
4679:
4680: END IF;
4689: l_error_code))) THEN
4690:
4691: debug_info := '(Create lines 6) Error encountered: '||l_error_code;
4692:
4693: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4694: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4695: END IF;
4696:
4697: RETURN(FALSE);
4690:
4691: debug_info := '(Create lines 6) Error encountered: '||l_error_code;
4692:
4693: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4694: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4695: END IF;
4696:
4697: RETURN(FALSE);
4698: END IF;
4707: EXCEPTION
4708: WHEN OTHERS THEN
4709:
4710: debug_info := debug_info || '->exception';
4711: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4712: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4713: END IF;
4714:
4715: IF (SQLCODE < 0) THEN
4708: WHEN OTHERS THEN
4709:
4710: debug_info := debug_info || '->exception';
4711: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4712: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4713: END IF;
4714:
4715: IF (SQLCODE < 0) THEN
4716: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4712: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, debug_info);
4713: END IF;
4714:
4715: IF (SQLCODE < 0) THEN
4716: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4717: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
4718: END IF;
4719: END IF;
4720: RETURN (FALSE);
4713: END IF;
4714:
4715: IF (SQLCODE < 0) THEN
4716: IF (AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y') THEN
4717: Print( AP_IMPORT_INVOICES_PKG.g_debug_switch, SQLERRM);
4718: END IF;
4719: END IF;
4720: RETURN (FALSE);
4721: END Create_lines;
4745: -- Insert invoice holds FROM the import batch
4746: --------------------------------------------------------------------------
4747:
4748: debug_info := '(Insert Holds 1) Insert invoice holds FROM the import batch';
4749: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4750: AP_IMPORT_UTILITIES_PKG.Print(
4751: AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4752: END IF;
4753:
4747:
4748: debug_info := '(Insert Holds 1) Insert invoice holds FROM the import batch';
4749: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4750: AP_IMPORT_UTILITIES_PKG.Print(
4751: AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4752: END IF;
4753:
4754: IF (p_hold_code is NOT NULL) THEN
4755: ap_holds_pkg.insert_single_hold(
4766: -- Insert Suppler's holds
4767: ---------------------------------------------------------------------------
4768:
4769: debug_info := '(Insert Holds 2) Insert Suppler holds';
4770: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4771: AP_IMPORT_UTILITIES_PKG.Print(
4772: AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4773: END IF;
4774:
4768:
4769: debug_info := '(Insert Holds 2) Insert Suppler holds';
4770: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4771: AP_IMPORT_UTILITIES_PKG.Print(
4772: AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4773: END IF;
4774:
4775: iF (NVL(p_hold_future_payments_flag,'N') = 'Y') THEN
4776: ap_holds_pkg.insert_single_hold(
4790: -- Insert Hold IF invoice_base_amount > invoice_amount_limit
4791: --------------------------------------------------------------------------
4792: debug_info := '(Insert Holds 3) Insert Hold IF invoice_base_amount > '||
4793: 'invoice_amount_limit';
4794: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4795: AP_IMPORT_UTILITIES_PKG.Print(
4796: AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4797: END IF;
4798:
4792: debug_info := '(Insert Holds 3) Insert Hold IF invoice_base_amount > '||
4793: 'invoice_amount_limit';
4794: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4795: AP_IMPORT_UTILITIES_PKG.Print(
4796: AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4797: END IF;
4798:
4799: ap_holds_pkg.insert_single_hold(
4800: X_invoice_id =>p_base_invoice_id,
4808: RETURN(TRUE);
4809:
4810: EXCEPTION
4811: WHEN OTHERS THEN
4812: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4813: AP_IMPORT_UTILITIES_PKG.Print(
4814: AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4815: END IF;
4816:
4810: EXCEPTION
4811: WHEN OTHERS THEN
4812: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4813: AP_IMPORT_UTILITIES_PKG.Print(
4814: AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4815: END IF;
4816:
4817: IF (SQLCODE < 0) THEN
4818: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4814: AP_IMPORT_INVOICES_PKG.g_debug_switch,debug_info);
4815: END IF;
4816:
4817: IF (SQLCODE < 0) THEN
4818: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4819: AP_IMPORT_UTILITIES_PKG.Print(
4820: AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
4821: END IF;
4822: END IF;
4816:
4817: IF (SQLCODE < 0) THEN
4818: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4819: AP_IMPORT_UTILITIES_PKG.Print(
4820: AP_IMPORT_INVOICES_PKG.g_debug_switch,SQLERRM);
4821: END IF;
4822: END IF;
4823:
4824: RETURN (FALSE);
4941:
4942: BEGIN
4943:
4944: l_curr_calling_sequence := 'Is_Product_Registered <-'||p_calling_sequence;
4945: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4946: AP_IMPORT_UTILITIES_PKG.Print(
4947: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
4948: END IF;
4949:
4943:
4944: l_curr_calling_sequence := 'Is_Product_Registered <-'||p_calling_sequence;
4945: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4946: AP_IMPORT_UTILITIES_PKG.Print(
4947: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
4948: END IF;
4949:
4950: l_debug_info := 'Check if the other application is registered for Distribution Generation';
4951: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4947: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
4948: END IF;
4949:
4950: l_debug_info := 'Check if the other application is registered for Distribution Generation';
4951: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4952: AP_IMPORT_UTILITIES_PKG.Print(
4953: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
4954: END IF;
4955:
4949:
4950: l_debug_info := 'Check if the other application is registered for Distribution Generation';
4951: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
4952: AP_IMPORT_UTILITIES_PKG.Print(
4953: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
4954: END IF;
4955:
4956:
4957: BEGIN
4987: END Is_Product_Registered;
4988:
4989: -- Bug 5448579. This function will be used for caching org_id, name
4990: FUNCTION Cache_Org_Id_Name (
4991: P_Moac_Org_Table OUT NOCOPY AP_IMPORT_INVOICES_PKG.moac_ou_tab_type,
4992: P_Fsp_Org_Table OUT NOCOPY AP_IMPORT_INVOICES_PKG.fsp_org_tab_type,
4993: P_Calling_Sequence IN VARCHAR2 )
4994:
4995: RETURN BOOLEAN IS
4988:
4989: -- Bug 5448579. This function will be used for caching org_id, name
4990: FUNCTION Cache_Org_Id_Name (
4991: P_Moac_Org_Table OUT NOCOPY AP_IMPORT_INVOICES_PKG.moac_ou_tab_type,
4992: P_Fsp_Org_Table OUT NOCOPY AP_IMPORT_INVOICES_PKG.fsp_org_tab_type,
4993: P_Calling_Sequence IN VARCHAR2 )
4994:
4995: RETURN BOOLEAN IS
4996:
5009:
5010: BEGIN
5011:
5012: l_curr_calling_sequence := 'Cache_Org_Id_Name <- '||P_calling_sequence;
5013: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5014: AP_IMPORT_UTILITIES_PKG.Print(
5015: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5016: END IF;
5017:
5011:
5012: l_curr_calling_sequence := 'Cache_Org_Id_Name <- '||P_calling_sequence;
5013: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5014: AP_IMPORT_UTILITIES_PKG.Print(
5015: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5016: END IF;
5017:
5018: l_debug_info := 'Caching Org_id , Name from MO: Security Profile';
5019: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5015: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5016: END IF;
5017:
5018: l_debug_info := 'Caching Org_id , Name from MO: Security Profile';
5019: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5020: AP_IMPORT_UTILITIES_PKG.Print(
5021: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5022: END IF;
5023:
5017:
5018: l_debug_info := 'Caching Org_id , Name from MO: Security Profile';
5019: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5020: AP_IMPORT_UTILITIES_PKG.Print(
5021: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5022: END IF;
5023:
5024: OPEN moac_org;
5025: FETCH moac_org
5026: BULK COLLECT INTO P_Moac_Org_Table;
5027: CLOSE moac_org;
5028:
5029: l_debug_info := 'Caching Org_id from Financials Systems';
5030: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5031: AP_IMPORT_UTILITIES_PKG.Print(
5032: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5033: END IF;
5034:
5028:
5029: l_debug_info := 'Caching Org_id from Financials Systems';
5030: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5031: AP_IMPORT_UTILITIES_PKG.Print(
5032: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5033: END IF;
5034:
5035: OPEN fsp_org;
5036: FETCH fsp_org
5076: -- Update the calling sequence
5077: --
5078: l_curr_calling_sequence :=
5079: 'AP_IMPORT_UTILITIES_PKG.Check_For_Calendar_Term<-'||p_calling_sequence;
5080: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5081: AP_IMPORT_UTILITIES_PKG.Print(
5082: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5083: END IF;
5084:
5078: l_curr_calling_sequence :=
5079: 'AP_IMPORT_UTILITIES_PKG.Check_For_Calendar_Term<-'||p_calling_sequence;
5080: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5081: AP_IMPORT_UTILITIES_PKG.Print(
5082: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5083: END IF;
5084:
5085: --------------------------------------------------------
5086: l_debug_info := 'OPEN cursor c';
5084:
5085: --------------------------------------------------------
5086: l_debug_info := 'OPEN cursor c';
5087: --------------------------------------------------------
5088: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5089: AP_IMPORT_UTILITIES_PKG.Print(
5090: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5091: END IF;
5092:
5086: l_debug_info := 'OPEN cursor c';
5087: --------------------------------------------------------
5088: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5089: AP_IMPORT_UTILITIES_PKG.Print(
5090: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5091: END IF;
5092:
5093: l_cal_exists := '';
5094: OPEN c;
5096: LOOP
5097: --------------------------------------------------------
5098: l_debug_info := 'Fetch cursor C';
5099: --------------------------------------------------------
5100: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5101: AP_IMPORT_UTILITIES_PKG.Print(
5102: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5103: END IF;
5104:
5098: l_debug_info := 'Fetch cursor C';
5099: --------------------------------------------------------
5100: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5101: AP_IMPORT_UTILITIES_PKG.Print(
5102: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5103: END IF;
5104:
5105: FETCH c INTO l_calendar;
5106: EXIT WHEN c%NOTFOUND;
5107:
5108: --------------------------------------------------------
5109: l_debug_info := 'Check for calendar';
5110: --------------------------------------------------------
5111: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5112: AP_IMPORT_UTILITIES_PKG.Print(
5113: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5114: END IF;
5115:
5109: l_debug_info := 'Check for calendar';
5110: --------------------------------------------------------
5111: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5112: AP_IMPORT_UTILITIES_PKG.Print(
5113: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5114: END IF;
5115:
5116: BEGIN
5117:
5140: END LOOP;
5141: --------------------------------------------------------
5142: l_debug_info := 'CLOSE cursor c';
5143: --------------------------------------------------------
5144: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5145: AP_IMPORT_UTILITIES_PKG.Print(
5146: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5147: END IF;
5148:
5142: l_debug_info := 'CLOSE cursor c';
5143: --------------------------------------------------------
5144: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5145: AP_IMPORT_UTILITIES_PKG.Print(
5146: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5147: END IF;
5148:
5149: CLOSE c;
5150:
5163: End Check_For_Calendar_Term;
5164:
5165: -- Bug 5448579. This function will be used for caching Pay Group
5166: FUNCTION Cache_Pay_Group (
5167: P_Pay_Group_Table OUT NOCOPY AP_IMPORT_INVOICES_PKG.pay_group_tab_type,
5168: P_Calling_Sequence IN VARCHAR2)
5169: RETURN BOOLEAN IS
5170:
5171: CURSOR pay_group IS
5172: SELECT lookup_code
5173: FROM po_lookup_codes
5174: WHERE lookup_type = 'PAY GROUP'
5175: AND DECODE(SIGN(NVL(inactive_date,
5176: AP_IMPORT_INVOICES_PKG.g_inv_sysdate) -
5177: AP_IMPORT_INVOICES_PKG.g_inv_sysdate),
5178: -1,'','*') = '*';
5179:
5180: l_debug_info VARCHAR2(1000);
5173: FROM po_lookup_codes
5174: WHERE lookup_type = 'PAY GROUP'
5175: AND DECODE(SIGN(NVL(inactive_date,
5176: AP_IMPORT_INVOICES_PKG.g_inv_sysdate) -
5177: AP_IMPORT_INVOICES_PKG.g_inv_sysdate),
5178: -1,'','*') = '*';
5179:
5180: l_debug_info VARCHAR2(1000);
5181: l_curr_calling_sequence VARCHAR2(2000);
5183:
5184: BEGIN
5185:
5186: l_curr_calling_sequence := 'Cache_Pay_group <- '||P_calling_sequence;
5187: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5188: AP_IMPORT_UTILITIES_PKG.Print(
5189: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5190: END IF;
5191:
5185:
5186: l_curr_calling_sequence := 'Cache_Pay_group <- '||P_calling_sequence;
5187: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5188: AP_IMPORT_UTILITIES_PKG.Print(
5189: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5190: END IF;
5191:
5192: l_debug_info := 'Caching Pay Group from PO Lookup Codes';
5193: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5189: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5190: END IF;
5191:
5192: l_debug_info := 'Caching Pay Group from PO Lookup Codes';
5193: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5194: AP_IMPORT_UTILITIES_PKG.Print(
5195: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5196: END IF;
5197:
5191:
5192: l_debug_info := 'Caching Pay Group from PO Lookup Codes';
5193: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5194: AP_IMPORT_UTILITIES_PKG.Print(
5195: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5196: END IF;
5197:
5198: OPEN pay_group;
5199: FETCH pay_group
5215: END Cache_Pay_Group;
5216:
5217: -- Bug 5448579. This function will be used for caching Payment Method from IBY
5218: FUNCTION Cache_Payment_Method (
5219: P_Payment_Method_Table OUT NOCOPY AP_IMPORT_INVOICES_PKG.payment_method_tab_type,
5220: P_Calling_Sequence IN VARCHAR2)
5221: RETURN BOOLEAN IS
5222:
5223: CURSOR payment_method IS
5230:
5231: BEGIN
5232:
5233: l_curr_calling_sequence := 'Cache_Payment_Method <- '||P_calling_sequence;
5234: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5235: AP_IMPORT_UTILITIES_PKG.Print(
5236: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5237: END IF;
5238:
5232:
5233: l_curr_calling_sequence := 'Cache_Payment_Method <- '||P_calling_sequence;
5234: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5235: AP_IMPORT_UTILITIES_PKG.Print(
5236: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5237: END IF;
5238:
5239: l_debug_info := 'Caching Payment Method from IBY';
5240: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5236: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5237: END IF;
5238:
5239: l_debug_info := 'Caching Payment Method from IBY';
5240: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5241: AP_IMPORT_UTILITIES_PKG.Print(
5242: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5243: END IF;
5244:
5238:
5239: l_debug_info := 'Caching Payment Method from IBY';
5240: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5241: AP_IMPORT_UTILITIES_PKG.Print(
5242: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5243: END IF;
5244:
5245: OPEN payment_method;
5246: FETCH payment_method
5261:
5262: END Cache_Payment_Method;
5263:
5264: FUNCTION Cache_Fnd_Currency (
5265: P_Fnd_Currency_Table OUT NOCOPY AP_IMPORT_INVOICES_PKG.fnd_currency_tab_type,
5266: P_Calling_Sequence IN VARCHAR2)
5267: RETURN BOOLEAN IS
5268:
5269: CURSOR currency_code_cur IS
5281:
5282: BEGIN
5283:
5284: l_curr_calling_sequence := 'Cache_Fnd_Currency <- '||P_calling_sequence;
5285: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5286: AP_IMPORT_UTILITIES_PKG.Print(
5287: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5288: END IF;
5289:
5283:
5284: l_curr_calling_sequence := 'Cache_Fnd_Currency <- '||P_calling_sequence;
5285: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5286: AP_IMPORT_UTILITIES_PKG.Print(
5287: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5288: END IF;
5289:
5290: l_debug_info := 'Caching Currency from Fnd Currency';
5291: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5287: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_curr_calling_sequence);
5288: END IF;
5289:
5290: l_debug_info := 'Caching Currency from Fnd Currency';
5291: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5292: AP_IMPORT_UTILITIES_PKG.Print(
5293: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5294: END IF;
5295:
5289:
5290: l_debug_info := 'Caching Currency from Fnd Currency';
5291: IF AP_IMPORT_INVOICES_PKG.g_debug_switch = 'Y' THEN
5292: AP_IMPORT_UTILITIES_PKG.Print(
5293: AP_IMPORT_INVOICES_PKG.g_debug_switch,l_debug_info);
5294: END IF;
5295:
5296: OPEN currency_code_cur;
5297: FETCH currency_code_cur