Featured post

General Ledger Revaluation

General Ledger Revaluation Account balances denominated in foreign currencies are adjusted through the revaluation procedure. Revaluat...

Showing posts with label E Business Tax. Show all posts
Showing posts with label E Business Tax. Show all posts

Wednesday, 15 August 2018

Query to get Tax details from invoice in oracle apps r12

1) Below is the query to get tax details from invoice:



  SELECT  lines.TAX_AMT,lines.tax_rate   
         FROM zx_lines lines,ra_customer_trx_all rct,ra_customer_trx_lines_all rl,
 ZX_TAXES_B ZTB,GL_DAILY_CONVERSION_TYPES gc
  where rct.trx_number=:TRX_NUMBER  and rct.customer_trx_id=lines.trx_id
 and rct.customer_trx_id       = rl.customer_trx_id
  and ZTB.Exchange_Rate_Type=gc.conversion_type
  and ztb.tax_id=lines.tax_id
  AND RL.LINE_TYPE='LINE'
  and rct.org_id=:P_ORG_ID
  and lines.trx_line_id=rl.customer_trx_line_id
  and rl.customer_trx_line_id=:customer_trx_line_id;

2) For Standard and Blanket PO:

    ---for tax rate and amount
      SELECT tax_rate  , tax_amt 
(SELECT  lines.tax_rate  ,lines.tax_amt
      FROM   po_headers_all poh,
       po_lines_all pol , po_line_locations_all plla ,zx_lines Lines
--WHERE (poh.segment1 = :p_po_no OR :p_po_no IS NULL)
WHERE  poh.PO_HEADER_ID=:po_header_id1
AND POL.PO_LINE_ID=:L_PO_LINE_ID
AND    poh.org_id = :p_org_id
AND    pol.po_header_id = poh.po_header_id
AND    pol.org_id = poh.org_id
   and lines.trx_id=poh.po_header_id and lines.trx_line_id=plla.line_location_id
  and pol.po_line_id=plla.po_line_id 
--AND    poh.authorization_status = 'APPROVED'
AND    :p_report_type = 'STANDARD'
AND    pol.quantity > 0  --- version 115.2 added this condition to show only those lines which are open/not fully cancelled
UNION ALL
SELECT  lines.tax_rate  ,lines.tax_amt
      FROM   po_headers_all poh,
       po_lines_all pol,
       po_distributions_all pod,
       po_releases_all prl,po_line_locations_all  pll,
   zx_lines lines
--WHERE (poh.segment1 = :p_po_no OR :p_po_no IS NULL)
WHERE  poh.PO_HEADER_ID=:po_header_id1
AND    poh.org_id = :p_org_id
--AND    poh.authorization_status = 'APPROVED'
AND    pol.po_header_id = poh.po_header_id
AND    pol.org_id = poh.org_id
AND    pod.po_header_id = pol.po_header_id
AND    pod.po_line_id = pol.po_line_id
AND    pod.org_id = pol.org_id
AND    prl.po_release_id = pod.po_release_id
AND    prl.po_header_id = pod.po_header_id
AND    prl.org_id = pod.org_id
and lines.trx_id=prl.po_release_id
and lines.trx_line_id=pll.line_location_id
AND    :p_report_type = 'BLANKET'
AND    ( prl.po_release_id  =NVL( :po_release_id1,prl.po_release_id))
and pol.po_line_id =:L_PO_LINE_ID
AND PRL.RELEASE_NUM =NVL(:P_RELEASE_NO,PRL.RELEASE_NUM)
and pll.po_line_id=pol.PO_LINE_ID
and pll.PO_HEADER_ID=pol.PO_HEADER_ID
and pll.LINE_LOCATION_ID=pod.line_location_id
and NVL(pll.CANCEL_FLAG,'N')='N'
--and not exists (select 1 from PO_LINE_LOCATIONS_RELEASE_V pllr
--where pllr.PO_RELEASE_ID=prl.PO_RELEASE_ID
--and nvl(QUANTITY_CANCELLED,0)<>0)

) a;

Tuesday, 9 January 2018

Supplier / Customer Tax Profiles Information

Supplier / Customer Tax Profiles Information
I have been working in a data migration project, and we have migrated customers and suppliers.

We have also uploaded tax profiles for them, i had to write SQL scripts to check/reconcile the tax profiles.

And these are them. Hopefully they are useful to any of you looking for the same.


--Customers and their tax profiles

SELECT A.customer_name,
  DECODE(A.customer_type, 'I', 'Internal', 'R', 'External') customer_type,
  a1.profile_class_name,
  a.creation_date,
  b.party_name,
  b.party_number,
  c.party_type_code,
  d.creation_date,
  d.class_category,
  d.class_code,
  d.start_date_active,
  e.tax_regime_code,
  e.registration_number,
  e.registration_status_code,
  e.effective_from,
  --A.vat_code,
  A.tax_reference,
  b1.party_site_name,
  b1.party_site_number,
  c1.party_type_code site_party_type_code,
  e1.tax_regime_code site_tax_regime_code,
  e1.registration_number site_registration_number,
  e1.registration_status_code site_registration_status_code,
  e1.effective_from site_effective_from,
  d1.class_category site_class_category,
  d1.class_code site_class_code,
  d1.start_date_active site_start_date_active
FROM ar_customers A,
  ar_customer_profiles_v a1,
  hz_parties b,
  hz_party_sites b1,
  zx_party_tax_profile c,
  zx_party_tax_profile c1,
  hz_code_assignments d,
  hz_code_assignments d1,
  zx_registrations e,
  zx_registrations e1
WHERE A.orig_system_reference =b.orig_system_reference
AND A.customer_id             =a1.customer_id(+)
AND b.party_id                =c.party_id(+)
AND c.party_tax_profile_id    =d.owner_table_id(+)
AND c.party_type_code(+)      ='THIRD_PARTY'
AND c.party_tax_profile_id    =e.party_tax_profile_id(+)
AND d.class_category(+)       ='XXXX'
AND b.party_id                =b1.party_id
AND b1.party_site_id          =c1.party_id(+)
AND c1.party_type_code(+)     ='THIRD_PARTY_SITE'
AND c1.party_tax_profile_id   =d1.owner_table_id(+)
AND c1.party_tax_profile_id   =e1.party_tax_profile_id(+);



--Suppliers and their tax profiles



SELECT --A.vendor_name,

  A.segment1 Suuplier_No,

  A.vendor_name Suuplier_Name,

  A.VENDOR_NAME_ALT Supp_ARABIC_NAME,

  A.ATTRIBUTE1 SUPP_Check_Name,

  --b.party_name,

  A.vendor_type_lookup_code,

  --b.party_number,

  c.party_type_code,

  c.process_for_applicability_flag allow_tax_applicability,

  c.allow_offset_tax_flag allow_offset_tax,

  d.class_category,

  d.class_code,

  d.start_date_active,

  d.end_date_active,

  e.tax_regime_code,

  e.registration_number,

  e.registration_status_code,

  e.effective_from,

  e.effective_to,

  A.vat_code,

  b1.party_site_name,

  b1.party_site_number,

  c1.party_type_code site_party_type_code,

  c1.process_for_applicability_flag site_allow_tax_applicability,

  c1.allow_offset_tax_flag site_allow_offset_tax,

  d1.class_category site_class_category,

  d1.class_code site_class_code,

  d1.start_date_active site_start_date_active,

  e1.tax_regime_code site_tax_regime_code,

  e1.registration_number site_registration_number,

  e1.registration_status_code site_registration_status_code,

  e1.effective_from site_effective_from,

  e1.effective_to site_effective_to

FROM ap_suppliers A,

  hz_parties b,

  hz_party_sites b1,

  zx_party_tax_profile c,

  zx_party_tax_profile c1,

  hz_code_assignments d,

  hz_code_assignments d1,

  zx_registrations e,

  zx_registrations e1

WHERE A.party_id                   =b.party_id

AND b.party_id                     =c.party_id(+)

AND c.party_type_code(+)           ='THIRD_PARTY'

AND c.party_tax_profile_id         =d.owner_table_id(+)

AND c.party_tax_profile_id         =e.party_tax_profile_id(+)

AND d.class_category(+)            =' XXXX '

AND A.vendor_type_lookup_code NOT IN ('EMPLOYEE', 'INTERNAL')

AND b.party_id                     =b1.party_id(+)

AND b1.party_site_id               =c1.party_id(+)

AND c1.party_type_code(+)          ='THIRD_PARTY_SITE'

AND c1.party_tax_profile_id        =d1.owner_table_id(+)

AND c1.party_tax_profile_id        =e1.party_tax_profile_id(+)

and A.segment1='1542'

  --and b.party_name='James Fleming'

ORDER BY d.class_category DESC,

  e.registration_status_code,

  b.party_name;

Saturday, 19 August 2017

Oracle eBTax: How to find the Tax Reporting Codes linked to your transactions


Tax reporting codes – how to find them?

Oracle provide tax reporting type codes that you can assign to the tax rate, the status, the process result, pretty much anywhere but once the tax has been calculated, how on earth do we find out what tax reporting codes have been assigned or not?
Below is an example of a Tax Reporting Type that we have created with the codes.
Navigation: Tax Manager>Defaults and Controls>Tax Reporting Types
eBusiness Tax Fusion Tax
Below are 2 scripts, the first one is to find the tax reporting type code assigned tot he process result (when a tax rule has selected a tax status) and the second one that is linked to the tax rate itself.
If you’re creating a custom process or using this information in a report then i would suggest that you check the process result first before checking the value linked to the tax rate.
Apologies for the poor SQL but I am more of a functional consultant rather than technical.
These scripts will list all the tax reporting codes linked to the transaction.

Process Result

select  zxli.trx_id, rcvl.reporting_code_name, repco.reporting_code_char_value, reptl.reporting_code_name
from apps.zx_reporting_codes_vl rcvl, apps.zx_report_codes_assoc reas, apps.zx_lines zxli, apps.zx_reporting_codes_b repco, APPS.ZX_REPORTING_CODES_tl reptl
where rcvl.reporting_code_id = reas.reporting_code_id
and zxli.status_result_id = reas.entity_id
–and reas.reporting_type_id = ‘&Tax_reporting_Type_ID’
and repco.reporting_code_id = reptl.reporting_code_id
and repco.reporting_code_id = reas.reporting_code_id
and zxli.trx_id = ‘&Transaction_ID’

Tax Rate

select  zxli.trx_id, rcvl.reporting_code_name, repco.reporting_code_char_value, reptl.reporting_code_name
from apps.zx_reporting_codes_vl rcvl, apps.zx_report_codes_assoc reas, apps.zx_lines zxli, apps.zx_reporting_codes_b repco, APPS.ZX_REPORTING_CODES_tl reptl
where rcvl.reporting_code_id = reas.reporting_code_id
and zxli.tax_rate_id = reas.entity_id
–and reas.reporting_type_id = ‘&Tax_reporting_Type_ID’
and repco.reporting_code_id = reptl.reporting_code_id
and repco.reporting_code_id = reas.reporting_code_id
and zxli.trx_id = ‘&Transaction_ID’