Skip to content

Commit

Permalink
Fix for yesturdays bad code
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioelia committed Jan 26, 2013
1 parent 3399dd7 commit fb39ce5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/plutus/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class Account < ActiveRecord::Base
validates_uniqueness_of :name

def credits_by_date(start_date = "1900-01-01", end_date = Date.today + 15.days)
self.credit_amounts.includes(:transaction).where("plutus_transactions.date >= '#{start_date}' AND DATE( plutus_transactions.date) <= '#{end_date.to_s}'")
credit_amounts.includes(:transaction).where("plutus_transactions.date >= '#{start_date}' AND DATE( plutus_transactions.date) <= '#{end_date.to_s}'")
end

def debits_by_date(start_date = "1900-01-01", end_date = Date.today + 15.days)
self.debit_amounts.includes(:transaction).where("plutus_transactions.date >= '#{start_date}' AND DATE( plutus_transactions.date ) <= '#{end_date.to_s}'")
debit_amounts.includes(:transaction).where("plutus_transactions.date >= '#{start_date}' AND DATE( plutus_transactions.date ) <= '#{end_date.to_s}'")
end

# The trial balance of all accounts in the system. This should always equal zero,
Expand All @@ -58,7 +58,7 @@ def debits_by_date(start_date = "1900-01-01", end_date = Date.today + 15.days)
#
# @return [BigDecimal] The decimal value balance of all accounts
def self.trial_balance(startDate = nil, endDate = nil)
unless self.new.class == Account
if 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 ))
Expand Down

0 comments on commit fb39ce5

Please sign in to comment.