Fixed bug order.profit calculation.
Order.profit will also be saved, when order is closed.
This commit is contained in:
parent
843e4a7233
commit
da08365816
32 changed files with 408 additions and 34 deletions
13
db/migrate/20090317175355_add_profit_to_orders.rb
Normal file
13
db/migrate/20090317175355_add_profit_to_orders.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class AddProfitToOrders < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :orders, :foodcoop_result, :decimal, :precision => 8, :scale => 2
|
||||
|
||||
Order.closed.each do |order|
|
||||
order.update_attribute(:foodcoop_result, order.profit)
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :orders, :foodcoop_result
|
||||
end
|
||||
end
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20090119155930) do
|
||||
ActiveRecord::Schema.define(:version => 20090317175355) do
|
||||
|
||||
create_table "article_categories", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
|
|
@ -205,9 +205,10 @@ ActiveRecord::Schema.define(:version => 20090119155930) do
|
|||
t.text "note"
|
||||
t.datetime "starts"
|
||||
t.datetime "ends"
|
||||
t.string "state", :default => "open"
|
||||
t.integer "lock_version", :default => 0, :null => false
|
||||
t.string "state", :default => "open"
|
||||
t.integer "lock_version", :default => 0, :null => false
|
||||
t.integer "updated_by_user_id"
|
||||
t.decimal "foodcoop_result", :precision => 8, :scale => 2
|
||||
end
|
||||
|
||||
create_table "stock_changes", :force => true do |t|
|
||||
|
|
@ -216,12 +217,12 @@ ActiveRecord::Schema.define(:version => 20090119155930) do
|
|||
t.integer "stock_article_id"
|
||||
t.integer "quantity", :default => 0
|
||||
t.datetime "created_at"
|
||||
t.integer "stock_taking_id"
|
||||
end
|
||||
|
||||
create_table "stock_takings", :force => true do |t|
|
||||
t.date "date"
|
||||
t.text "note"
|
||||
t.integer "created_by"
|
||||
t.datetime "created_at"
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue