Fixed bug order.profit calculation.

Order.profit will also be saved, when order is closed.
This commit is contained in:
Benjamin Meichsner 2009-03-17 19:43:41 +01:00
parent 843e4a7233
commit da08365816
32 changed files with 408 additions and 34 deletions

View file

@ -1,5 +1,5 @@
# == Schema Information
# Schema version: 20090120184410
# Schema version: 20090317175355
#
# Table name: articles
#

View file

@ -1,5 +1,5 @@
# == Schema Information
# Schema version: 20090119155930
# Schema version: 20090317175355
#
# Table name: orders
#
@ -11,6 +11,7 @@
# state :string(255) default("open")
# lock_version :integer default(0), not null
# updated_by_user_id :integer
# foodcoop_result :decimal(8, 2)
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

View file

@ -1,5 +1,5 @@
# == Schema Information
# Schema version: 20090120184410
# Schema version: 20090317175355
#
# Table name: stock_changes
#
@ -9,6 +9,7 @@
# stock_article_id :integer
# quantity :integer default(0)
# created_at :datetime
# stock_taking_id :integer
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

View file

@ -1,3 +1,14 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: stock_takings
#
# id :integer not null, primary key
# date :date
# note :text
# created_at :datetime
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:

View file

@ -1,24 +1,21 @@
# == Schema Information
# Schema version: 20090120184410
# Schema version: 20090317175355
#
# Table name: suppliers
#
# id :integer not null, primary key
# name :string(255) default(""), not null
# address :string(255) default(""), not null
# phone :string(255) default(""), not null
# phone2 :string(255)
# fax :string(255)
# email :string(255)
# url :string(255)
# contact_person :string(255)
# customer_number :string(255)
# delivery_days :string(255)
# order_howto :string(255)
# note :string(255)
# shared_supplier_id :integer
# min_order_quantity :string(255)
# deleted_at :datetime
# id :integer(4) not null, primary key
# name :string(255) not null
# address :string(255) not null
# phone :string(255) not null
# phone2 :string(255)
# fax :string(255)
# email :string(255)
# url :string(255)
# delivery_days :string(255)
# note :string(255)
# created_on :datetime
# updated_on :datetime
# lists :string(255)
#
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html

View file

@ -1,3 +1,13 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: article_categories
#
# id :integer not null, primary key
# name :string(255) default(""), not null
# description :string(255)
#
require File.dirname(__FILE__) + '/../test_helper'
class ArticleCategoryTest < Test::Unit::TestCase

View file

@ -1,3 +1,17 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: article_prices
#
# id :integer not null, primary key
# article_id :integer
# price :decimal(8, 2) default(0.0), not null
# tax :decimal(8, 2) default(0.0), not null
# deposit :decimal(8, 2) default(0.0), not null
# unit_quantity :integer
# created_at :datetime
#
require 'test_helper'
class ArticlePriceTest < ActiveSupport::TestCase

View file

@ -1,3 +1,30 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: articles
#
# id :integer not null, primary key
# name :string(255) default(""), not null
# supplier_id :integer default(0), not null
# article_category_id :integer default(0), not null
# unit :string(255) default(""), not null
# note :string(255)
# availability :boolean default(TRUE), not null
# manufacturer :string(255)
# origin :string(255)
# shared_updated_on :datetime
# price :decimal(, )
# tax :float
# deposit :decimal(, ) default(0.0)
# unit_quantity :integer default(1), not null
# order_number :string(255)
# created_at :datetime
# updated_at :datetime
# quantity :integer default(0)
# deleted_at :datetime
# type :string(255)
#
require File.dirname(__FILE__) + '/../test_helper'
class ArticleTest < Test::Unit::TestCase

View file

@ -1,3 +1,14 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: assignments
#
# id :integer not null, primary key
# user_id :integer default(0), not null
# task_id :integer default(0), not null
# accepted :boolean
#
require File.dirname(__FILE__) + '/../test_helper'
class AssignmentTest < Test::Unit::TestCase

View file

@ -1,3 +1,16 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: financial_transactions
#
# id :integer not null, primary key
# ordergroup_id :integer default(0), not null
# amount :decimal(8, 2) default(0.0), not null
# note :text not null
# user_id :integer default(0), not null
# created_on :datetime not null
#
require File.dirname(__FILE__) + '/../test_helper'
class FinancialTransactionTest < Test::Unit::TestCase

View file

@ -1,3 +1,15 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: group_order_article_quantities
#
# id :integer not null, primary key
# group_order_article_id :integer default(0), not null
# quantity :integer default(0)
# tolerance :integer default(0)
# created_on :datetime not null
#
require File.dirname(__FILE__) + '/../test_helper'
class GroupOrderArticleQuantityTest < Test::Unit::TestCase

View file

@ -1,3 +1,31 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: groups
#
# id :integer not null, primary key
# type :string(255) default(""), not null
# name :string(255) default(""), not null
# description :string(255)
# account_balance :decimal(, ) default(0.0), not null
# account_updated :datetime
# created_on :datetime not null
# role_admin :boolean not null
# role_suppliers :boolean not null
# role_article_meta :boolean not null
# role_finance :boolean not null
# role_orders :boolean not null
# weekly_task :boolean
# weekday :integer
# task_name :string(255)
# task_description :string(255)
# task_required_users :integer default(1)
# deleted_at :datetime
# contact_person :string(255)
# contact_phone :string(255)
# contact_address :string(255)
#
require File.dirname(__FILE__) + '/../test_helper'
class GroupTest < Test::Unit::TestCase

View file

@ -1,3 +1,13 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: memberships
#
# id :integer not null, primary key
# group_id :integer default(0), not null
# user_id :integer default(0), not null
#
require File.dirname(__FILE__) + '/../test_helper'
class MembershipTest < Test::Unit::TestCase

View file

@ -1,3 +1,15 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: order_comments
#
# id :integer not null, primary key
# order_id :integer
# user_id :integer
# text :text
# created_at :datetime
#
require 'test_helper'
class OrderCommentTest < ActiveSupport::TestCase

View file

@ -1,3 +1,19 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: orders
#
# id :integer not null, primary key
# supplier_id :integer
# note :text
# starts :datetime
# ends :datetime
# state :string(255) default("open")
# lock_version :integer default(0), not null
# updated_by_user_id :integer
# foodcoop_result :decimal(8, 2)
#
require File.dirname(__FILE__) + '/../test_helper'
class OrderTest < Test::Unit::TestCase

View file

@ -1,3 +1,27 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: articles
#
# id :integer(4) not null, primary key
# name :string(255) not null
# supplier_id :integer(4) not null
# number :string(255)
# note :string(255)
# manufacturer :string(255)
# origin :string(255)
# unit :string(255)
# price :decimal(8, 2) default(0.0), not null
# tax :decimal(3, 1) default(7.0), not null
# deposit :decimal(8, 2) default(0.0), not null
# unit_quantity :decimal(4, 1) default(1.0), not null
# scale_quantity :decimal(4, 2)
# scale_price :decimal(8, 2)
# created_on :datetime
# updated_on :datetime
# list :string(255)
#
require File.dirname(__FILE__) + '/../test_helper'
class SharedArticleTest < Test::Unit::TestCase

View file

@ -1,3 +1,23 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: suppliers
#
# id :integer(4) not null, primary key
# name :string(255) not null
# address :string(255) not null
# phone :string(255) not null
# phone2 :string(255)
# fax :string(255)
# email :string(255)
# url :string(255)
# delivery_days :string(255)
# note :string(255)
# created_on :datetime
# updated_on :datetime
# lists :string(255)
#
require File.dirname(__FILE__) + '/../test_helper'
class SharedSupplierTest < Test::Unit::TestCase

View file

@ -1,3 +1,30 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: articles
#
# id :integer not null, primary key
# name :string(255) default(""), not null
# supplier_id :integer default(0), not null
# article_category_id :integer default(0), not null
# unit :string(255) default(""), not null
# note :string(255)
# availability :boolean default(TRUE), not null
# manufacturer :string(255)
# origin :string(255)
# shared_updated_on :datetime
# price :decimal(, )
# tax :float
# deposit :decimal(, ) default(0.0)
# unit_quantity :integer default(1), not null
# order_number :string(255)
# created_at :datetime
# updated_at :datetime
# quantity :integer default(0)
# deleted_at :datetime
# type :string(255)
#
require 'test_helper'
class StockArticleTest < ActiveSupport::TestCase

View file

@ -1,3 +1,17 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: stock_changes
#
# id :integer not null, primary key
# delivery_id :integer
# order_id :integer
# stock_article_id :integer
# quantity :integer default(0)
# created_at :datetime
# stock_taking_id :integer
#
require 'test_helper'
class StockChangeTest < ActiveSupport::TestCase

View file

@ -1,3 +1,14 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: stock_takings
#
# id :integer not null, primary key
# date :date
# note :text
# created_at :datetime
#
require 'test_helper'
class StockTakingTest < ActiveSupport::TestCase

View file

@ -1,3 +1,26 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: suppliers
#
# id :integer not null, primary key
# name :string(255) default(""), not null
# address :string(255) default(""), not null
# phone :string(255) default(""), not null
# phone2 :string(255)
# fax :string(255)
# email :string(255)
# url :string(255)
# contact_person :string(255)
# customer_number :string(255)
# delivery_days :string(255)
# order_howto :string(255)
# note :string(255)
# shared_supplier_id :integer
# min_order_quantity :string(255)
# deleted_at :datetime
#
require File.dirname(__FILE__) + '/../test_helper'
class SupplierTest < Test::Unit::TestCase

View file

@ -1,3 +1,20 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: tasks
#
# id :integer not null, primary key
# name :string(255) default(""), not null
# description :string(255)
# due_date :date
# done :boolean
# workgroup_id :integer
# assigned :boolean
# created_on :datetime not null
# updated_on :datetime not null
# required_users :integer default(1)
#
require File.dirname(__FILE__) + '/../test_helper'
class TaskTest < Test::Unit::TestCase

View file

@ -1,3 +1,22 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: users
#
# id :integer not null, primary key
# nick :string(255) default(""), not null
# password_hash :string(255) default(""), not null
# password_salt :string(255) default(""), not null
# first_name :string(255) default(""), not null
# last_name :string(255) default(""), not null
# email :string(255) default(""), not null
# phone :string(255)
# created_on :datetime not null
# reset_password_token :string(255)
# reset_password_expires :datetime
# last_login :datetime
#
require File.dirname(__FILE__) + '/../test_helper'
class UserTest < Test::Unit::TestCase

View file

@ -1,3 +1,31 @@
# == Schema Information
# Schema version: 20090317175355
#
# Table name: groups
#
# id :integer not null, primary key
# type :string(255) default(""), not null
# name :string(255) default(""), not null
# description :string(255)
# account_balance :decimal(, ) default(0.0), not null
# account_updated :datetime
# created_on :datetime not null
# role_admin :boolean not null
# role_suppliers :boolean not null
# role_article_meta :boolean not null
# role_finance :boolean not null
# role_orders :boolean not null
# weekly_task :boolean
# weekday :integer
# task_name :string(255)
# task_description :string(255)
# task_required_users :integer default(1)
# deleted_at :datetime
# contact_person :string(255)
# contact_phone :string(255)
# contact_address :string(255)
#
require 'test_helper'
class WorkgroupTest < ActiveSupport::TestCase