Permalink
Browse files

Finished current enrollement and tips activity report csv export

  • Loading branch information...
Catchit
Catchit committed Feb 23, 2012
1 parent 15d33ee commit 782ef81ad82dd6c32c6c89485b746e4ce8538f3c
Showing with 33 additions and 3 deletions.
  1. +33 −3 application/app/controllers/report_controller.rb
@@ -698,7 +698,7 @@ def call_lengths
report_header = ["","Count", "Morning Count", "Morning Avg", "Morning Min", "Morning SDev",
"Midday Count", "Midday Avg", "Midday Min", "Midday SDev",
"Afternoon Count", "Afternoon Avg", "Afternoon Min", "Afternoon SDev",
- "Evening Count", "Evening Avg", "Evening Min", "Evening SDev",]
+ "Evening Count", "Evening Avg", "Evening Min", "Evening SDev"]
export_to_csv('call_lengths', report_header, @report, @patient_type,
@grouping)
redirect_to "/clinic"
@@ -726,7 +726,22 @@ def tips_activity
@report = Report.tips_activity(@start_date, @end_date, @grouping,
@content_type, @language, @phone_type,
@delivery, @number_prefix)
- render :layout => false
+
+ if params[:destination] == 'csv'
+ report_header = ["","Count", "Content Pregnancy Count",
+ "Content Pregnancy %age", "Content Child Count",
+ "Content Child %age", "Language Chiyao Count",
+ "Language Chiyao %age", "Language Chichewa Count",
+ "Language Chichewa %age", "Delivery SMS Count",
+ "Delivery SMS %age", "Language Voice Count",
+ "Language Voice %age"
+ ]
+ export_to_csv('tips_activity', report_header, @report, @patient_type,
+ @grouping)
+ redirect_to "/clinic"
+ else
+ render :layout => false
+ end
end
def current_enrollment_totals
@@ -747,7 +762,22 @@ def current_enrollment_totals
@report_name = "Current Enrollment Totals"
@report = Report.current_enrollment_totals(@start_date, @end_date, @grouping,
@content_type, @language, @delivery, @number_prefix)
- render :layout => false
+
+ if params[:destination] == 'csv'
+ report_header = ["","Count", "Content Pregnancy Count",
+ "Content Pregnancy %age", "Content Child Count",
+ "Content Child %age", "Language Chiyao Count",
+ "Language Chiyao %age", "Language Chichewa Count",
+ "Language Chichewa %age", "Delivery SMS Count",
+ "Delivery SMS %age", "Language Voice Count",
+ "Language Voice %age"
+ ]
+ export_to_csv('current_enrollment_totals', report_header, @report, @patient_type,
+ @grouping)
+ redirect_to "/clinic"
+ else
+ render :layout => false
+ end
end
def individual_current_enrollments

0 comments on commit 782ef81

Please sign in to comment.