2021-02-08 01:07:10 +01:00
|
|
|
require 'csv'
|
|
|
|
|
2022-10-18 17:23:18 +02:00
|
|
|
class InvoicesCsv < RenderCsv
|
2021-02-08 01:07:10 +01:00
|
|
|
include ApplicationHelper
|
|
|
|
|
|
|
|
def header
|
|
|
|
[
|
|
|
|
Invoice.human_attribute_name(:created_at),
|
|
|
|
Invoice.human_attribute_name(:created_by),
|
|
|
|
Invoice.human_attribute_name(:date),
|
|
|
|
Invoice.human_attribute_name(:supplier),
|
|
|
|
Invoice.human_attribute_name(:number),
|
|
|
|
Invoice.human_attribute_name(:amount),
|
2022-02-18 13:03:34 +01:00
|
|
|
Invoice.human_attribute_name(:total),
|
2021-02-08 01:07:10 +01:00
|
|
|
Invoice.human_attribute_name(:deposit),
|
|
|
|
Invoice.human_attribute_name(:deposit_credit),
|
|
|
|
Invoice.human_attribute_name(:paid_on),
|
|
|
|
Invoice.human_attribute_name(:note)
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def data
|
|
|
|
@object.each do |t|
|
|
|
|
yield [
|
|
|
|
t.created_at,
|
|
|
|
show_user(t.created_by),
|
|
|
|
t.date,
|
|
|
|
t.supplier.name,
|
|
|
|
t.number,
|
|
|
|
t.amount,
|
2022-02-18 13:03:34 +01:00
|
|
|
t.expected_amount,
|
2021-02-08 01:07:10 +01:00
|
|
|
t.deposit,
|
|
|
|
t.deposit_credit,
|
|
|
|
t.paid_on,
|
|
|
|
t.note,
|
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|