From 2009d015326643e06385d5c6f94e19eedc5fb532 Mon Sep 17 00:00:00 2001 From: wandji Date: Thu, 23 Nov 2023 17:35:51 +0100 Subject: [PATCH] Strip insignificant zero for ledger records in consumption export [SCI-9646] (#6693) * Strip insignificant zero for ledger records when stock precision is zero [SCI-9646] * Stip insignicant zeros for all stock ledger records in consumption exports [SCI-9646] --- app/services/repository_stock_ledger_zip_export.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/services/repository_stock_ledger_zip_export.rb b/app/services/repository_stock_ledger_zip_export.rb index e896c7b2b..52f4deb45 100644 --- a/app/services/repository_stock_ledger_zip_export.rb +++ b/app/services/repository_stock_ledger_zip_export.rb @@ -37,6 +37,8 @@ module RepositoryStockLedgerZipExport end class << self + include ActionView::Helpers::NumberHelper + private def load_records(repository_row_ids) @@ -64,13 +66,13 @@ module RepositoryStockLedgerZipExport consumption_type, record.repository_row.name, record.repository_row.code, - consumed_amount, + number_with_precision(consumed_amount, strip_insignificant_zeros: true), consumed_amount_unit, - added_amount, + number_with_precision(added_amount, strip_insignificant_zeros: true), added_amount_unit, record.user.full_name, I18n.l(record.created_at, format: :full), - record.balance, + number_with_precision(record.balance, strip_insignificant_zeros: true), record.unit ] breadcrumbs_data =