foodsoft/plugins/automatic_invoices/app/views/orders/_articles.html.haml

54 lines
2.1 KiB
Text
Raw Normal View History

2023-10-11 14:53:47 +02:00
%table.table.table-hover
%thead
%tr
%th= heading_helper Article, :name
%th= heading_helper Article, :unit
%th= t '.prices'
- if order.stockit?
%th= t '.units_ordered'
- if FoodsoftConfig[:group_order_invoices]&.[](:separate_deposits)
%th= t '.deposit'
- else
%th= 'Members'
%th= t '.units_full'
- total_net, total_gross, counter = 0, 0, 0
%tbody.list
- order.articles_grouped_by_category.each do |category_name, order_articles|
%tr.list-heading.article-category
%td
= category_name
%i.icon-tag
%td{:colspan => "9"}
- order_articles.each do |order_article|
- net_price = order_article.price.price
- if FoodsoftConfig[:group_order_invoices]&.[](:separate_deposits)
- gross_price = order_article.price.gross_price_without_deposit
- else
- gross_price = order_article.price.gross_price
- unit_quantity = order_article.price.unit_quantity
- units = order_article.units
- total_net += units * unit_quantity * net_price
- total_gross += units * unit_quantity * gross_price
%tr{:class => cycle('even', 'odd', :name => 'articles') + ' ' + order_article_class(order_article)}
%td.name=h order_article.article.name
%td= order_article.article.unit
%td= "#{number_to_currency(net_price)} / #{number_to_currency(gross_price)}"
- if FoodsoftConfig[:group_order_invoices]&.[](:separate_deposits)
%td= "#{number_to_currency(order_article.price.deposit)}"
- if order.stockit?
%td= units
- else
- if unit_quantity > 1 or order_article.tolerance > 0
%td= "#{order_article.quantity} + #{order_article.tolerance}"
- else
%td= "#{order_article.quantity}"
%td{title: units_history_line(order_article, plain: true)}
= units
= pkg_helper order_article.price
%p
= t '.prices_sum'
= "#{number_to_currency(total_net)} / #{number_to_currency(total_gross)}"
%p
= t '.article_count'
= order.order_articles.ordered.count