Bug 38010: Fix tax rate display

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matt Blenkinsop 2024-11-19 15:20:54 +00:00 committed by Katrin Fischer
parent 0d232857f9
commit 7c824a4d0f
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 9 additions and 3 deletions

View File

@ -48,9 +48,7 @@
</li>
<li>
<label>{{ $__("Tax rate") }}:</label>
<span>
{{ (vendor.tax_rate || 0) * 100 }}
</span>
<span> {{ formatTaxRate(vendor.tax_rate) }}% </span>
</li>
<li v-if="vendor.deliverytime">
<label>{{ $__("Delivery time") }}:</label>
@ -241,5 +239,13 @@ export default {
gstValues,
};
},
methods: {
formatTaxRate(taxRate) {
if (!taxRate) return 0;
const decimalPlaces = taxRate.toString().split(".")[1]?.length || 0;
const multiplier = 10 ** decimalPlaces;
return Math.round(taxRate * multiplier) / (multiplier / 100);
},
},
};
</script>