Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pythonandchips/d40f7b2f314446a2dcfd58a7cd21e84c to your computer and use it in GitHub Desktop.
Save pythonandchips/d40f7b2f314446a2dcfd58a7cd21e84c to your computer and use it in GitHub Desktop.
Get list of negative recurring invoices
negative_recurring_invoice_profiles = []
count = RecurringInvoiceProfile.active.count
progress = ProgressBar.new(count)
RecurringInvoiceProfile.includes(
:company,
:contact,
{recurring_invoice_profile_items: [:general_ledger_account, :company]},
).active.find_each do |recurring_invoice_profile|
if recurring_invoice_profile.value.total.negative?
negative_recurring_invoice_profiles << recurring_invoice_profile
end
progress.increment!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment