Merge pull request #2482 from internetee/2480-fix-monthly-invoices

Fixed dates for yearly domains in monthly invoices
This commit is contained in:
Timo Võhmar 2022-11-18 14:13:19 +02:00 committed by GitHub
commit 30fd6d2465
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,8 +59,9 @@ module Invoice::BookKeeping
duration.times do |dur| duration.times do |dur|
single_item_dup = single_item.dup single_item_dup = single_item.dup
single_item_dup['start_date'] = (issue_date + dur.year).end_of_month.strftime('%Y-%m-%d') date = (issue_date + dur.year).end_of_month.strftime('%Y-%m-%d')
single_item_dup['end_date'] = (issue_date + (dur + 1).year).end_of_month.strftime('%Y-%m-%d') single_item_dup['start_date'] = date
single_item_dup['end_date'] = date
single_item_dup['price'] = (item['price'].to_f / duration).round(2) single_item_dup['price'] = (item['price'].to_f / duration).round(2)
lines << single_item_dup lines << single_item_dup
end end