enable actions for multi (group) orders and ordergroup invoices
This commit is contained in:
parent
f676497e43
commit
e902aa0d5a
44 changed files with 550 additions and 324 deletions
|
|
@ -11,7 +11,7 @@ class GroupOrderInvoicePdf < RenderPdf
|
|||
def body
|
||||
contact = FoodsoftConfig[:contact].symbolize_keys
|
||||
ordergroup = @options[:ordergroup]
|
||||
|
||||
# TODO: group_by supplier, sort alphabetically
|
||||
# From paragraph
|
||||
bounding_box [margin_box.right - 200, margin_box.top - 20], width: 200 do
|
||||
text I18n.t('documents.group_order_invoice_pdf.invoicer')
|
||||
|
|
@ -69,8 +69,6 @@ class GroupOrderInvoicePdf < RenderPdf
|
|||
|
||||
#------------- Table Data -----------------------
|
||||
|
||||
@group_order = GroupOrder.find(@options[:group_order].id)
|
||||
|
||||
if FoodsoftConfig[:group_order_invoices][:vat_exempt]
|
||||
body_for_vat_exempt
|
||||
else
|
||||
|
|
@ -82,7 +80,8 @@ class GroupOrderInvoicePdf < RenderPdf
|
|||
total_gross = 0
|
||||
data = [I18n.t('documents.group_order_invoice_pdf.vat_exempt_rows')]
|
||||
move_down 10
|
||||
group_order_articles = GroupOrderArticle.where(group_order_id: @group_order.id)
|
||||
# no sinle group_order_id, capice? get all the articles.
|
||||
group_order_articles = GroupOrderArticle.where(group_order_ids: @options.group_order_ids)
|
||||
separate_deposits = FoodsoftConfig[:group_order_invoices]&.[](:separate_deposits)
|
||||
group_order_articles.each do |goa|
|
||||
# if no unit is received, nothing is to be charged
|
||||
|
|
@ -173,7 +172,7 @@ class GroupOrderInvoicePdf < RenderPdf
|
|||
else
|
||||
[I18n.t('documents.group_order_invoice_pdf.price_markup_rows', marge: marge)]
|
||||
end
|
||||
goa_tax_hash = GroupOrderArticle.where(group_order_id: @group_order.id).find_each.group_by { |oat| oat.order_article.price.tax }
|
||||
goa_tax_hash = GroupOrderArticle.where(group_order_id: @options[:group_order_ids]).find_each.group_by { |oat| oat.order_article.price.tax }
|
||||
goa_tax_hash.each do |tax, group_order_articles|
|
||||
group_order_articles.each do |goa|
|
||||
# if no unit is received, nothing is to be charged
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue