--- a
+++ b/kohaReports/trunk/summerReadingClubReport/summerReadingClubReport.php
@@ -0,0 +1,270 @@
+<?php
+## Copyright 2006 Kyle Hall
+
+## This file is part of koha-tools.
+
+## koha-tools is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+
+## koha-tools is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with koha-tools; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#Summer Reading Club Reports
+#Input: $date - start date of summer reading club, $length - length of reading club in weeks
+
+include_once("classes/MySQLConnectionFactory.class.php");
+include_once("classes/KohaReports_SummerReadingClubReport.class.php");
+include_once("classes/PHP_Timer.class.php");
+
+
+$timer = new PHP_timer;
+$timer->start();
+
+$mySqlConnection = new MySQLConnectionFactory;
+$mySqlConnection->create();
+
+$startDate = $HTTP_GET_VARS['startYear'] . $HTTP_GET_VARS['startMonth'] . $HTTP_GET_VARS['startDay'];
+$endDate = $HTTP_GET_VARS['endYear'] . $HTTP_GET_VARS['endMonth'] . $HTTP_GET_VARS['endDay'];
+$myReport = new KohaReports_SummerReadingClubReport($startDate, $endDate);
+
+?>
+<html>
+<head>
+<meta content="text/html; charset=ISO-8859-1"
+http-equiv="content-type">
+<title></title>
+</head>
+<body>
+<h2>Meadville Public Library Summer Reading Club Report</h2>
+<table>
+   <tr>
+      <td>Start Date</td>
+      <td><?php echo $HTTP_GET_VARS['startMonth'] . '/' . $HTTP_GET_VARS['startDay'] . '/' . $startDate = $HTTP_GET_VARS['startYear'] ?></td>
+   </tr>
+   <tr>
+      <td>End Date</td>
+      <td><?php echo $HTTP_GET_VARS['endMonth'] . '/' . $HTTP_GET_VARS['endDay'] . '/' . $startDate = $HTTP_GET_VARS['endYear'] ?></td>
+   </tr>
+<br>
+<table>
+<tbody>
+<tr>
+<td style="vertical-align: top;">Members<br>
+</td>
+<td style="vertical-align: top;">Children<br>
+</td>
+</tr>
+<tr>
+<td style="vertical-align: top;">Total members<br>
+</td>
+<td style="vertical-align: top;"><?php echo $myReport->getTotalMembersCount() ?><br>
+</td>
+</tr>
+<tr>
+<td style="vertical-align: top;">Active Members*<br>
+</td>
+<td style="vertical-align: top;"><?php echo $myReport->getActiveMembersCount() ?><br>
+</td>
+</tr>
+<tr>
+<td style="vertical-align: top;">Books Read<br>
+</td>
+<td style="vertical-align: top;"><?php echo $myReport->getTotalBooksRead() ?><br>
+</td>
+</tr>
+<tr>
+<td style="vertical-align: top;">Average books/child<br>
+</td>
+<td style="vertical-align: top;"><?php echo $myReport->getAverageBooksRead() ?><br>
+</td>
+</tr>
+<tr>
+<td colspan="2" rowspan="1" style="vertical-align: top;">* of the
+children who pregistered, <?php echo $myReport->getInactiveMembersCount() ?> never participated.<br>
+</td>
+</tr>
+</tbody>
+</table>
+
+<br>
+<table border=1>
+<tr>
+	<th colspan="2" rowspan="1" style="vertical-align: top;">Breakdown of Members by Grade Level</th>
+</tr>
+<tr>
+	<th>Grade</th>
+	<th># of Children</th>
+</tr>
+<?php 
+$gradesArray = array('P', 'K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', 'O', 'Total');
+$breakdownArray = $myReport->getBreakdownOfMembersByGradeLevel();
+foreach($gradesArray as $thisGrade){
+	echo "<tr>";
+	echo "<td>" . $thisGrade . "</td>";
+	echo "<td>" . $breakdownArray[$thisGrade] . "</td>";
+	echo "</tr>";
+}
+?>
+</table>
+
+<br>
+<table border=1>
+<tr>
+	<th colspan="4">Breakdown of Activity by Grade Level</th>
+</tr>
+<tr>
+	<th>Grade</th>
+	<th>Active</th>
+	<th>Inactive</th>
+	<th>Total</th>
+</tr>
+<?php 
+$gradesArray = array('P', 'K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', 'O', 'Total');
+$breakdownArray = $myReport->getActivityByGradeLevel();
+foreach($gradesArray as $thisGrade){
+	echo "<tr>";
+	echo "<td>" . $thisGrade . "</td>";
+	echo "<td>" . $breakdownArray[$thisGrade]['Active'] . "</td>";
+	echo "<td>" . $breakdownArray[$thisGrade]['Inactive'] . "</td>";
+	echo "<td>" . $breakdownArray[$thisGrade]['Total'] . "</td>";
+	echo "</tr>";
+}
+?>
+</table>
+
+<br>
+<table border=1>
+<tr>
+	<th colspan="4">Breakdown of Activity by Year of Birth</th>
+</tr>
+<tr>
+	<th>Year</th>
+	<th>Active</th>
+	<th>Inactive</th>
+	<th>Total</th>
+</tr>
+<?php 
+$yearsArray = $myReport->getYears();
+$yearsArray[] = 'Total';
+
+$breakdownArray = $myReport->getActivitybyYearOfBirth();
+foreach($yearsArray as $thisYear){
+	echo "<tr>";
+	echo "<td>" . $thisYear . "</td>";
+	echo "<td>" . $breakdownArray[$thisYear]['Active'] . "</td>";
+	echo "<td>" . $breakdownArray[$thisYear]['Inactive'] . "</td>";
+	echo "<td>" . $breakdownArray[$thisYear]['Total'] . "</td>";
+	echo "</tr>";
+}
+?>
+</table>
+
+<br>
+<table border=1>
+<tr>
+	<th colspan="9" rowspan="1" style="vertical-align: top;">Number of Books Read By Grade</th>
+</tr>
+<tr>
+	<th>Grade</th>
+	<th>0</th>
+	<th>1-9</th>
+	<th>10-19</th>
+	<th>20-39</th>
+	<th>40-59</th>
+	<th>60-79</th>
+	<th>80+</th>
+	<th>Total</th>
+</tr>
+<?php 
+$numberArray = array('0', '1-9', '10-19', '20-39', '40-59', '60-79', '80+', 'Total');
+$breakdownArray = $myReport->getActivityByNumberOfBooksReadByGrade();
+foreach($gradesArray as $thisGrade){
+	echo "<tr>";
+	echo "<td>" . $thisGrade . "</td>";
+	foreach($numberArray as $thisNumber){
+		echo "<td>" . $breakdownArray[$thisGrade][$thisNumber] . "</td>";
+	}
+	echo "</tr>";
+}
+?>
+</table>
+
+<br>
+<table border=1>
+<tr>
+	<th colspan="9">Number of Books Read By Year of Birth</th>
+</tr>
+<tr>
+	<th>Year</th>
+	<th>0</th>
+	<th>1-9</th>
+	<th>10-19</th>
+	<th>20-39</th>
+	<th>40-59</th>
+	<th>60-79</th>
+	<th>80+</th>
+	<th>Total</th>
+</tr>
+<?php 
+$numberArray = array('0', '1-9', '10-19', '20-39', '40-59', '60-79', '80+', 'Total');
+$breakdownArray = $myReport->getActivityByNumberOfBooksReadByYearOfBirth();
+foreach($yearsArray as $thisYear){
+	echo "<tr>";
+	echo "<td>" . $thisYear . "</td>";
+	foreach($numberArray as $thisNumber){
+		echo "<td>" . $breakdownArray[$thisYear][$thisNumber] . "</td>";
+	}
+	echo "</tr>";
+}
+?>
+</table>
+
+<?php
+
+$timer->stop();
+$timer->showtime();
+
+function print_pr($object){
+	echo "<pre>";
+	print_r($object);
+	echo "</pre>";
+}
+
+function convert2dArrayToTable($array){
+	echo "<table>";
+	echo "<tbody>";
+	
+	foreach($array as $key => $data){
+		echo "<tr>";
+		echo "<td>" . $key . "</td>";
+		echo "<td>" . $data . "</td>";
+		echo "</tr>";
+	}
+	echo "</tbody>";
+	echo "</table>";
+}
+
+function convert3dArrayToTable($array){
+	echo "<table>";
+	echo "<tbody>";
+	
+	foreach($array as $key => $data){
+		echo "<tr>";
+		echo "<td>" . $key . "</td>";
+		foreach($data as $subkey => $subdata){
+			echo "<td>" . $subdata . "</td>";
+		}
+		echo "</tr>";
+	}
+	echo "</tbody>";
+	echo "</table>";
+}
+?>