Skip to content

Instantly share code, notes, and snippets.

Created April 2, 2013 10:47
Show Gist options
  • Save anonymous/5291385 to your computer and use it in GitHub Desktop.
Save anonymous/5291385 to your computer and use it in GitHub Desktop.
def index
@hospital_bookings = HospitalBooking.scoped
hospital_booking = @hospital_bookings
@user = User.where(:role => :administrator).first
if params[:format] == 'pdf'
@hospital_bookings = @hospital_bookings.where(:day => Date.today.beginning_of_month..Date.today.end_of_month)
end
respond_to do |format|
format.html
format.pdf do
render :pdf => "#{Date.today.strftime('%B')} Overtime Report",
:header => {:html => {:template => 'layouts/pdf.html.erb'}}
OvertimeMailer.overtime_pdf(@user, hospital_booking).deliver
end
end
end
task :overtime_report => :environment do
if Date.today.day == 18
HospitalBooking.index
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment