From 7c824a4d0f0aec19bbe9dc7fa3c8e11b9d5d3db2 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 Signed-off-by: Katrin Fischer --- .../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 7af5ab619c..74c2630ffd 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); + }, + }, };