This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
content = CSV.generate do |csv| | |
csv << ["Program ID", "Program Name", "Master Organization ID", "Master Organization Name", "Organization ID", "Organization Name", "Schedule", "Credit Limit", "Credit Limit Note", "Last Invoice Created At", "Last Invoice Number", "Last Invoice Amount"] | |
InvoiceAccount | |
.includes({organization: [:program, :master_organization]}, :invoices) | |
.commercial | |
.active | |
.order("programs.name", "organizations.name") | |
.each do |invoice_account| | |
organization = invoice_account.organization |