This commit is contained in:
Nweni
2017-06-29 18:59:17 +06:30
parent 11c3be8f4a
commit 8046bc7745
9 changed files with 119 additions and 69 deletions

View File

@@ -19,4 +19,25 @@ class PaymentJournal < ApplicationRecord
self.created_by = current_user
self.save
end
# def self.today_cash_in(current_user)
# credit = 0.0
# today_date = DateTime.now.strftime("%Y-%m-%d")
# pj_credit = PaymentJournal.where("TO_CHAR(created_at, 'YYYY-MM-DD')=? and created_by=?",today_date, current_user)
# pj_credit.each do |obj|
# credit += obj.credit_amount
# end
# return credit
# end
#
# def self.today_cash_out(current_user)
# debit = 0.0
# today_date = DateTime.now.strftime("%Y-%m-%d")
# pj_debit = PaymentJournal.where("TO_CHAR(created_at, 'YYYY-MM-DD')=? and created_by=?",today_date, current_user)
# pj_debit.each do |obj|
# debit += obj.debit_amount
# end
# return debit
# end
end