3:
4: --============================================================================
5: -- POSSIBLE SCENARIOS ON HOW THIS API MAY BE CALLED:
6: -- 1) PAYMENT MATURITY
7: -- In this case we insert a record into the AP_PAYMENT_HISTORY which
8: -- contains all information in currency of payment.
9: -- 2) PAYMENT CLEARING WITH RECONCILIATION ACCOUNTING OFF
10: -- In this case we simply update the AP_CHECKS and no entry is generated
11: -- for AP_PAYMENT_HISTORY. The amounts need to be properly converted
7: -- In this case we insert a record into the AP_PAYMENT_HISTORY which
8: -- contains all information in currency of payment.
9: -- 2) PAYMENT CLEARING WITH RECONCILIATION ACCOUNTING OFF
10: -- In this case we simply update the AP_CHECKS and no entry is generated
11: -- for AP_PAYMENT_HISTORY. The amounts need to be properly converted
12: -- to the payment currency.
13: -- 3) PAYMENT CLEARING WITH RECONCILIATION ACCOUNTING ON
14: -- Same as 2
15: -- 4) PAYMENT RECONCILIATION WITH RECONCILIATION ACCOUNTING OFF
14: -- Same as 2
15: -- 4) PAYMENT RECONCILIATION WITH RECONCILIATION ACCOUNTING OFF
16: -- Same as 2
17: -- 5) PAYMENT RECONCILIATION WITH RECONCILIATION ACCOUNTING ON
18: -- Same as 2 + Creation of entry into the AP_PAYMENT_HISTORY table.
19: -- NOTE: Entry into AP_PAYMENT_HISTORY table will be in the recon currency.
20: --
21: -- TERMINOLOGY:
22: -- 1) PAYMENT MATURITY:
15: -- 4) PAYMENT RECONCILIATION WITH RECONCILIATION ACCOUNTING OFF
16: -- Same as 2
17: -- 5) PAYMENT RECONCILIATION WITH RECONCILIATION ACCOUNTING ON
18: -- Same as 2 + Creation of entry into the AP_PAYMENT_HISTORY table.
19: -- NOTE: Entry into AP_PAYMENT_HISTORY table will be in the recon currency.
20: --
21: -- TERMINOLOGY:
22: -- 1) PAYMENT MATURITY:
23: -- TRANSACTION_TYPE = PAYMENT MATURITY
103: X_REQUEST_ID NUMBER,
104: X_CALLING_SEQUENCE VARCHAR2
105: ) AS
106: current_calling_sequence VARCHAR2(2000);
107: l_Trx_Bank_Amount AP_PAYMENT_HISTORY.Trx_Bank_Amount%TYPE;
108: l_Errors_Bank_Amount AP_PAYMENT_HISTORY.Errors_Bank_Amount%TYPE;
109: l_Charges_Bank_Amount AP_PAYMENT_HISTORY.Charges_Bank_Amount%TYPE;
110: l_Bank_Currency_Code AP_PAYMENT_HISTORY.Bank_Currency_Code%TYPE;
111: l_Pmt_to_Base_Xrate_Type AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Type%TYPE;
104: X_CALLING_SEQUENCE VARCHAR2
105: ) AS
106: current_calling_sequence VARCHAR2(2000);
107: l_Trx_Bank_Amount AP_PAYMENT_HISTORY.Trx_Bank_Amount%TYPE;
108: l_Errors_Bank_Amount AP_PAYMENT_HISTORY.Errors_Bank_Amount%TYPE;
109: l_Charges_Bank_Amount AP_PAYMENT_HISTORY.Charges_Bank_Amount%TYPE;
110: l_Bank_Currency_Code AP_PAYMENT_HISTORY.Bank_Currency_Code%TYPE;
111: l_Pmt_to_Base_Xrate_Type AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Type%TYPE;
112: l_Pmt_to_Base_Xrate_Date AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Date%TYPE;
105: ) AS
106: current_calling_sequence VARCHAR2(2000);
107: l_Trx_Bank_Amount AP_PAYMENT_HISTORY.Trx_Bank_Amount%TYPE;
108: l_Errors_Bank_Amount AP_PAYMENT_HISTORY.Errors_Bank_Amount%TYPE;
109: l_Charges_Bank_Amount AP_PAYMENT_HISTORY.Charges_Bank_Amount%TYPE;
110: l_Bank_Currency_Code AP_PAYMENT_HISTORY.Bank_Currency_Code%TYPE;
111: l_Pmt_to_Base_Xrate_Type AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Type%TYPE;
112: l_Pmt_to_Base_Xrate_Date AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Date%TYPE;
113: l_Pmt_to_Base_Xrate AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate%TYPE;
106: current_calling_sequence VARCHAR2(2000);
107: l_Trx_Bank_Amount AP_PAYMENT_HISTORY.Trx_Bank_Amount%TYPE;
108: l_Errors_Bank_Amount AP_PAYMENT_HISTORY.Errors_Bank_Amount%TYPE;
109: l_Charges_Bank_Amount AP_PAYMENT_HISTORY.Charges_Bank_Amount%TYPE;
110: l_Bank_Currency_Code AP_PAYMENT_HISTORY.Bank_Currency_Code%TYPE;
111: l_Pmt_to_Base_Xrate_Type AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Type%TYPE;
112: l_Pmt_to_Base_Xrate_Date AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Date%TYPE;
113: l_Pmt_to_Base_Xrate AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate%TYPE;
114: l_debug_info VARCHAR2(240);
107: l_Trx_Bank_Amount AP_PAYMENT_HISTORY.Trx_Bank_Amount%TYPE;
108: l_Errors_Bank_Amount AP_PAYMENT_HISTORY.Errors_Bank_Amount%TYPE;
109: l_Charges_Bank_Amount AP_PAYMENT_HISTORY.Charges_Bank_Amount%TYPE;
110: l_Bank_Currency_Code AP_PAYMENT_HISTORY.Bank_Currency_Code%TYPE;
111: l_Pmt_to_Base_Xrate_Type AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Type%TYPE;
112: l_Pmt_to_Base_Xrate_Date AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Date%TYPE;
113: l_Pmt_to_Base_Xrate AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate%TYPE;
114: l_debug_info VARCHAR2(240);
115: BEGIN
108: l_Errors_Bank_Amount AP_PAYMENT_HISTORY.Errors_Bank_Amount%TYPE;
109: l_Charges_Bank_Amount AP_PAYMENT_HISTORY.Charges_Bank_Amount%TYPE;
110: l_Bank_Currency_Code AP_PAYMENT_HISTORY.Bank_Currency_Code%TYPE;
111: l_Pmt_to_Base_Xrate_Type AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Type%TYPE;
112: l_Pmt_to_Base_Xrate_Date AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Date%TYPE;
113: l_Pmt_to_Base_Xrate AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate%TYPE;
114: l_debug_info VARCHAR2(240);
115: BEGIN
116:
109: l_Charges_Bank_Amount AP_PAYMENT_HISTORY.Charges_Bank_Amount%TYPE;
110: l_Bank_Currency_Code AP_PAYMENT_HISTORY.Bank_Currency_Code%TYPE;
111: l_Pmt_to_Base_Xrate_Type AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Type%TYPE;
112: l_Pmt_to_Base_Xrate_Date AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate_Date%TYPE;
113: l_Pmt_to_Base_Xrate AP_PAYMENT_HISTORY.Pmt_to_Base_Xrate%TYPE;
114: l_debug_info VARCHAR2(240);
115: BEGIN
116:
117: current_calling_sequence := X_CALLING_SEQUENCE ||
253: X_REQUEST_ID NUMBER,
254: X_CALLING_SEQUENCE VARCHAR2
255: ) AS
256: current_calling_sequence VARCHAR2(2000);
257: l_trx_base_amount AP_PAYMENT_HISTORY.Trx_Base_Amount%TYPE;
258: l_functional_currency_code VARCHAR2(15);
259: l_rev_pmt_hist_id NUMBER; -- Bug3343314
260: l_org_id NUMBER;
261: l_debug_info VARCHAR2(240);
270: -- Bug3343314
271: IF (x_transaction_type = 'PAYMENT MATURITY REVERSAL') THEN
272: SELECT payment_history_id
273: INTO l_rev_pmt_hist_id
274: FROM ap_payment_history
275: WHERE transaction_type = 'PAYMENT MATURITY'
276: AND check_id = x_check_id;
277: ELSE
278: l_rev_pmt_hist_id := NULL;
354:
355:
356: /* *************************************************************************
357: * DELETE_PAYMENT_MATURITY: Removes entry for payment maturity from *
358: * AP_PAYMENT_HISTORY for a particular check *
359: ************************************************************************* */
360:
361: PROCEDURE Delete_Payment_Maturity (
362: X_CHECK_ID NUMBER,
369: current_calling_sequence := X_CALLING_SEQUENCE ||
370: 'AP_RECONCILIATION_PKG.DELETE_PAYMENT_MATURITY' ;
371: l_debug_info := 'Deleting from Payment History table';
372:
373: DELETE FROM AP_PAYMENT_HISTORY
374: WHERE check_id = x_check_id
375: AND transaction_type = 'PAYMENT MATURITY'
376: AND nvl(posted_flag,'N') = 'N';
377:
1430:
1431: --bgufix:5623562
1432: l_recon_accounting_flag ap_system_parameters.recon_accounting_flag%TYPE;
1433: l_check_amount ap_checks.amount%TYPE;
1434: l_rev_pmt_hist_id ap_payment_history.rev_pmt_hist_id%TYPE;
1435: l_check_id ap_checks.check_id%TYPE;
1436: l_ind_trx_bank_amount ap_payment_history.trx_bank_amount%TYPE;
1437: l_ind_errors_bank_amount ap_payment_history.errors_bank_amount%TYPE;
1438: l_ind_charges_bank_amount ap_payment_history.charges_bank_amount%TYPE;
1432: l_recon_accounting_flag ap_system_parameters.recon_accounting_flag%TYPE;
1433: l_check_amount ap_checks.amount%TYPE;
1434: l_rev_pmt_hist_id ap_payment_history.rev_pmt_hist_id%TYPE;
1435: l_check_id ap_checks.check_id%TYPE;
1436: l_ind_trx_bank_amount ap_payment_history.trx_bank_amount%TYPE;
1437: l_ind_errors_bank_amount ap_payment_history.errors_bank_amount%TYPE;
1438: l_ind_charges_bank_amount ap_payment_history.charges_bank_amount%TYPE;
1439: l_bank_currency_code ap_payment_history.bank_currency_code%TYPE;
1440: l_bank_to_base_xrate_type ap_payment_history.bank_to_base_xrate_type%TYPE;
1433: l_check_amount ap_checks.amount%TYPE;
1434: l_rev_pmt_hist_id ap_payment_history.rev_pmt_hist_id%TYPE;
1435: l_check_id ap_checks.check_id%TYPE;
1436: l_ind_trx_bank_amount ap_payment_history.trx_bank_amount%TYPE;
1437: l_ind_errors_bank_amount ap_payment_history.errors_bank_amount%TYPE;
1438: l_ind_charges_bank_amount ap_payment_history.charges_bank_amount%TYPE;
1439: l_bank_currency_code ap_payment_history.bank_currency_code%TYPE;
1440: l_bank_to_base_xrate_type ap_payment_history.bank_to_base_xrate_type%TYPE;
1441: l_bank_to_base_xrate_date ap_payment_history.bank_to_base_xrate_date%TYPE;
1434: l_rev_pmt_hist_id ap_payment_history.rev_pmt_hist_id%TYPE;
1435: l_check_id ap_checks.check_id%TYPE;
1436: l_ind_trx_bank_amount ap_payment_history.trx_bank_amount%TYPE;
1437: l_ind_errors_bank_amount ap_payment_history.errors_bank_amount%TYPE;
1438: l_ind_charges_bank_amount ap_payment_history.charges_bank_amount%TYPE;
1439: l_bank_currency_code ap_payment_history.bank_currency_code%TYPE;
1440: l_bank_to_base_xrate_type ap_payment_history.bank_to_base_xrate_type%TYPE;
1441: l_bank_to_base_xrate_date ap_payment_history.bank_to_base_xrate_date%TYPE;
1442: l_bank_to_base_xrate ap_payment_history.bank_to_base_xrate%TYPE;
1435: l_check_id ap_checks.check_id%TYPE;
1436: l_ind_trx_bank_amount ap_payment_history.trx_bank_amount%TYPE;
1437: l_ind_errors_bank_amount ap_payment_history.errors_bank_amount%TYPE;
1438: l_ind_charges_bank_amount ap_payment_history.charges_bank_amount%TYPE;
1439: l_bank_currency_code ap_payment_history.bank_currency_code%TYPE;
1440: l_bank_to_base_xrate_type ap_payment_history.bank_to_base_xrate_type%TYPE;
1441: l_bank_to_base_xrate_date ap_payment_history.bank_to_base_xrate_date%TYPE;
1442: l_bank_to_base_xrate ap_payment_history.bank_to_base_xrate%TYPE;
1443: l_ind_trx_pmt_amount ap_payment_history.trx_pmt_amount%TYPE;
1436: l_ind_trx_bank_amount ap_payment_history.trx_bank_amount%TYPE;
1437: l_ind_errors_bank_amount ap_payment_history.errors_bank_amount%TYPE;
1438: l_ind_charges_bank_amount ap_payment_history.charges_bank_amount%TYPE;
1439: l_bank_currency_code ap_payment_history.bank_currency_code%TYPE;
1440: l_bank_to_base_xrate_type ap_payment_history.bank_to_base_xrate_type%TYPE;
1441: l_bank_to_base_xrate_date ap_payment_history.bank_to_base_xrate_date%TYPE;
1442: l_bank_to_base_xrate ap_payment_history.bank_to_base_xrate%TYPE;
1443: l_ind_trx_pmt_amount ap_payment_history.trx_pmt_amount%TYPE;
1444: l_ind_errors_pmt_amount ap_payment_history.errors_pmt_amount%TYPE;
1437: l_ind_errors_bank_amount ap_payment_history.errors_bank_amount%TYPE;
1438: l_ind_charges_bank_amount ap_payment_history.charges_bank_amount%TYPE;
1439: l_bank_currency_code ap_payment_history.bank_currency_code%TYPE;
1440: l_bank_to_base_xrate_type ap_payment_history.bank_to_base_xrate_type%TYPE;
1441: l_bank_to_base_xrate_date ap_payment_history.bank_to_base_xrate_date%TYPE;
1442: l_bank_to_base_xrate ap_payment_history.bank_to_base_xrate%TYPE;
1443: l_ind_trx_pmt_amount ap_payment_history.trx_pmt_amount%TYPE;
1444: l_ind_errors_pmt_amount ap_payment_history.errors_pmt_amount%TYPE;
1445: l_ind_charges_pmt_amount ap_payment_history.charges_pmt_amount%TYPE;
1438: l_ind_charges_bank_amount ap_payment_history.charges_bank_amount%TYPE;
1439: l_bank_currency_code ap_payment_history.bank_currency_code%TYPE;
1440: l_bank_to_base_xrate_type ap_payment_history.bank_to_base_xrate_type%TYPE;
1441: l_bank_to_base_xrate_date ap_payment_history.bank_to_base_xrate_date%TYPE;
1442: l_bank_to_base_xrate ap_payment_history.bank_to_base_xrate%TYPE;
1443: l_ind_trx_pmt_amount ap_payment_history.trx_pmt_amount%TYPE;
1444: l_ind_errors_pmt_amount ap_payment_history.errors_pmt_amount%TYPE;
1445: l_ind_charges_pmt_amount ap_payment_history.charges_pmt_amount%TYPE;
1446: l_pmt_currency_code ap_payment_history.pmt_currency_code%TYPE;
1439: l_bank_currency_code ap_payment_history.bank_currency_code%TYPE;
1440: l_bank_to_base_xrate_type ap_payment_history.bank_to_base_xrate_type%TYPE;
1441: l_bank_to_base_xrate_date ap_payment_history.bank_to_base_xrate_date%TYPE;
1442: l_bank_to_base_xrate ap_payment_history.bank_to_base_xrate%TYPE;
1443: l_ind_trx_pmt_amount ap_payment_history.trx_pmt_amount%TYPE;
1444: l_ind_errors_pmt_amount ap_payment_history.errors_pmt_amount%TYPE;
1445: l_ind_charges_pmt_amount ap_payment_history.charges_pmt_amount%TYPE;
1446: l_pmt_currency_code ap_payment_history.pmt_currency_code%TYPE;
1447: l_pmt_to_base_xrate_type ap_payment_history.pmt_to_base_xrate_type%TYPE;
1440: l_bank_to_base_xrate_type ap_payment_history.bank_to_base_xrate_type%TYPE;
1441: l_bank_to_base_xrate_date ap_payment_history.bank_to_base_xrate_date%TYPE;
1442: l_bank_to_base_xrate ap_payment_history.bank_to_base_xrate%TYPE;
1443: l_ind_trx_pmt_amount ap_payment_history.trx_pmt_amount%TYPE;
1444: l_ind_errors_pmt_amount ap_payment_history.errors_pmt_amount%TYPE;
1445: l_ind_charges_pmt_amount ap_payment_history.charges_pmt_amount%TYPE;
1446: l_pmt_currency_code ap_payment_history.pmt_currency_code%TYPE;
1447: l_pmt_to_base_xrate_type ap_payment_history.pmt_to_base_xrate_type%TYPE;
1448: l_pmt_to_base_xrate_date ap_payment_history.pmt_to_base_xrate_date%TYPE;
1441: l_bank_to_base_xrate_date ap_payment_history.bank_to_base_xrate_date%TYPE;
1442: l_bank_to_base_xrate ap_payment_history.bank_to_base_xrate%TYPE;
1443: l_ind_trx_pmt_amount ap_payment_history.trx_pmt_amount%TYPE;
1444: l_ind_errors_pmt_amount ap_payment_history.errors_pmt_amount%TYPE;
1445: l_ind_charges_pmt_amount ap_payment_history.charges_pmt_amount%TYPE;
1446: l_pmt_currency_code ap_payment_history.pmt_currency_code%TYPE;
1447: l_pmt_to_base_xrate_type ap_payment_history.pmt_to_base_xrate_type%TYPE;
1448: l_pmt_to_base_xrate_date ap_payment_history.pmt_to_base_xrate_date%TYPE;
1449: l_pmt_to_base_xrate ap_payment_history.pmt_to_base_xrate%TYPE;
1442: l_bank_to_base_xrate ap_payment_history.bank_to_base_xrate%TYPE;
1443: l_ind_trx_pmt_amount ap_payment_history.trx_pmt_amount%TYPE;
1444: l_ind_errors_pmt_amount ap_payment_history.errors_pmt_amount%TYPE;
1445: l_ind_charges_pmt_amount ap_payment_history.charges_pmt_amount%TYPE;
1446: l_pmt_currency_code ap_payment_history.pmt_currency_code%TYPE;
1447: l_pmt_to_base_xrate_type ap_payment_history.pmt_to_base_xrate_type%TYPE;
1448: l_pmt_to_base_xrate_date ap_payment_history.pmt_to_base_xrate_date%TYPE;
1449: l_pmt_to_base_xrate ap_payment_history.pmt_to_base_xrate%TYPE;
1450: l_ind_trx_base_amount ap_payment_history.trx_base_amount%TYPE;
1443: l_ind_trx_pmt_amount ap_payment_history.trx_pmt_amount%TYPE;
1444: l_ind_errors_pmt_amount ap_payment_history.errors_pmt_amount%TYPE;
1445: l_ind_charges_pmt_amount ap_payment_history.charges_pmt_amount%TYPE;
1446: l_pmt_currency_code ap_payment_history.pmt_currency_code%TYPE;
1447: l_pmt_to_base_xrate_type ap_payment_history.pmt_to_base_xrate_type%TYPE;
1448: l_pmt_to_base_xrate_date ap_payment_history.pmt_to_base_xrate_date%TYPE;
1449: l_pmt_to_base_xrate ap_payment_history.pmt_to_base_xrate%TYPE;
1450: l_ind_trx_base_amount ap_payment_history.trx_base_amount%TYPE;
1451: l_ind_errors_base_amount ap_payment_history.errors_base_amount%TYPE;
1444: l_ind_errors_pmt_amount ap_payment_history.errors_pmt_amount%TYPE;
1445: l_ind_charges_pmt_amount ap_payment_history.charges_pmt_amount%TYPE;
1446: l_pmt_currency_code ap_payment_history.pmt_currency_code%TYPE;
1447: l_pmt_to_base_xrate_type ap_payment_history.pmt_to_base_xrate_type%TYPE;
1448: l_pmt_to_base_xrate_date ap_payment_history.pmt_to_base_xrate_date%TYPE;
1449: l_pmt_to_base_xrate ap_payment_history.pmt_to_base_xrate%TYPE;
1450: l_ind_trx_base_amount ap_payment_history.trx_base_amount%TYPE;
1451: l_ind_errors_base_amount ap_payment_history.errors_base_amount%TYPE;
1452: l_ind_charges_base_amount ap_payment_history.charges_base_amount%TYPE;
1445: l_ind_charges_pmt_amount ap_payment_history.charges_pmt_amount%TYPE;
1446: l_pmt_currency_code ap_payment_history.pmt_currency_code%TYPE;
1447: l_pmt_to_base_xrate_type ap_payment_history.pmt_to_base_xrate_type%TYPE;
1448: l_pmt_to_base_xrate_date ap_payment_history.pmt_to_base_xrate_date%TYPE;
1449: l_pmt_to_base_xrate ap_payment_history.pmt_to_base_xrate%TYPE;
1450: l_ind_trx_base_amount ap_payment_history.trx_base_amount%TYPE;
1451: l_ind_errors_base_amount ap_payment_history.errors_base_amount%TYPE;
1452: l_ind_charges_base_amount ap_payment_history.charges_base_amount%TYPE;
1453: l_debug_info VARCHAR2(240);
1446: l_pmt_currency_code ap_payment_history.pmt_currency_code%TYPE;
1447: l_pmt_to_base_xrate_type ap_payment_history.pmt_to_base_xrate_type%TYPE;
1448: l_pmt_to_base_xrate_date ap_payment_history.pmt_to_base_xrate_date%TYPE;
1449: l_pmt_to_base_xrate ap_payment_history.pmt_to_base_xrate%TYPE;
1450: l_ind_trx_base_amount ap_payment_history.trx_base_amount%TYPE;
1451: l_ind_errors_base_amount ap_payment_history.errors_base_amount%TYPE;
1452: l_ind_charges_base_amount ap_payment_history.charges_base_amount%TYPE;
1453: l_debug_info VARCHAR2(240);
1454:
1447: l_pmt_to_base_xrate_type ap_payment_history.pmt_to_base_xrate_type%TYPE;
1448: l_pmt_to_base_xrate_date ap_payment_history.pmt_to_base_xrate_date%TYPE;
1449: l_pmt_to_base_xrate ap_payment_history.pmt_to_base_xrate%TYPE;
1450: l_ind_trx_base_amount ap_payment_history.trx_base_amount%TYPE;
1451: l_ind_errors_base_amount ap_payment_history.errors_base_amount%TYPE;
1452: l_ind_charges_base_amount ap_payment_history.charges_base_amount%TYPE;
1453: l_debug_info VARCHAR2(240);
1454:
1455: l_org_id NUMBER;
1448: l_pmt_to_base_xrate_date ap_payment_history.pmt_to_base_xrate_date%TYPE;
1449: l_pmt_to_base_xrate ap_payment_history.pmt_to_base_xrate%TYPE;
1450: l_ind_trx_base_amount ap_payment_history.trx_base_amount%TYPE;
1451: l_ind_errors_base_amount ap_payment_history.errors_base_amount%TYPE;
1452: l_ind_charges_base_amount ap_payment_history.charges_base_amount%TYPE;
1453: l_debug_info VARCHAR2(240);
1454:
1455: l_org_id NUMBER;
1456:
1490: APHA.charges_base_amount,
1491: C.check_id,
1492: NVL(c.amount, 0),
1493: c.org_id
1494: FROM ap_payment_history_all APHA,
1495: ap_checks_all C
1496: WHERE APHA.check_id = C.check_id
1497: AND C.checkrun_id = X_CHECKRUN_ID
1498: AND C.org_id = p_org_id -- Bug 5674397
1501: 'CLEARED BUT UNACCOUNTED',
1502: 'RECONCILED',
1503: 'RECONCILED UNACCOUNTED')
1504: AND NOT EXISTS (SELECT APHB.payment_history_id
1505: FROM ap_payment_history APHB
1506: WHERE APHB.check_id = APHA.check_id
1507: AND APHB.rev_pmt_hist_id = APHA.payment_history_id)
1508: GROUP BY
1509: APHA.payment_history_id,
1678:
1679: --bugfix:2972765 added the following select and if statements.
1680: SELECT count(*)
1681: INTO l_dummy
1682: FROM ap_payment_history
1683: WHERE check_id=x_check_id
1684: AND transaction_type='PAYMENT CLEARING';
1685:
1686: --bugfix:5623562
1728: l_ind_errors_base_amount,
1729: l_ind_charges_base_amount,
1730: l_check_amount,
1731: l_org_id
1732: FROM ap_payment_history APHA,
1733: ap_checks C
1734: WHERE APHA.check_id = X_CHECK_ID
1735: AND APHA.check_id = C.check_id
1736: AND APHA.transaction_type = 'PAYMENT CLEARING'
1738: 'CLEARED BUT UNACCOUNTED',
1739: 'RECONCILED',
1740: 'RECONCILED UNACCOUNTED')
1741: AND NOT EXISTS (SELECT APHB.payment_history_id
1742: FROM ap_payment_history APHB
1743: WHERE APHB.check_id = APHA.check_id
1744: AND APHB.rev_pmt_hist_id = APHA.payment_history_id);
1745:
1746: AP_RECONCILIATION_PKG.Insert_Payment_History
1810: APP_EXCEPTION.RAISE_EXCEPTION;
1811: END Recon_Payment_Unclearing ;
1812:
1813: --============================================================================
1814: -- INSERT_PAYMENT_HISTORY : API to insert a row into the AP_Payment_History
1815: -- table.
1816: --
1817: -- Due to R12 SLA project impact, for every payment action, we will need
1818: -- to add the row in ap_payment_history
1814: -- INSERT_PAYMENT_HISTORY : API to insert a row into the AP_Payment_History
1815: -- table.
1816: --
1817: -- Due to R12 SLA project impact, for every payment action, we will need
1818: -- to add the row in ap_payment_history
1819: -- in 11i - transaction types are
1820: -- PAYMENT MATURITY
1821: -- PAYMENT UNCLEARING
1822: -- PAYMENT CLEARING
1938: IF X_REV_PMT_HIST_ID IS NOT NULL THEN
1939:
1940: SELECT Accounting_Event_ID
1941: INTO l_related_event_id
1942: FROM AP_Payment_History APH
1943: WHERE APH.Payment_History_ID = X_REV_PMT_HIST_ID;
1944:
1945: END IF;
1946:
1946:
1947: ----------------------------------------------------------------
1948: -- Insert payment information into payment history table
1949: ----------------------------------------------------------------
1950: l_debug_info := 'Inserting into AP_Payment_History';
1951:
1952: INSERT INTO AP_PAYMENT_HISTORY_ALL
1953: ( PAYMENT_HISTORY_ID,
1954: CHECK_ID,
1948: -- Insert payment information into payment history table
1949: ----------------------------------------------------------------
1950: l_debug_info := 'Inserting into AP_Payment_History';
1951:
1952: INSERT INTO AP_PAYMENT_HISTORY_ALL
1953: ( PAYMENT_HISTORY_ID,
1954: CHECK_ID,
1955: ACCOUNTING_DATE,
1956: TRANSACTION_TYPE,
1988: RELATED_EVENT_ID, -- Bug 5015973
1989: invoice_adjustment_event_id -- bug 5694577
1990: )
1991: VALUES
1992: ( AP_PAYMENT_HISTORY_S.nextval,
1993: X_CHECK_ID,
1994: X_ACCOUNTING_DATE,
1995: X_TRANSACTION_TYPE,
1996: 'N',