sort ordergroups in order screen and pdfs
This commit is contained in:
parent
8ca95f396f
commit
b11706f30a
6 changed files with 7 additions and 5 deletions
|
@ -14,7 +14,7 @@ class OrderByArticles < OrderPdf
|
||||||
@order.order_articles.ordered.each do |order_article|
|
@order.order_articles.ordered.each do |order_article|
|
||||||
rows = []
|
rows = []
|
||||||
dimrows = []
|
dimrows = []
|
||||||
for goa in order_article.group_order_articles
|
for goa in order_article.group_order_articles.ordered
|
||||||
rows << [goa.group_order.ordergroup.name,
|
rows << [goa.group_order.ordergroup.name,
|
||||||
"#{goa.quantity} + #{goa.tolerance}",
|
"#{goa.quantity} + #{goa.tolerance}",
|
||||||
goa.result,
|
goa.result,
|
||||||
|
|
|
@ -12,7 +12,7 @@ class OrderByGroups < OrderPdf
|
||||||
|
|
||||||
def body
|
def body
|
||||||
# Start rendering
|
# Start rendering
|
||||||
@order.group_orders.each do |group_order|
|
@order.group_orders.ordered.each do |group_order|
|
||||||
total = 0
|
total = 0
|
||||||
rows = []
|
rows = []
|
||||||
dimrows = []
|
dimrows = []
|
||||||
|
|
|
@ -17,6 +17,8 @@ class GroupOrder < ActiveRecord::Base
|
||||||
scope :in_open_orders, joins(:order).merge(Order.open)
|
scope :in_open_orders, joins(:order).merge(Order.open)
|
||||||
scope :in_finished_orders, joins(:order).merge(Order.finished_not_closed)
|
scope :in_finished_orders, joins(:order).merge(Order.finished_not_closed)
|
||||||
|
|
||||||
|
scope :ordered, :include => :ordergroup, :order => 'groups.name'
|
||||||
|
|
||||||
# Generate some data for the javascript methods in ordering view
|
# Generate some data for the javascript methods in ordering view
|
||||||
def load_data
|
def load_data
|
||||||
data = {}
|
data = {}
|
||||||
|
|
|
@ -14,7 +14,7 @@ class GroupOrderArticle < ActiveRecord::Base
|
||||||
validates_inclusion_of :tolerance, :in => 0..99
|
validates_inclusion_of :tolerance, :in => 0..99
|
||||||
validates_uniqueness_of :order_article_id, :scope => :group_order_id # just once an article per group order
|
validates_uniqueness_of :order_article_id, :scope => :group_order_id # just once an article per group order
|
||||||
|
|
||||||
scope :ordered, :conditions => 'result > 0 OR quantity > 0 OR tolerance > 0'
|
scope :ordered, :conditions => 'group_order_articles.result > 0 OR group_order_articles.quantity > 0 OR group_order_articles.tolerance > 0', :include => {:group_order => :ordergroup}, :order => 'groups.name'
|
||||||
|
|
||||||
localize_input_of :result
|
localize_input_of :result
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
= order_article.article.name
|
= order_article.article.name
|
||||||
= "(#{order_article.article.unit} | #{order_article.price.unit_quantity} | #{number_to_currency(order_article.price.gross_price)})"
|
= "(#{order_article.article.unit} | #{order_article.price.unit_quantity} | #{number_to_currency(order_article.price.gross_price)})"
|
||||||
%tbody
|
%tbody
|
||||||
- for goa in order_article.group_order_articles
|
- for goa in order_article.group_order_articles.ordered
|
||||||
%tr{:class => [cycle('even', 'odd', :name => 'groups'), if goa.result == 0 then 'unavailable' end]}
|
%tr{:class => [cycle('even', 'odd', :name => 'groups'), if goa.result == 0 then 'unavailable' end]}
|
||||||
%td{:style => "width:70%"}=h goa.group_order.ordergroup.name
|
%td{:style => "width:70%"}=h goa.group_order.ordergroup.name
|
||||||
%td= "#{goa.quantity} + #{goa.tolerance}"
|
%td= "#{goa.quantity} + #{goa.tolerance}"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
%th= t '.unit'
|
%th= t '.unit'
|
||||||
%th= t '.price'
|
%th= t '.price'
|
||||||
|
|
||||||
- for group_order in order.group_orders.all
|
- for group_order in order.group_orders.ordered
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th{:colspan => "7"}
|
%th{:colspan => "7"}
|
||||||
|
|
Loading…
Reference in a new issue