class Xeroizer::Record::BankTransaction

Constants

BANK_TRANSACTION_STATUS
BANK_TRANSACTION_STATUSES

Public Class Methods

new(parent) click to toggle source
Calls superclass method
# File lib/xeroizer/models/bank_transaction.rb, line 23
def initialize(parent)
  super parent
  self.line_amount_types = "Exclusive"
end

Public Instance Methods

sub_total() click to toggle source
# File lib/xeroizer/models/bank_transaction.rb, line 71
def sub_total
  if ought_to_recalculate_totals?
    result = LineItemSum.sub_total(self.line_items)
    result -= total_tax if line_amount_types == 'Inclusive'
    result
  else
    attributes[:sub_total]
  end
end
sub_total=(value) click to toggle source
# File lib/xeroizer/models/bank_transaction.rb, line 65
def sub_total=(value); raise SettingTotalDirectlyNotSupported.new(:sub_total); end
total() click to toggle source
# File lib/xeroizer/models/bank_transaction.rb, line 69
def total; sub_total + total_tax; end
total=(value) click to toggle source
# File lib/xeroizer/models/bank_transaction.rb, line 67
def total=(value);     raise SettingTotalDirectlyNotSupported.new(:total);     end
total_tax() click to toggle source
# File lib/xeroizer/models/bank_transaction.rb, line 81
def total_tax
  return ought_to_recalculate_totals? ?
    LineItemSum.total_tax(self.line_items) :
    attributes[:total_tax]
end
total_tax=(value) click to toggle source
# File lib/xeroizer/models/bank_transaction.rb, line 66
def total_tax=(value); raise SettingTotalDirectlyNotSupported.new(:total_tax); end

Private Instance Methods

ought_to_recalculate_totals?() click to toggle source
# File lib/xeroizer/models/bank_transaction.rb, line 89
def ought_to_recalculate_totals?
  new_record? || line_items && line_items.size > 0
end