Fix current_order PDFs and update article/group PDFs too

This commit is contained in:
wvengen 2015-07-10 18:59:50 +02:00
parent dc731ee40d
commit cb000a0438
4 changed files with 52 additions and 67 deletions

View file

@ -25,26 +25,30 @@ class OrderByGroups < OrderPdf
sub_total = price * goa.result
total += sub_total
rows << [goa.order_article.article.name,
"#{goa.quantity} + #{goa.tolerance}",
goa.tolerance > 0 ? "#{goa.quantity} + #{goa.tolerance}" : goa.quantity,
goa.result,
number_with_precision(price, precision: 2),
number_to_currency(price),
goa.order_article.price.unit_quantity,
goa.order_article.article.unit,
number_with_precision(sub_total, precision: 2)]
number_to_currency(sub_total)]
dimrows << rows.length if goa.result == 0
end
next if rows.length == 0
rows << [ I18n.t('documents.order_by_groups.sum'), nil, nil, nil, nil, nil, number_with_precision(total, precision: 2)]
rows << [ I18n.t('documents.order_by_groups.sum'), nil, nil, nil, nil, nil, number_to_currency(total)]
rows.unshift I18n.t('documents.order_by_groups.rows') # Table Header
text group_order.ordergroup.name, size: fontsize(9), style: :bold
table rows, width: 500, cell_style: {size: fontsize(8), overflow: :shrink_to_fit} do |table|
# borders
table.cells.borders = []
table.row(0).borders = [:bottom]
table.row(group_order_articles.size).borders = [:bottom]
table.cells.border_width = 1
table.cells.border_color = '666666'
table.cells.borders = [:bottom]
table.cells.border_width = 0.02
table.cells.border_color = 'dddddd'
table.rows(0).border_width = 1
table.rows(0).border_color = '666666'
table.rows(0).column(5).font_style = :bold
table.row(rows.length-2).border_width = 1
table.row(rows.length-2).border_color = '666666'
table.row(rows.length-1).borders = []
table.column(0).width = 240
table.column(2).font_style = :bold
@ -53,7 +57,10 @@ class OrderByGroups < OrderPdf
table.column(6).font_style = :bold
# dim rows which were ordered but not received
dimrows.each { |ri| table.row(ri).text_color = '999999' }
dimrows.each do |ri|
table.row(ri).text_color = '999999'
table.row(ri).columns(0..-1).font_style = nil
end
end
end