Add CSV downloads for BankTransaction and Invoice
This commit is contained in:
parent
e0c0834690
commit
9f2e630266
6 changed files with 96 additions and 6 deletions
|
|
@ -5,7 +5,15 @@ class Finance::InvoicesController < ApplicationController
|
|||
before_action :ensure_can_edit, only: [:edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@invoices = Invoice.includes(:supplier, :deliveries, :orders).order('date DESC').page(params[:page]).per(@per_page)
|
||||
@invoices_all = Invoice.includes(:supplier, :deliveries, :orders).order('date DESC')
|
||||
@invoices = @invoices_all.page(params[:page]).per(@per_page)
|
||||
|
||||
respond_to do |format|
|
||||
format.js; format.html { render }
|
||||
format.csv do
|
||||
send_data InvoicesCsv.new(@invoices_all).to_csv, filename: 'invoices.csv', type: 'text/csv'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def unpaid
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue