order articles by number then name in fax+receive

This makes it easier to enter the receive screen from an order pdf print
with received amounts.

Conflicts:
	app/documents/order_fax.rb
This commit is contained in:
wvengen 2014-08-18 10:56:03 +02:00
parent fd8b9ac19d
commit e61c3c9267
3 changed files with 3 additions and 3 deletions

View file

@ -114,7 +114,7 @@ class OrdersController < ApplicationController
def receive def receive
@order = Order.find(params[:id]) @order = Order.find(params[:id])
unless request.post? unless request.post?
@order_articles = @order.order_articles.ordered.includes(:article) @order_articles = @order.order_articles.ordered.includes(:article).order('articles.order_number, articles.name')
else else
s = update_order_amounts s = update_order_amounts
flash[:notice] = (s ? I18n.t('orders.receive.notice', :msg => s) : I18n.t('orders.receive.notice_none')) flash[:notice] = (s ? I18n.t('orders.receive.notice', :msg => s) : I18n.t('orders.receive.notice_none'))

View file

@ -58,7 +58,7 @@ class OrderFax < OrderPdf
# Articles # Articles
total = 0 total = 0
data = [I18n.t('documents.order_fax.rows')] data = [I18n.t('documents.order_fax.rows')]
data += @order.order_articles.ordered.includes(:article).collect do |a| data += @order.order_articles.ordered.includes(:article).order('articles.order_number, articles.name').collect do |a|
subtotal = a.units_to_order * a.price.unit_quantity * a.price.price subtotal = a.units_to_order * a.price.unit_quantity * a.price.price
total += subtotal total += subtotal
[a.article.order_number, [a.article.order_number,

View file

@ -78,7 +78,7 @@
%thead %thead
%tr %tr
%th.sort{:data => {:sort => 'string'}}= heading_helper Article, :order_number, short: true %th.sort{:data => {:sort => 'string'}}= heading_helper Article, :order_number, short: true
%th.default-sort.sort{:data => {:sort => 'string'}}= heading_helper Article, :name %th.sort{:data => {:sort => 'string'}}= heading_helper Article, :name
%th= heading_helper Article, :unit %th= heading_helper Article, :unit
%th= heading_helper Article, :price %th= heading_helper Article, :price
%th= heading_helper OrderArticle, :quantity, short: true %th= heading_helper OrderArticle, :quantity, short: true