Debian Codegraph @

examples/vat.cgi

raw
1 #!/usr/bin/perl
2 ############################################################################
3 # IT Development software #
4 # European VAT number validator #
5 # CGI interface Version 1.00 #
6 # Copyright 2003 Nauwelaerts B [email protected] #
7 # Created 06/08/2003 Last Modified 25/03/2012 #
8 ############################################################################
9 # COPYRIGHT NOTICE #
10 # Copyright 2003 Bernard Nauwelaerts All Rights Reserved. #
11 # #
12 # THIS SOFTWARE IS RELEASED UNDER THE GNU Public Licence version 3 #
13 # See COPYING for details #
14 # #
15 # This software is provided as is, WITHOUT ANY WARRANTY, without even the #
16 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. #
17 # #
18 ############################################################################
19 # Revision history : #
20 # #
21 # 1.00 25/03/2012; For use with the SOAP version of the Validation module #
22 # 0.02 18/08/2008; Updated disclaimer URL #
23 # 0.01 06/08/2003; #
24 # #
25 ############################################################################
26
27 use strict;
28 use Business::Tax::VAT::Validation;
29 use CGI qw/:standard/;
30
31 print header,
32 start_html('VAT checkup example'),
33 h1('A simple VAT checkup example');
34 print "Uses the Business::Tax::VAT::Validation PERL module version ".$Business::Tax::VAT::Validation::VERSION;
35 my $hvatn=Business::Tax::VAT::Validation->new();
36
37 if (param()) {
38 my $vat=join("-",param('MS'),param('VAT'));
39 print h2("Results"), $vat, ': ';
40
41 if ($hvatn->check($vat)) {
42 print 'This number exists in the VIES database. It belongs to '.$hvatn->information('name')." ".$hvatn->information('address');
43 } else {
44 print $hvatn->get_last_error_code.' '.$hvatn->get_last_error;
45 }
46 }
47
48
49 print hr, start_form,
50 "VAT Number", p,
51 popup_menu(-name=>'MS',
52 -values=>[$hvatn->member_states]),
53 textfield('VAT'),p,
54 submit,
55 end_form,
56 hr,
57 h2("Disclaimer"), "This interface is provided for demonstration purposes only, WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.",
58 p,
59 'See also this disclaimer: <a href="http://ec.europa.eu/taxation_customs/vies/viesdisc.do?selectedLanguage=EN">http://ec.europa.eu/taxation_customs/vies/viesdisc.do?selectedLanguage=EN</a>';
60 end_html;
61
62 exit;