From 94dbbf28cca65ba14f2d8081503d8731d8049f06 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 --- .../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 9967456887e..bbcaaf74c66 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.39.3 (Apple Git-146)