Skip to content

Instantly share code, notes, and snippets.

@leemcalilly
Created August 1, 2013 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leemcalilly/e2503188bb26df64ad20 to your computer and use it in GitHub Desktop.
Save leemcalilly/e2503188bb26df64ad20 to your computer and use it in GitHub Desktop.
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