From 7130a1aab4dac5ffd1b16a2d09503b3053da7b47 Mon Sep 17 00:00:00 2001 From: viehlieb Date: Fri, 23 May 2025 14:22:47 +0200 Subject: [PATCH] tiny change to pdf --- app/documents/group_order_invoice_pdf.rb | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/app/documents/group_order_invoice_pdf.rb b/app/documents/group_order_invoice_pdf.rb index ccbdb1aa..9759cd45 100644 --- a/app/documents/group_order_invoice_pdf.rb +++ b/app/documents/group_order_invoice_pdf.rb @@ -85,17 +85,12 @@ class GroupOrderInvoicePdf < RenderPdf group_order_articles = GroupOrderArticle.where(group_order_id: @options[:group_order_ids]) separate_deposits = FoodsoftConfig[:group_order_invoices]&.[](:separate_deposits) supplier = "" - headlines = [] - index = 0 group_order_articles.each do |goa| # if no unit is received, nothing is to be charged next if goa.result.to_i == 0 - index +=1 if goa.group_order.order.supplier.name != supplier - headlines << index supplier = goa.group_order.order.supplier.name data << [supplier,"","",""] - index +=1 end goa_total_price = separate_deposits ? goa.total_price_without_deposit : goa.total_price data << [goa.order_article.article.name, @@ -120,7 +115,6 @@ class GroupOrderInvoicePdf < RenderPdf table.cells.border_color = '666666' table.row(0).column(0..4).width = 80 table.row(0).column(0).width = 180 - table.row(headlines).font_style= :bold table.row(0).border_bottom_width = 2 table.columns(1).align = :right table.columns(1..6).align = :right @@ -184,18 +178,14 @@ class GroupOrderInvoicePdf < RenderPdf end group_order_articles = GroupOrderArticle.where(group_order_id: @options[:group_order_ids]).includes(group_order: { order: :supplier }) - index = 0 - supplier_headlines = [] + group_order_articles.group_by { |goa| goa.group_order.order.supplier.name }.each do |supplier_name, articles| if articles.map(&:result).sum > 0 data << [supplier_name, "", "", "", "", ""] - index += 1 - supplier_headlines << index end - + articles.each do |goa| next if goa.result.to_i == 0 - index += 1 order_article = goa.order_article tax = order_article.price.tax @@ -256,9 +246,6 @@ class GroupOrderInvoicePdf < RenderPdf table.row(0).border_bottom_width = 2 table.columns(1).align = :right table.columns(1..6).align = :right - supplier_headlines.each do |row_index| - table.row(row_index).columns(0..6).style(font_style: :bold) - end end if marge > 0