-
-
Save leemcalilly/e2503188bb26df64ad20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ReportsHelper | |
def checkouts_today | |
current_user.checkouts.where( :date => Date.today ) | |
end | |
def sales_today | |
checkouts_today.sum(:sales) | |
end | |
def tips_today | |
checkouts_today.sum(:tips) | |
end | |
def owed_today | |
checkouts_today.sum(:owed) | |
end | |
def collected_today | |
checkouts_today.sum(:collected) | |
end | |
def employee_checkouts_today | |
checkouts_today.where( Employee.find_by(id: params[:id]) ) | |
end | |
def employee_hours_today | |
employee_checkouts_today.sum(:hours) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment