From ab650e0b54736cba160c7e0d8b95efa8bd614acc Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Tue, 19 Nov 2024 15:20:54 +0000 Subject: [PATCH] Bug 38010: Fix tax rate display Signed-off-by: Michaela Sieber Signed-off-by: Jonathan Druart --- .../components/Vendors/VendorOrderingInformation.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorOrderingInformation.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorOrderingInformation.vue index 7af5ab619c5..74c2630ffda 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorOrderingInformation.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Vendors/VendorOrderingInformation.vue @@ -48,9 +48,7 @@
  • - - {{ (vendor.tax_rate || 0) * 100 }} - + {{ formatTaxRate(vendor.tax_rate) }}%
  • @@ -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); + }, + }, }; -- 2.34.1