Jump to content

Format Tax Rate


flangefrog

Recommended Posts

Please format the tax rate on display. Instead of displaying GST (15.0000%) I want it to display GST (15%). Probably something like floatval($tax_rate) would be fine, I can't think of a reason anybody would need extra 0s. As a workaround I've changed the database column to be an INT.

Link to comment
Share on other sites

I know of at least one province in Canada that has a provincial sales tax rate of 9.975%, so it definitely needs the decimal places. However, I don't need them, so I used round( ) on the tax rate in my invoice template to get rid of those zeros in the pdf invoice.

 

In line 315 of components/invoice_templates/default_invoice/default_invoice_pdf.php change $tax->amount to round($tax->amount) so that it looks like

$data[] = array('notes'=>null,'label'=>Language::_("DefaultInvoice.tax_heading", true, $tax->name, round($tax->amount)),'price'=>$this->CurrencyFormat->format($tax->tax_total, $this->invoice->currency, self::$standard_num_options));

If you still want some of the decimal places, you can specify how many like this round($tax->amount,2)

 

It doesn't bother me if the zeros still appear in the admin panel, so this change was all it took to make me happy.

Link to comment
Share on other sites

I know of at least one province in Canada that has a provincial sales tax rate of 9.975%, so it definitely needs the decimal places.

I wasn't suggesting to remove numbers after the decimal, floatval() just removes the extraneous 0s. e.g.

floatval(1.1234) = 1.1234
floatval(1.1230 ) = 1.123
floatval(1.0000) = 1
$amount + 0 or (float)$amount do the same thing.
Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...