120: AIP.global_attribute20,
121: AIP.global_attribute_category,
122: AIP.org_id /* Bug 4759178, added org_id */
123: FROM ap_invoice_payments AIP,
124: ap_invoices AI
125: WHERE AIP.check_id = P_Check_Id
126: AND AIP.invoice_id = AI.invoice_id
127: AND nvl(AIP.reversal_flag, 'N') <> 'Y';
128:
197: WHERE AH.invoice_id = AIP.invoice_id
198: AND AH.hold_lookup_code = P_Hold_Code
199: AND AH.release_lookup_code IS NULL)
200: AND NOT EXISTS (SELECT 'Invoice is an Interest Invoice' -- 3240962
201: FROM ap_invoices AI
202: WHERE AI.invoice_id = AIP.invoice_id
203: AND AI.invoice_type_lookup_code = 'INTEREST');
204:
205: -- bug9441420
206: CURSOR Prepay_Appl IS
207: SELECT DISTINCT aid.invoice_id
208: FROM ap_invoice_payments_all aip,
209: ap_invoice_distributions_all aid_prepay,
210: ap_invoices_all ai_prepay,
211: ap_invoice_distributions_all aid
212: WHERE aip.check_id = P_Check_ID
213: AND aip.invoice_id = aid_prepay.invoice_id
214: AND aid_prepay.invoice_id = ai_prepay.invoice_id
406: -- Fix for bug 893626:
407: -- Problem: After voiding a payment, the form field inv_curr_amount_paid
408: -- was incorrectly showing the invoice amount instead of the amount paid
409: -- for that invoice.
410: -- Cause: The payment_status_flag in ap_invoices table was not being
411: -- set to 'N' after voiding the payment for an invoice.
412: -- Fix: By executing the ap_pay_update_payment_schedule procedure call
413: -- before the ap_pay_update_ap_invoices, the payment_status_flag that was
414: -- set in ap_payment_schedule is populated in ap_invoices.
409: -- for that invoice.
410: -- Cause: The payment_status_flag in ap_invoices table was not being
411: -- set to 'N' after voiding the payment for an invoice.
412: -- Fix: By executing the ap_pay_update_payment_schedule procedure call
413: -- before the ap_pay_update_ap_invoices, the payment_status_flag that was
414: -- set in ap_payment_schedule is populated in ap_invoices.
415: ---------------------------------------------------------------------
416:
417: l_debug_info := 'Open c_payment_schedules cursor';
410: -- Cause: The payment_status_flag in ap_invoices table was not being
411: -- set to 'N' after voiding the payment for an invoice.
412: -- Fix: By executing the ap_pay_update_payment_schedule procedure call
413: -- before the ap_pay_update_ap_invoices, the payment_status_flag that was
414: -- set in ap_payment_schedule is populated in ap_invoices.
415: ---------------------------------------------------------------------
416:
417: l_debug_info := 'Open c_payment_schedules cursor';
418: IF (G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
473: FETCH c_invoices INTO l_invoice_id;
474: EXIT WHEN c_invoices%NOTFOUND;
475:
476: -----------------------------------------------------------------
477: -- Update AP_INVOICES paid by P_Check_Id
478: -----------------------------------------------------------------
479:
480: AP_PAY_INVOICE_PKG.AP_PAY_UPDATE_AP_INVOICES (
481: l_invoice_id,
476: -----------------------------------------------------------------
477: -- Update AP_INVOICES paid by P_Check_Id
478: -----------------------------------------------------------------
479:
480: AP_PAY_INVOICE_PKG.AP_PAY_UPDATE_AP_INVOICES (
481: l_invoice_id,
482: P_Check_Id,
483: NULL,
484: NULL,
539: p_operation => 'U',
540: p_key_value_list => l_dbi_key_value_list2,
541: p_calling_sequence => l_curr_calling_sequence);
542:
543: l_debug_info := 'Update ap_invoices for Interest invoice';
544: IF (G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
545: FND_LOG.STRING(G_LEVEL_STATEMENT,G_MODULE_NAME||l_api_name,l_debug_info);
546: END IF;
547:
544: IF (G_LEVEL_STATEMENT >= G_CURRENT_RUNTIME_LEVEL) THEN
545: FND_LOG.STRING(G_LEVEL_STATEMENT,G_MODULE_NAME||l_api_name,l_debug_info);
546: END IF;
547:
548: UPDATE ap_invoices_all AI
549: SET AI.description = 'VOID '||AI.description,
550: AI.invoice_amount = 0,
551: AI.amount_paid = 0,
552: AI.invoice_distribution_total = 0,
567: END IF;
568:
569: --Bug 4539462 DBI logging
570: AP_DBI_PKG.Maintain_DBI_Summary
571: (p_table_name => 'AP_INVOICES',
572: p_operation => 'U',
573: p_key_value_list => l_dbi_key_value_list1,
574: p_calling_sequence => l_curr_calling_sequence);
575:
938: WHERE AH.invoice_id = AIP.invoice_id
939: AND AH.hold_lookup_code = P_Hold_Code
940: AND AH.release_lookup_code IS NULL)
941: AND NOT EXISTS (SELECT 'Invoice is an Interest Invoice'
942: FROM ap_invoices AI
943: WHERE AI.invoice_id = AIP.invoice_id
944: AND AI.invoice_type_lookup_code = 'INTEREST');
945:
946: /* Bug 5169128 */