Skip to content

Commit

Permalink
fix:dev: standardrb
Browse files Browse the repository at this point in the history
  • Loading branch information
Skulli committed Feb 20, 2025
1 parent 268632b commit cc14acf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/secretariat/export/zugferd_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def self.logger

# @@logger ||= Logger.new(File.join(log_directory, "export.log"))

@@logger ||= Logger.new(STDOUT)
@@logger ||= Logger.new($stdout)
end

def self.convert_a1_to_a3_params(pdf_a1, output_file_path)
Expand Down
12 changes: 6 additions & 6 deletions lib/secretariat/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def valid?
@errors = []
tax = BigDecimal(tax_amount)
basis = BigDecimal(basis_amount)
calc_tax = basis * BigDecimal(tax_percent) / BigDecimal("100")
calc_tax = basis * BigDecimal(tax_percent) / BigDecimal(100)
calc_tax = calc_tax.round(2)
if tax != calc_tax
@errors << "Tax amount and calculated tax amount deviate: #{tax} / #{calc_tax}"
Expand All @@ -85,7 +85,7 @@ def valid?
@errors << "Grand total amount and calculated grand total amount deviate: #{grand_total} / #{calc_grand_total}"
return false
end
line_item_sum = line_items.inject(BigDecimal("0")) do |m, item|
line_item_sum = line_items.inject(BigDecimal(0)) do |m, item|
m + BigDecimal(item.charge_amount)
end
if line_item_sum != basis
Expand Down Expand Up @@ -306,12 +306,12 @@ def to_xml(version: 1, skip_validation: false, mode: :zugferd)
Helpers.currency_element(xml, "ram", "LineTotalAmount", basis_amount, currency_code, add_currency: version == 1)
# TODO: Fix this!
# Zuschuesse
unless BigDecimal("0").to_f.zero?
Helpers.currency_element(xml, "ram", "ChargeTotalAmount", BigDecimal("0"), currency_code, add_currency: version == 1)
unless BigDecimal(0).to_f.zero?
Helpers.currency_element(xml, "ram", "ChargeTotalAmount", BigDecimal(0), currency_code, add_currency: version == 1)
end
# Rabatte
unless BigDecimal("0").to_f.zero?
Helpers.currency_element(xml, "ram", "AllowanceTotalAmount", BigDecimal("0"), currency_code, add_currency: version == 1)
unless BigDecimal(0).to_f.zero?
Helpers.currency_element(xml, "ram", "AllowanceTotalAmount", BigDecimal(0), currency_code, add_currency: version == 1)
end
Helpers.currency_element(xml, "ram", "TaxBasisTotalAmount", basis_amount, currency_code, add_currency: version == 1)
unless tax_amount.to_f.zero?
Expand Down
2 changes: 1 addition & 1 deletion lib/secretariat/line_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def valid?
end
end

calculated_tax = charge_price * BigDecimal(tax_percent) / BigDecimal("100")
calculated_tax = charge_price * BigDecimal(tax_percent) / BigDecimal(100)
calculated_tax = calculated_tax.round(2)
if calculated_tax != tax
@errors << "Tax and calculated tax deviate: #{tax} / #{calculated_tax}"
Expand Down

0 comments on commit cc14acf

Please sign in to comment.