print $balanceCarity; ?> :</td> <td width="25%" align="right"><?php print FormatMoney($costBalance); ?> </td> </tr> </table> <?php } if ($AdminReport) { if (isset($_REQUEST['all'])) { $ChuchList = ChurchesDefined(); } else { $ChuchList = ChurchesRegistered(); } if (count($ChuchList) > 0) { foreach ($ChuchList as $ChurchID => $ChurchName) { PrintReport($ChurchID); print "<br><hr>"; } } else { ?> <center> <h1>No churches with participating registrants have been defined</h1> <h2>Expense report is empty</h2> </center> <?php } } else {
// // Author: Paul Lemmons //---------------------------------------------------------------------------- include 'include/RegFunctions.php'; if ($Admin != 'Y') { header("refresh: 0; URL=Admin.php"); die; //SELECT P.ParticipantID, P.FirstName, P.LastName, P.Address, P.City, P.State, //P.Zip, P.Grade, P.Gender, P.Comments, P.ChurchID FROM Participants P; } $filename = "AllParticipants-" . date("m-d-Y") . ".csv"; header("Content-disposition: attachment; filename={$filename}"); header("Content-type: application/octet-stream"); $rowCount = 0; $fp = fopen('php://output', 'w'); $church_list = ChurchesRegistered(); foreach ($church_list as $ChurchID => $ChurchName) { $ParticipantIDs = ActiveParticipants($ChurchID); foreach ($ParticipantIDs as $ParticipantID => $ParticipantName) { $results = $db->query("select ParticipantID,\n FirstName,\n LastName,\n Address,\n City,\n State,\n Zip,\n Grade,\n Gender,\n Comments,\n ChurchID,\n Case MealTicket\n When '3' Then '3 Meals'\n When '5' Then '5 Meals'\n When 'N' Then 'No Meals'\n else '<error>'\n end\n MealTicket\n from {$ParticipantsTable}\n where ParticipantID = {$ParticipantID}\n ") or die("Unable to get Participant Info:" . sqlError()); while ($row = $results->fetch(PDO::FETCH_ASSOC)) { if ($rowCount++ == 0) { foreach ($row as $key => $value) { $heading[] = $key; } fputcsv($fp, $heading); } fputcsv($fp, $row); } } }