From f6552724487d5c4bf1c067c7e776c672e3022be7 Mon Sep 17 00:00:00 2001 From: sandoz Date: Fri, 20 Mar 2009 23:00:42 +0800 Subject: [PATCH 1/4] Removed auto-created fixtures in stock_takings.yml Signed-off-by: bennibu --- test/fixtures/stock_takings.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/test/fixtures/stock_takings.yml b/test/fixtures/stock_takings.yml index e966ff1c..1d32b4b5 100644 --- a/test/fixtures/stock_takings.yml +++ b/test/fixtures/stock_takings.yml @@ -11,14 +11,3 @@ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html -one: - date: 2009-02-12 - note: MyText - created_by: 1 - created_at: 2009-02-12 14:53:06 - -two: - date: 2009-02-12 - note: MyText - created_by: 1 - created_at: 2009-02-12 14:53:06 From 39fdda401959869b5eba0ebac90068e857fb1481 Mon Sep 17 00:00:00 2001 From: sandoz Date: Fri, 20 Mar 2009 23:32:47 +0800 Subject: [PATCH 2/4] Fixed buggy link in finance/balancing/new.html.haml * Link to "Rechnung anlegen" did not send supplier id. Signed-off-by: bennibu --- app/views/finance/balancing/new.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/finance/balancing/new.html.haml b/app/views/finance/balancing/new.html.haml index 71b4e9e8..da9af99d 100644 --- a/app/views/finance/balancing/new.html.haml +++ b/app/views/finance/balancing/new.html.haml @@ -22,7 +22,7 @@ .column_content %ul - unless @order.invoice - %li= link_to "Rechnung anlegen", new_finance_invoice_path(:order_id => @order) + %li= link_to "Rechnung anlegen", new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier) - unless @order.closed? %li= link_to "Bestellung abschließen", :action => "confirm", :id => @order From f7f13ee7a60a2867ed5debd5b4be363481a13ffa Mon Sep 17 00:00:00 2001 From: sandoz Date: Sat, 21 Mar 2009 01:54:05 +0800 Subject: [PATCH 3/4] Correct 'brutto'-price to be price.gross not fc_price. * We want to be more consistent in the use of diffrent price types: * netto, brutto, fc_price Signed-off-by: bennibu --- app/views/finance/balancing/_order_article.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/finance/balancing/_order_article.html.haml b/app/views/finance/balancing/_order_article.html.haml index 9ca7f5ab..7b55307e 100644 --- a/app/views/finance/balancing/_order_article.html.haml +++ b/app/views/finance/balancing/_order_article.html.haml @@ -9,7 +9,7 @@ %span{:style => "color:red;font-weight: bold"} ! %td= order_article.price.unit_quantity.to_s + ' * ' + order_article.article.unit.to_s %td= number_to_currency(order_article.price.price, :unit => "") -%td= number_to_currency(order_article.price.fc_price, :unit => "") +%td= number_to_currency(order_article.price.gross_price, :unit => "") %td= order_article.price.tax %td= order_article.price.deposit %td From 3654ba7cf185d7662c4e5c8035b55b4de70cc636 Mon Sep 17 00:00:00 2001 From: sandoz Date: Sat, 21 Mar 2009 01:56:17 +0800 Subject: [PATCH 4/4] Added buttons to in/decrease group order article results. Signed-off-by: bennibu --- .../finance/balancing_controller.rb | 22 +++++++++++++++++++ app/models/group_order_article.rb | 1 + .../balancing/_group_order_articles.html.haml | 4 +++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/controllers/finance/balancing_controller.rb b/app/controllers/finance/balancing_controller.rb index 6ccde68b..570bce98 100644 --- a/app/controllers/finance/balancing_controller.rb +++ b/app/controllers/finance/balancing_controller.rb @@ -196,6 +196,28 @@ class Finance::BalancingController < ApplicationController end end + def update_group_order_article_result + goa = GroupOrderArticle.find(params[:id]) + + if params[:modifier] == '-' + goa.update_attributes({:result => goa.result - 1}) + elsif params[:modifier] == '+' + goa.update_attributes({:result => goa.result + 1}) + end + + render :update do |page| + goa.group_order.update_price! # Update the price attribute of new GroupOrder + goa.order_article.update_results! if goa.order_article.article.is_a?(StockArticle) # Update units_to_order of order_article + + page["order_article_#{goa.order_article.id}"].replace_html :partial => 'order_article', :locals => {:order_article => goa.order_article} + page["group_order_articles_#{goa.order_article.id}"].replace_html :partial => 'group_order_articles', + :locals => {:order_article => goa.order_article} + page["summary"].replace_html :partial => 'summary', :locals => {:order => goa.order_article.order} + page["order_profit"].visual_effect :highlight, :duration => 2 + end + + end + def destroy_group_order_article goa = GroupOrderArticle.find(params[:id]) goa.destroy diff --git a/app/models/group_order_article.rb b/app/models/group_order_article.rb index 3635b689..89d41407 100644 --- a/app/models/group_order_article.rb +++ b/app/models/group_order_article.rb @@ -24,6 +24,7 @@ class GroupOrderArticle < ActiveRecord::Base validates_presence_of :group_order_id, :order_article_id validates_inclusion_of :quantity, :in => 0..99 + validates_inclusion_of :result, :in => 0..99, :allow_nil => true validates_inclusion_of :tolerance, :in => 0..99 validates_uniqueness_of :order_article_id, :scope => :group_order_id # just once an article per group order diff --git a/app/views/finance/balancing/_group_order_articles.html.haml b/app/views/finance/balancing/_group_order_articles.html.haml index af3c283b..f6db6c8c 100644 --- a/app/views/finance/balancing/_group_order_articles.html.haml +++ b/app/views/finance/balancing/_group_order_articles.html.haml @@ -14,8 +14,10 @@ %td %td{:style=>"width:50%"} = group_order_article.group_order.ordergroup.name - %td{:id => "group_order_article_#{group_order_article.id}_quantity"} + %td{:id => "group_order_article_#{group_order_article.id}_quantity", :style => "white-space:nowrap"} = group_order_article.result + = button_to_remote( "+", :url => {:action => "update_group_order_article_result", :id => group_order_article, :modifier => '+'}, :html => {:style => "float:left"}, :success => "Element.hide('loader');", :before => "Element.show('loader');") + = button_to_remote( "-", :url => {:action => "update_group_order_article_result", :id => group_order_article, :modifier => '-'}, :success => "Element.hide('loader');", :before => "Element.show('loader');") %td.currency = number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.result, :unit => "") %td.actions{:style=>"width:1em"}