Add option to create a new FinancialTransaction at a FinancialLink
This commit is contained in:
parent
0e77a0e77c
commit
a30d0d4453
8 changed files with 66 additions and 1 deletions
|
|
@ -37,4 +37,8 @@ class FinancialLink < ApplicationRecord
|
|||
def self.first_unused_or_create
|
||||
unused.first || create
|
||||
end
|
||||
|
||||
def amount
|
||||
bank_transactions.sum(:amount) + invoices.sum(:amount) - financial_transactions.sum(:amount)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue