[Home] [Help]
570: END IF;
571:
572: SELECT ROUND(100 - sum(mcd.percent),3)
573: INTO l_rounding_diff
574: FROM ar_misc_cash_distributions mcd
575: WHERE mcd.cash_receipt_id = p_cash_receipt_id;
576:
577: IF (l_rounding_diff <> 0) THEN
578: -- rounding error must be added to first record so that percent
587: | distribution id for use in MRC |
588: | engine for trigger replacement |
589: +----------------------------------*/
590:
591: UPDATE ar_misc_cash_distributions mcd
592: SET mcd.percent = mcd.percent + l_rounding_diff
593: WHERE cash_receipt_id = p_cash_receipt_id
594: AND ROWNUM =1
595: RETURNING misc_cash_distribution_id
603: /*BUG4301323
604: BEGIN
605: ar_mrc_engine.maintain_mrc_data(
606: p_event_mode => 'UPDATE',
607: p_table_name => 'AR_MISC_CASH_DISTRIBUTIONS',
608: p_mode => 'BATCH',
609: p_key_value_list => l_misc_cash_key_value_list);
610: EXCEPTION
611: WHEN OTHERS THEN
677: p_receipt_date IN ar_cash_receipts.receipt_date%TYPE,
678: p_receivables_trx_id IN ar_cash_receipts.receivables_trx_id%TYPE,
679: p_distribution_set_id IN ar_cash_receipts.distribution_set_id%TYPE default NULL,
680: p_ussgl_trx_code IN ar_cash_receipts.ussgl_transaction_code%TYPE default NULL,
681: p_created_from IN ar_misc_cash_distributions.created_from%TYPE default 'ARRERCT'
682: ) IS
683:
684: l_trx_code_combination_id ar_receivables_trx.code_combination_id%TYPE;
685: l_distribution_set_id ar_receivables_trx.default_acctg_distribution_set%TYPE;
682: ) IS
683:
684: l_trx_code_combination_id ar_receivables_trx.code_combination_id%TYPE;
685: l_distribution_set_id ar_receivables_trx.default_acctg_distribution_set%TYPE;
686: l_dummy ar_misc_cash_distributions.misc_cash_distribution_id%TYPE;
687: l_misc_cash_dist_rec ar_misc_cash_distributions%ROWTYPE;
688: l_misc_cash_key_value_list gl_ca_utility_pkg.r_key_value_arr; /* MRC */
689: l_crh_ccid ar_cash_receipt_history.account_code_combination_id%TYPE; /*Bug fix 4025652 */
690: l_type ar_receivables_trx.type%TYPE; /*4726219 */
683:
684: l_trx_code_combination_id ar_receivables_trx.code_combination_id%TYPE;
685: l_distribution_set_id ar_receivables_trx.default_acctg_distribution_set%TYPE;
686: l_dummy ar_misc_cash_distributions.misc_cash_distribution_id%TYPE;
687: l_misc_cash_dist_rec ar_misc_cash_distributions%ROWTYPE;
688: l_misc_cash_key_value_list gl_ca_utility_pkg.r_key_value_arr; /* MRC */
689: l_crh_ccid ar_cash_receipt_history.account_code_combination_id%TYPE; /*Bug fix 4025652 */
690: l_type ar_receivables_trx.type%TYPE; /*4726219 */
691:
711: | distribution id for use in MRC |
712: | engine for trigger replacement |
713: +----------------------------------*/
714:
715: DELETE ar_misc_cash_distributions
716: WHERE cash_receipt_id = p_cash_receipt_id
717: RETURNING misc_cash_distribution_id
718: BULK COLLECT INTO l_misc_cash_key_value_list;
719: --
725: /*BUG4301323
726: BEGIN
727: ar_mrc_engine.maintain_mrc_data(
728: p_event_mode => 'DELETE',
729: p_table_name => 'AR_MISC_CASH_DISTRIBUTIONS',
730: p_mode => 'BATCH',
731: p_key_value_list => l_misc_cash_key_value_list);
732: EXCEPTION
733: WHEN OTHERS THEN
855:
856: ELSIF (l_distribution_set_id is not null) THEN
857:
858: -- 941243: insert distributions records
859: -- do not create ar_misc_cash_distributions if receipt amount = 0
860: /* Bug fix 2272461
861: When the MISC receipt amount is changed to zero, the MISCCASH accounting
862: Record is not created in ar_distributions table. Commented out NOCOPY the condition
863: which check for the receipt amount before creating the record.
892: | PROCEDURE |
893: | update_misc_dist |
894: | |
895: | DESCRIPTION |
896: | updates distribution in ar_misc_cash_distributions |
897: | |
898: | SCOPE - PRIVATE |
899: | |
900: | EXTERNAL PROCEDURES/FUNCTIONS ACCESSED |
934: ) IS
935:
936: l_trx_code_combination_id ar_receivables_trx.code_combination_id%TYPE;
937: l_old_trx_code_combination_id ar_receivables_trx.code_combination_id%TYPE;
938: l_dummy ar_misc_cash_distributions.misc_cash_distribution_id%TYPE;
939: l_misc_cash_dist_rec ar_misc_cash_distributions%ROWTYPE;
940: l_old_recs_auto_flag BOOLEAN;
941: l_new_recs_auto_flag BOOLEAN;
942: l_count NUMBER;
935:
936: l_trx_code_combination_id ar_receivables_trx.code_combination_id%TYPE;
937: l_old_trx_code_combination_id ar_receivables_trx.code_combination_id%TYPE;
938: l_dummy ar_misc_cash_distributions.misc_cash_distribution_id%TYPE;
939: l_misc_cash_dist_rec ar_misc_cash_distributions%ROWTYPE;
940: l_old_recs_auto_flag BOOLEAN;
941: l_new_recs_auto_flag BOOLEAN;
942: l_count NUMBER;
943: l_posted ar_cash_receipt_history.posting_control_id%TYPE;
1042: END IF;
1043:
1044: SELECT count(mcd.misc_cash_distribution_id)
1045: INTO l_count
1046: FROM ar_misc_cash_distributions mcd
1047: WHERE mcd.cash_receipt_id = p_cash_receipt_id
1048: AND mcd.reversal_gl_date IS NULL --For rate adjustments picks up records with new rate
1049: AND mcd.posting_control_id = -3 --Not posted
1050: AND EXISTS (SELECT 'x'
1081: | distribution id for use in MRC |
1082: | engine for trigger replacement |
1083: +----------------------------------*/
1084:
1085: /*DELETE ar_misc_cash_distributions
1086: WHERE cash_receipt_id = p_cash_receipt_id
1087: RETURNING misc_cash_distribution_id
1088: BULK COLLECT INTO l_misc_cash_key_value_list; */
1089:
1231: | distribution id for use in MRC |
1232: | engine for trigger replacement |
1233: +----------------------------------*/
1234: /* Bug 5980036 */
1235: UPDATE ar_misc_cash_distributions
1236: SET -- gl_date = p_gl_date,
1237: apply_date = p_receipt_date
1238: WHERE cash_receipt_id = p_cash_receipt_id
1239: RETURNING misc_cash_distribution_id
1258: --
1259: /* Bug 1792989. When only the receipt amount is changed with no change
1260: to receivable activity, then distribution accounting should not be
1261: affected and only the amounts should be updated in
1262: AR_MISC_CASH_DISTRIBUTIONS. Also Accounting engine is called to
1263: recreate accounting in AR_DISTRIBUTIONS for the new amounts.
1264: This is done by
1265: 1. Calling the Accounting engine to delete the MCD records
1266: from AR_DISTRIBUTIONS for the passed cash_receipt_id.
1263: recreate accounting in AR_DISTRIBUTIONS for the new amounts.
1264: This is done by
1265: 1. Calling the Accounting engine to delete the MCD records
1266: from AR_DISTRIBUTIONS for the passed cash_receipt_id.
1267: 2. Update the amount in AR_MISC_CASH_DISTRIBUTIONS by calling
1268: procedure update_manual_dist.
1269: 3. Calling the Accounting engine to recreate the MCD records
1270: taking the new amount into consideration.
1271: */
1282: arp_util.debug('update_misc_dist: ' || '=====> Case 2: updating amounts');
1283: END IF;
1284: SELECT count(mcd.misc_cash_distribution_id)
1285: INTO l_count
1286: FROM ar_misc_cash_distributions mcd
1287: WHERE mcd.cash_receipt_id = p_cash_receipt_id
1288: AND mcd.reversal_gl_date IS NULL
1289: AND mcd.posting_control_id = -3
1290: AND EXISTS (SELECT 'x'
1382: IF PG_DEBUG in ('Y', 'C') THEN
1383: arp_util.debug('update_misc_dist: ' || 'Case 3: deleting old records');
1384: END IF;
1385:
1386: DELETE ar_misc_cash_distributions
1387: WHERE cash_receipt_id = p_cash_receipt_id;
1388:
1389: */
1390: IF PG_DEBUG in ('Y', 'C') THEN
1416: END IF;
1417:
1418: SELECT count(mcd.misc_cash_distribution_id)
1419: INTO l_count
1420: FROM ar_misc_cash_distributions mcd
1421: WHERE mcd.cash_receipt_id = p_cash_receipt_id
1422: AND mcd.reversal_gl_date IS NULL --For rate adjustments picks up records with new rate
1423: AND mcd.posting_control_id = -3 --Not posted
1424: AND EXISTS (SELECT 'x'
1496: | PROCEDURE |
1497: | create_mcd_recs |
1498: | |
1499: | DESCRIPTION |
1500: | creates distribution in ar_misc_cash_distributions based on a pre- |
1501: | defined distribution set. This function also takes care of possible |
1502: | rounding errors. |
1503: | |
1504: | SCOPE - PRIVATE |
1542: l_min_unit NUMBER;
1543: l_precision NUMBER;
1544: l_acctd_rounding_diff NUMBER;
1545: l_rounding_diff NUMBER;
1546: l_misc_cash_dist_id ar_misc_cash_distributions.misc_cash_distribution_id%TYPE; /* added for mrc changes */
1547: l_misc_cash_key_value_list gl_ca_utility_pkg.r_key_value_arr;
1548:
1549: l_xla_ev_rec arp_xla_events.xla_events_type;
1550:
1635: END IF;
1636:
1637: /* store the misc cash dist id for use in MRC call */
1638:
1639: SELECT ar_misc_cash_distributions_s.nextval
1640: INTO l_misc_cash_dist_id
1641: FROM DUAL;
1642:
1643: INSERT INTO ar_misc_cash_distributions (
1639: SELECT ar_misc_cash_distributions_s.nextval
1640: INTO l_misc_cash_dist_id
1641: FROM DUAL;
1642:
1643: INSERT INTO ar_misc_cash_distributions (
1644: misc_cash_distribution_id,
1645: last_updated_by,
1646: last_update_date,
1647: created_by,
1693: +---------------------------------*/
1694: /*4301323
1695: ar_mrc_engine.maintain_mrc_data(
1696: p_event_mode => 'INSERT',
1697: p_table_name => 'AR_MISC_CASH_DISTRIBUTIONS',
1698: p_mode => 'SINGLE',
1699: p_key_value => l_misc_cash_dist_id );
1700: */
1701: END LOOP;
1747: | distribution id for use in MRC |
1748: | engine for trigger replacement |
1749: +----------------------------------*/
1750:
1751: UPDATE ar_misc_cash_distributions
1752: SET amount = amount + l_rounding_diff,
1753: acctd_amount = acctd_amount + l_acctd_rounding_diff,
1754: percent = ROUND (
1755: (amount + l_rounding_diff)*100/p_amount,
1765: +---------------------------------*/
1766: /*BUG4301323
1767: ar_mrc_engine.maintain_mrc_data(
1768: p_event_mode => 'UPDATE',
1769: p_table_name => 'AR_MISC_CASH_DISTRIBUTIONS',
1770: p_mode => 'BATCH',
1771: p_key_value_list => l_misc_cash_key_value_list);
1772: */
1773:
1786: | PROCEDURE |
1787: | update_manual_dist |
1788: | |
1789: | DESCRIPTION |
1790: | creates distribution in ar_misc_cash_distributions based on a pre- |
1791: | defined distribution set. This function also takes care of possible |
1792: | rounding errors. |
1793: | |
1794: | SCOPE - PRIVATE |
1839: | distribution id for use in MRC |
1840: | engine for trigger replacement |
1841: +----------------------------------*/
1842:
1843: UPDATE ar_misc_cash_distributions
1844: SET gl_date = p_gl_date,
1845: apply_date = p_receipt_date,
1846: amount = decode
1847: (
1871: +---------------------------------*/
1872: /*BUG4301323
1873: ar_mrc_engine.maintain_mrc_data(
1874: p_event_mode => 'UPDATE',
1875: p_table_name => 'AR_MISC_CASH_DISTRIBUTIONS',
1876: p_mode => 'BATCH',
1877: p_key_value_list => l_misc_cash_key_value_list);
1878: */
1879: -- determine if there is a rounding error
1908: ),0)
1909:
1910: INTO l_rounding_diff,
1911: l_acctd_rounding_diff
1912: FROM ar_misc_cash_distributions
1913: WHERE cash_receipt_id = p_cash_receipt_id;
1914:
1915: arp_util.debug('Rounding error = ' || to_char(l_rounding_diff));
1916: arp_util.debug('Rounding error (acctd) = ' || to_char(l_acctd_rounding_diff));
1922: | Added bulk collect of misc cash |
1923: | distribution id for use in MRC |
1924: | engine for trigger replacement |
1925: +----------------------------------*/
1926: UPDATE ar_misc_cash_distributions
1927: SET amount = amount + l_rounding_diff,
1928: acctd_amount = acctd_amount + l_acctd_rounding_diff,
1929: percent = ROUND (
1930: (amount + l_rounding_diff)*100/p_amount,
1940: +---------------------------------*/
1941: /*BUG4301323
1942: ar_mrc_engine.maintain_mrc_data(
1943: p_event_mode => 'UPDATE',
1944: p_table_name => 'AR_MISC_CASH_DISTRIBUTIONS',
1945: p_mode => 'BATCH',
1946: p_key_value_list => l_misc_cash_key_value_list);
1947: */
1948: