Hide zero results in matrix pdf.
This commit is contained in:
parent
de1aa2ac38
commit
d62d45e4a4
2 changed files with 8 additions and 2 deletions
|
@ -152,7 +152,12 @@ class OrdersController < ApplicationController
|
||||||
# Renders the matrix PDF.
|
# Renders the matrix PDF.
|
||||||
def matrixPdf
|
def matrixPdf
|
||||||
@order = Order.find(params[:id])
|
@order = Order.find(params[:id])
|
||||||
prawnto :filename => "#{Date.today}_#{@order.name}_Matrix.pdf"
|
unless @order.order_articles.ordered.empty?
|
||||||
|
prawnto :filename => "#{Date.today}_#{@order.name}_Matrix.pdf"
|
||||||
|
else
|
||||||
|
flash[:error] = "Es sind keine Artikel bestellt worden."
|
||||||
|
redirect_to @order
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# adds a Comment to the Order
|
# adds a Comment to the Order
|
||||||
|
|
|
@ -6,6 +6,7 @@ pdf.header [pdf.margin_box.left,pdf.margin_box.top+20] do
|
||||||
end
|
end
|
||||||
pdf.footer [pdf.margin_box.left, pdf.margin_box.bottom-5] do
|
pdf.footer [pdf.margin_box.left, pdf.margin_box.bottom-5] do
|
||||||
pdf.stroke_horizontal_rule
|
pdf.stroke_horizontal_rule
|
||||||
|
pdf.move_down 2
|
||||||
pdf.text "Seite #{pdf.page_count}", :size => 8
|
pdf.text "Seite #{pdf.page_count}", :size => 8
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ while (page_number * max_order_articles_per_page < total_num_order_articles) do
|
||||||
for order_article in current_order_articles
|
for order_article in current_order_articles
|
||||||
# get the Ordergroup result for this order_article
|
# get the Ordergroup result for this order_article
|
||||||
goa = order_article.group_order_articles.first :conditions => { :group_order_id => group_order.id }
|
goa = order_article.group_order_articles.first :conditions => { :group_order_id => group_order.id }
|
||||||
group_result << ((goa.nil? || goa == 0) ? "" : goa.result.to_i)
|
group_result << ((goa.nil? || goa.result == 0) ? "" : goa.result.to_i)
|
||||||
end
|
end
|
||||||
groups_data << group_result
|
groups_data << group_result
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue