Wednesday, 2 November 2016

WHT Tax Code Information Query

http://aporaclepayables.blogspot.com/2016/11/wht-tax-code-information-query.html

Tax Codes

select   cc.NAME, mm.VENDOR_SITE_CODE, vv.TAX_RATE, vv.START_DATE, vv.END_DATE, vv.START_AMOUNT, vv.END_AMOUNT
, cc.DESCRIPTION, cc.ATTRIBUTE1 Section, cc.ATTRIBUTE2 Description
 from AP_AWT_TAX_RATES_ALL vv,  AP_TAX_CODES_ALL cc, po_vendor_sites_all mm
where vv.TAX_NAME=cc.NAME
and vv.ORG_ID=cc.ORG_ID
and mm.VENDOR_SITE_ID=cc.AWT_VENDOR_SITE_ID
and mm.ORG_ID=cc.ORG_ID
and vv.ORG_ID=82
and cc.ENABLED_FLAG='Y'
and vv.RATE_TYPE='STANDARD'
and vv.END_DATE is null
order by cc.NAME

--------------------------------------------------------------------------------------------------------------------------

Tax Groups

select * from AP_AWT_GROUPS kk, AP_AWT_TAX_RATES_ALL jj, AP_AWT_GROUP_TAXES_ALL xx
where 1=1
and jj.TAX_NAME=xx.TAX_NAME
and kk.GROUP_ID=xx.GROUP_ID
and jj.END_DATE is null
and jj.RATE_TYPE = 'STANDARD'
and xx.TAX_NAME in ('SS0','SS1','SS2','US1')

--------------------------------------------------------------------------------------------------------------------------

Tax Codes Location & Vendor Site

select tt.NAME, rr.SEGMENT2, oo.VENDOR_SITE_CODE, qq.TAX_RATE
  from AP_TAX_CODES_ALL      tt,
       gl_code_combinations  rr,
       ap_supplier_sites_all oo,
       AP_AWT_TAX_RATES_ALL  qq
 where tt.TAX_CODE_COMBINATION_ID = rr.CODE_COMBINATION_ID
   and tt.AWT_VENDOR_SITE_ID = oo.VENDOR_SITE_ID
   and qq.TAX_NAME = tt.NAME
   and tt.ORG_ID = oo.ORG_ID
   and oo.ORG_ID = 82
   and tt.NAME in ('PS0', 'PS1', 'UP1')

--------------------------------------------------------------------------------------------------------------------------

select kk.NAME Group_Name,
       kk.DESCRIPTION Group_description,
       jj.TAX_NAME Tax_Code,
       jj.TAX_RATE,
       jj.START_DATE,
       oo.VENDOR_SITE_CODE Site,
       ww.DESCRIPTION Tax_Name_Description,
       ww.ATTRIBUTE1 DFF_Section,
       ww.ATTRIBUTE2 DFF_Description,
       gc.SEGMENT1 Company,
       gc.SEGMENT2 Location,
       gc.SEGMENT4 Account

  from AP_AWT_GROUPS          kk,
       AP_AWT_TAX_RATES_ALL   jj,
       AP_AWT_GROUP_TAXES_ALL xx,
       ap_supplier_sites_all  oo,
       AP_TAX_CODES_ALL       ww,
       gl_code_combinations   gc
 where 1 = 1
   and jj.TAX_NAME = xx.TAX_NAME
   and kk.GROUP_ID = xx.GROUP_ID
   and jj.ORG_ID = xx.ORG_ID
   and ww.NAME = jj.TAX_NAME
   and oo.VENDOR_SITE_ID = ww.AWT_VENDOR_SITE_ID
   and gc.CODE_COMBINATION_ID = ww.TAX_CODE_COMBINATION_ID
   and ww.ORG_ID = jj.ORG_ID
   and xx.ORG_ID = jj.ORG_ID
   and jj.END_DATE is null
   and jj.RATE_TYPE = 'STANDARD'
   and kk.CREATION_DATE > '27-OCT-2016'
   and kk.INACTIVE_DATE is null
 order by jj.ORG_ID, kk.NAME
--and xx.TAX_NAME in ('SS0','SS1','SS2','US1')



1 comment: