Add FinancialLinks
For now this is only usefull for plugins, since there is no UI.
This commit is contained in:
parent
75deec9f06
commit
53bb096046
12 changed files with 95 additions and 7 deletions
27
app/controllers/finance/financial_links_controller.rb
Normal file
27
app/controllers/finance/financial_links_controller.rb
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
class Finance::FinancialLinksController < Finance::BaseController
|
||||
|
||||
def show
|
||||
@financial_link = FinancialLink.find(params[:id])
|
||||
|
||||
@items = @financial_link.financial_transactions.map do |ft|
|
||||
{
|
||||
date: ft.created_on,
|
||||
type: t('activerecord.models.financial_transaction'),
|
||||
description: "#{ft.ordergroup.name}: #{ft.note}",
|
||||
amount: ft.amount,
|
||||
link_to: finance_ordergroup_transactions_path(ft.ordergroup)
|
||||
}
|
||||
end
|
||||
@items += @financial_link.invoices.map do |invoice|
|
||||
{
|
||||
date: invoice.date || invoice.created_at,
|
||||
type: t('activerecord.models.invoice'),
|
||||
description: "#{invoice.supplier.name}: #{invoice.number}",
|
||||
amount: invoice.amount,
|
||||
link_to: finance_invoice_path(invoice)
|
||||
}
|
||||
end
|
||||
@items.sort_by! { |item| item[:date] }
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue