Support

Home Forums Event Espresso Premium Noticed that Invoice changes date every time it is being downloaded

Noticed that Invoice changes date every time it is being downloaded

Posted: May 10, 2015 at 11:18 am

Viewing 6 reply threads


Andreas

May 10, 2015 at 11:18 am

Hi,

I used the Invoice payment gateway as a way to generate a receipt that the customer can download for their bookkeeping. As my customers only have PayPal as an payment option, and I am not letting PayPal generate my receipts, instead using the invoice option, so that the customers easily can download once their payment has been confirmed via PayPal IPN.

My problem now, which I discovered today, is that the receipts (invoices) are using the DATE when they click the download invoice button. This makes it wrong for the bookkeeping.

I want the DATE displayed on the downloaded receipt (invoice) to show the actual date when PayPal received the payment from my customer. As this is being transfered from PayPal via IPN to my website and the Event Espresso 3 installation.

Can someone help me out with this?

Thank you very much in advance for support!

Sincerely,
Andreas


Dean

May 11, 2015 at 3:05 am

Hi,

The invoice in EE3 was not intended to be used in that way, which is why the dates are displayed differently, but it can be changed relatively easily.

OK, you will need to modify the Invoice gateway template, but it’s not too hard, just some file copying and a single line of editing.

The easiest way to do this is to copy the entire Invoice folder (wp-content/plugins/event-espresso/gateways/invoice) over to the wp-uploads/espresso/gateways folder (if the gateways folder doesn’t exist here, create it).

Then edit the wp-content/uploads/espresso/gateways/invoice/template.php file.

On line 115 you should see:

$pdf->Cell(180, 0, pdftext(__('Date: ', 'event_espresso') . date(get_option('date_format'))), 0, 1, 'R'); //Set invoice date

Change this to read:

$pdf->Cell(180, 0, pdftext(__('Date: ', 'event_espresso') . date(get_option('date_format'), strtotime($date) )), 0, 1, 'R'); //Set invoice date

This will then use the attendees registration date for the invoice date.


Andreas

May 11, 2015 at 7:17 am

Thank you very much for the quick reply!

Is it possible to instead put in the date when the payment was confirmed from PayPal?

Sincerely,
Andreas


Josh

  • Support Staff

May 11, 2015 at 11:23 am

Andreas,

Here’s some example code for the invoice that you can use. It will first check to see if there is a payment date (in case payment hasn’t been made yet), then print the date if a payment was applied:

//Set the payment date
if (!empty($payment_date)) {
	$pdf->Cell(180, 0, pdftext(__('Payment Date: ', 'event_espresso') . $payment_date), 0, 1, 'R');
} else {
	$pdf->Ln(10);
}


Andreas

May 11, 2015 at 11:31 am

Thank you very much Josh!

Where shall I put the code?
At line 115 as Dean suggests?

Also, is it a big trick to add the unique ticket ID number below the “Primary attende-ID”?

Thank you in advance!

Sincerely,
Andreas


Lorenzo Orlando Caum

  • Support Staff

May 11, 2015 at 6:21 pm

Hi Andreas, the sample code that Josh shared would replace the code around line 115. Your code editor may have the line as a little different so just check for the sample code that Dean shared and then replace it.


Lorenzo


Josh

  • Support Staff

May 11, 2015 at 7:44 pm

Re:

Also, is it a big trick to add the unique ticket ID number below the “Primary attende-ID”?

It is tricky to add it there because there can be more than one unique ticket ID number for a transaction. Instead of adding it there, you can change the section where it displays the event name and attendee name.

You find this in your invoice template:

pdftext($tmp_attendee["event_name"] . "[" . date('m-d-Y', strtotime($tmp_attendee['start_date'])) . "]") . ' >> '
. pdftext(html_entity_decode($tmp_attendee["fname"], ENT_QUOTES, "UTF-8") . " " . html_entity_decode($tmp_attendee["lname"], ENT_QUOTES, "UTF-8")) . ';'

Then change it to:

pdftext($tmp_attendee["event_name"]) . ' | '
. pdftext(html_entity_decode($tmp_attendee["fname"], ENT_QUOTES, "UTF-8") . " " . html_entity_decode($tmp_attendee["lname"], ENT_QUOTES, "UTF-8")) . ' | '
. pdftext($tmp_attendee["registration_id"]) . ';'

What that will do is display the unique ticket ID (or registration ID) for each attendee in the transaction, next to the attendee name.

Viewing 6 reply threads

The support post ‘Noticed that Invoice changes date every time it is being downloaded’ 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