Skip to content

Commit

Permalink
Trialbalance by date
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioelia committed Jan 26, 2013
1 parent 9cefb18 commit e6930ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/plutus/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ class Account < ActiveRecord::Base
# => 0
#
# @return [BigDecimal] The decimal value balance of all accounts
def self.trial_balance
def self.trial_balance(startDate = nil, endDate = nil)
unless self.new.class == Account
raise(NoMethodError, "undefined method 'trial_balance'")
elsif startDate || endDate
Asset.balance( startDate, endDate ) - (Liability.balance( startDate, endDate ) + Equity.balance( startDate, endDate ) + Revenue.balance( startDate, endDate ) - Expense.balance( startDate, endDate ))
else
Asset.balance - (Liability.balance + Equity.balance + Revenue.balance - Expense.balance)
end
Expand Down

0 comments on commit e6930ae

Please sign in to comment.