Giter VIP home page Giter VIP logo

business-tax-vat's Introduction

CPAN version Build Status Coverage Status

NAME

Business::Tax::VAT - perform European VAT calculations

VERSION

This pod describes version 1.07

SYNOPSIS

use Business::Tax::VAT;

my $vat = Business::Tax::VAT->new(qw/uk ie/);

my $price = $vat->item(120 => 'ie');
my $price_to_customer = $price->full;     # 120
my $vat_charged       = $price->vat;      #  20
my $net_price_to_me   = $price->net;      # 100

my $price = $vat->business_item(102 => 'uk');
my $price_to_customer = $price->full;     # 102
my $vat_charged       = $price->vat;      #  17
my $net_price_to_me   = $price->net;      #  85

DESCRIPTION

Charging VAT across the European Union is quite complex. The rate of tax you have to charge depends on whether you're dealing with consumers or corporations, what types of goods you're selling, whether you've crossed thresholds in certain countries, etc.

This module aims to make some of this simpler.

There are several key processes:

CONSTRUCTING A VAT OBJECT

new

my $vat = Business::Tax::VAT->new(@country_codes);

First of all you have to construct a VAT object, providing it with a list of countries for which you have to charge VAT. This may only be the country in which you are trading, or it may be any of the 15 EC territories in which VAT is collected.

The full list of territories, and their abbreviations, is documented below.

PRICING AN ITEM

item / business_item

my $price = $vat->item($unit_price => $country_code);
my $price = $vat->business_item($unit_price => $country_code);

You create a Price object by calling either the 'item' or 'business_item' constructor, with the unit price, and the country to which you are supplying the goods. This operates on the priciple that prices to consumers are quoted with VAT included, but prices to business are quoted ex-VAT.

If you do not supply a country code, it will default to the first country in the country list passed to VAT->new;

CALCULATING THE COMPONENT PRICES

full / vat / net

my $price_to_customer = $price->full;
my $vat_charged       = $price->vat;
my $net_price_to_me   = $price->net;

Once we have our price, we can query it for either the 'full' price that will be charged (including VAT), the 'net' price (excluding VAT), and the 'vat' portion itself.

NON-VATABLE COUNTRIES

If you send goods to many countries, some of which are in your VAT territory and others not, you can avoid surrounding this code in conditionals by calling $vat->item on all items anyway, listing the country to which you are supplying the goods.

If the country in question is not one of the territories in which you should charge VAT then the 'full' and 'net' values will be the same, and 'vat' will be zero.

NON-VATABLE, ZERO-RATED, REDUCED-RATE GOODS

This module does not cope with goods which are not at the 'standard' rate of VAT for a country (as detailed below).

Patches welcomed!

COUNTRIES AND RATES

This module uses the following rates and codes:

at, Austria, 20%
be, Belgium, 21%
cy, Cyprus, 15%
cz, Czech Republic, 19%
dk, Denmark, 25%
ee, Estonia, 18%
fi, Finland, 22%
fr, France, 19.6%
de, Germany, 19%
gr, Greece, 17.5%
hu, Hungary, 25%
ie, Ireland, 21%
it, Italy, 22%
lv, Latvia, 18%
lt, Lithuania, 17.5%
lu, Luxembourg, 15%
mt, Malta, 18%
nl, The Netherlands, 19%
pl, Poland, 22%
pt, Portugal, 21%
sk, Slovak Republic, 19%
si, Slovenia, 20%
es, Spain, 16%
se, Sweden, 25%
uk, United Kingdom, 20%

If any of these rates become incorrect, or if you wish to use different rates due to the nature of the product (e.g. books are 0% VAT in the UK), then you can (locally) set the rate by assigning to %Business::Tax::VAT::Price::RATE. e.g.:

local $Business::Tax::VAT::Price::RATE{uk} = 0 
  if ($product_type eq 'book' and $country eq 'uk');

SEE ALSO

AUTHOR

Tony Bowden

BUGS and QUERIES

Please direct all correspondence regarding this module to: [email protected]

ACKNOWLEDGEMENTS

  • Sam Kington, patches leading to release of 1.07

COPYRIGHT

Copyright (C) 2001-2014 Tony Bowden.

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License; either version 2 of the License,
or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.

business-tax-vat's People

Contributors

tmtmtmtm avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.