#!/usr/bin/perl use CGI qw(param cookie); use POSIX; use DBI; my $dbh = DBI->connect("DBI:mysql:licenses:localhost","licenseuser","kic"); my $refer = cookie('refer'); exit if ($refer eq 'nabbers'); my $step = param('step'); my $license = param('license'); my $where = param('where'); my $exlic = param('exlic'); my $exp = ";exlic=$exlic" if ($exlic); my $upsupport = param('upsupport'); $exp = ";upsupport=$upsupport" if ($upsupport); if (!$where) { my $cty = 'cn'; $where = 'uk' if ($cty eq 'uk'); $where = 'ecnonumber' if ($cty eq 'eu'); $where ||= 'nonec'; } my $coupon = param('coupon'); print "Content-type:text/html\n\n"; open(TOP,"top.html.ssl"); print while (); close(TOP); print "
"; if (!$step) { print qq~Thanks for your interest in using bbBoard v2. We offer three different payment options. You can either rent a copy of bbBoard v2, purchase a copy, or purchase a copy without included technical support.

We offer the above options so that you can weigh the benefits of each and choose the one that best matches your current situation. You'll want to research the differences between purchasing and renting and business and regular licenses. Please contact us if you have questions - we'll do all we can to help you make the right decision. If budget is an issue, consider the advantages of using our new Pot O' Gold and allow your users to donate towards the cost! ~; } elsif ($step == 55) { print qq~You have chosen a $license license.

Please now choose where you are located in the world from the options below. The option you select must match with the billing address you provide later on.

I am in the UK.
~; if ($license eq 'business') { print qq~ I am in the EC (but outside of the UK), and I have a VAT registration number for my business.
I am in the EC (but outside of the UK), and I don\'t have a VAT registration number for my business.
~; } else { print qq~ I am in the EC (but outside of the UK).
~; } print qq~ I am not in the EC (e.g if you\'re in the USA).

~; } elsif ($step == 2 || param('changemeth') || param('docoupon') eq 'Redeem') { my %in = ( uk => 'in the UK', ecwithnumber => 'in the EC, with a VAT registration number', ecnonumber => 'in the EC' . (($license eq 'business') ? ', without a VAT registration number' : ''), nonec => 'not in the EC'); print qq~You have chosen a ~ . ($license eq 'personal' ? 'regular' : $license) . qq~ license, and you are $in{$where}. ~; if ($where eq 'ecnonumber' && $license eq 'business') { print qq~
~; } my $tax; if ($where eq 'uk' || $where eq 'ecnonumber') { # print qq~17.5% VAT has been included in the total purchase price.~; # $tax = 1; } elsif ($where eq 'ecwithnumber' || $where eq 'nonec') { $tax = 0; } require "/home/bbv2/v2/amounts.pl"; my $amt = &amounts; my $total = ($license eq 'personal') ? $amt->{cn}->{per_pur} : $amt->{cn}->{bus_pur}; my $ustotal = ($license eq 'personal') ? $amt->{usa}->{per_pur} : $amt->{usa}->{bus_pur}; # $coupon ||= 'v2intro'; # # print qq~
"; # my $tax = ($total * 0.175); # $tax = sprintf("%0.2f",$tax); # my $ustax = ($ustotal * 0.175); # $ustax = sprintf("%0.2f",$ustax); print qq~
~; print "Upgrade For:$exlic
" if ($exlic); print "Upgrade (Tech Support) For:$upsupport
" if ($upsupport); if ($upsupport) { $coupon = 'upgradesupport'; } print "Base price:$amt->{cn}->{prefix}$total$amt->{cn}->{suffix}" . ($tax ? " (inc VAT)" : '') . "
" if ($coupon); my $discount, $usdiscount; if (!$coupon) { print qq~If you have a coupon code, please enter it here. Coupon Code: ~; } else { print qq~Coupon Code:$coupon~; if ($coupon=~/^existing_/) { $discount = $amt->{cn}->{dis_exist}; $usdiscount = $amt->{usa}->{dis_exist}; print qq~
Discount:$amt->{cn}->{prefix}$discount$amt->{cn}->{suffix}~; $total -= $discount; $ustotal -= $usdiscount; } elsif ($coupon eq 'upgradesupport') { $discount = $amt->{cn}->{$license eq 'personal' ? 'per_nos' : 'bus_nos'}; print qq~
Already Paid:$amt->{cn}->{prefix}$discount$amt->{cn}->{suffix}~; $total -= $discount; } elsif ($coupon eq '2hours') { $discount = sprintf("%.2f", 60 * $amt->{cn}->{fromgbp}); $total += $discount; print qq~
Design/Customisation Work:$amt->{cn}->{prefix}~ . $discount . qq~$amt->{cn}->{suffix}~; } elsif ($coupon eq 'v2intro') { # $discount = $amt->{cn}->{dis_int}; # $usdiscount = $amt->{usa}->{dis_int}; # print qq~
Discount:$amt->{cn}->{prefix}$discount$amt->{cn}->{suffix}~; # $total -= $discount; $ustotal -= $usdiscount; } elsif ($coupon eq 'nonprofit') { $discount = sprintf("%.2f",$amt->{cn}->{dis_char}); $total -= $discount; print qq~
Discount:$amt->{cn}->{prefix}$discount$amt->{cn}->{suffix}~; } elsif ($coupon eq 'nosupport') { $discount = $total - $amt->{cn}->{$license eq 'personal' ? 'per_nos' : 'bus_nos'}; $total = $amt->{cn}->{$license eq 'personal' ? 'per_nos' : 'bus_nos'}; print qq~
Discount:$amt->{cn}->{prefix}$discount$amt->{cn}->{suffix}~; } elsif ($coupon eq 'mon') { $discount = sprintf("%.2f", $total / 2); $total = $total - $discount; print qq~
Discount:$amt->{cn}->{prefix}$discount$amt->{cn}->{suffix}~; } elsif ($coupon eq 'bbv1') { $discount = -$amt->{cn}->{amt_inst}; $total = $total - $discount; print qq~
v1 Conversion:$amt->{cn}->{prefix}$amt->{cn}->{amt_inst}$amt->{cn}->{suffix}~; } } print "
"; my $installation = param('installation'); if (!$upsupport) { if ($installation) { print qq~Installation:$amt->{cn}->{prefix}$amt->{cn}->{amt_inst}$amt->{cn}->{suffix}
~; $total += $amt->{cn}->{amt_inst}; } else { print qq~Installation:Click here to have a tech install bbBoard v2 for you ($amt->{cn}->{prefix}$amt->{cn}->{amt_inst}$amt->{cn}->{suffix})
~; } } if ($tax) { my $taxamt = sprintf("%0.2f",$total * (17.5 / (100 + 17.5))); my $pretax = $total - $taxamt; print "Subtotal:$amt->{cn}->{prefix}$pretax$amt->{cn}->{suffix}
Tax (VAT):$amt->{cn}->{prefix}$taxamt$amt->{cn}->{suffix}
~; # $total = $total + $tax; # $ustotal = $ustotal + $ustax; } my $meth = param('method'); my $ref; while (!$ref) { $ref = int(rand(999999999999)); my $sth = $dbh->prepare("SELECT invnumber FROM invoices WHERE invnumber = '$ref'"); $sth->execute; (my $alr) = $sth->fetchrow_array; $sth->finish; $ref = '' if ($alr); } my $sess = cookie("frmsessionid"); my $uid; if ($sess) { require "/home/bbv2/sf.bbv2.com/bbv2api.pm"; my $bbv2 = new bbv2api; my $uu = $bbv2->{db}->bbselect('uid, sesid','session',"sesid = '$sess'",'sesid'); $uid = $uu->{$sess}->{uid}; } $dbh->do("INSERT INTO invoices (invnumber, currency, total, status, uid, lictype, rentorbuy, refer, wantsinstall, whatfor, extlicense, nosupport) VALUES ('$ref','CNY','$total','Awaiting Payment', '$uid', '$license', 'purchased','$refer','" . ($installation ? $amt->{cn}->{amt_inst} : '0') . "', '" . ($exlic ? 'UpgradeTrial' : $upsupport ? 'UpgradeSupport' : 'license') . "', " . ($exlic ? "'$exlic'" : $upsupport ? "'$upsupport'" : 'NULL') . ", " . ($coupon eq 'nosupport' ? 1 : 0) . ")"); print qq~Total:$amt->{cn}->{prefix}$total$amt->{cn}->{suffix}
~; if ($meth ne 'check') { print qq~Please choose a payment method below, and make payment. After making payment, you will be taken to your client area, where you will be able to download a copy of bbBoard v2, and manage your license. We offer a 30-day no questions asked 100% money-back guarantee.

~; # print qq~~; print qq~~; } else { print qq~PayPal~; } print qq~
Credit/Debit Card #
#


#
~; if ('CNY' ne 'AUD' && 'CNY' ne 'CNY') { print qq~PayPal
(For Credit/Debit Card, click the logo on the right
and scroll to the bottom of the page)


PayPal is not yet available for your currency. If you wish to pay by PayPal, please click here to review your order in GBP, then choose PayPal.

Paper ChequePaper Cheque


~; } if ($meth eq 'check') { if ("CNY" ne 'GBP') { my $surcharge = $amt->{cn}->{chk_surcharge}; print qq~Paper cheque surchage: $amt->{cn}->{prefix}$surcharge$amt->{cn}->{suffix}

~; print qq~[ Choose a different payment method? ]

~; $total += $surcharge; } print qq~ Please send a paper cheque for $amt->{cn}->{prefix}$total$amt->{cn}->{suffix} to:

~ . "Chris Brooks
9 Travis Grove
Thorne
Doncaster
Sth Yorkshire
DN8 5PL
England" . #
Suite 6
34 Buckingham Palace Road
London
SW1W 0RH
England qq~
A window with a print out form should have popped up when you loaded this page (click here if it didn\'t). To ensure quick processing of your cheque, please print out the form, fill in the blanks, staple the cheque to the paper and send it in an envelope to the above address. If you are not sending from the UK, then air mail is preferred.

We understand that post will take a while, but endeavour to process all cheques on the day we receive them. While you\'re waiting, please feel free to take advantage of our Free Trial - you will be able to set up and begin using your board right now, before your payment is processed.~; } } open(BOT,"bottom.html.ssl"); print while (); close(BOT);