Method: Billingly::BaseCustomer.debtors
- Defined in:
- app/models/billingly/base_customer.rb
.debtors ⇒ Object
Note:
A customer may be a debtor and still have an active account until Billingly’s rake task goes through the process of deactivating all debtors.
Furthermore, customers may unsubscribe before their invoices become overdue, hence they may be in a deactivated state and not be debtors yet.
A customer who has overdue invoices at the time of asking this question is considered a debtor.
200 201 202 203 204 |
# File 'app/models/billingly/base_customer.rb', line 200 def self.debtors joins(:invoices).readonly(false) .where("#{Billingly::Invoice.table_name}.due_on < ?", Time.now) .where(billingly_invoices: {deleted_on: nil, paid_on: nil}) end |