class Reporting::Accounting::InvoicesJob < Reporting::Job
  def process
    invoices = @school.accounting_invoices.where(id: @params['invoice_ids'])
    create_tmp_file
    create_pdf
    invoices.each do |invoice|
      file = Pdf::Accounting::InvoiceService.call(@school, invoice.id)
      @pdf << CombinePDF.load(file.path)
    end

    save_pdf

    @filename = "accounting_invoices_#{timestamp}.pdf"

    save_to_user
    send_report
  end
end
