I have changed the way the ValidateAndSetVat method works slightly so that we eliminate the need for a seperate table of European Countries. Instead I assign the Euro countries to the VAT group for Sweden and do the checking against that group.
So the code ends up:
private void ValidateAndSetVat(Order order) { if (order.Country.CountryCode.ToLower().Equals("se")) { //We are in Sweden order.VATGroupId = euroVATGroupId; } else { if (order.Country.VATGroupId == euroVATGroupId) { //The country is a member of the European Union and we need to check the VAT number OrderProperty vatProperty = order.Properties.SingleOrDefault(p => p.Alias.Equals("companyVATNo"));
if (vatProperty != null && CheckVatNumber(vatProperty.Value, order.Country.CountryCode)) //We are in Europe and the customer has a valid VAT number - 0% VAT is applicable order.VATGroupId = noVATGroupId; else //We are in Europe and the customer does not have a valid VAT number - 6% VAT is applicable order.VATGroupId = euroVATGroupId; } else { //The country is NOT a member of the European Union - 0% VAT is applicable order.VATGroupId = noVATGroupId; } } order.Save(); }
Euro VAT checking
Hi,
Not a question this time ;) just sharing some code I'm working on today...
I have been following the excellent article http://rune.gronkjaer.dk/en-US/2011/04/12/tea-commerce-dynamic-vat/
I have changed the way the ValidateAndSetVat method works slightly so that we eliminate the need for a seperate table of European Countries. Instead I assign the Euro countries to the VAT group for Sweden and do the checking against that group.
So the code ends up:
Cheers
Paul
Hi Paul
THANKS for sharing! A great and simple solution - just the way we love to work with Umbraco and Tea Commerce :)
Kind regards
Anders
is working on a reply...