add ordergroupname to invoice file name

This commit is contained in:
viehlieb 2023-08-30 10:01:29 +02:00
parent 6f7c057a47
commit 410479f6cc

View file

@ -1,6 +1,7 @@
class GroupOrderInvoicePdf < RenderPdf
def filename
I18n.t('documents.group_order_invoice_pdf.filename', :number => @options[:invoice_number]) + '.pdf'
ordergroup_name = @options[:ordergroup].name || "OrderGroup"
"#{ordergroup_name}_" + I18n.t('documents.group_order_invoice_pdf.filename', :number => @options[:invoice_number]) + '.pdf'
end
def title
@ -217,38 +218,15 @@ class GroupOrderInvoicePdf < RenderPdf
table.columns(1..6).align = :right
end
# 4 spalten Netto, MwSt, Brutto
# Produkte mit 7% MwSt
# Pfand mit 7% MwSt
# Produkte mit 19% MwSt
# Pfand mit 19% MwSt
#
# x,x,GESAMT; SUMME
sum = [[nil, nil, nil, "Netto", "MwSt", "Brutto"]]
[7, 19].each do |key|
sum << [nil, nil, "Produkte mit #{key}%", number_to_currency(tax_hash_net[key]), number_to_currency(tax_hash_gross[key] - tax_hash_net[key]), number_to_currency(tax_hash_gross[key])]
sum << [nil, nil, "Pfand mit #{key}%", number_to_currency(tax_hash_deposit_net[key]), number_to_currency(tax_hash_deposit_gross[key] - tax_hash_deposit_net[key]), number_to_currency(tax_hash_deposit_gross[key])] if separate_deposits
end
total_deposit_gross ||= 0
sum << [nil, nil, nil, nil, I18n.t('documents.group_order_invoice_pdf.sum_to_pay_gross'), number_to_currency(total_gross + total_deposit_gross)]
# tax_hash_net.each_key.each do |tax|
# sum << [nil, nil, nil, nil, I18n.t('documents.group_order_invoice_pdf.tax_included', tax: tax), number_to_currency(tax_hash_gross[tax] - tax_hash_net[tax])]
# end
# unless marge == 0
# sum << [nil, nil, nil, nil, I18n.t('documents.group_order_invoice_pdf.markup_included', marge: marge), number_to_currency(total_gross * marge / 100.0)]
# end
# end_sum = total_gross * (1 + marge / 100.0)
# sum << [nil, nil, nil, nil, I18n.t('documents.group_order_invoice_pdf.sum_to_pay_gross'), number_to_currency(end_sum)]
# table for sum
# table sum, position: :right, cell_style: { size: fontsize(8), overflow: :shrink_to_fit } do |table|
# sum.length.times do |count|
# table.row(count).columns(0..5).borders = []
# end
# table.row(sum.length - 1).columns(0..4).borders = []
# table.row(sum.length - 1).border_bottom_width = 2
# table.row(sum.length - 1).columns(5).borders = [:bottom]
# end
move_down 10
table sum, cell_style: { size: fontsize(8), overflow: :shrink_to_fit } do |table|
table.header = true