Bug 14541: Do not truncate tax rate values

Tax rates are stored in decimal(6,4) fields which means that 4 decimals
are allowed.
If a tax rate is 8.42%, it is stored as 0.0842
If a tax rate has more precision than that, Koha won't deal correctly
with it. We will need to update the DB structure.

With this patch, the tax rate will be displayed with the same precision
as in the DB. So if you enter 8.42, you will see 8.42% instead of 8.4%
without this patch.

Test plan:
Do a full acquisition workflow with a tax rate like 8.42% and confirm
that it is correctly displayed.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-11-09 09:13:27 +00:00 committed by Kyle M Hall
parent 3e112f3837
commit cb3d6625e8
6 changed files with 13 additions and 13 deletions

View File

@ -481,7 +481,7 @@
[% FOREACH foot_loo IN book_foot_loop %]
<tr>
<th></th>
<th>Total (GST [% foot_loo.tax_rate * 100 | $Price %])</th>
<th>Total (GST [% foot_loo.tax_rate * 100 %])</th>
<th class="tax_excluded">&nbsp;</th>
<th class="tax_excluded">&nbsp;</th>
<th class="tax_included">&nbsp;</th>
@ -585,7 +585,7 @@
<td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
<td class="number tax_excluded [% IF books_loo.total_tax_excluded.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_excluded | $Price %]</td>
<td class="number tax_included [% IF books_loo.total_tax_included.search(zero_regex) %]error[% END %]">[% books_loo.total_tax_included | $Price %]</td>
<td class="number">[% books_loo.tax_rate * 100 | $Price %]</td>
<td class="number">[% books_loo.tax_rate * 100 %]</td>
<td class="number [% IF books_loo.tax_value.search(zero_regex) %]error[% END %]">[% books_loo.tax_value | $Price %]</td>
<td>[% books_loo.budget_name %]</td>
<td>[% books_loo.suppliers_report %]</td>
@ -698,7 +698,7 @@
<td class="number">[% order.quantity %]</td>
<td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
<td class="number tax_included">[% order.total_tax_included | $Price %]</td>
<td class="number">[% order.tax_rate * 100 | $Price %]</td>
<td class="number">[% order.tax_rate * 100 %]</td>
<td class="number">[% order.tax_value | $Price %]</td>
<td>[% order.budget_name %]
</tr>

View File

@ -179,7 +179,7 @@
<td class="number">[% order.quantity %]</td>
<td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
<td class="number tax_included">[% order.total_tax_included | $Price %]</td>
<td class="number">[% order.tax_rate * 100 | $Price %]</td>
<td class="number">[% order.tax_rate * 100 %]</td>
<td class="number">[% order.tax_value | $Price %]</td>
<td>[% order.budget_name %]</td>
</tr>
@ -188,7 +188,7 @@
<tfoot>
[% FOR tf IN foot_loop %]
<tr>
<th colspan="2">Total (GST [% tf.tax_rate * 100 | $Price %] %)</th>
<th colspan="2">Total (GST [% tf.tax_rate * 100 %] %)</th>
<th class="tax_excluded"/><th class="tax_included"/>
<th>[% tf.quantity %]</th>
<th class="tax_excluded">[% tf.total_tax_excluded | $Price %]</th>

View File

@ -573,9 +573,9 @@ $(document).ready(function()
<select name="tax_rate" id="tax_rate" onchange="updateCosts();">
[% FOREACH gst IN gst_values %]
[% IF ( gst.option == tax_rate ) %]
<option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
<option value="[% gst.option %]" selected="selected">[% gst.option * 100 %]%</option>
[% ELSE %]
<option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
<option value="[% gst.option %]">[% gst.option * 100 %]%</option>
[% END %]
[% END %]
</select>

View File

@ -335,9 +335,9 @@
<select name="tax_rate" id="tax_rate">
[% FOREACH gst IN gst_values %]
[% IF gst.option == tax_rate %]
<option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format("%.1f") %]%</option>
<option value="[% gst.option %]" selected="selected">[% gst.option * 100 %]%</option>
[% ELSE %]
<option value="[% gst.option %]">[% gst.option * 100 | format("%.1f") %]%</option>
<option value="[% gst.option %]">[% gst.option * 100 %]%</option>
[% END %]
[% END %]
</select>

View File

@ -379,7 +379,7 @@
</tr>
[% FOREACH book_foot IN book_foot_loop %]
<tr>
<th colspan="10">Total (GST [% book_foot.tax_rate * 100 | $Price %]%)</th>
<th colspan="10">Total (GST [% book_foot.tax_rate * 100 %]%)</th>
<th>[% book_foot.tax_value | $Price %]</th>
<th></th>
</tr>

View File

@ -291,9 +291,9 @@ function delete_contact(ev) {
<select name="tax_rate" id="tax_rate">
[% FOREACH gst IN gst_values %]
[% IF ( tax_rate == gst.option ) %]
<option value="[% gst.option %]" selected="selected">[% gst.option * 100 | format ("%.1f") %] %</option>
<option value="[% gst.option %]" selected="selected">[% gst.option * 100 %] %</option>
[% ELSE %]
<option value="[% gst.option %]">[% gst.option * 100 | format ("%.1f") %] %</option>
<option value="[% gst.option %]">[% gst.option * 100 %] %</option>
[% END %]
[% END %]
</select>
@ -353,7 +353,7 @@ function delete_contact(ev) {
<p><strong>Discount: </strong>
[% discount | format("%.1f") %] %</p>
<p><strong>Tax rate: </strong>
[% 0 + tax_rate * 100 | format("%.1f") %] %</p>
[% 0 + tax_rate * 100 %] %</p>
[% IF deliverytime.defined %]
<p><strong>Delivery time: </strong>
[% deliverytime %] days</p>