101: P_minimum_accountable_unit,
102: P_precision,
103: P_release_amount_net_of_tax
104: FROM
105: ap_invoices_all ai,
106: FND_CURRENCIES FC,
107: HZ_PARTIES HP,
108: ap_suppliers pv,
109: ap_supplier_sites_all pvs,
296:
297: Begin
298:
299: /*
300: * bug 7118571 - added ap_invoices_all to the query to consider non-cancelled invoices only
301: */
302: Select Nvl(Sum(ail.quantity_invoiced), 0)
303: Into l_existing_corr_qty
304: From ap_invoice_lines_all ail
301: */
302: Select Nvl(Sum(ail.quantity_invoiced), 0)
303: Into l_existing_corr_qty
304: From ap_invoice_lines_all ail
305: ,ap_invoices_all ai
306: Where ail.corrected_inv_id = p_invoice_id
307: And ail.corrected_line_number = p_line_number
308: And ail.match_type = 'QTY_CORRECTION'
309: And ail.invoice_id = ai.invoice_id
326:
327: Begin
328:
329: /*
330: * bug 7118571 - added ap_invoices_all to the query to consider non-cancelled invoices only
331: */
332: Select Nvl(Sum(ail.unit_price * ail.quantity_invoiced), 0)
333: Into l_correction_amount
334: From ap_invoice_lines_all ail
331: */
332: Select Nvl(Sum(ail.unit_price * ail.quantity_invoiced), 0)
333: Into l_correction_amount
334: From ap_invoice_lines_all ail
335: ,ap_invoices_all ai
336: Where ail.corrected_inv_id = p_invoice_id
337: And ail.corrected_line_number = p_line_number
338: And ail.match_type = 'PRICE_CORRECTION'
339: And ai.invoice_id = ail.invoice_id
391:
392: Begin
393:
394: /*
395: * bug 7118571 - added ap_invoices_all to the query to consider non-cancelled invoices only
396: */
397:
398: Select Nvl(Sum(ail.amount), 0)
399: Into l_existing_corr_amt
397:
398: Select Nvl(Sum(ail.amount), 0)
399: Into l_existing_corr_amt
400: From ap_invoice_lines_all ail
401: ,ap_invoices_all ai
402: Where ail.corrected_inv_id = p_invoice_id
403: And ail.corrected_line_number = p_line_number
404: And ail.match_type In ( 'QTY_CORRECTION', 'PRICE_CORRECTION',
405: 'AMOUNT_CORRECTION')
1325:
1326: --bugfix:5496603
1327: l_recouped_tax_amt_in_pay_curr NUMBER;
1328: l_recouped_tax_amount NUMBER;
1329: l_inv_curr_code ap_invoices_all.invoice_currency_code%TYPE;
1330: l_inv_xrate ap_invoices_all.exchange_rate%TYPE;
1331: l_inv_xdate ap_invoices_all.exchange_date%TYPE;
1332: l_inv_xrate_type ap_invoices_all.exchange_rate_type%TYPE;
1333: l_inv_pay_curr_code ap_invoices_all.payment_currency_code%TYPE;
1326: --bugfix:5496603
1327: l_recouped_tax_amt_in_pay_curr NUMBER;
1328: l_recouped_tax_amount NUMBER;
1329: l_inv_curr_code ap_invoices_all.invoice_currency_code%TYPE;
1330: l_inv_xrate ap_invoices_all.exchange_rate%TYPE;
1331: l_inv_xdate ap_invoices_all.exchange_date%TYPE;
1332: l_inv_xrate_type ap_invoices_all.exchange_rate_type%TYPE;
1333: l_inv_pay_curr_code ap_invoices_all.payment_currency_code%TYPE;
1334: l_inv_pay_cross_rate_date ap_invoices_all.payment_cross_rate_date%TYPE;
1327: l_recouped_tax_amt_in_pay_curr NUMBER;
1328: l_recouped_tax_amount NUMBER;
1329: l_inv_curr_code ap_invoices_all.invoice_currency_code%TYPE;
1330: l_inv_xrate ap_invoices_all.exchange_rate%TYPE;
1331: l_inv_xdate ap_invoices_all.exchange_date%TYPE;
1332: l_inv_xrate_type ap_invoices_all.exchange_rate_type%TYPE;
1333: l_inv_pay_curr_code ap_invoices_all.payment_currency_code%TYPE;
1334: l_inv_pay_cross_rate_date ap_invoices_all.payment_cross_rate_date%TYPE;
1335: l_inv_pay_cross_rate_type ap_invoices_all.payment_cross_rate_type%TYPE;
1328: l_recouped_tax_amount NUMBER;
1329: l_inv_curr_code ap_invoices_all.invoice_currency_code%TYPE;
1330: l_inv_xrate ap_invoices_all.exchange_rate%TYPE;
1331: l_inv_xdate ap_invoices_all.exchange_date%TYPE;
1332: l_inv_xrate_type ap_invoices_all.exchange_rate_type%TYPE;
1333: l_inv_pay_curr_code ap_invoices_all.payment_currency_code%TYPE;
1334: l_inv_pay_cross_rate_date ap_invoices_all.payment_cross_rate_date%TYPE;
1335: l_inv_pay_cross_rate_type ap_invoices_all.payment_cross_rate_type%TYPE;
1336: TYPE PREPAY_DIST_ID_LIST IS TABLE OF AP_INVOICE_DISTRIBUTIONS_ALL.PREPAY_DISTRIBUTION_ID%TYPE INDEX BY PLS_INTEGER;
1329: l_inv_curr_code ap_invoices_all.invoice_currency_code%TYPE;
1330: l_inv_xrate ap_invoices_all.exchange_rate%TYPE;
1331: l_inv_xdate ap_invoices_all.exchange_date%TYPE;
1332: l_inv_xrate_type ap_invoices_all.exchange_rate_type%TYPE;
1333: l_inv_pay_curr_code ap_invoices_all.payment_currency_code%TYPE;
1334: l_inv_pay_cross_rate_date ap_invoices_all.payment_cross_rate_date%TYPE;
1335: l_inv_pay_cross_rate_type ap_invoices_all.payment_cross_rate_type%TYPE;
1336: TYPE PREPAY_DIST_ID_LIST IS TABLE OF AP_INVOICE_DISTRIBUTIONS_ALL.PREPAY_DISTRIBUTION_ID%TYPE INDEX BY PLS_INTEGER;
1337: TYPE RECOUP_AMOUNT_LIST IS TABLE OF AP_INVOICE_DISTRIBUTIONS_ALL.AMOUNT%TYPE INDEX BY PLS_INTEGER;
1330: l_inv_xrate ap_invoices_all.exchange_rate%TYPE;
1331: l_inv_xdate ap_invoices_all.exchange_date%TYPE;
1332: l_inv_xrate_type ap_invoices_all.exchange_rate_type%TYPE;
1333: l_inv_pay_curr_code ap_invoices_all.payment_currency_code%TYPE;
1334: l_inv_pay_cross_rate_date ap_invoices_all.payment_cross_rate_date%TYPE;
1335: l_inv_pay_cross_rate_type ap_invoices_all.payment_cross_rate_type%TYPE;
1336: TYPE PREPAY_DIST_ID_LIST IS TABLE OF AP_INVOICE_DISTRIBUTIONS_ALL.PREPAY_DISTRIBUTION_ID%TYPE INDEX BY PLS_INTEGER;
1337: TYPE RECOUP_AMOUNT_LIST IS TABLE OF AP_INVOICE_DISTRIBUTIONS_ALL.AMOUNT%TYPE INDEX BY PLS_INTEGER;
1338: l_prepay_dist_id_list prepay_dist_id_list;
1331: l_inv_xdate ap_invoices_all.exchange_date%TYPE;
1332: l_inv_xrate_type ap_invoices_all.exchange_rate_type%TYPE;
1333: l_inv_pay_curr_code ap_invoices_all.payment_currency_code%TYPE;
1334: l_inv_pay_cross_rate_date ap_invoices_all.payment_cross_rate_date%TYPE;
1335: l_inv_pay_cross_rate_type ap_invoices_all.payment_cross_rate_type%TYPE;
1336: TYPE PREPAY_DIST_ID_LIST IS TABLE OF AP_INVOICE_DISTRIBUTIONS_ALL.PREPAY_DISTRIBUTION_ID%TYPE INDEX BY PLS_INTEGER;
1337: TYPE RECOUP_AMOUNT_LIST IS TABLE OF AP_INVOICE_DISTRIBUTIONS_ALL.AMOUNT%TYPE INDEX BY PLS_INTEGER;
1338: l_prepay_dist_id_list prepay_dist_id_list;
1339: l_recoup_amount_list recoup_amount_list;