1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

[bug] vat rat in archives may be wrong

This commit is contained in:
Sylvain 2019-04-03 16:56:47 +02:00
parent 8e895e6b6a
commit 9e39a0517c
2 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,8 @@
# Changelog Fab Manager
- Improved end-user message when closing an accounting period
- Improved date checks before closing an accounting period
- Fix a bug: when VAT has changed during fab-manager's lifecycle, this may not be reflected in archives
- Fix a bug: using a quote in event category's name results in angular $parse:syntax Error
## v3.0.1 2019 April 1st

View File

@ -62,8 +62,8 @@ class AccountingPeriod < ActiveRecord::Base
first_rate = @vat_rates.first
return first_rate[:rate] if date < first_rate[:date]
@vat_rates.each do |h|
return h[:rate] if h[:date] <= date
@vat_rates.each_index do |i|
return @vat_rates[i][:rate] if date >= @vat_rates[i][:date] && (@vat_rates[i + 1].nil? || date < @vat_rates[i + 1][:date])
end
end
@ -105,7 +105,7 @@ class AccountingPeriod < ActiveRecord::Base
end
def archive_closed_data
data = invoices.includes(:invoice_items)
data = invoices.includes(:invoice_items).order(id: :asc)
previous_file = previous_period&.archive_file
last_archive_checksum = previous_file ? Checksum.file(previous_file) : nil
json_data = to_json_archive(data, previous_file, last_archive_checksum)