Hi D365 FO Tech Guys,
Greetings!
This is my first technical blog of D365 FO. I want to share my experience with D365 FO tech guys whatever i have learnt so far because i have a strong belief that the more you share knowledge with others the more you can contribute in the community and this is my objective to help people who wants to pursue their career in Dynamics 365 Finance and Operations technical side.
In this post, i am going to share X++ code snippets of how you can get VAT number for Customer, Vendor and Legal entity. This requirement is very common in those countries where VAT regulations are imposed and VAT number is mandatory to be displayed on external document prints like Sales invoice, Purchase order etc.
Since, there is a possibility of multiple VAT registration number versions for the same vendor, customer or legal entity and one version is active that's why ValidTo condition in the X++ query is required to handle multiple VAT registration number versions and capture active VAT registration number version
Customer VAT:
select custTable
where custTable.AccountNum == "CUST00001"
join dirpartytableCust
where dirpartytableCust.RecId==custTable.Party
join dirpartylocationCust
where dirpartylocationCust.Party==dirpartytableCust.RecId && dirpartylocationCust.IsPrimary==1
join RegistrationNumber from taxregistrationCust
where taxregistrationCust.DirPartyLocation == dirPartyLocationCust.RecId && taxregistrationCust.ValidTo>=today();
info(strfmt("Customer VAT: %1", taxregistrationCust.RegistrationNumber));
Vendor VAT:
select vendTable
where vendTable.AccountNum == "VEND00001"
join dirpartytableVend
where dirpartytableVend.RecId==vendTable.Party
join dirpartylocationVend
where dirpartylocationVend.Party==dirpartytableVend.RecId && dirpartylocationVend.IsPrimary==1
join RegistrationNumber from taxregistrationVend
where taxregistrationVend.DirPartyLocation == dirPartyLocationVend.RecId && taxregistrationVend.ValidTo>=today();
info(strfmt("Vendor VAT: %1", taxregistrationVend.RegistrationNumber));
Legal entity VAT:
select _companyInfo
where _companyInfo.DataArea ==curExt()
join dirpartytable
where dirpartytable.PartyNumber ==_companyInfo.PartyNumber
join dirpartylocation
where dirpartylocation.Party == dirpartytable.RecId && dirpartylocation.IsPrimary==1
join RegistrationNumber from taxregistration
where taxregistration.DirPartyLocation == dirPartyLocation.RecId && taxregistration.ValidTo>=today();
info(strfmt("Company VAT: %1", taxregistration.RegistrationNumber));
Vat Registration
ReplyDeleteValue Added Tax (VAT) Registration is a tax registration required for businesses trading or manufacturing goods in Dubai. VAT Registration replaced Sales Tax in UAE. For more information about Vat Registration then visit here.
Very useful Post and it is very useful and knowledgeable. UAE vat registration a VAT and Tax Consulting firm in the UAE.
ReplyDeletevat registration