Skip to content

Commit

Permalink
Fixed dates for yearly domains in monthly invoices
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei Tsoganov authored and Sergei Tsoganov committed Nov 18, 2022
1 parent c96a9bd commit 7e80221
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/models/concerns/invoice/book_keeping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ def divide_by_quantity_and_years(quantity, duration, item, lines)

duration.times do |dur|
single_item_dup = single_item.dup
single_item_dup['start_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')
date = (issue_date + dur.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)
lines << single_item_dup
end
Expand Down

0 comments on commit 7e80221

Please sign in to comment.