Class: Skr::Customer

Inherits:
Model
  • Object
show all
Includes:
BusinessEntity
Defined in:
lib/skr/customer.rb

Overview

Customers are Companies (or individuals) that purchase Skus. They have both a billing and shipping address, a gl account that payments should be applied against, and a payment term.

Instance Method Summary collapse

Instance Method Details

#update_balance!Object

Updates the amount the customer owes, which is the sum of the amount unpaid on open invoices



22
23
24
25
# File 'lib/skr/customer.rb', line 22

def update_balance!(*)
    update_attributes open_balance: invoices.open_for_customer(self)
                                            .with_details.sum('details.total')
end