DBA Data[Home] [Help]

APPS.JE_ES_WHTAX dependencies on AP_INVOICE_DISTRIBUTIONS_ALL

Line 506: from ap_invoice_distributions_all dist,

502: amount_withheld NUMBER := 0;
503: BEGIN
504: select (0 - sum(nvl(dist.base_amount,nvl(dist.amount,0))))
505: into amount_withheld
506: from ap_invoice_distributions_all dist,
507: ap_invoice_lines_all line,
508: ap_invoices_all inv
509: where dist.invoice_id = l_invoice_id
510: and inv.legal_entity_id = nvl(l_legal_entity_id, inv.legal_entity_id)

Line 531: from ap_invoice_distributions_all dist,

527: prepaid_amount NUMBER := 0;
528: BEGIN
529: select (0 - sum(nvl(dist.base_amount,nvl(dist.amount,0))))
530: into prepaid_amount
531: from ap_invoice_distributions_all dist,
532: ap_invoice_lines_all line,
533: ap_invoices_all inv
534: where dist.invoice_id = l_invoice_id
535: and inv.legal_entity_id = nvl(l_legal_entity_id, inv.legal_entity_id)

Line 558: FROM ap_invoice_distributions_all dist,

554: l_awt_net_total NUMBER := 0;
555: BEGIN
556: SELECT NVL(SUM(nvl(dist.base_amount,NVL(dist.amount,0))),0)
557: INTO l_awt_net_total
558: FROM ap_invoice_distributions_all dist,
559: ap_invoice_lines_all line,
560: ap_invoices_all inv
561: WHERE dist.invoice_id = l_invoice_id
562: and inv.legal_entity_id = nvl(l_legal_entity_id, inv.legal_entity_id)

Line 686: ap_invoice_distributions_all dist,

682: po_vendor_sites_all vs,
683: fnd_lookups fl,
684: ap_invoices_all inv,
685: ap_invoice_lines_all line,
686: ap_invoice_distributions_all dist,
687: ap_tax_codes_all atc,
688: ap_awt_tax_rates_all awt,
689: (SELECT distinct person_id
690: ,national_identifier

Line 735: from ap_invoice_distributions_all dist2

731: AND( (dist.awt_tax_rate_id = awt.tax_rate_id)
732: OR (dist.awt_tax_rate_id is NULL) )
733: -- Ignore any invoices which do not have 'AWT' distribution lines
734: AND EXISTS ( select dist2.invoice_id
735: from ap_invoice_distributions_all dist2
736: where inv.invoice_id = dist2.invoice_id
737: and dist2.line_type_lookup_code = 'AWT'
738: and dist2.withholding_tax_code_id in
739: -- Bug 2019586: Column name should be tax_id.

Line 770: ap_invoice_distributions_all dist,

766: ap_tax_codes_all atc,
767: ap_awt_tax_rates_all awt,
768: ap_invoices_all inv,
769: ap_invoice_lines_all line,
770: ap_invoice_distributions_all dist,
771: (SELECT distinct person_id
772: ,national_identifier
773: FROM PER_ALL_PEOPLE_F) papf
774: WHERE v.vendor_id = vs.vendor_id

Line 795: from ap_invoice_distributions_all dist1

791: (dist.cancellation_flag is null
792: AND dist.accounting_date < (select distinct gl.start_date
793: from gl_period_statuses gl
794: where gl.period_name IN (select distinct to_char(dist1.accounting_date,'MM-YY')
795: from ap_invoice_distributions_all dist1
796: where dist1.invoice_id = inv.invoice_id
797: and dist1.cancellation_flag = 'Y' )))
798: OR
799: (dist.cancellation_flag = 'Y'

Line 803: from ap_invoice_distributions_all dist1

799: (dist.cancellation_flag = 'Y'
800: AND dist.accounting_date > (select distinct gl.end_date
801: from gl_period_statuses gl
802: where gl.period_name IN (select distinct to_char(dist1.accounting_date,'MM-YY')
803: from ap_invoice_distributions_all dist1
804: where dist1.invoice_id = inv.invoice_id
805: and dist1.cancellation_flag is null )))
806: )
807: -- END

Line 839: from ap_invoice_distributions_all dist2

835: AND( (dist.awt_tax_rate_id = awt.tax_rate_id)
836: OR (dist.awt_tax_rate_id is NULL) )
837: -- Ignore any invoices which do not have 'AWT' distribution lines
838: AND EXISTS ( select dist2.invoice_id
839: from ap_invoice_distributions_all dist2
840: where inv.invoice_id = dist2.invoice_id
841: and dist2.line_type_lookup_code = 'AWT'
842: and dist2.withholding_tax_code_id in
843: -- Bug 2019586: Column name should be tax_id.

Line 899: ap_invoice_distributions_all dist,

895: ap_awt_tax_rates_all awt,
896: fnd_document_sequences seq,
897: ap_invoices_all inv,
898: ap_invoice_lines_all line,
899: ap_invoice_distributions_all dist,
900: (SELECT distinct person_id
901: ,national_identifier
902: FROM PER_ALL_PEOPLE_F) papf
903: WHERE vs.country = fl.lookup_code(+)

Line 956: from ap_invoice_distributions_all dist2

952: AND( (dist.awt_tax_rate_id = awt.tax_rate_id)
953: OR (dist.awt_tax_rate_id is NULL) )
954: -- Ignore any invoices which do not have 'AWT' distribution lines
955: AND EXISTS (select dist2.invoice_id
956: from ap_invoice_distributions_all dist2
957: where inv.invoice_id = dist2.invoice_id
958: and dist2.line_type_lookup_code = 'AWT'
959: and dist2.withholding_tax_code_id in
960: -- Bug 2019586: Column name should be tax_id.

Line 966: from ap_invoice_distributions_all dist2

962: (select tax_id
963: from ap_tax_codes_all
964: where vat_transaction_type = p_wht_tax_type))
965: AND NOT EXISTS ( select dist2.invoice_id
966: from ap_invoice_distributions_all dist2
967: where inv.invoice_id = dist2.invoice_id
968: and dist2.line_type_lookup_code = 'AWT'
969: and dist2.awt_flag <> 'A')
970: GROUP BY 'A',

Line 1047: ap_invoice_distributions_all dist,

1043: ap_awt_tax_rates_all awt,
1044: fnd_document_sequences seq,
1045: ap_invoices_all inv,
1046: ap_invoice_lines_all line,
1047: ap_invoice_distributions_all dist,
1048: (SELECT distinct person_id
1049: ,national_identifier
1050: FROM PER_ALL_PEOPLE_F) papf
1051: WHERE vs.country = fl.lookup_code(+)

Line 1074: from ap_invoice_distributions_all dist1

1070: (dist.cancellation_flag is null
1071: AND dist.accounting_date < (select distinct gl.start_date
1072: from gl_period_statuses gl
1073: where gl.period_name IN (select distinct to_char(dist1.accounting_date,'MM-YY')
1074: from ap_invoice_distributions_all dist1
1075: where dist1.invoice_id = inv.invoice_id
1076: and dist1.cancellation_flag = 'Y' )))
1077: OR
1078: (dist.cancellation_flag = 'Y'

Line 1082: from ap_invoice_distributions_all dist1

1078: (dist.cancellation_flag = 'Y'
1079: AND dist.accounting_date > (select distinct gl.end_date
1080: from gl_period_statuses gl
1081: where gl.period_name IN (select distinct to_char(dist1.accounting_date,'MM-YY')
1082: from ap_invoice_distributions_all dist1
1083: where dist1.invoice_id = inv.invoice_id
1084: and dist1.cancellation_flag is null )))
1085: )
1086: -- END

Line 1123: from ap_invoice_distributions_all dist2

1119: and nvl(awt.end_date, invpay.accounting_date)
1120: AND inv.doc_sequence_id = seq.doc_sequence_id(+)
1121: -- Ignore any invoices which do not have 'AWT' distribution lines
1122: AND EXISTS (select dist2.invoice_id
1123: from ap_invoice_distributions_all dist2
1124: where inv.invoice_id = dist2.invoice_id
1125: and dist2.line_type_lookup_code = 'AWT'
1126: and dist2.withholding_tax_code_id in
1127: -- Bug 2019586: Column name should be tax_id.

Line 1133: from ap_invoice_distributions_all dist2

1129: (select tax_id
1130: from ap_tax_codes_all
1131: where vat_transaction_type = p_wht_tax_type))
1132: AND NOT EXISTS ( select dist2.invoice_id
1133: from ap_invoice_distributions_all dist2
1134: where inv.invoice_id = dist2.invoice_id
1135: and dist2.line_type_lookup_code = 'AWT'
1136: and dist2.awt_flag <> 'A')
1137: GROUP BY 'A',

Line 1209: ap_invoice_distributions_all dist,

1205: ap_awt_tax_rates_all awt,
1206: fnd_document_sequences seq,
1207: ap_invoices_all inv,
1208: ap_invoice_lines_all line,
1209: ap_invoice_distributions_all dist,
1210: (SELECT distinct person_id
1211: ,national_identifier
1212: FROM PER_ALL_PEOPLE_F) papf
1213: WHERE vs.country = fl.lookup_code(+)

Line 1264: from ap_invoice_distributions_all dist2

1260: -- Bug 5207771 : Added to remove the duplicates WH lines
1261: AND( (dist.awt_tax_rate_id = awt.tax_rate_id)
1262: OR (dist.awt_tax_rate_id is NULL) )
1263: AND EXISTS (select dist2.invoice_id
1264: from ap_invoice_distributions_all dist2
1265: where inv.invoice_id = dist2.invoice_id
1266: and dist2.line_type_lookup_code = 'AWT'
1267: and dist2.withholding_tax_code_id in
1268: -- Bug 2019586: Column name should be tax_id.

Line 1274: from ap_invoice_distributions_all dist2

1270: (select tax_id
1271: from ap_tax_codes_all
1272: where vat_transaction_type = p_wht_tax_type))
1273: AND NOT EXISTS ( select dist2.invoice_id
1274: from ap_invoice_distributions_all dist2
1275: where inv.invoice_id = dist2.invoice_id
1276: and dist2.line_type_lookup_code = 'AWT'
1277: and dist2.awt_flag <> 'A')
1278: -- BUG 3930123 : Adding one more select clause with certain modifications, to fetch

Line 1323: ap_invoice_distributions_all dist,

1319: ap_awt_tax_rates_all awt,
1320: fnd_document_sequences seq,
1321: ap_invoices_all inv,
1322: ap_invoice_lines_all line,
1323: ap_invoice_distributions_all dist,
1324: (SELECT distinct person_id
1325: ,national_identifier
1326: FROM PER_ALL_PEOPLE_F) papf
1327: WHERE vs.country = fl.lookup_code(+)

Line 1350: from ap_invoice_distributions_all dist1

1346: (dist.cancellation_flag is null
1347: AND dist.accounting_date < (select distinct gl.start_date
1348: from gl_period_statuses gl
1349: where gl.period_name IN (select distinct to_char(dist1.accounting_date,'MM-YY')
1350: from ap_invoice_distributions_all dist1
1351: where dist1.invoice_id = inv.invoice_id
1352: and dist1.cancellation_flag = 'Y' )))
1353: OR
1354: (dist.cancellation_flag = 'Y'

Line 1358: from ap_invoice_distributions_all dist1

1354: (dist.cancellation_flag = 'Y'
1355: AND dist.accounting_date > (select distinct gl.end_date
1356: from gl_period_statuses gl
1357: where gl.period_name IN (select distinct to_char(dist1.accounting_date,'MM-YY')
1358: from ap_invoice_distributions_all dist1
1359: where dist1.invoice_id = inv.invoice_id
1360: and dist1.cancellation_flag is null )))
1361: )
1362: -- END

Line 1398: from ap_invoice_distributions_all dist2

1394: AND invpay.accounting_date between nvl(awt.start_date, invpay.accounting_date)
1395: AND nvl(awt.end_date, invpay.accounting_date)
1396: AND inv.doc_sequence_id = seq.doc_sequence_id(+)
1397: AND EXISTS (select dist2.invoice_id
1398: from ap_invoice_distributions_all dist2
1399: where inv.invoice_id = dist2.invoice_id
1400: and dist2.line_type_lookup_code = 'AWT'
1401: and dist2.withholding_tax_code_id in
1402: -- Bug 2019586: Column name should be tax_id.

Line 1408: from ap_invoice_distributions_all dist2

1404: (select tax_id
1405: from ap_tax_codes_all
1406: where vat_transaction_type = p_wht_tax_type))
1407: AND NOT EXISTS ( select dist2.invoice_id
1408: from ap_invoice_distributions_all dist2
1409: where inv.invoice_id = dist2.invoice_id
1410: and dist2.line_type_lookup_code = 'AWT'
1411: and dist2.awt_flag <> 'A')
1412: UNION

Line 1454: ap_invoice_distributions_all dist,

1450: ap_awt_tax_rates_all awt,
1451: fnd_document_sequences seq,
1452: ap_invoices_all inv,
1453: ap_invoice_lines_all line,
1454: ap_invoice_distributions_all dist,
1455: (SELECT distinct person_id
1456: ,national_identifier
1457: FROM PER_ALL_PEOPLE_F) papf
1458: WHERE vs.country = fl.lookup_code(+)

Line 1507: from ap_invoice_distributions_all dist2

1503: AND invpay.accounting_date between nvl(awt.start_date, invpay.accounting_date)
1504: AND nvl(awt.end_date, invpay.accounting_date)
1505: AND inv.doc_sequence_id = seq.doc_sequence_id(+)
1506: AND EXISTS (select dist2.invoice_id
1507: from ap_invoice_distributions_all dist2
1508: where inv.invoice_id = dist2.invoice_id
1509: and dist2.line_type_lookup_code = 'AWT'
1510: and dist2.withholding_tax_code_id in
1511: -- Bug 2019586: Column name should be tax_id.

Line 1517: from ap_invoice_distributions_all dist2

1513: (select tax_id
1514: from ap_tax_codes_all
1515: where vat_transaction_type = p_wht_tax_type))
1516: AND EXISTS ( select dist2.invoice_id
1517: from ap_invoice_distributions_all dist2
1518: where inv.invoice_id = dist2.invoice_id
1519: and dist2.line_type_lookup_code = 'AWT'
1520: and dist2.awt_flag <> 'A')
1521: GROUP BY 'M',

Line 1598: ap_invoice_distributions_all dist,

1594: ap_awt_tax_rates_all awt,
1595: fnd_document_sequences seq,
1596: ap_invoices_all inv,
1597: ap_invoice_lines_all line,
1598: ap_invoice_distributions_all dist,
1599: (SELECT distinct person_id
1600: ,national_identifier
1601: FROM PER_ALL_PEOPLE_F) papf
1602: WHERE vs.country = fl.lookup_code(+)

Line 1624: from ap_invoice_distributions_all dist1

1620: (dist.cancellation_flag is null
1621: AND dist.accounting_date < (select distinct gl.start_date
1622: from gl_period_statuses gl
1623: where gl.period_name IN (select distinct to_char(dist1.accounting_date,'MM-YY')
1624: from ap_invoice_distributions_all dist1
1625: where dist1.invoice_id = inv.invoice_id
1626: and dist1.cancellation_flag = 'Y' )))
1627: OR
1628: (dist.cancellation_flag = 'Y'

Line 1632: from ap_invoice_distributions_all dist1

1628: (dist.cancellation_flag = 'Y'
1629: AND dist.accounting_date > (select distinct gl.end_date
1630: from gl_period_statuses gl
1631: where gl.period_name IN (select distinct to_char(dist1.accounting_date,'MM-YY')
1632: from ap_invoice_distributions_all dist1
1633: where dist1.invoice_id = inv.invoice_id
1634: and dist1.cancellation_flag is null )))
1635: )
1636: -- END

Line 1671: from ap_invoice_distributions_all dist2

1667: AND invpay.accounting_date between nvl(awt.start_date, invpay.accounting_date)
1668: AND nvl(awt.end_date, invpay.accounting_date)
1669: AND inv.doc_sequence_id = seq.doc_sequence_id(+)
1670: AND EXISTS (select dist2.invoice_id
1671: from ap_invoice_distributions_all dist2
1672: where inv.invoice_id = dist2.invoice_id
1673: and dist2.line_type_lookup_code = 'AWT'
1674: and dist2.withholding_tax_code_id in
1675: -- Bug 2019586: Column name should be tax_id.

Line 1681: from ap_invoice_distributions_all dist2

1677: (select tax_id
1678: from ap_tax_codes_all
1679: where vat_transaction_type = p_wht_tax_type))
1680: AND EXISTS ( select dist2.invoice_id
1681: from ap_invoice_distributions_all dist2
1682: where inv.invoice_id = dist2.invoice_id
1683: and dist2.line_type_lookup_code = 'AWT'
1684: and dist2.awt_flag <> 'A')
1685: GROUP BY 'M',

Line 1748: ap_invoice_distributions_all dist,

1744: ap_awt_tax_rates_all awt,
1745: fnd_document_sequences seq,
1746: ap_invoices_all inv,
1747: ap_invoice_lines_all line,
1748: ap_invoice_distributions_all dist,
1749: (SELECT distinct person_id
1750: ,national_identifier
1751: FROM PER_ALL_PEOPLE_F) papf
1752: WHERE vs.country = fl.lookup_code(+)

Line 1796: from ap_invoice_distributions_all dist2

1792: OR (dist.awt_tax_rate_id is NULL) )
1793: AND inv.doc_sequence_id = seq.doc_sequence_id(+)
1794: -- Ignore any invoices which do not have 'AWT' distribution lines
1795: AND EXISTS ( select dist2.invoice_id
1796: from ap_invoice_distributions_all dist2
1797: where inv.invoice_id = dist2.invoice_id
1798: and dist2.line_type_lookup_code = 'AWT'
1799: and dist2.withholding_tax_code_id in
1800: -- Bug 2019586: Column name should be tax_id.

Line 1853: ap_invoice_distributions_all dist,

1849: ap_awt_tax_rates_all awt,
1850: fnd_document_sequences seq,
1851: ap_invoices_all inv,
1852: ap_invoice_lines_all line,
1853: ap_invoice_distributions_all dist,
1854: (SELECT distinct person_id
1855: ,national_identifier
1856: FROM PER_ALL_PEOPLE_F) papf
1857: WHERE vs.country = fl.lookup_code(+)

Line 1879: from ap_invoice_distributions_all dist1

1875: (dist.cancellation_flag is null
1876: AND dist.accounting_date < (select distinct gl.start_date
1877: from gl_period_statuses gl
1878: where gl.period_name IN (select distinct to_char(dist1.accounting_date,'MM-YY')
1879: from ap_invoice_distributions_all dist1
1880: where dist1.invoice_id = inv.invoice_id
1881: and dist1.cancellation_flag = 'Y' )))
1882: OR
1883: (dist.cancellation_flag = 'Y'

Line 1887: from ap_invoice_distributions_all dist1

1883: (dist.cancellation_flag = 'Y'
1884: AND dist.accounting_date > (select distinct gl.end_date
1885: from gl_period_statuses gl
1886: where gl.period_name IN (select distinct to_char(dist1.accounting_date,'MM-YY')
1887: from ap_invoice_distributions_all dist1
1888: where dist1.invoice_id = inv.invoice_id
1889: and dist1.cancellation_flag is null )))
1890: )
1891: -- END

Line 1921: from ap_invoice_distributions_all dist2

1917: OR (dist.awt_tax_rate_id is NULL) )
1918: AND inv.doc_sequence_id = seq.doc_sequence_id(+)
1919: -- Ignore any invoices which do not have 'AWT' distribution lines
1920: AND EXISTS ( select dist2.invoice_id
1921: from ap_invoice_distributions_all dist2
1922: where inv.invoice_id = dist2.invoice_id
1923: and dist2.line_type_lookup_code = 'AWT'
1924: and dist2.withholding_tax_code_id in
1925: -- Bug 2019586: Column name should be tax_id.

Line 1962: l_accounting_date ap_invoice_distributions_all.accounting_date%TYPE;

1958: l_tax_code_id ap_tax_codes.tax_id%TYPE;
1959: l_invoice_num ap_invoices.invoice_num%TYPE;
1960: l_tax_name JE_ES_MODELO_190_ALL.tax_name%TYPE;
1961: l_tax_rate JE_ES_MODELO_190_ALL.tax_rate%TYPE;
1962: l_accounting_date ap_invoice_distributions_all.accounting_date%TYPE;
1963: begin
1964: begin
1965: if p_fetch_pi_flag = 'P' then
1966: select min(dist.withholding_tax_code_id), max(invpay.accounting_date)

Line 1969: ap_invoice_distributions_all dist

1965: if p_fetch_pi_flag = 'P' then
1966: select min(dist.withholding_tax_code_id), max(invpay.accounting_date)
1967: into l_tax_code_id, l_accounting_date
1968: from ap_invoice_payments_all invpay,
1969: ap_invoice_distributions_all dist
1970: where dist.invoice_id = p_fetch_invoice_id
1971: and invpay.invoice_id = dist.invoice_id
1972: and dist.line_type_lookup_code = 'AWT'
1973: -- Bug 5207771

Line 1982: from ap_invoice_distributions_all

1978: nvl(dist.base_amount,dist.amount),0)) = p_fetch_wht_amount);
1979: else -- p_fetch_pi_flag <> 'P
1980: select min(withholding_tax_code_id), max(accounting_date)
1981: into l_tax_code_id, l_accounting_date
1982: from ap_invoice_distributions_all
1983: where invoice_id = p_fetch_invoice_id
1984: and line_type_lookup_code = 'AWT'
1985: -- Bug 5207771
1986: -- and accounting_date = date_paid1 -- Bug 3930217 : Spanugan 23/12/2004