1 PACKAGE BODY IGI_AP_CANCEL_PKG AS
2 /* $Header: igicancb.pls 115.10 2003/08/09 11:36:03 rgopalan ship $ */
3
4 ---------------------------------------------------------------------
5 -- Procedure Insert_Hold creates a CANCEL hold on the invoice using
6 -- the translated message string as the hold reason.
7 --
8 PROCEDURE Insert_Hold(P_invoice_id IN VARCHAR2,
9 P_message_name IN VARCHAR2,
10 P_last_updated_by IN NUMBER,
11 P_calling_sequence IN VARCHAR2)
12 IS
13 BEGIN
14 NULL;
15 END Insert_Hold;
16
17 ---------------------------------------------------------------------
18 -- Function Ap_Cancel_Single_Invoice cancels one invoice by executing
19 -- the following sequence of steps, returning TRUE if successful and
20 -- FALSE otherwise:
21 --
22 -- 1. If invoice has an effective payment, return FALSE
23 -- 2. If invoice is selected for payment, return FALSE
24 -- 3. If invoice is already cancelled, return FALSE
25 -- 4. If invoices have been applied against this invoice (prepayment),
26 -- return FALSE
27 -- 5. If invoice is matched to Finally Closed PO's, return FALSE
28 -- 5a If project related invoices have pending adjustments, return FALSE
29 -- 6. If invoice is matched, reverse matching
30 -- 6a.If invoice tax calculation level is line, calculate tax
31 -- 6b.If invoice has had tax withheld, undo withholding
32 -- 7. Clear out NOCOPY payment schedules
33 -- 7a.Create allocations for existing charges if needed
34 -- 8. Create reversing distribution lines
35 -- 8a.Fetch the maximum distribution line number
36 -- 8b.Set encumbered flags to 'N'
37 -- 8c.Insert distribution reversals based on existing lines
38 -- 9. Zero out NOCOPY the Invoice
39 -- 10. Run AutoApproval for this invoice
40 -- 11. If no posting holds remain then cancel the invoice
41 -- 12. Commit
42 --
43 FUNCTION Ap_Cancel_Single_Invoice(P_invoice_id IN NUMBER,
44 P_last_updated_by IN NUMBER,
45 P_last_update_login IN NUMBER,
46 P_set_of_books_id IN NUMBER,
47 P_accounting_date IN DATE,
48 P_period_name IN VARCHAR2,
49 P_message_name OUT NOCOPY VARCHAR2,
50 P_invoice_amount OUT NOCOPY NUMBER,
51 P_base_amount OUT NOCOPY NUMBER,
52 P_tax_amount OUT NOCOPY NUMBER,
53 P_temp_cancelled_amount OUT NOCOPY NUMBER,
54 P_cancelled_by OUT NOCOPY NUMBER,
55 P_cancelled_amount OUT NOCOPY NUMBER,
56 P_cancelled_date OUT NOCOPY DATE,
57 P_last_update_date OUT NOCOPY DATE,
58 P_original_prepayment_amount OUT NOCOPY NUMBER,
59 P_calling_sequence IN VARCHAR2)
60 RETURN BOOLEAN
61 IS
62 BEGIN
63 NULL;
64 END Ap_Cancel_Single_Invoice;
65
66
67
68 ---------------------------------------------------------------------
69 -- Procedure Ap_Cancel_Invoices cancels all invoices associated with
70 -- the payment given by P_check_id
71 --
72 -- Invoices that are not eligible for cancellation:
73 -- 1. invoices associated with an effective payment,
74 -- 2. invoices that are selected for payment,
75 -- 3. invoices that are already cancelled
76 -- 4. invoices (prepayments) that have been used by other invoices
77 -- 5. invoices that are matched to Finally Closed PO's)
78 -- 6. invoices which were paid originally by check but whose payment
79 -- was removed prior to the voiding of the check i.e. through
80 -- an invoice adjustment.
81 -- are left unaffected.
82 --
83 -- AutoApproval is run for each invoice. If the invoice has posting
84 -- holds, it is zeroed out NOCOPY by reversing all invoice distributions and
85 -- PO matching, but the invoice is not cancelled.
86 --
87 --
88 PROCEDURE Ap_Cancel_Invoices(P_check_id IN NUMBER,
89 P_last_updated_by IN NUMBER,
90 P_last_update_login IN NUMBER,
91 P_set_of_books_id IN NUMBER,
92 P_accounting_date IN DATE,
93 P_period_name IN VARCHAR2,
94 P_num_cancelled OUT NOCOPY NUMBER,
95 P_num_not_cancelled OUT NOCOPY NUMBER,
96 P_calling_sequence IN VARCHAR2)
97 IS
98 BEGIN
99 NULL;
100 END Ap_Cancel_Invoices;
101
102
103 END IGI_AP_CANCEL_PKG;