From f3cfbd1187702812b007e6184c44be40926f1885 Mon Sep 17 00:00:00 2001 From: Thomas Burkhalter Date: Mon, 16 Sep 2024 22:54:27 +0200 Subject: [PATCH] Add amount to order_service CSV-Export --- app/controllers/concerns/worktimes_csv.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/controllers/concerns/worktimes_csv.rb b/app/controllers/concerns/worktimes_csv.rb index a389955d..11e58c96 100644 --- a/app/controllers/concerns/worktimes_csv.rb +++ b/app/controllers/concerns/worktimes_csv.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright (c) 2006-2017, Puzzle ITC GmbH. This file is part of +# Copyright (c) 2006-2024, Puzzle ITC GmbH. This file is part of # PuzzleTime and licensed under the Affero General Public License version 3 # or later. See the COPYING file at the top-level directory or at # https://github.com/puzzle/puzzletime. @@ -19,13 +19,14 @@ def send_worktimes_csv(worktimes, filename) def worktimes_csv(worktimes) CSV.generate do |csv| - csv << ['Datum', 'Stunden', 'Von Zeit', 'Bis Zeit', 'Reporttyp', + csv << ['Datum', 'Stunden', 'Von Zeit', 'Bis Zeit', 'Stundenansatz CHF', 'Reporttyp', 'Verrechenbar', 'Member', 'Position', 'Ticket', 'Bemerkungen'] worktimes.each do |time| csv << [I18n.l(time.work_date), time.hours, (time.start_stop? ? I18n.l(time.from_start_time, format: :time) : ''), (time.start_stop? && time.to_end_time? ? I18n.l(time.to_end_time, format: :time) : ''), + currency(time.amount), time.report_type, time.billable, time.employee.label, @@ -35,4 +36,11 @@ def worktimes_csv(worktimes) end end end + + def currency(value) + format( + '%0.02f', + amount: value, + ) + end end