DBA Data[Home] [Help]

APPS.LNS_DISTRIBUTIONS_PUB dependencies on LNS_DISTRIBUTIONS

Line 1: PACKAGE BODY LNS_DISTRIBUTIONS_PUB AS

1: PACKAGE BODY LNS_DISTRIBUTIONS_PUB AS
2: /* $Header: LNS_DIST_PUBP_B.pls 120.45.12010000.4 2009/03/03 08:45:17 mbolli ship $ */
3:
4: /*========================================================================+
5: | Package Global Constants

Line 10: G_PKG_NAME CONSTANT VARCHAR2(30) := 'LNS_DISTRIBUTIONS_PUB';

6: +=======================================================================*/
7: G_DEBUG_COUNT NUMBER := 0;
8: G_DEBUG BOOLEAN := FALSE;
9:
10: G_PKG_NAME CONSTANT VARCHAR2(30) := 'LNS_DISTRIBUTIONS_PUB';
11:
12: --------------------------------------------
13: -- internal package routines
14: --------------------------------------------

Line 101: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling lns_distributions_pub.onlineAccounting...');

97: -- Initialize API return status to SUCCESS
98: x_return_status := FND_API.G_RET_STS_SUCCESS;
99:
100: -- first complete accounting for any unprocessed events / documents for the loan transaction
101: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling lns_distributions_pub.onlineAccounting...');
102: lns_distributions_pub.onlineAccounting(p_loan_id => p_loan_id
103: ,p_init_msg_list => fnd_api.g_false
104: ,p_accounting_mode => 'F'
105: ,p_transfer_flag => 'Y'

Line 102: lns_distributions_pub.onlineAccounting(p_loan_id => p_loan_id

98: x_return_status := FND_API.G_RET_STS_SUCCESS;
99:
100: -- first complete accounting for any unprocessed events / documents for the loan transaction
101: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling lns_distributions_pub.onlineAccounting...');
102: lns_distributions_pub.onlineAccounting(p_loan_id => p_loan_id
103: ,p_init_msg_list => fnd_api.g_false
104: ,p_accounting_mode => 'F'
105: ,p_transfer_flag => 'Y'
106: ,p_offline_flag => 'N'

Line 156: update lns_distributions

152: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
153: END IF;
154:
155: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'stamping new event_id on distributions');
156: update lns_distributions
157: set event_id = l_event_id
158: ,last_update_date = sysdate
159: where distribution_type = 'ORIGINATION'
160: and loan_id = p_loan_id

Line 520: -- stamp the eventID onto the lns_distributions table

516: logMessage(FND_LOG.LEVEL_UNEXPECTED, G_PKG_NAME, FND_MSG_PUB.Get(p_encoded => 'F'));
517: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
518: END IF;
519:
520: -- stamp the eventID onto the lns_distributions table
521: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'stamping eventID on lns_distributions');
522: update lns_distributions
523: set event_id = x_event_id
524: ,last_update_date = sysdate

Line 521: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'stamping eventID on lns_distributions');

517: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
518: END IF;
519:
520: -- stamp the eventID onto the lns_distributions table
521: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'stamping eventID on lns_distributions');
522: update lns_distributions
523: set event_id = x_event_id
524: ,last_update_date = sysdate
525: where distribution_type = 'ORIGINATION'

Line 522: update lns_distributions

518: END IF;
519:
520: -- stamp the eventID onto the lns_distributions table
521: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'stamping eventID on lns_distributions');
522: update lns_distributions
523: set event_id = x_event_id
524: ,last_update_date = sysdate
525: where distribution_type = 'ORIGINATION'
526: and loan_id = p_loan_id;

Line 661: || this procedure insert records into lns_distributions table

657: /*=========================================================================
658: || PRIVATE PROCEDURE do_insert_distributions
659: ||
660: || DESCRIPTION
661: || this procedure insert records into lns_distributions table
662: ||
663: || PARAMETERS p_distributions_tbl => table -f distribution records
664: ||
665: || Return value: NA

Line 669: || Target Tables: LNS_DISTRIBUTIONS

665: || Return value: NA
666: ||
667: || Source Tables:
668: ||
669: || Target Tables: LNS_DISTRIBUTIONS
670: ||
671: || KNOWN ISSUES
672: ||
673: || NOTES

Line 679: procedure do_insert_distributions(p_distributions_tbl in lns_distributions_pub.distribution_tbl

675: || MODIFICATION HISTORY
676: || Date Author Description of Changes
677: || 04-20-2005 raverma Created
678: *=======================================================================*/
679: procedure do_insert_distributions(p_distributions_tbl in lns_distributions_pub.distribution_tbl
680: ,p_loan_id in number)
681:
682: is
683: l_total_distributions number;

Line 706: Insert into lns_distributions

702: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'PERCENT = ' || p_distributions_tbl(k).distribution_percent);
703: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'AMOUNT = ' || p_distributions_tbl(k).distribution_amount);
704: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'DIST_TYPE = ' || p_distributions_tbl(k).distribution_type);
705:
706: Insert into lns_distributions
707: (DISTRIBUTION_ID
708: ,LOAN_ID
709: ,LINE_TYPE
710: ,ACCOUNT_NAME

Line 724: (LNS_DISTRIBUTIONS_S.nextval

720: ,LAST_UPDATED_BY
721: ,OBJECT_VERSION_NUMBER
722: ,DISB_HEADER_ID)
723: values
724: (LNS_DISTRIBUTIONS_S.nextval
725: ,p_loan_id
726: ,p_distributions_tbl(k).line_type
727: ,p_distributions_tbl(k).account_name
728: ,p_distributions_tbl(k).code_combination_id

Line 795: ,x_distribution_tbl OUT NOCOPY lns_distributions_pub.distribution_tbl

791: ,p_loan_id IN NUMBER
792: ,p_disb_header_id IN NUMBER
793: ,p_include_loan_receivables IN VARCHAR2
794: ,p_distribution_type IN VARCHAR2
795: ,x_distribution_tbl OUT NOCOPY lns_distributions_pub.distribution_tbl
796: ,x_return_status OUT NOCOPY VARCHAR2
797: ,x_msg_count OUT NOCOPY NUMBER
798: ,x_msg_data OUT NOCOPY VARCHAR2)
799:

Line 820: l_distributions lns_distributions_pub.distribution_tbl;

816: l_distribution_type varchar2(30);
817: l_funded_amount number;
818: l_loan_receivables_count number;
819: l_loan_payables_count number;
820: l_distributions lns_distributions_pub.distribution_tbl;
821: l_running_amount1 number;
822: l_running_amount2 number;
823: l_running_amount3 number;
824: l_running_amount4 number;

Line 829: l_ledger_details lns_distributions_pub.gl_ledger_details;

825: k number;
826: n number;
827: l number;
828: m number;
829: l_ledger_details lns_distributions_pub.gl_ledger_details;
830: Type refCur is ref cursor;
831: sql_Cur refCur;
832: vSqlCur varchar2(1000);
833: vPLSQL VARCHAR2(1000);

Line 908: l_ledger_details := lns_distributions_pub.getLedgerDetails;

904: l_running_amount1 := 0;
905: l_running_amount2 := 0;
906: l_running_amount3 := 0;
907: l_running_amount4 := 0;
908: l_ledger_details := lns_distributions_pub.getLedgerDetails;
909:
910: -- get class and type for the loan
911: if p_disb_header_id is null then
912: OPEN c_loan_info(p_loan_id);

Line 1081: || Overview: will write to xla_events table and update lns_distributions

1077: /*=========================================================================
1078: || PUBLIC PROCEDURE create_event
1079: ||
1080: || DESCRIPTION
1081: || Overview: will write to xla_events table and update lns_distributions
1082: || this can handle a set of accounting event records
1083: ||
1084: || PSEUDO CODE/LOGIC
1085: ||

Line 1106: procedure create_event(p_acc_event_tbl in LNS_DISTRIBUTIONS_PUB.acc_event_tbl

1102: || Date Author Description of Changes
1103: || 8/3/2005 raverma Created
1104: ||
1105: *=======================================================================*/
1106: procedure create_event(p_acc_event_tbl in LNS_DISTRIBUTIONS_PUB.acc_event_tbl
1107: ,p_init_msg_list in varchar2
1108: ,p_commit in varchar2
1109: ,x_return_status out nocopy varchar2
1110: ,x_msg_count out nocopy number

Line 1117: l_distributions LNS_DISTRIBUTIONS_PUB.distribution_tbl;

1113: is
1114: l_api_name varchar2(25);
1115: l_loan_class varchar2(30);
1116: l_loan_type_id number;
1117: l_distributions LNS_DISTRIBUTIONS_PUB.distribution_tbl;
1118: l_msg_count NUMBER;
1119: l_msg_data VARCHAR2(2000);
1120: l_return_Status VARCHAR2(1);
1121: l_event_id number;

Line 1179: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Updating lns_distributions...');

1175: logMessage(FND_LOG.LEVEL_UNEXPECTED, G_PKG_NAME, FND_MSG_PUB.Get(p_encoded => 'F'));
1176: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1177: ELSE
1178: -- update the distributions table with proper event_id for valid disb_header_id
1179: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Updating lns_distributions...');
1180: update lns_distributions
1181: set event_id = l_event_id
1182: ,last_update_date = sysdate
1183: where disb_header_id = p_acc_event_tbl(k).disb_header_id

Line 1180: update lns_distributions

1176: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1177: ELSE
1178: -- update the distributions table with proper event_id for valid disb_header_id
1179: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Updating lns_distributions...');
1180: update lns_distributions
1181: set event_id = l_event_id
1182: ,last_update_date = sysdate
1183: where disb_header_id = p_acc_event_tbl(k).disb_header_id
1184: and loan_id = p_acc_event_tbl(k).loan_id;

Line 1435: l_ledger_details lns_distributions_pub.gl_ledger_details;

1431: ,p_loan_id number) return number
1432: is
1433:
1434: l_new_cc_id number;
1435: l_ledger_details lns_distributions_pub.gl_ledger_details;
1436: l_natural_account_rec varchar2(25); -- the lns_def_distribs replacement for Loans Receivable
1437: l_nat_acct_seg_number number;
1438: l_api_name varchar2(25);
1439:

Line 1452: l_ledger_details := lns_distributions_pub.getLedgerDetails;

1448: and h.loan_type_id = d.loan_type_id;
1449:
1450: begin
1451:
1452: l_ledger_details := lns_distributions_pub.getLedgerDetails;
1453: -- given a code_combination
1454: if p_distribution_type = 'LOAN_RECEIVABLE' then
1455:
1456: -- build new cc_id

Line 1527: || Source Tables: lns_distributions

1523: || p_distribution_type = 'ORIGINATION' , 'BILLING', 'FUNDING'
1524: ||
1525: || Return value: table of distribution entities
1526: ||
1527: || Source Tables: lns_distributions
1528: ||
1529: || Target Tables:
1530: ||
1531: || KNOWN ISSUES

Line 1546: ,p_distribution_type in varchar2) return LNS_DISTRIBUTIONS_PUB.default_distributions_tbl

1542: ,p_loan_type_id in number
1543: ,p_account_type in varchar2
1544: ,p_account_name in varchar2
1545: ,p_line_type in varchar2
1546: ,p_distribution_type in varchar2) return LNS_DISTRIBUTIONS_PUB.default_distributions_tbl
1547: is
1548: x_distribution_tbl LNS_DISTRIBUTIONS_PUB.default_distributions_tbl;
1549: l_index number := 1;
1550: l_loan_id number;

Line 1548: x_distribution_tbl LNS_DISTRIBUTIONS_PUB.default_distributions_tbl;

1544: ,p_account_name in varchar2
1545: ,p_line_type in varchar2
1546: ,p_distribution_type in varchar2) return LNS_DISTRIBUTIONS_PUB.default_distributions_tbl
1547: is
1548: x_distribution_tbl LNS_DISTRIBUTIONS_PUB.default_distributions_tbl;
1549: l_index number := 1;
1550: l_loan_id number;
1551: l_loan_class varchar2(30);
1552: l_loan_type_id number;

Line 1682: || Source Tables: lns_distributions

1678: || p_distribution_type = 'ORIGINATION' , 'BILLING' , ' FUNDING'
1679: ||
1680: || Return value: table of distribution entities
1681: ||
1682: || Source Tables: lns_distributions
1683: ||
1684: || Target Tables:
1685: ||
1686: || KNOWN ISSUES

Line 1700: ,p_distribution_type in varchar2) return LNS_DISTRIBUTIONS_PUB.distribution_tbl

1696: function getDistributions(p_loan_id in number
1697: ,p_account_type in varchar2
1698: ,p_account_name in varchar2
1699: ,p_line_type in varchar2
1700: ,p_distribution_type in varchar2) return LNS_DISTRIBUTIONS_PUB.distribution_tbl
1701:
1702: is
1703:
1704: l_api_name varchar2(30);

Line 1705: x_distribution_tbl lns_distributions_pub.distribution_tbl;

1701:
1702: is
1703:
1704: l_api_name varchar2(30);
1705: x_distribution_tbl lns_distributions_pub.distribution_tbl;
1706: l_index number;
1707: l_loan_id number;
1708: l_distribution_id number;
1709: l_line_type varchar2(30);

Line 1731: from lns_distributions d

1727: ,d.distribution_percent
1728: ,d.distribution_amount
1729: ,d.distribution_type
1730: ,d.event_id
1731: from lns_distributions d
1732: where d.loan_id = x_loan_id
1733: and d.account_type = x_acct_type
1734: and d.account_name = x_acct_name
1735: and d.line_type = x_line_type

Line 1813: function getDistributions(p_distribution_id in number) return LNS_DISTRIBUTIONS_PUB.distribution_rec

1809: return x_distribution_tbl;
1810:
1811: end getDistributions;
1812:
1813: function getDistributions(p_distribution_id in number) return LNS_DISTRIBUTIONS_PUB.distribution_rec
1814:
1815: is
1816:
1817: x_distribution_rec lns_distributions_pub.distribution_rec;

Line 1817: x_distribution_rec lns_distributions_pub.distribution_rec;

1813: function getDistributions(p_distribution_id in number) return LNS_DISTRIBUTIONS_PUB.distribution_rec
1814:
1815: is
1816:
1817: x_distribution_rec lns_distributions_pub.distribution_rec;
1818: l_api_name varchar2(30);
1819:
1820: cursor c_get_distribution(x_distribution_id number) is
1821: select distribution_id

Line 1832: from lns_distributions

1828: ,distribution_type
1829: ,account_type
1830: ,account_name
1831: ,event_id
1832: from lns_distributions
1833: where distribution_id = x_distribution_id
1834: and distribution_percent > 0;
1835:
1836: begin

Line 1905: function getLedgerDetails return lns_distributions_pub.gl_ledger_details

1901: || Date Author Description of Changes
1902: || 02-18-2004 raverma Created
1903: ||
1904: *=======================================================================*/
1905: function getLedgerDetails return lns_distributions_pub.gl_ledger_details
1906: is
1907: cursor c_ledger
1908: is
1909: SELECT so.set_of_books_id

Line 1922: l_ledger_details lns_distributions_pub.gl_ledger_details;

1918: fnd_currencies fndc
1919: WHERE sb.ledger_id = so.set_of_books_id
1920: and sb.currency_code = fndc.currency_code;
1921:
1922: l_ledger_details lns_distributions_pub.gl_ledger_details;
1923:
1924: begin
1925:
1926: begin

Line 1964: || store the distributions on LNS_DISTRIBUTIONS

1960: ||
1961: || DESCRIPTION
1962: || calculatest the distribution amount based on the distribution percentage
1963: || this api assumes the defaultDistributions API has been called to
1964: || store the distributions on LNS_DISTRIBUTIONS
1965: ||
1966: || PSEUDO CODE/LOGIC
1967: ||
1968: || PARAMETERS

Line 1969: || p_distribution_id = pk to LNS_DISTRIBUTIONS

1965: ||
1966: || PSEUDO CODE/LOGIC
1967: ||
1968: || PARAMETERS
1969: || p_distribution_id = pk to LNS_DISTRIBUTIONS
1970: ||
1971: || Return value: amount of distribution based from loan funded amount
1972: ||
1973: || Source Tables: lns_distributions, lns_loan_headers

Line 1973: || Source Tables: lns_distributions, lns_loan_headers

1969: || p_distribution_id = pk to LNS_DISTRIBUTIONS
1970: ||
1971: || Return value: amount of distribution based from loan funded amount
1972: ||
1973: || Source Tables: lns_distributions, lns_loan_headers
1974: ||
1975: || Target Tables: NA
1976: ||
1977: || KNOWN ISSUES

Line 1993: l_ledger_details lns_distributions_pub.gl_ledger_details;

1989:
1990: is
1991: l_api_name varchar2(50);
1992: l_distribution_amount number;
1993: l_ledger_details lns_distributions_pub.gl_ledger_details;
1994: l_distribution_rec lns_distributions_pub.distribution_rec;
1995: l_distribution_tbl lns_distributions_pub.distribution_tbl;
1996: l_loan_id number;
1997: l_max_distribution_id number;

Line 1994: l_distribution_rec lns_distributions_pub.distribution_rec;

1990: is
1991: l_api_name varchar2(50);
1992: l_distribution_amount number;
1993: l_ledger_details lns_distributions_pub.gl_ledger_details;
1994: l_distribution_rec lns_distributions_pub.distribution_rec;
1995: l_distribution_tbl lns_distributions_pub.distribution_tbl;
1996: l_loan_id number;
1997: l_max_distribution_id number;
1998:

Line 1995: l_distribution_tbl lns_distributions_pub.distribution_tbl;

1991: l_api_name varchar2(50);
1992: l_distribution_amount number;
1993: l_ledger_details lns_distributions_pub.gl_ledger_details;
1994: l_distribution_rec lns_distributions_pub.distribution_rec;
1995: l_distribution_tbl lns_distributions_pub.distribution_tbl;
1996: l_loan_id number;
1997: l_max_distribution_id number;
1998:
1999: cursor c_get_distribution(p_distribution_id number) is

Line 2001: from lns_distributions lnd

1997: l_max_distribution_id number;
1998:
1999: cursor c_get_distribution(p_distribution_id number) is
2000: select round(lnh.funded_amount * lnd.distribution_percent / 100, curr.precision)
2001: from lns_distributions lnd
2002: ,lns_loan_headers lnh
2003: ,fnd_currencies curr
2004: where lnh.loan_id = lnd.loan_id
2005: and curr.currency_code = lnh.loan_currency

Line 2013: from lns_distributions lnd

2009: cursor c_max_dist(p_loan_id number
2010: ,p_distribution_type varchar
2011: ,p_account_type varchar2) is
2012: select max(distribution_id)
2013: from lns_distributions lnd
2014: ,lns_loan_headers lnh
2015: where lnh.loan_id = lnd.loan_id
2016: and lnd.distribution_type = p_distribution_type
2017: and lnd.account_type = p_account_type

Line 2028: from lns_distributions

2024: select
2025: lnh.funded_amount -
2026: (round(lnh.funded_amount *
2027: (select sum(distribution_percent) / 100
2028: from lns_distributions
2029: where distribution_id <> p_distribution_id
2030: and distribution_type = p_distribution_type
2031: and account_type = p_account_type
2032: and loan_id = p_loan_id), curr.precision))

Line 2033: from lns_distributions lnd

2029: where distribution_id <> p_distribution_id
2030: and distribution_type = p_distribution_type
2031: and account_type = p_account_type
2032: and loan_id = p_loan_id), curr.precision))
2033: from lns_distributions lnd
2034: ,lns_loan_headers lnh
2035: ,fnd_currencies curr
2036: where lnh.loan_id = lnd.loan_id
2037: and lnh.loan_id = p_loan_id

Line 2044: l_ledger_details := lns_distributions_pub.getLedgerDetails;

2040: begin
2041:
2042: l_api_name := 'calculateDistributionAmount';
2043: --logMessage(FND_LOG.LEVEL_PROCEDURE, G_PKG_NAME, l_api_name || ' - BEGIN');
2044: l_ledger_details := lns_distributions_pub.getLedgerDetails;
2045: l_distribution_rec := lns_distributions_pub.getDistributions(p_distribution_id);
2046:
2047: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'loanID = ' || l_distribution_rec.loan_id);
2048: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'DIST_ID = ' || p_distribution_id);

Line 2045: l_distribution_rec := lns_distributions_pub.getDistributions(p_distribution_id);

2041:
2042: l_api_name := 'calculateDistributionAmount';
2043: --logMessage(FND_LOG.LEVEL_PROCEDURE, G_PKG_NAME, l_api_name || ' - BEGIN');
2044: l_ledger_details := lns_distributions_pub.getLedgerDetails;
2045: l_distribution_rec := lns_distributions_pub.getDistributions(p_distribution_id);
2046:
2047: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'loanID = ' || l_distribution_rec.loan_id);
2048: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'DIST_ID = ' || p_distribution_id);
2049: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'disttype = ' || l_distribution_rec.distribution_type);

Line 2053: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling lns_distributions_pub.getDistributions...');

2049: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'disttype = ' || l_distribution_rec.distribution_type);
2050: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'accounttype = ' || l_distribution_rec.account_type);
2051:
2052: if l_distribution_rec.distribution_amount is null then
2053: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling lns_distributions_pub.getDistributions...');
2054: l_distribution_tbl := lns_distributions_pub.getDistributions(p_loan_id => l_distribution_rec.loan_id
2055: ,p_account_type => l_distribution_rec.account_type
2056: ,p_account_name => l_distribution_rec.account_name
2057: ,p_line_type => l_distribution_rec.line_type

Line 2054: l_distribution_tbl := lns_distributions_pub.getDistributions(p_loan_id => l_distribution_rec.loan_id

2050: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'accounttype = ' || l_distribution_rec.account_type);
2051:
2052: if l_distribution_rec.distribution_amount is null then
2053: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling lns_distributions_pub.getDistributions...');
2054: l_distribution_tbl := lns_distributions_pub.getDistributions(p_loan_id => l_distribution_rec.loan_id
2055: ,p_account_type => l_distribution_rec.account_type
2056: ,p_account_name => l_distribution_rec.account_name
2057: ,p_line_type => l_distribution_rec.line_type
2058: ,p_distribution_type => l_distribution_rec.distribution_type);

Line 2099: || store the distributions on LNS_DISTRIBUTIONS

2095: ||
2096: || DESCRIPTION
2097: || calculatest the distribution amount based on the distribution percentage
2098: || this api assumes the defaultDistributions API has been called to
2099: || store the distributions on LNS_DISTRIBUTIONS
2100: ||
2101: || PSEUDO CODE/LOGIC
2102: ||
2103: || PARAMETERS

Line 2104: || p_distribution_id = pk to LNS_DISTRIBUTIONS

2100: ||
2101: || PSEUDO CODE/LOGIC
2102: ||
2103: || PARAMETERS
2104: || p_distribution_id = pk to LNS_DISTRIBUTIONS
2105: || p_accounted_flag = 'Y' to get amount in set_of_books currency
2106: || 'N' to get amount in loan currency
2107: ||
2108: || Return value: amount of distribution based from loan funded amount

Line 2110: || Source Tables: lns_distributions, lns_loan_headers

2106: || 'N' to get amount in loan currency
2107: ||
2108: || Return value: amount of distribution based from loan funded amount
2109: ||
2110: || Source Tables: lns_distributions, lns_loan_headers
2111: ||
2112: || Target Tables: NA
2113: ||
2114: || KNOWN ISSUES

Line 2132: l_ledger_details lns_distributions_pub.gl_ledger_details;

2128: is
2129: l_api_name varchar2(50);
2130: l_distribution_amount number;
2131: l_return number;
2132: l_ledger_details lns_distributions_pub.gl_ledger_details;
2133: l_distribution_rec lns_distributions_pub.distribution_rec;
2134: l_distribution_tbl lns_distributions_pub.distribution_tbl;
2135: l_loan_id number;
2136: l_max_distribution_id number;

Line 2133: l_distribution_rec lns_distributions_pub.distribution_rec;

2129: l_api_name varchar2(50);
2130: l_distribution_amount number;
2131: l_return number;
2132: l_ledger_details lns_distributions_pub.gl_ledger_details;
2133: l_distribution_rec lns_distributions_pub.distribution_rec;
2134: l_distribution_tbl lns_distributions_pub.distribution_tbl;
2135: l_loan_id number;
2136: l_max_distribution_id number;
2137: l_currency_code varchar2(10);

Line 2134: l_distribution_tbl lns_distributions_pub.distribution_tbl;

2130: l_distribution_amount number;
2131: l_return number;
2132: l_ledger_details lns_distributions_pub.gl_ledger_details;
2133: l_distribution_rec lns_distributions_pub.distribution_rec;
2134: l_distribution_tbl lns_distributions_pub.distribution_tbl;
2135: l_loan_id number;
2136: l_max_distribution_id number;
2137: l_currency_code varchar2(10);
2138: l_exchange_rate_type varchar2(30);

Line 2152: from lns_distributions lnd

2148: where loan_id = p_loan_id;
2149:
2150: cursor c_get_distribution(p_distribution_id number) is
2151: select round(lnh.funded_amount * lnd.distribution_percent / 100, curr.precision)
2152: from lns_distributions lnd
2153: ,lns_loan_headers lnh
2154: ,fnd_currencies curr
2155: where lnh.loan_id = lnd.loan_id
2156: and curr.currency_code = lnh.loan_currency

Line 2167: from lns_distributions

2163: select
2164: lnh.funded_amount -
2165: (round(lnh.funded_amount *
2166: (select sum(distribution_percent) / 100
2167: from lns_distributions
2168: where distribution_id <> p_distribution_id
2169: and distribution_type = p_distribution_type
2170: and account_type = p_account_type
2171: and loan_id = p_loan_id), curr.precision))

Line 2172: from lns_distributions lnd

2168: where distribution_id <> p_distribution_id
2169: and distribution_type = p_distribution_type
2170: and account_type = p_account_type
2171: and loan_id = p_loan_id), curr.precision))
2172: from lns_distributions lnd
2173: ,lns_loan_headers lnh
2174: ,fnd_currencies curr
2175: where lnh.loan_id = lnd.loan_id
2176: and lnh.loan_id = p_loan_id

Line 2184: l_ledger_details := lns_distributions_pub.getLedgerDetails;

2180:
2181: l_api_name := 'calculateDistributionAmount';
2182:
2183: logMessage(FND_LOG.LEVEL_PROCEDURE, G_PKG_NAME, l_api_name || ' - BEGIN');
2184: l_ledger_details := lns_distributions_pub.getLedgerDetails;
2185: l_distribution_rec := lns_distributions_pub.getDistributions(p_distribution_id);
2186:
2187: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'loanID = ' || l_distribution_rec.loan_id);
2188: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'DIST_ID = ' || p_distribution_id);

Line 2185: l_distribution_rec := lns_distributions_pub.getDistributions(p_distribution_id);

2181: l_api_name := 'calculateDistributionAmount';
2182:
2183: logMessage(FND_LOG.LEVEL_PROCEDURE, G_PKG_NAME, l_api_name || ' - BEGIN');
2184: l_ledger_details := lns_distributions_pub.getLedgerDetails;
2185: l_distribution_rec := lns_distributions_pub.getDistributions(p_distribution_id);
2186:
2187: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'loanID = ' || l_distribution_rec.loan_id);
2188: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'DIST_ID = ' || p_distribution_id);
2189: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'disttype = ' || l_distribution_rec.distribution_type);

Line 2242: ,lns_distributions lnd

2238:
2239: cursor c_currency1(p_distribution_id number) is
2240: select lnh.loan_currency
2241: from lns_loan_headers lnh
2242: ,lns_distributions lnd
2243: where lnh.loan_id = lnd.loan_id
2244: and lnd.distribution_id = p_distribution_id;
2245:
2246: cursor c_currency2 is

Line 2267: l_amount := lns_distributions_pub.calculateDistributionAmount(p_distribution_id => p_distribution_id

2263: fetch c_currency1 into l_currency;
2264: close c_currency1;
2265: end if;
2266:
2267: l_amount := lns_distributions_pub.calculateDistributionAmount(p_distribution_id => p_distribution_id
2268: ,p_accounted_flag => p_accounted_flag);
2269: l_char := to_char(l_amount, fnd_currency.safe_get_format_mask(l_currency,25));
2270:
2271: l_return := l_char || ' ' || l_currency;

Line 2452: --l_loan_liability_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;

2448: ,x_msg_count OUT NOCOPY NUMBER
2449: ,x_msg_data OUT NOCOPY VARCHAR2)
2450: is
2451:
2452: --l_loan_liability_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2453: l_loan_clearing_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2454: l_loan_receivables_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2455: l_loan_clearing_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2456: l_loan_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;

Line 2453: l_loan_clearing_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;

2449: ,x_msg_data OUT NOCOPY VARCHAR2)
2450: is
2451:
2452: --l_loan_liability_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2453: l_loan_clearing_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2454: l_loan_receivables_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2455: l_loan_clearing_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2456: l_loan_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2457: l_prin_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;

Line 2454: l_loan_receivables_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;

2450: is
2451:
2452: --l_loan_liability_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2453: l_loan_clearing_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2454: l_loan_receivables_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2455: l_loan_clearing_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2456: l_loan_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2457: l_prin_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2458: l_int_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;

Line 2455: l_loan_clearing_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;

2451:
2452: --l_loan_liability_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2453: l_loan_clearing_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2454: l_loan_receivables_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2455: l_loan_clearing_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2456: l_loan_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2457: l_prin_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2458: l_int_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2459: l_int_income_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;

Line 2456: l_loan_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;

2452: --l_loan_liability_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2453: l_loan_clearing_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2454: l_loan_receivables_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2455: l_loan_clearing_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2456: l_loan_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2457: l_prin_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2458: l_int_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2459: l_int_income_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2460:

Line 2457: l_prin_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;

2453: l_loan_clearing_fund LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2454: l_loan_receivables_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2455: l_loan_clearing_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2456: l_loan_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2457: l_prin_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2458: l_int_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2459: l_int_income_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2460:
2461: l_dist_percent_rec_orig number;

Line 2458: l_int_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;

2454: l_loan_receivables_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2455: l_loan_clearing_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2456: l_loan_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2457: l_prin_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2458: l_int_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2459: l_int_income_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2460:
2461: l_dist_percent_rec_orig number;
2462: l_dist_percent_rec_bill number;

Line 2459: l_int_income_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;

2455: l_loan_clearing_orig LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2456: l_loan_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2457: l_prin_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2458: l_int_receivables_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2459: l_int_income_bill LNS_DISTRIBUTIONS_PUB.distribution_tbl;
2460:
2461: l_dist_percent_rec_orig number;
2462: l_dist_percent_rec_bill number;
2463: l_dist_percent_clear_orig number;

Line 2501: l_loan_liability_fund := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id

2497:
2498: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'loan_class = ' || l_loan_class);
2499: -- get the distributions details
2500: /*
2501: l_loan_liability_fund := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2502: ,p_account_type => 'DR'
2503: ,p_account_name => 'LOAN_LIABILITY'
2504: ,p_line_type => 'ORIG'
2505: ,p_distribution_type => 'FUNDING');

Line 2509: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 1...');

2505: ,p_distribution_type => 'FUNDING');
2506: */
2507: if l_loan_class = 'ERS' then
2508:
2509: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 1...');
2510: l_loan_clearing_orig := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2511: ,p_account_type => 'CR'
2512: ,p_account_name => 'LOAN_CLEARING'
2513: ,p_line_type => 'CLEAR'

Line 2510: l_loan_clearing_orig := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id

2506: */
2507: if l_loan_class = 'ERS' then
2508:
2509: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 1...');
2510: l_loan_clearing_orig := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2511: ,p_account_type => 'CR'
2512: ,p_account_name => 'LOAN_CLEARING'
2513: ,p_line_type => 'CLEAR'
2514: ,p_distribution_type => 'ORIGINATION');

Line 2517: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 2...');

2513: ,p_line_type => 'CLEAR'
2514: ,p_distribution_type => 'ORIGINATION');
2515: elsif l_loan_class = 'DIRECT' then
2516:
2517: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 2...');
2518: l_loan_clearing_orig := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2519: ,p_account_type => 'CR'
2520: ,p_account_name => 'LOAN_PAYABLE'
2521: ,p_line_type => 'CLEAR'

Line 2518: l_loan_clearing_orig := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id

2514: ,p_distribution_type => 'ORIGINATION');
2515: elsif l_loan_class = 'DIRECT' then
2516:
2517: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 2...');
2518: l_loan_clearing_orig := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2519: ,p_account_type => 'CR'
2520: ,p_account_name => 'LOAN_PAYABLE'
2521: ,p_line_type => 'CLEAR'
2522: ,p_distribution_type => 'ORIGINATION');

Line 2525: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 3...');

2521: ,p_line_type => 'CLEAR'
2522: ,p_distribution_type => 'ORIGINATION');
2523: end if;
2524:
2525: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 3...');
2526: l_loan_receivables_orig := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2527: ,p_account_type => 'DR'
2528: ,p_account_name => 'LOAN_RECEIVABLE'
2529: ,p_line_type => 'ORIG'

Line 2526: l_loan_receivables_orig := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id

2522: ,p_distribution_type => 'ORIGINATION');
2523: end if;
2524:
2525: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 3...');
2526: l_loan_receivables_orig := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2527: ,p_account_type => 'DR'
2528: ,p_account_name => 'LOAN_RECEIVABLE'
2529: ,p_line_type => 'ORIG'
2530: ,p_distribution_type => 'ORIGINATION');

Line 2532: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 4...');

2528: ,p_account_name => 'LOAN_RECEIVABLE'
2529: ,p_line_type => 'ORIG'
2530: ,p_distribution_type => 'ORIGINATION');
2531:
2532: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 4...');
2533: l_loan_receivables_bill := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2534: ,p_account_type => 'CR'
2535: ,p_account_name => 'LOAN_RECEIVABLE'
2536: ,p_line_type => 'PRIN'

Line 2533: l_loan_receivables_bill := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id

2529: ,p_line_type => 'ORIG'
2530: ,p_distribution_type => 'ORIGINATION');
2531:
2532: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 4...');
2533: l_loan_receivables_bill := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2534: ,p_account_type => 'CR'
2535: ,p_account_name => 'LOAN_RECEIVABLE'
2536: ,p_line_type => 'PRIN'
2537: ,p_distribution_type => 'BILLING');

Line 2539: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 5...');

2535: ,p_account_name => 'LOAN_RECEIVABLE'
2536: ,p_line_type => 'PRIN'
2537: ,p_distribution_type => 'BILLING');
2538:
2539: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 5...');
2540: l_prin_receivables_bill := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2541: ,p_account_type => 'DR'
2542: ,p_account_name => 'PRINCIPAL_RECEIVABLE'
2543: ,p_line_type => 'PRIN'

Line 2540: l_prin_receivables_bill := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id

2536: ,p_line_type => 'PRIN'
2537: ,p_distribution_type => 'BILLING');
2538:
2539: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 5...');
2540: l_prin_receivables_bill := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2541: ,p_account_type => 'DR'
2542: ,p_account_name => 'PRINCIPAL_RECEIVABLE'
2543: ,p_line_type => 'PRIN'
2544: ,p_distribution_type => 'BILLING');

Line 2546: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 6...');

2542: ,p_account_name => 'PRINCIPAL_RECEIVABLE'
2543: ,p_line_type => 'PRIN'
2544: ,p_distribution_type => 'BILLING');
2545:
2546: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 6...');
2547: l_int_receivables_bill := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2548: ,p_account_type => 'DR'
2549: ,p_account_name => 'INTEREST_RECEIVABLE'
2550: ,p_line_type => 'INT'

Line 2547: l_int_receivables_bill := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id

2543: ,p_line_type => 'PRIN'
2544: ,p_distribution_type => 'BILLING');
2545:
2546: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 6...');
2547: l_int_receivables_bill := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2548: ,p_account_type => 'DR'
2549: ,p_account_name => 'INTEREST_RECEIVABLE'
2550: ,p_line_type => 'INT'
2551: ,p_distribution_type => 'BILLING');

Line 2553: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 7...');

2549: ,p_account_name => 'INTEREST_RECEIVABLE'
2550: ,p_line_type => 'INT'
2551: ,p_distribution_type => 'BILLING');
2552:
2553: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 7...');
2554: l_int_income_bill := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2555: ,p_account_type => 'CR'
2556: ,p_account_name => 'INTEREST_INCOME'
2557: ,p_line_type => 'INT'

Line 2554: l_int_income_bill := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id

2550: ,p_line_type => 'INT'
2551: ,p_distribution_type => 'BILLING');
2552:
2553: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling LNS_DISTRIBUTIONS_PUB.getDistributions 7...');
2554: l_int_income_bill := LNS_DISTRIBUTIONS_PUB.getDistributions(p_loan_id => p_loan_id
2555: ,p_account_type => 'CR'
2556: ,p_account_name => 'INTEREST_INCOME'
2557: ,p_line_type => 'INT'
2558: ,p_distribution_type => 'BILLING');

Line 3020: l_distributions lns_distributions_pub.distribution_tbl;

3016: l_api_name varchar2(30);
3017: l_msg_count NUMBER;
3018: l_msg_data VARCHAR2(2000);
3019: l_return_Status VARCHAR2(1);
3020: l_distributions lns_distributions_pub.distribution_tbl;
3021: l_exists number;
3022: l_disb_header_id number;
3023: l_distributions_count number;
3024: i number;

Line 3031: from lns_distributions

3027:
3028:
3029: cursor c_distribsExist(p_loan_id number, p_disb_header_id number) is
3030: select count(1)
3031: from lns_distributions
3032: where loan_id = p_loan_id
3033: and distribution_type = 'ORIGINATION'
3034: and disb_header_id = p_disb_header_id;
3035:

Line 3043: from lns_distributions

3039: where loan_id = p_loan_id;
3040:
3041: cursor c_subsidy_rows_exist(p_loan_id number) is
3042: select count(1)
3043: from lns_distributions
3044: where loan_id = p_loan_id
3045: and line_type = 'SUBSIDY'
3046: and distribution_type = 'ORIGINATION'
3047: and event_id is not null;

Line 3227: || Target Tables: LNS_DISTRIBUTIONS

3223: || Return value: Standard S = Success E = Error U = Unexpected
3224: ||
3225: || Source Tables: LNS_DEFAULT_DISTRIBUTIONS, lns_loan_headers_all
3226: ||
3227: || Target Tables: LNS_DISTRIBUTIONS
3228: ||
3229: || KNOWN ISSUES
3230: ||
3231: || NOTES

Line 3265: l_distributions lns_distributions_pub.distribution_tbl;

3261: i number;
3262: n number;
3263: l_code_combination_id number;
3264: l_code_combination_id_new_rec number;
3265: l_distributions lns_distributions_pub.distribution_tbl;
3266: l_distributionsCLEAR_ORIG lns_distributions_pub.distribution_tbl;
3267: l_distributionsREC_ORIG lns_distributions_pub.distribution_tbl;
3268: l_distributionsREC_BILL lns_distributions_pub.distribution_tbl;
3269: l_distributionsCatch lns_distributions_pub.distribution_tbl;

Line 3266: l_distributionsCLEAR_ORIG lns_distributions_pub.distribution_tbl;

3262: n number;
3263: l_code_combination_id number;
3264: l_code_combination_id_new_rec number;
3265: l_distributions lns_distributions_pub.distribution_tbl;
3266: l_distributionsCLEAR_ORIG lns_distributions_pub.distribution_tbl;
3267: l_distributionsREC_ORIG lns_distributions_pub.distribution_tbl;
3268: l_distributionsREC_BILL lns_distributions_pub.distribution_tbl;
3269: l_distributionsCatch lns_distributions_pub.distribution_tbl;
3270: l_distributionsALL lns_distributions_pub.distribution_tbl;

Line 3267: l_distributionsREC_ORIG lns_distributions_pub.distribution_tbl;

3263: l_code_combination_id number;
3264: l_code_combination_id_new_rec number;
3265: l_distributions lns_distributions_pub.distribution_tbl;
3266: l_distributionsCLEAR_ORIG lns_distributions_pub.distribution_tbl;
3267: l_distributionsREC_ORIG lns_distributions_pub.distribution_tbl;
3268: l_distributionsREC_BILL lns_distributions_pub.distribution_tbl;
3269: l_distributionsCatch lns_distributions_pub.distribution_tbl;
3270: l_distributionsALL lns_distributions_pub.distribution_tbl;
3271: l_distributions_count number;

Line 3268: l_distributionsREC_BILL lns_distributions_pub.distribution_tbl;

3264: l_code_combination_id_new_rec number;
3265: l_distributions lns_distributions_pub.distribution_tbl;
3266: l_distributionsCLEAR_ORIG lns_distributions_pub.distribution_tbl;
3267: l_distributionsREC_ORIG lns_distributions_pub.distribution_tbl;
3268: l_distributionsREC_BILL lns_distributions_pub.distribution_tbl;
3269: l_distributionsCatch lns_distributions_pub.distribution_tbl;
3270: l_distributionsALL lns_distributions_pub.distribution_tbl;
3271: l_distributions_count number;
3272: l_distributionsCatch_count number;

Line 3269: l_distributionsCatch lns_distributions_pub.distribution_tbl;

3265: l_distributions lns_distributions_pub.distribution_tbl;
3266: l_distributionsCLEAR_ORIG lns_distributions_pub.distribution_tbl;
3267: l_distributionsREC_ORIG lns_distributions_pub.distribution_tbl;
3268: l_distributionsREC_BILL lns_distributions_pub.distribution_tbl;
3269: l_distributionsCatch lns_distributions_pub.distribution_tbl;
3270: l_distributionsALL lns_distributions_pub.distribution_tbl;
3271: l_distributions_count number;
3272: l_distributionsCatch_count number;
3273: l_total_distributions number;

Line 3270: l_distributionsALL lns_distributions_pub.distribution_tbl;

3266: l_distributionsCLEAR_ORIG lns_distributions_pub.distribution_tbl;
3267: l_distributionsREC_ORIG lns_distributions_pub.distribution_tbl;
3268: l_distributionsREC_BILL lns_distributions_pub.distribution_tbl;
3269: l_distributionsCatch lns_distributions_pub.distribution_tbl;
3270: l_distributionsALL lns_distributions_pub.distribution_tbl;
3271: l_distributions_count number;
3272: l_distributionsCatch_count number;
3273: l_total_distributions number;
3274: l_ers_distribution_amount number;

Line 3276: l_ledger_details lns_distributions_pub.gl_ledger_details;

3272: l_distributionsCatch_count number;
3273: l_total_distributions number;
3274: l_ers_distribution_amount number;
3275: l_orig_distribution_amount number;
3276: l_ledger_details lns_distributions_pub.gl_ledger_details;
3277: l_include_receivables varchar2(1);
3278: l_sum number;
3279: l_multifund number;
3280: l_multifund_exists number;

Line 3522: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'Calling lns_distributions_pub.validateDefaultAccounting...');

3518: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'l_loan_type_id = ' || l_loan_type_id);
3519: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'l_funded_amount = ' || l_funded_amount);
3520: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'l_legal_entity_id = ' || l_legal_entity_id);
3521:
3522: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'Calling lns_distributions_pub.validateDefaultAccounting...');
3523: lns_distributions_pub.validateDefaultAccounting(p_loan_class => l_loan_class
3524: ,p_loan_type_id => l_loan_type_id
3525: ,p_init_msg_list => p_init_msg_list
3526: ,x_return_status => l_return_status

Line 3523: lns_distributions_pub.validateDefaultAccounting(p_loan_class => l_loan_class

3519: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'l_funded_amount = ' || l_funded_amount);
3520: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'l_legal_entity_id = ' || l_legal_entity_id);
3521:
3522: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'Calling lns_distributions_pub.validateDefaultAccounting...');
3523: lns_distributions_pub.validateDefaultAccounting(p_loan_class => l_loan_class
3524: ,p_loan_type_id => l_loan_type_id
3525: ,p_init_msg_list => p_init_msg_list
3526: ,x_return_status => l_return_status
3527: ,x_msg_count => l_msg_count

Line 3540: delete from lns_distributions

3536: end if;
3537:
3538: /* delete any rows for this loan before inheritance do not delete FEE_RECEIVABLE or FEE_INCOME rows*/
3539: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'Deleting any existing accounting rows except FEE_RECEIVABLE or FEE_INCOME...');
3540: delete from lns_distributions
3541: where loan_id = p_loan_id
3542: and account_name in ('PRINCIPAL_RECEIVABLE', 'INTEREST_RECEIVABLE', 'INTEREST_INCOME', 'LOAN_RECEIVABLE', 'LOAN_CLEARING', 'LOAN_LIABILITY', 'LOAN_PAYABLE')
3543: and event_id is null;
3544: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'Done');

Line 3633: l_ledger_details := lns_distributions_pub.getLedgerDetails;

3629: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'ERS LOAN INHERITANCE');
3630:
3631: -- this switch is for the CatchAll Procedure
3632: l_include_receivables := 'N';
3633: l_ledger_details := lns_distributions_pub.getLedgerDetails;
3634: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'chart_of_accounts_id = ' || l_ledger_details.chart_of_accounts_id);
3635:
3636: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'Fetching documents to account...');
3637: open c_get_loan_documents(p_loan_id);

Line 3915: -- ensure this amount is accurate it will get inserted into lns_distributions for loans booking

3911: l_percent := round(l_distributionsCLEAR_ORIG(k).distribution_amount / l_clearing_total_amount_due * 100,4);
3912: --l_percent := round(l_distributionsREC_ORIG(k).distribution_amount / l_receivable_total_amount_due * 100,4);
3913: l_distributionsREC_ORIG(k).distribution_percent := l_percent;
3914: l_distributionsREC_BILL(k).distribution_percent := l_percent;
3915: -- ensure this amount is accurate it will get inserted into lns_distributions for loans booking
3916: l_distributionsREC_ORIG(k).distribution_amount := l_percent / 100 * l_funded_amount;
3917: else
3918: -- last row ensure that amounts = 100% and total = funded amount of loan
3919: l_percent := 100 - l_running_percent;

Line 4031: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'Calling lns_distributions_pub.validateAccounting...');

4027: do_insert_distributions(p_distributions_tbl => l_distributionsALL
4028: ,p_loan_id => p_loan_id);
4029:
4030: -- validate the accounting rows here
4031: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'Calling lns_distributions_pub.validateAccounting...');
4032: lns_distributions_pub.validateAccounting(p_loan_id => p_loan_id
4033: ,p_init_msg_list => p_init_msg_list
4034: ,x_return_status => l_return_status
4035: ,x_msg_count => l_msg_count

Line 4032: lns_distributions_pub.validateAccounting(p_loan_id => p_loan_id

4028: ,p_loan_id => p_loan_id);
4029:
4030: -- validate the accounting rows here
4031: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'Calling lns_distributions_pub.validateAccounting...');
4032: lns_distributions_pub.validateAccounting(p_loan_id => p_loan_id
4033: ,p_init_msg_list => p_init_msg_list
4034: ,x_return_status => l_return_status
4035: ,x_msg_count => l_msg_count
4036: ,x_msg_data => l_msg_data);

Line 4146: ,lns_distributions disb

4142: and source_id_int_1 = p_loan_id
4143: and source_id_int_2 IN
4144: (select disb.disb_header_id
4145: from lns_disb_headers dh
4146: ,lns_distributions disb
4147: where disb.loan_id = p_loan_id
4148: and disb.disb_header_id = dh.disb_header_id
4149: and disb.account_name = 'LOAN_RECEIVABLE'
4150: and dh.status = 'FULLY_FUNDED'

Line 4206: -- can we make join thru lns_distributions

4202: else
4203:
4204: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'DIRECT loan accounting');
4205:
4206: -- can we make join thru lns_distributions
4207: insert into XLA_ACCT_PROG_DOCS_GT
4208: (entity_id)
4209: select entity_id from xla_transaction_entities
4210: where application_id = 206

Line 4215: ,lns_distributions disb

4211: and entity_code = 'LOANS'
4212: and source_id_int_1 = p_loan_id
4213: and source_id_int_2 in (select disb.disb_header_id
4214: from lns_disb_headers dh
4215: ,lns_distributions disb
4216: where disb.loan_id = p_loan_id
4217: and disb.disb_header_id = dh.disb_header_id
4218: and disb.account_name = 'LOAN_RECEIVABLE'
4219: and dh.status = 'FULLY_FUNDED');

Line 4451: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling Lns_distributions_pub.defaultDistributions...');

4447:
4448:
4449:
4450: -- we should do online accounting in batch mode here
4451: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling Lns_distributions_pub.defaultDistributions...');
4452: Lns_distributions_pub.defaultDistributions(p_api_version => 1.0
4453: ,p_init_msg_list => FND_API.G_TRUE
4454: ,p_commit => FND_API.G_FALSE
4455: ,p_loan_id => P_LOAN_ID

Line 4452: Lns_distributions_pub.defaultDistributions(p_api_version => 1.0

4448:
4449:
4450: -- we should do online accounting in batch mode here
4451: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Calling Lns_distributions_pub.defaultDistributions...');
4452: Lns_distributions_pub.defaultDistributions(p_api_version => 1.0
4453: ,p_init_msg_list => FND_API.G_TRUE
4454: ,p_commit => FND_API.G_FALSE
4455: ,p_loan_id => P_LOAN_ID
4456: ,p_loan_class_code => l_loan_class_code

Line 4463: -- logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Call to Lns_distributions_pub.defaultDistributions failed with status ' || l_return_status);

4459: ,x_msg_data => l_msg_data);
4460: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'l_return_status = ' || l_return_status);
4461:
4462: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4463: -- logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Call to Lns_distributions_pub.defaultDistributions failed with status ' || l_return_status);
4464: -- fnd_file.put_line(FND_FILE.LOG, 'FAILED TO INHERIT DISTRIBUTIONS');
4465: --l_last_api_called := 'Lns_distributions_pub.defaultDistributions';
4466: RAISE FND_API.G_EXC_ERROR;
4467: ELSE

Line 4465: --l_last_api_called := 'Lns_distributions_pub.defaultDistributions';

4461:
4462: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
4463: -- logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Call to Lns_distributions_pub.defaultDistributions failed with status ' || l_return_status);
4464: -- fnd_file.put_line(FND_FILE.LOG, 'FAILED TO INHERIT DISTRIBUTIONS');
4465: --l_last_api_called := 'Lns_distributions_pub.defaultDistributions';
4466: RAISE FND_API.G_EXC_ERROR;
4467: ELSE
4468:
4469: if x_event_id is not null then

Line 4470: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Updating lns_distributions...');

4466: RAISE FND_API.G_EXC_ERROR;
4467: ELSE
4468:
4469: if x_event_id is not null then
4470: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Updating lns_distributions...');
4471: update lns_distributions
4472: set event_id = x_event_id
4473: where loan_id = P_LOAN_ID
4474: and account_name in ('LOAN_RECEIVABLE', 'LOAN_CLEARING')

Line 4471: update lns_distributions

4467: ELSE
4468:
4469: if x_event_id is not null then
4470: logMessage(FND_LOG.LEVEL_STATEMENT, G_PKG_NAME, 'Updating lns_distributions...');
4471: update lns_distributions
4472: set event_id = x_event_id
4473: where loan_id = P_LOAN_ID
4474: and account_name in ('LOAN_RECEIVABLE', 'LOAN_CLEARING')
4475: and distribution_type = 'ORIGINATION';

Line 4587: l_distributionsCatch lns_distributions_pub.distribution_tbl;

4583: l_api_name constant VARCHAR2(30) := 'defaultDistrForImport';
4584: l_return_status VARCHAR2(1) ;
4585: l_msg_count NUMBER;
4586: l_msg_data VARCHAR2(32767);
4587: l_distributionsCatch lns_distributions_pub.distribution_tbl;
4588:
4589: BEGIN
4590:
4591: logmessage(fnd_log.level_procedure, G_PKG_NAME, g_pkg_name || '.' || l_api_name || ' +');

Line 4601: LNS_DISTRIBUTIONS_PUB.defaultDistributionsCatch(

4597: FND_MSG_PUB.initialize;
4598: END IF;
4599:
4600: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'Calling defaultDistributionsCatch...');
4601: LNS_DISTRIBUTIONS_PUB.defaultDistributionsCatch(
4602: p_api_version => 1.0
4603: ,p_init_msg_list => FND_API.G_TRUE
4604: ,p_commit => FND_API.G_FALSE
4605: ,p_loan_id => p_loan_id

Line 4621: lns_distributions_pub.do_insert_distributions(

4617:
4618: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'l_distributionsCatch.count = ' || l_distributionsCatch.count);
4619:
4620: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'Calling do_insert_distributions...');
4621: lns_distributions_pub.do_insert_distributions(
4622: p_distributions_tbl => l_distributionsCatch
4623: ,p_loan_id => p_loan_id);
4624: if l_return_status <> 'S' then
4625: RAISE FND_API.G_EXC_ERROR;

Line 4630: lns_distributions_pub.validateAccounting(p_loan_id => p_loan_id

4626: end if;
4627:
4628: -- validate the accounting rows here
4629: logMessage(FND_LOG.level_statement, G_PKG_NAME, 'Calling validateAccounting...');
4630: lns_distributions_pub.validateAccounting(p_loan_id => p_loan_id
4631: ,p_init_msg_list => FND_API.G_TRUE
4632: ,x_return_status => l_return_status
4633: ,x_msg_count => l_msg_count
4634: ,x_msg_data => l_msg_data);

Line 4655: END LNS_DISTRIBUTIONS_PUB;

4651: END;
4652:
4653:
4654:
4655: END LNS_DISTRIBUTIONS_PUB;