Class: Split
- Inherits:
-
SqliteBase
- Object
- ActiveRecord::Base
- SqliteBase
- Split
- Defined in:
- lib/models/split.rb
Instance Method Summary collapse
-
#amount ⇒ Object
attribute :rdate, :date after_find do |s| if s.reconcile_date.present? s.rdate = Date.parse(s.reconcile_date) end end.
- #details ⇒ Object
Instance Method Details
#amount ⇒ Object
attribute :rdate, :date after_find do |s|
if s.reconcile_date.present?
s.rdate = Date.parse(s.reconcile_date)
end
end
13 14 15 |
# File 'lib/models/split.rb', line 13 def amount return "#{self.value_num / self.value_denom}.#{self.value_num % self.value_denom}" end |
#details ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/models/split.rb', line 17 def details acct = self.cash_account fund = acct.name parent = acct.parent acct_name = parent.present? ? "#{parent.name}:#{acct.name}" : acct.name amt = self.value_num if amt.to_f < 0 credit = amt * -1 debit = 0 else credit = 0 debit = amt end return {fund:fund,name:acct_name,cr:credit,db:debit, memo:self.memo, r:self.reconcile_state, aguid:self.account_guid} end |