/* Formatted on 5/16/2014 6:59:24 PM (QP5 v5.115.810.9015) */
SELECT AI.INVOICE_ID,
AI.INVOICE_NUM,
vendor_name,
TAX.TAX_RATE,
TAX.DESCRIPTION,
AI.INVOICE_NUM,
AI.INVOICE_DATE BILLNO_DATE,
AI.VOUCHER_NUM,
AI.GL_DATE,
a.INVOICE_AMOUNT inv_amont,
ai.INVOICE_AMOUNT,
AIL.AMOUNT TDSVALUE,
GL.SEGMENT5 TAX_CODE
FROM AP_INVOICES_ALL AI,
AP_INVOICE_LINES_ALL aIL,
gl_code_combinations gl,
(SELECT DISTINCT Vendor_TYPE_TDS.VENDOR_ID,
vendor_name,
TDS_VENDOR_TYPE_LOOKUP_CODE,
FROM_AMOUNT,
TO_AMOUNT,
jslab.TAX_RATE,
TDS.TAX_DESCR,
gl.segment1,
gl.segment2,
gl.segment3,
gl.segment4,
gl.segment5,
gl.segment6,
fflex.DESCRIPTION
FROM ( SELECT DISTINCT
a.vendor_id,
a.tax_id,
DECODE (a.TDS_VENDOR_TYPE_LOOKUP_CODE,
NULL, b.VENDOR_TYPE_LOOKUP_CODE,
a.TDS_VENDOR_TYPE_LOOKUP_CODE)
TDS_VENDOR_TYPE_LOOKUP_CODE
FROM JAI_AP_TDS_VENDOR_HDRS a,
JAI_AP_TDS_THHOLD_EXCEPTION_V b
WHERE a.VENDOR_ID = b.VENDOR_ID(+)
ORDER BY a.vendor_id) Vendor_TYPE_TDS,
po_vendors pov,
JAI_AP_TDS_THHOLD_HDRS jth,
JAI_AP_TDS_THHOLD_TAXES jtl,
JAI_AP_TDS_THHOLD_SLABS jslab,
JAI_AP_TDS_THHOLD_TAXES jttax,
JAI_CMN_TAXES_ALL TDS,
gl_code_combinations gl,
FND_FLEX_VALUES_VL fflex
WHERE pov.VENDOR_ID = Vendor_TYPE_TDS.VENDOR_ID
AND jth.VENDOR_TYPE_LOOKUP_CODE =
Vendor_TYPE_TDS.TDS_VENDOR_TYPE_LOOKUP_CODE
--and pov.vendor_id=1034
AND jth.THRESHOLD_HDR_ID = jtl.THRESHOLD_HDR_ID
AND jslab.THRESHOLD_SLAB_ID = jtl.THRESHOLD_SLAB_ID
AND jslab.THRESHOLD_HDR_ID = jtl.THRESHOLD_HDR_ID
AND jslab.THRESHOLD_TYPE_ID = jttax.THRESHOLD_TYPE_ID
AND jslab.THRESHOLD_SLAB_ID = jttax.THRESHOLD_SLAB_ID
AND jslab.THRESHOLD_HDR_ID = jttax.THRESHOLD_HDR_ID
AND tds.TAX_ID = Vendor_TYPE_TDS.TAX_ID
AND Vendor_TYPE_TDS.TAX_ID = jttax.TAX_ID
AND gl.CODE_COMBINATION_ID = tds.TAX_ACCOUNT_ID
--AND tds.ORG_ID=163
AND fflex.FLEX_VALUE = gl.segment5) tax,
AP_INVOICES_ALL a
WHERE gl.CODE_COMBINATION_ID = aIL.DEFAULT_DIST_CCID
AND AI.INVOICE_ID = AIL.INVOICE_ID
AND ai.INVOICE_TYPE_LOOKUP_CODE <> 'PREPAYMENT'
AND TAX.VENDOR_ID = AI.VENDOR_ID
AND TAX.segment5 = GL.segment5
AND ai.attribute1 = a.invoice_id
--and to_number(par.ATTRIBUTE1)=AI.INVOICE_ID
AND TRUNC (AI.GL_DATE) BETWEEN '01-AUG-2009' AND '31-dec-2009'
ORDER BY vendor_name
SELECT AI.INVOICE_ID,
AI.INVOICE_NUM,
vendor_name,
TAX.TAX_RATE,
TAX.DESCRIPTION,
AI.INVOICE_NUM,
AI.INVOICE_DATE BILLNO_DATE,
AI.VOUCHER_NUM,
AI.GL_DATE,
a.INVOICE_AMOUNT inv_amont,
ai.INVOICE_AMOUNT,
AIL.AMOUNT TDSVALUE,
GL.SEGMENT5 TAX_CODE
FROM AP_INVOICES_ALL AI,
AP_INVOICE_LINES_ALL aIL,
gl_code_combinations gl,
(SELECT DISTINCT Vendor_TYPE_TDS.VENDOR_ID,
vendor_name,
TDS_VENDOR_TYPE_LOOKUP_CODE,
FROM_AMOUNT,
TO_AMOUNT,
jslab.TAX_RATE,
TDS.TAX_DESCR,
gl.segment1,
gl.segment2,
gl.segment3,
gl.segment4,
gl.segment5,
gl.segment6,
fflex.DESCRIPTION
FROM ( SELECT DISTINCT
a.vendor_id,
a.tax_id,
DECODE (a.TDS_VENDOR_TYPE_LOOKUP_CODE,
NULL, b.VENDOR_TYPE_LOOKUP_CODE,
a.TDS_VENDOR_TYPE_LOOKUP_CODE)
TDS_VENDOR_TYPE_LOOKUP_CODE
FROM JAI_AP_TDS_VENDOR_HDRS a,
JAI_AP_TDS_THHOLD_EXCEPTION_V b
WHERE a.VENDOR_ID = b.VENDOR_ID(+)
ORDER BY a.vendor_id) Vendor_TYPE_TDS,
po_vendors pov,
JAI_AP_TDS_THHOLD_HDRS jth,
JAI_AP_TDS_THHOLD_TAXES jtl,
JAI_AP_TDS_THHOLD_SLABS jslab,
JAI_AP_TDS_THHOLD_TAXES jttax,
JAI_CMN_TAXES_ALL TDS,
gl_code_combinations gl,
FND_FLEX_VALUES_VL fflex
WHERE pov.VENDOR_ID = Vendor_TYPE_TDS.VENDOR_ID
AND jth.VENDOR_TYPE_LOOKUP_CODE =
Vendor_TYPE_TDS.TDS_VENDOR_TYPE_LOOKUP_CODE
--and pov.vendor_id=1034
AND jth.THRESHOLD_HDR_ID = jtl.THRESHOLD_HDR_ID
AND jslab.THRESHOLD_SLAB_ID = jtl.THRESHOLD_SLAB_ID
AND jslab.THRESHOLD_HDR_ID = jtl.THRESHOLD_HDR_ID
AND jslab.THRESHOLD_TYPE_ID = jttax.THRESHOLD_TYPE_ID
AND jslab.THRESHOLD_SLAB_ID = jttax.THRESHOLD_SLAB_ID
AND jslab.THRESHOLD_HDR_ID = jttax.THRESHOLD_HDR_ID
AND tds.TAX_ID = Vendor_TYPE_TDS.TAX_ID
AND Vendor_TYPE_TDS.TAX_ID = jttax.TAX_ID
AND gl.CODE_COMBINATION_ID = tds.TAX_ACCOUNT_ID
--AND tds.ORG_ID=163
AND fflex.FLEX_VALUE = gl.segment5) tax,
AP_INVOICES_ALL a
WHERE gl.CODE_COMBINATION_ID = aIL.DEFAULT_DIST_CCID
AND AI.INVOICE_ID = AIL.INVOICE_ID
AND ai.INVOICE_TYPE_LOOKUP_CODE <> 'PREPAYMENT'
AND TAX.VENDOR_ID = AI.VENDOR_ID
AND TAX.segment5 = GL.segment5
AND ai.attribute1 = a.invoice_id
--and to_number(par.ATTRIBUTE1)=AI.INVOICE_ID
AND TRUNC (AI.GL_DATE) BETWEEN '01-AUG-2009' AND '31-dec-2009'
ORDER BY vendor_name
I have checked query but I did not found any record from query
ReplyDeletei cant make out (last to 4th number line)
as (AND ai.attribute1 = a.invoice_id ) what is this
Hi all, Oracle technical and fusion cloud SCM online classes, if you are interested whatsapp to this number 7382582893, thank you.
ReplyDelete