Preisänderungen beim Abrechnen können auch global angewandt werden.
This commit is contained in:
parent
7b7d50a235
commit
2c1385c9ce
3 changed files with 9 additions and 3 deletions
|
@ -136,7 +136,7 @@ class Finance::BalancingController < ApplicationController
|
||||||
def update_order_article
|
def update_order_article
|
||||||
@order_article = OrderArticle.find(params[:id])
|
@order_article = OrderArticle.find(params[:id])
|
||||||
begin
|
begin
|
||||||
@order_article.update_article_and_price!(params[:article], params[:price], params[:order_article])
|
@order_article.update_article_and_price!(params[:article], params[:price], params[:order_article], params[:price_global])
|
||||||
render :update do |page|
|
render :update do |page|
|
||||||
page["edit_box"].hide
|
page["edit_box"].hide
|
||||||
page["summary"].replace_html :partial => 'summary', :locals => {:order => @order_article.order}
|
page["summary"].replace_html :partial => 'summary', :locals => {:order => @order_article.order}
|
||||||
|
|
|
@ -77,10 +77,12 @@ class OrderArticle < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# Updates order_article and belongings during balancing process
|
# Updates order_article and belongings during balancing process
|
||||||
def update_article_and_price!(article_attributes, price_attributes, order_article_attributes)
|
def update_article_and_price!(article_attributes, price_attributes, order_article_attributes, global_attribute)
|
||||||
OrderArticle.transaction do
|
OrderArticle.transaction do
|
||||||
# Updates article
|
# Updates article
|
||||||
article.update_attributes!(article_attributes)
|
article.update_attributes!(article_attributes)
|
||||||
|
article.update_attributes!(price_attributes) if global_attribute
|
||||||
|
|
||||||
|
|
||||||
article_price.attributes = price_attributes
|
article_price.attributes = price_attributes
|
||||||
if article_price.changed?
|
if article_price.changed?
|
||||||
|
@ -93,6 +95,7 @@ class OrderArticle < ActiveRecord::Base
|
||||||
group_order_articles.each { |goa| goa.group_order.update_price! }
|
group_order_articles.each { |goa| goa.group_order.update_price! }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Updates units_to_order
|
# Updates units_to_order
|
||||||
self.attributes = order_article_attributes
|
self.attributes = order_article_attributes
|
||||||
self.save!
|
self.save!
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
%th Netto
|
%th Netto
|
||||||
%th MwSt.
|
%th MwSt.
|
||||||
%th Pfand
|
%th Pfand
|
||||||
|
%th
|
||||||
|
%abbr{:title=>"Aendert den Preis auch fuer zukuenftige Bestellungen"} Preisaenderung (Preis/MwSt/Pfand) global anwenden
|
||||||
%tr
|
%tr
|
||||||
%td= text_field_tag 'article[name]', @order_article.article.name, :size => 20
|
%td= text_field_tag 'article[name]', @order_article.article.name, :size => 20
|
||||||
%td= text_field_tag 'article[order_number]', @order_article.article.order_number, :size => 3
|
%td= text_field_tag 'article[order_number]', @order_article.article.order_number, :size => 3
|
||||||
|
@ -20,6 +22,7 @@
|
||||||
%td= text_field_tag 'price[price]', @order_article.price.price, :size => 3
|
%td= text_field_tag 'price[price]', @order_article.price.price, :size => 3
|
||||||
%td= text_field_tag 'price[tax]', @order_article.price.tax, :size => 3
|
%td= text_field_tag 'price[tax]', @order_article.price.tax, :size => 3
|
||||||
%td= text_field_tag 'price[deposit]', @order_article.price.deposit, :size => 3
|
%td= text_field_tag 'price[deposit]', @order_article.price.deposit, :size => 3
|
||||||
|
%td= check_box_tag 'price_global'
|
||||||
%br/
|
%br/
|
||||||
= submit_tag "Speichern"
|
= submit_tag "Speichern"
|
||||||
|
|
|
|
||||||
|
|
Loading…
Reference in a new issue