Support

Home Forums Event Espresso Premium Invoice not showing proper amount paid

Invoice not showing proper amount paid

Posted: November 28, 2013 at 12:00 pm

Viewing 2 reply threads


Patrick Hohol

November 28, 2013 at 12:00 pm

I have setup event espresso on a client’s site, and am using a custom invoice template to display PO numbers. Everything works fine with this, however it will not pull in the amount paid (amount_pd).

Here is where attendee info is pulled in, and it seems to be calling for the amount_pd variable properly:

<code>		foreach ($attendees as $attendee){
			$attendee_id = $attendee-&gt;id;
			$attendee_last = $attendee-&gt;lname;
			$attendee_first = $attendee-&gt;fname;
			$attendee_address = $attendee-&gt;address;
			$attendee_city = $attendee-&gt;city;
			$attendee_state = $attendee-&gt;state;
			$attendee_zip = $attendee-&gt;zip;
			$attendee_email = $attendee-&gt;email;
			//$attendee_organization_name = $attendee-&gt;organization_name;
			//$attendee_country = $attendee-&gt;country_id;
			$phone = $attendee-&gt;phone;
			$date = $attendee-&gt;date;
			//$num_people = $attendee-&gt;quantity;
			$payment_status = $attendee-&gt;payment_status;
			$txn_type = $attendee-&gt;txn_type;
			$attendee_session = $attendee-&gt;attendee_session;
			$event_price_type = $attendee-&gt;price_option;
			$amount_pd = $attendee-&gt;amount_pd;
			$payment_date = $attendee-&gt;payment_date;
			$event_id = $attendee-&gt;event_id;
			$registration_id=$attendee-&gt;registration_id;
			$quantity = $attendee-&gt;quantity;
		}</code>

Here is the part of the template.php file which should display the amount_pd but is always showing $0:
`function InvoiceTotals($sub_total, $vat, $surcharge){
$options = get_option(‘events_organization_settings’);
$currency = $options[‘currency_symbol’];
$total_cost = $sub_total + ($vat/10);
$this->SetFillColor(192,192,192);
//Print sub total
$this->Cell(155, 10, ‘Subtotal excluding GST:’, 0, 0, ‘R’, true);
$this->Cell(35, 10, html_entity_decode($currency, ENT_QUOTES, ‘ISO-8859-15’) . number_format($sub_total,2, ‘.’, ”), 0, 1, ‘C’, true);

//Print total VAT
$this->Cell(155, 10, ‘GST @ ‘ . $surcharge . ‘%:’, 0, 0, ‘R’, true);
$this->Cell(35, 10, html_entity_decode($currency, ENT_QUOTES, ‘ISO-8859-15’) . number_format(($vat/10),2, ‘.’, ”), 0, 1, ‘C’, true);

//Print total cost

$this->Cell(155, 10, ‘Total:’, 0, 0, ‘R’);
$this->Cell(35, 10, html_entity_decode($currency, ENT_QUOTES, ‘ISO-8859-15’) . number_format($total_cost,2, ‘.’, ”), 0, 1, ‘C’);
$this->Cell(155, 10, ‘Amount Paid:’, 0, 0, ‘R’);
$this->Cell(35, 10, html_entity_decode($currency, ENT_QUOTES, ‘ISO-8859-15’) . number_format($amount_pd,2, ‘.’, ”), 0, 1, ‘C’);
$this->Cell(155, 10, ‘Total Due:’, 0, 0, ‘R’);
$total_owing = $total_cost – $amount_pd;
$this->Cell(35, 10, html_entity_decode($currency, ENT_QUOTES, ‘ISO-8859-15’) . number_format($total_owing,2, ‘.’, ”), 0, 1, ‘C’);
$this->Ln(20);
$this->Cell(190, 10, ‘GST registration number: 894590983RT0001’, 0, 0, ‘R’); // replace with your VAT ID or comment this line out
}`

any help?


Tony

  • Support Staff

November 29, 2013 at 4:34 am

Hi Patrick,

Without seeing all of the code its hard to say.

Have you checked that the attendee data you are pulling in actually has an amount other than 0.00 in the database?

Does the SQL query used to pull the information include amount_pd?

If you would like to email us a copy of your template to support at eventespresso.com we can take a look and advise from there.


Tony

  • Support Staff

December 2, 2013 at 4:19 am

Hi Patrick,

Thank you for sending the template over.

I’ve reviewed the code and the reason the totals are being calculated incorrectly is due to $amount_pd not being passed to the InvoiceTotals() function.

Line 320:

$pdf->InvoiceTotals($cost_total, $tax_total, $surcharge);

Needs to pass $amount_pd into the function…

$pdf->InvoiceTotals($cost_total, $tax_total, $surcharge, $amount_pd);

Also line 211

function InvoiceTotals($sub_total, $vat, $surcharge){

Needs to be

function InvoiceTotals($sub_total, $vat, $surcharge, $amount_pd){

Otherwise the $amount_pd variable used within that function is actually a totally different variable with the same name.

Viewing 2 reply threads

The support post ‘Invoice not showing proper amount paid’ 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