2: /* $Header: apslappb.pls 120.29.12010000.4 2008/09/12 10:51:03 gkarampu ship $ */
3:
4: -------------------------------------------------------------------------------
5: --
6: -- ap_invoice_payments_all
7: -- \|/ \|/
8: -- | |
9: -- +-----------------------+ +------------------------+
10: -- | |
25: -- /|\ /|\ /|\
26: -- ap_payment_hist_dists ap_prepay_app_dists
27: --
28: --
29: -- Each record in the AP_INVOICE_PAYMENTS_ALL table relates a portion of a
30: -- payment to an invoice.
31: --
32: -- Each record in the AP_INVOICE_DISTRIBUTIONS_ALL table relates a portion of
33: -- the cost of an invoice to an accounting cost object.
166: -- or 'S' will their POSTED_FLAGs update to 'S'.
167: ---------------------------------------------------------------------
168:
169: FORALL i IN 1 .. p_event_ids.count
170: UPDATE ap_invoice_payments_all AIP
171: SET AIP.posted_flag = 'S'
172: WHERE AIP.accounting_event_id = p_event_ids(i);
173:
174: ---------------------------------------------------------------------
728: -----------------------------------------------------------------------
729:
730:
731: FORALL num in 1 .. l_accrual_event_ids.COUNT
732: UPDATE AP_Invoice_Payments_all
733: SET Posted_Flag = 'Y', Accrual_Posted_Flag = 'Y'
734: WHERE Accounting_Event_ID = l_accrual_event_ids(num);
735:
736: FORALL num in 1 .. l_accrual_event_ids.COUNT
806: trace(G_LEVEL_STATEMENT, l_procedure_name, l_debug_info);
807: -----------------------------------------------------------------------
808:
809: FORALL num in 1 .. l_cash_event_ids.COUNT
810: UPDATE AP_Invoice_Payments_all
811: SET Posted_Flag = 'Y', Accrual_Posted_Flag = 'N', Cash_Posted_Flag = 'Y'
812: WHERE Accounting_Event_ID = l_cash_event_ids(num);
813:
814: -- update for prepay event
1073: -1,
1074: AID.invoice_distribution_id,
1075: 'SQL'),0)
1076: WHERE AID.Invoice_ID IN (SELECT AIP.invoice_id
1077: FROM Ap_Invoice_Payments_All AIP
1078: WHERE AIP.Accounting_Event_ID
1079: = l_payclear_event_list(num))
1080: AND AID.Prepay_Distribution_ID IS NULL
1081: AND AID.prepay_tax_parent_id IS NULL
1138: STID.Invoice_Distribution_ID,
1139: STID.Amount,
1140: l_curr_calling_sequence)
1141: WHERE STID.Invoice_ID IN (SELECT AIP.invoice_id
1142: FROM Ap_Invoice_Payments_All AIP
1143: WHERE AIP.Accounting_Event_ID
1144: = l_payclear_event_list(num))
1145: AND STID.Prepay_Distribution_ID IS NULL
1146: AND nvl(STID.cancellation_flag,'N') <> 'Y'
1185: AID.Invoice_Distribution_ID,
1186: AID.Amount,
1187: l_curr_calling_sequence)
1188: WHERE AID.Invoice_ID IN (SELECT AIP.invoice_id
1189: FROM Ap_Invoice_Payments_All AIP
1190: WHERE AIP.Accounting_Event_ID
1191: = l_other_event_list(num))
1192: AND AID.Prepay_Distribution_ID IS NULL
1193: AND AID.prepay_tax_parent_id IS NULL
1250: STID.Invoice_Distribution_ID,
1251: STID.Amount,
1252: l_curr_calling_sequence)
1253: WHERE STID.Invoice_ID IN (SELECT AIP.invoice_id
1254: FROM Ap_Invoice_Payments_All AIP
1255: WHERE AIP.Accounting_Event_ID
1256: = l_other_event_list(num))
1257: AND STID.Prepay_Distribution_ID IS NULL
1258: AND nvl(STID.cancellation_flag,'N') <> 'Y'
1491: SET POSTED_FLAG = 'N'
1492: WHERE AID.accounting_event_id in
1493: ( select event_id from xla_events_gt);
1494:
1495: UPDATE ap_invoice_payments_all AIP
1496: SET POSTED_FLAG = 'N'
1497: WHERE AIP.accounting_event_id in
1498: ( select event_id from xla_events_gt);
1499:
1881: -- posted_flag to 'Y' for payment create and maturity event after
1882: -- Create Accounting program
1883:
1884: -- FORALL i IN 1 .. l_event_ids.count
1885: -- UPDATE ap_invoice_payments_all AIP
1886: -- SET AIP.posted_flag = 'N'
1887: -- WHERE AIP.accounting_event_id = l_event_ids(i);
1888:
1889: FORALL i IN 1 .. l_event_ids.count
1886: -- SET AIP.posted_flag = 'N'
1887: -- WHERE AIP.accounting_event_id = l_event_ids(i);
1888:
1889: FORALL i IN 1 .. l_event_ids.count
1890: UPDATE ap_invoice_payments_all AIP
1891: SET AIP.POSTED_FLAG = CASE WHEN l_event_status(i) = 'U'
1892: AND EXISTS(SELECT 1
1893: FROM ap_system_parameters asp, ap_payment_history_all aph
1894: WHERE asp.when_to_account_pmt = 'CLEARING ONLY'