581: -- If there is a rounding due to proration, instead of rounding the
582: -- the difference can go to gain loss account.
583: SELECT count(*)
584: INTO l_upg_inv_pmts
585: FROM AP_Invoice_Payments_All AIP
586: WHERE Invoice_ID = l_inv_pay_rec.invoice_id
587: AND EXISTS (SELECT 'Upg Payment'
588: FROM AP_Payment_History_All APH
589: WHERE APH.Check_ID = AIP.Check_ID
1340: AIP.Exchange_Date,
1341: AIP.Exchange_Rate,
1342: NVL(AIP.Reversal_Flag,'N'),
1343: AIP.Reversal_Inv_Pmt_ID
1344: FROM AP_Invoice_Payments_All AIP
1345: WHERE AIP.Check_ID = P_Check_ID
1346: AND AIP.Invoice_ID = P_Invoice_ID;
1347:
1348: -- Logging Infra:
3880: NULL,
3881: SYSDATE,
3882: FND_GLOBAL.Conc_Request_ID
3883: FROM AP_Payment_Hist_Dists APHD,
3884: AP_Invoice_Payments_All AIP,
3885: AP_Invoice_Distributions_All AID
3886: WHERE AIP.Invoice_Payment_ID = p_reversal_inv_pmt_id
3887: AND AIP.Accounting_Event_ID = APHD.Accounting_Event_ID
3888: AND AIP.Invoice_ID = AID.Invoice_ID
3970: SYSDATE,
3971: FND_GLOBAL.Conc_Request_ID
3972: FROM AP_Payment_Hist_Dists APHD,
3973: AP_Payment_History_All APH,
3974: AP_Invoice_Payments_All AIP,
3975: AP_Invoice_Distributions_All AID -- 6804379
3976: WHERE nvl(APH.Related_Event_ID, APH.Accounting_Event_ID) = p_related_event_id
3977: AND APHD.Payment_History_ID = APH.Payment_History_ID
3978: AND NVL(APHD.Reversal_Flag,'N') <> 'Y'