Compare commits

...

2 commits

Author SHA1 Message Date
6058b2f239 mark bold sum for vat exempt foodcoops 2023-08-30 10:11:25 +02:00
410479f6cc add ordergroupname to invoice file name 2023-08-30 10:01:29 +02:00

View file

@ -1,6 +1,7 @@
class GroupOrderInvoicePdf < RenderPdf class GroupOrderInvoicePdf < RenderPdf
def filename 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 end
def title def title
@ -102,13 +103,13 @@ class GroupOrderInvoicePdf < RenderPdf
total_gross += goa_total_deposit total_gross += goa_total_deposit
end end
table data, position: :left, cell_style: { size: fontsize(8), overflow: :shrink_to_fit } do |table| table data, cell_style: { size: fontsize(8), overflow: :shrink_to_fit } do |table|
table.header = true table.header = true
table.position = :center table.position = :center
table.cells.border_width = 1 table.cells.border_width = 1
table.cells.border_color = '666666' table.cells.border_color = '666666'
table.row(0).column(1).width = 40 table.row(0).column(0..4).width = 80
table.row(0).border_bottom_width = 2 table.row(0).border_bottom_width = 2
table.columns(1).align = :right table.columns(1).align = :right
table.columns(1..6).align = :right table.columns(1..6).align = :right
@ -116,17 +117,25 @@ class GroupOrderInvoicePdf < RenderPdf
move_down 5 move_down 5
sum = [] sum = []
sum << [nil, nil, I18n.t('documents.group_order_invoice_pdf.sum_to_pay'), number_to_currency(total_gross)] sum << [nil, nil, I18n.t('documents.group_order_invoice_pdf.sum_to_pay_gross'), number_to_currency(total_gross)]
# table for sum # table for sum
indent(200) do table sum, cell_style: { size: fontsize(8), overflow: :shrink_to_fit } do |table|
table sum, position: :center, cell_style: { size: fontsize(8), overflow: :shrink_to_fit } do |table| table.header = true
sum.length.times do |count| table.position = :center
table.row(count).columns(0..3).borders = [] table.cells.border_width = 1
end table.cells.border_color = '666666'
table.row(sum.length - 1).columns(0..2).borders = [] table.row(0).columns(2..4).style(align: :bottom)
table.row(sum.length - 1).border_bottom_width = 2 table.row(0).border_bottom_width = 2
table.row(sum.length - 1).columns(3).borders = [:bottom] table.row(0..-1).columns(0..1).border_width = 0
end
table.rows(0..-1).columns(0..4).width = 80
table.row(0).column(-1).style(font_style: :bold)
table.row(0).column(-2).style(font_style: :bold)
table.row(0).column(-1).size = fontsize(10)
table.row(0).column(-2).size = fontsize(10)
table.columns(1).align = :right
table.columns(1..6).align = :right
end end
move_down 25 move_down 25
@ -217,38 +226,15 @@ class GroupOrderInvoicePdf < RenderPdf
table.columns(1..6).align = :right table.columns(1..6).align = :right
end 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"]] sum = [[nil, nil, nil, "Netto", "MwSt", "Brutto"]]
[7, 19].each do |key| [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, "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 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 end
total_deposit_gross ||= 0 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)] 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 move_down 10
table sum, cell_style: { size: fontsize(8), overflow: :shrink_to_fit } do |table| table sum, cell_style: { size: fontsize(8), overflow: :shrink_to_fit } do |table|
table.header = true table.header = true