2438: WHERE Accounting_Event_Id = Events_to_Process_tab(i).Event_Id
2439: AND Invoice_Id = l_Source_Id;
2440:
2441: DELETE
2442: FROM ap_prepay_app_dists
2443: WHERE PREPAY_HISTORY_ID IN
2444: (SELECT PREPAY_HISTORY_ID
2445: FROM ap_prepay_history_all
2446: WHERE Accounting_Event_Id = Events_to_Process_tab(i).Event_Id
3435: 'ACCOUNT_SEGMENT_VALUE', aid.dist_code_combination_id,
3436: asp.rounding_error_ccid),
3437: asp.rounding_error_ccid
3438: ) write_off_code_combination
3439: FROM ap_prepay_app_dists apad,
3440: ap_prepay_history_all apph,
3441: ap_system_parameters_all asp,
3442: ap_invoice_distributions_all aid
3443: WHERE apad.accounting_event_id = P_Event_Id
3878: ELSE
3879:
3880: SELECT max(apad.prepay_app_dist_id)
3881: INTO l_max_prepay_dist_id
3882: FROM ap_prepay_app_dists apad
3883: WHERE apad.accounting_event_id = l_max_event_id;
3884:
3885: END IF;
3886:
4344: p_security_context => l_event_security_context,
4345: p_calling_sequence => l_procedure_name
4346: );
4347:
4348: DELETE ap_prepay_app_dists apad
4349: WHERE apad.accounting_event_id = i.accounting_event_id
4350: AND NOT EXISTS
4351: (
4352: SELECT 1
4680: aid.match_status_flag = 'S'
4681: WHERE aid.invoice_distribution_id = l_inv_dist_id_tab(j);
4682:
4683:
4684: l_debug_info := 'Deleting from ap_prepay_app_dists';
4685: -- bug10056653, updated the delete to exclude the PREPAY APP
4686: -- DISTS pertaining to ADJ events
4687: --
4688: FORALL j IN l_inv_dist_id_tab.FIRST..l_inv_dist_id_tab.LAST
4685: -- bug10056653, updated the delete to exclude the PREPAY APP
4686: -- DISTS pertaining to ADJ events
4687: --
4688: FORALL j IN l_inv_dist_id_tab.FIRST..l_inv_dist_id_tab.LAST
4689: DELETE FROM ap_prepay_app_dists apad
4690: WHERE (apad.accounting_event_id = l_acct_event_id_tab(j) OR
4691: apad.bc_event_id = l_bc_event_id_tab(j) OR
4692: apad.prepay_app_distribution_id = l_inv_dist_id_tab(j))
4693: AND NOT EXISTS
4708: AND apph.transaction_type <> 'PREPAYMENT APPLICATION ADJ'
4709: AND apph.invoice_line_number = l_inv_line_no_tab(j)
4710: AND NOT EXISTS
4711: (SELECT 1
4712: FROM ap_prepay_app_dists apad,
4713: ap_invoice_distributions_all aid
4714: WHERE apad.prepay_history_id = apph.prepay_history_id
4715: AND apad.prepay_app_distribution_id = aid.invoice_distribution_id
4716: AND (aid.posted_flag = 'Y' OR
4749: aid.bc_event_id = l_bc_event_id_tab(j),
4750: aid.match_status_flag = l_match_status_flg_tab(j)
4751: WHERE aid.invoice_distribution_id = l_inv_dist_id_tab(j);
4752:
4753: l_debug_info := 'Updating ap_prepay_app_dists';
4754: -- bug10056653, excluded prepay history pertaining to the
4755: -- cascade ADJ events
4756: --
4757: FORALL j IN l_inv_dist_id_tab.FIRST..l_inv_dist_id_tab.LAST
4754: -- bug10056653, excluded prepay history pertaining to the
4755: -- cascade ADJ events
4756: --
4757: FORALL j IN l_inv_dist_id_tab.FIRST..l_inv_dist_id_tab.LAST
4758: UPDATE ap_prepay_app_dists apad
4759: SET apad.accounting_event_id = l_acct_event_id_tab(j),
4760: apad.bc_event_id = l_bc_event_id_tab(j)
4761: WHERE apad.prepay_app_distribution_id = l_inv_dist_id_tab(j)
4762: AND NOT EXISTS
4775: apph.bc_event_id = l_bc_event_id_tab(j)
4776: WHERE apph.transaction_type <> 'PREPAYMENT APPLICATION ADJ'
4777: AND EXISTS
4778: (SELECT 1
4779: FROM ap_prepay_app_dists apad
4780: WHERE apad.prepay_history_id = apph.prepay_history_id
4781: AND apad.prepay_app_distribution_id = l_inv_dist_id_tab(j));
4782:
4783: l_prev_org_id := l_org_id;
4816: -- bug10056653, changed the display message
4817: --
4818: l_message := 'Following are the details of the invoices for which '||
4819: 'repopulation of Prepay History(AP_PREPAY_HISTORY_ALL) and '||
4820: 'Prepay App Dists(AP_PREPAY_APP_DISTS) was successful ';
4821: Print(l_message);
4822:
4823: l_debug_info := ' Printing the details of the repopulated prepayment ';
4824: l_message := '