Support

Home Forums Event Espresso Premium UK VAT Support on PDF Invoices

UK VAT Support on PDF Invoices

Posted: January 21, 2014 at 10:52 am


Tim Kirk

January 21, 2014 at 10:52 am

Hi,

Prior to purchase, I’m trying to find out how well UK VAT is handled by EE.

I understand there is a custom template which can be added but I’m a bit of a (advanced) novice when it comes to PHP so wouldn’t want to purchase and then not be able to implement it.

Will I also have a copy so that I can send them a copy as a reminder?

Thanks,

Tim

Thanks,


Sidney Harrell

January 21, 2014 at 2:55 pm

I believe this is the template with VAT support:
https://gist.github.com/Apina/5857667. You should just be able to upload it to your /wp-content/uploads/espresso/gateways/invoice folder. If you have any trouble with it, we can help you out in the forums with it. You can download a copy of the attendee’s invoice by clicking on an icon next to the attendee in the admin.


Tim Kirk

January 22, 2014 at 2:03 am

Hi Sidney,

Thanks for the reply. I’ve added this to a test site but I don’t think it’s working.

When you click the link from the registration confirmation page, the PDF file has no name and hasn’t pulled any information through (date, attendee number, etc).

However, when you view the PDF from the back end by the link you mentioned, it looks good.

I’d like to be confident it works before purchase so any advice you could offer would be much appreciated.

Thanks.


Tim Kirk

January 22, 2014 at 2:08 am

Sorry – I have it working. I didn’t click the link, just searched through google and found a different version of the file.

Which file do I edit to change the formatting of the invoice?

Thanks again – it’s now a plugin that seems to do everything I need so a purchase will be made later today.


Tim Kirk

January 22, 2014 at 3:04 am

Sorry – me again!!

On testing it would seem that the VAT invoice template works great for set prices but when you add early booking discounts and/or coupon codes, the invoice reverts to the standard price.

Is there a fix for this?

Thanks,

Tim


Dean

January 22, 2014 at 6:35 am

Hi Tim,

Not currently, it is on our to do list, but our current focus in on Event Espresso 4 which will be a more robust platform.


Tim Kirk

January 22, 2014 at 6:42 am

Thanks Dean.

If I was to purchase now, would I be eligible for an upgrade to 4 or am I better waiting? VAT is obviously a legal requirement in the UK so unfortunately it means that to implement it I would be lacking core functionality of EE (discounts) that attracted me to you guys in the first place.


Josh

  • Support Staff

January 23, 2014 at 9:34 am

Hi Tim,

Current support license holders of Event Espresso 3 will have access to upgrade to EE4. EE4 will have early bird type discount functionality right away, and the ability to sell a set quantity of discounted tickets for an event, just not the promo code discounts on its initial release.


Tim Kirk

January 23, 2014 at 10:39 am

Thanks Josh. I’ve purchased a personal license.

I’ve got one final question before my site goes live which I’ve added to the forums. I just need to know how to add a CC to the admin email.

I’m guessing I need to add/amend a line in includes/functions/email.php but I can’t figure out how you’ve formatted the headers. I’m a much better “copy and paster” than I am a coder!

If you could help or point someone towards the forum that would be great.


Josh

  • Support Staff

January 23, 2014 at 11:30 am

Hi Tim,

It turns out that you can cc the admin notification to additional email addresses by entering them in the Alternate email address field under event options in the event editor.


Tim Kirk

January 23, 2014 at 11:56 am

Hi Josh,

Thanks for coming back to me but that’s not quite what I asked. I know I was brief on this post.

I want the admin email to also go to the person booking the event (the training courses I run are often booked by administrators). I’ve created a custom question which I can reference but I need to add the CC to email.php file as it will be dynamic.

Adding an additional static email address unfortunately doesn’t help me.

I just couldn’t figure out the code used to create the header so if someone could just explain it, that would be a huge help.

Thanks.


Dean

January 24, 2014 at 12:19 am

Hi,

In email.php about line 554 there is a function called event_espresso_send_email

There are two code blocks there that show the From and Reply-To headers, just add below both of them

$headers .= "Cc: " . $variable_with_the_email . "\r\n";


Tim Kirk

January 24, 2014 at 1:43 am

Thanks Dean but would this not send EVERY email to (lets call them) the booking administrator?

I appreciate I haven’t explained myself too well… What I’m looking to achieve is:

Booking Confirmation Email (admin email) – sent to WP Admin AND (client) Booking Admin with payment instructions. I’ve collected the email address in a custom question on the registration form.

Confirmation Email – sent to each delegate registered from the event with instructions/address etc.

You can seem my reg form on my test site at http://hire-education.co.uk/blog/all-events/?ee=2


Tim Kirk

January 24, 2014 at 1:48 am

I think where I need to add the line is in the “espresso_prepare_admin_email” function but I couldn’t figure out how to structure the code…

<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”> //Build the headers
$headers = '';
return array(
'send_to' => $data->event->alt_email == '' ? $org_options['contact_email'] : $data->event->alt_email . ',' . $org_options['contact_email'],
'email_subject' => !$data->multi_reg ? $data->event->event_name . ' ' . __('registration confirmation', 'event_espresso') : __('Event Registration Notification', 'event_espresso'),
'email_body' => $admin_message . $data->table_open . $admin_email_body . $data->table_close . $admin_additional_info,
'headers' => $headers
);


Tim Kirk

January 24, 2014 at 2:53 am

Sorry – my brain doesn’t work too well first thing in the morning.

I’ve set the CC header as you suggested and now realise I just need to declare the variable in the Admin Email function. Doh!

However – I’m stuck! How can I pull the custom question answer through? I assumed I could use the custom answers shortcode but obviously not.


Dean

January 24, 2014 at 4:38 am

Hi Tim,

Well the data you need wont be in event_espresso_send_email, but should be in espresso_prepare_admin_email, but you will need to pull it out of the $data array there. But that could be messy as its embedded in a string, so you would need to go further back to where $data is actually defined, which I cannot trace currently.

Either that or use the $data in the admin email function and use something like the attendee id to pull the email from the database.

As you can tell it’s not going to be simple.


Tim Kirk

January 24, 2014 at 6:54 am

Thanks I appreciate the email.

I don’t really care how messy the code appears – I just need to get it working. It’s the final thing I need complete before I can put the site live and actually start earning a living again.

It’s got to be possible as the functions already exist to add custom questions to an email AND add a CC.

How do we go about linking them?


Tim Kirk

January 24, 2014 at 7:31 am

How about we break it down together?!

I know that the system first looks for an alternative admin email address (you can set this option on the event page) and if it doesn’t find one, it sets the organisation email address as the recipient.

To me that looks like this line found in espresso_prepare_admin_email:
<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”> 'send_to' => $data->event->alt_email == '' ? $org_options['contact_email'] : $data->event->alt_email . ',' . $org_options['contact_email'],

However, I don’t understand what’s happening and therefore how to manipulate the code to achieve what I want.

Do you know how I could change that code to add an additional recipient to the “send to” section of espresso_prepare_admin_email? I understand that WPmail can send to multiple addresses separated by a comma but the way the current code is written is beyond me. Let’s start simple and just add a static email address by text?

Once we’ve figured out how to add multiple addresses to that string, it should be relatively straightforward to query the database to collect the email address that’s stored at a custom question answer (in this case it’s ID is “14”).

We could build a brand new query if necessary?

Unfortunately, the only coding training I’ve has was on ASP back in 2002 so while I can just about understand what’s going on, I can’t figure out how to write in new stuff!

I’d really value your help…


Sidney Harrell

January 24, 2014 at 12:24 pm

In includes/functions/email.php, at line 461, stick in:

$sql = "SELECT ea.answer FROM " . EVENTS_ANSWER_TABLE . " ea ";
$sql .= " WHERE ea.question_id=39 AND ea.attendee_id=%d";
global $wpdb;
$add_email = $wpdb->get_var($wpdb->prepare($sql, $data->attendee->id));

Then change line 465 to be:

'send_to' => $data->event->alt_email == '' ? $org_options['contact_email'] . ',' . $add_email: $data->event->alt_email . ',' . $org_options['contact_email'] . ',' . $add_email,


Sidney Harrell

January 24, 2014 at 12:26 pm

Oh, note that in the sql query, where I have ’39’, you’ll need to substitute in the id for your custom additional email question. I just picked ’39’ at random.


Tim Kirk

January 29, 2014 at 4:54 am

I’ve just noticed that this template file doesn’t seem to work when more than one delegate are on the same booking…

I had edited the file to display different information but just to be sure I re-installed the original and for some reason it doesn’t work.

Even in the back-end, if I click the invoice, you get a value for just one delegate but if I click the payment link, it adds all delegates on the same registration ID.

I’m a bit frustrated as I went ahead and bought the plugin and it’s only now that I’m fully testing everything before going live that I’ve spotted the issue.

Some urgent help would be much appreciated.

Thanks,

Tim


Tim Kirk

January 29, 2014 at 5:34 am

Just to be super clear:

original template.php bundled with 3.1.36.4:
support multiple delegates? Yes
Support UK VAT? No

template.php from github (https://gist.github.com/Apina/5857667):
Support multiple delegates? No
Support UK VAT? Yes

Unless I can get things supported, I’ll be looking for a refund as detailing VAT is a legal requirement here in the UK.


Tim Kirk

January 29, 2014 at 8:20 am

Hi,

I followed the tutorial to add the modified UK VAT template.php file (from Github) to uploads/espresso/gateway/invoice/ and thought I had it working but on further testing, it would seem it doesn’t allow for multiple delegates on the same booking.

In the back-office attendee view, the payments are linked when I click the “payments” icon but the invoice only ever shows one booking.

I really need a fix as I purchased EE after being told about this template for VAT. If it doesn’t work, I’ll need a refund I’m afraid.


Josh

  • Support Staff

January 29, 2014 at 10:18 am

Hi Tim,

You’re welcome try this out on EE4 by signing up for early access to EE4. EE4 has built in support for taxes and it allows for multiple ticket prices for an event. This way different prices can be charged for an event based on ticket sale date ranges (so you can offer an early registration discount).

If EE4 doesn’t meet your needs, then please send an email to sales@eventespresso.com to request a refund.


Tim Kirk

January 29, 2014 at 10:21 am

Hi Josh,

I’ve spent 3 weeks manipulating code for EE3 and implementing it on my site. I’m at final testing stages having thought we’d already rectified the VAT issue.

I just can’t invest any more time and money in this – it should have been a week long job and unfortunately I just haven’t had the answers I needed.

The support post ‘UK VAT Support on PDF Invoices’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso