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>
(cherry picked from commit cb3d6625e8)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
(cherry picked from commit ff33093591)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Jonathan Druart 2016-11-09 09:13:27 +00:00 committed by Mason James
parent 094ef820d9
commit 4ad29b9f2e
5 changed files with 11 additions and 11 deletions

View File

@ -454,7 +454,7 @@
[% FOREACH foot_loo IN book_foot_loop %]
<tr>
<th></th>
<th>Total (GST [% foot_loo.gstrate * 100 | $Price %])</th>
<th>Total (GST [% foot_loo.gstrate * 100 %])</th>
<th class="gste">&nbsp;</th>
<th class="gste">&nbsp;</th>
<th class="gsti">&nbsp;</th>
@ -558,7 +558,7 @@
<td class="number [% IF books_loo.quantity.search(zero_regex) %]error[% END %]">[% books_loo.quantity %]</td>
<td class="number gste [% IF books_loo.totalgste.search(zero_regex) %]error[% END %]">[% books_loo.totalgste | $Price %]</td>
<td class="number gsti [% IF books_loo.totalgsti.search(zero_regex) %]error[% END %]">[% books_loo.totalgsti | $Price %]</td>
<td class="number">[% books_loo.gstrate * 100 | $Price %]</td>
<td class="number">[% books_loo.gstrate * 100 %]</td>
<td class="number [% IF books_loo.gstvalue.search(zero_regex) %]error[% END %]">[% books_loo.gstvalue | $Price %]</td>
<td>[% books_loo.budget_name %]</td>
<td>[% books_loo.suppliers_report %]</td>
@ -671,7 +671,7 @@
<td class="number">[% order.quantity %]</td>
<td class="number gste">[% order.totalgste | $Price %]</td>
<td class="number gsti">[% order.totalgsti | $Price %]</td>
<td class="number">[% order.gstrate * 100 | $Price %]</td>
<td class="number">[% order.gstrate * 100 %]</td>
<td class="number">[% order.gstvalue | $Price %]</td>
<td>[% order.budget_name %]
</tr>

View File

@ -173,7 +173,7 @@
<td class="number">[% order.quantity %]</td>
<td class="number gste">[% order.totalgste | $Price %]</td>
<td class="number gsti">[% order.totalgsti | $Price %]</td>
<td class="number">[% order.gstrate * 100 | $Price %]</td>
<td class="number">[% order.gstrate * 100 %]</td>
<td class="number">[% order.gstvalue | $Price %]</td>
<td>[% order.budget_name %]</td>
</tr>
@ -182,7 +182,7 @@
<tfoot>
[% FOR tf IN foot_loop %]
<tr>
<th colspan='2'>Total (GST [% tf.gstrate * 100 | $Price %] %)</th>
<th colspan='2'>Total (GST [% tf.gstrate * 100 %] %)</th>
<th class="gste"/><th class="gsti"/>
<th>[% tf.quantity %]</th>
<th class="gste">[% tf.totalgste | $Price %]</th>

View File

@ -562,9 +562,9 @@ $(document).ready(function()
<select name="gstrate" id="gstrate" onchange="updateCosts();">
[% FOREACH gst IN gst_values %]
[% IF ( gst.option == gstrate ) %]
<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.gstrate * 100 | $Price %]%)</th>
<th colspan="10">Total (GST [% book_foot.gstrate * 100 %]%)</th>
<th>[% book_foot.gstvalue | $Price %]</th>
<th></th>
</tr>

View File

@ -278,9 +278,9 @@ function delete_contact(ev) {
<select name="gstrate" id="gstrate">
[% FOREACH gst IN gst_values %]
[% IF ( gstrate == 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>
@ -340,7 +340,7 @@ function delete_contact(ev) {
<p><strong>Discount: </strong>
[% discount | format("%.1f") %] %</p>
<p><strong>Tax rate: </strong>
[% 0 + gstrate * 100 | format("%.1f") %] %</p>
[% 0 + gstrate * 100 %] %</p>
[% IF deliverytime.defined %]
<p><strong>Delivery time: </strong>
[% deliverytime %] days</p>