Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active August 29, 2015 14:02
Show Gist options
  • Save joshfeck/a0482a918ef34bee24ab to your computer and use it in GitHub Desktop.
Save joshfeck/a0482a918ef34bee24ab to your computer and use it in GitHub Desktop.
A simple GST line itemizer for the Event Espresso 3 invoice template function file. Works in conjunction with https://gist.github.com/joshfeck/e2b91cd6599000ecb772
<?php
//* Please do NOT include the above opening php tag
function my_itemised_surcharge( $attendees ){
$options = get_option( 'events_organization_settings' );
$currency = $options['currency_symbol'];
$this->SetFillColor( 239,239,239 );
// pull the selected ticket price breakdown from the database
global $org_options;
$total_price_per = $attendees[0][0][2];
// In this case GST is 10 percent of the total, multiplier of 10/11
$price_before_gst = $total_price_per * .909090909;
$gst = $total_price_per - $price_before_gst;
// print unit price w/o surcharge
$this->Cell( 95, 7, __( 'Price per unit excluding GST:','event_espresso'), 0, 0, 'L', true );
$this->Cell( 90, 7, html_entity_decode( $currency, ENT_QUOTES, 'ISO-8859-15' ) . number_format( $price_before_gst,2, '.', '' ), 0, 1, 'C', true );
// print unit surcharge
$this->Cell( 95, 7, __( 'GST per unit:','event_espresso' ), 0, 0, 'L', true );
$this->Cell( 90, 7, html_entity_decode( $currency, ENT_QUOTES, 'ISO-8859-15' ) . number_format( $gst,2, '.', '' ), 0, 1, 'C', true );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment