Exemple #1
0
               </tr>
         <?php 
    foreach ($ChuchList as $ChurchID => $ChurchName) {
        $costDetail = ChurchExpenses($ChurchID);
        $ChurchName = ChurchName($ChurchID);
        if ($costDetail["Balance"] != 0 or $showZeroBalances) {
            if ($costDetail["Balance"] > 0) {
                $BalanceComment = "Owed to LTC";
            } else {
                if ($costDetail["Balance"] < 0) {
                    $BalanceComment = "Credit to Church";
                } else {
                    $BalanceComment = "Zero Balance";
                }
            }
            if (count(ActiveParticipants($ChurchID)) > 0) {
                $registered = 'Yes';
            } else {
                $registered = 'No';
            }
            ?>
               <tr>
                  <td width="40%" align="left"   ><?php 
            print "{$ChurchName}";
            ?>
</td>
                  <td width="10%" align="center" ><?php 
            print "{$registered}";
            ?>
</td>
                  <td width="25%" align="center" ><?php 
Exemple #2
0
function ChurchExpenses($ChurchID)
{
    global $ChurchesTable, $EventsTable, $RegistrationTable, $ParticipantsTable, $TeamMembersTable, $ExtraOrdersTable, $MoneyTable;
    global $db;
    //-----------------------------------------------------------------------
    // Get the cost for various items
    //-----------------------------------------------------------------------
    $price = GetPrices();
    $RegCost = $price["Registration"];
    $ShirtCost = $price["Shirt"];
    $AdultMealCost = $price["AdultMeal"];
    $ChildMealCost = $price["ChildMeal"];
    //-----------------------------------------------------------------------
    // Get the active participant list and put it in sql "in" clause format
    //-----------------------------------------------------------------------
    $participantList = ActiveParticipants($ChurchID);
    $ParticipantCount = count($participantList);
    if ($ParticipantCount > 0) {
        $inClause = "(";
        foreach ($participantList as $participantID => $participantName) {
            $inClause .= "{$participantID},";
        }
        $inClause = trim($inClause, ",") . ")";
    }
    //-----------------------------------------------------------------------
    // Get the number of extra Adult-meal meal tickets
    //-----------------------------------------------------------------------
    $results = $db->query("select sum(ItemCount) count\n                           from   {$ExtraOrdersTable}\n                           where  ChurchID   = '{$ChurchID}'\n                           and    ItemType   = 'AdultMeal'\n                        ") or die("Unable to get Extra Adult Meal Ticket Count:" . sqlError());
    $row = $results->fetch(PDO::FETCH_ASSOC);
    $ExtraAdultMealCount = isset($row['count']) ? $row['count'] : 0;
    //-----------------------------------------------------------------------
    // Get the number of extra Child-meal meal tickets
    //-----------------------------------------------------------------------
    $results = $db->query("select sum(ItemCount) count\n                           from   {$ExtraOrdersTable}\n                           where  ChurchID   = '{$ChurchID}'\n                           and    ItemType   = 'ChildMeal'\n                        ") or die("Unable to get Extra Child Meal Ticket Count:" . sqlError());
    $row = $results->fetch(PDO::FETCH_ASSOC);
    $ExtraChildMealCount = isset($row['count']) ? $row['count'] : 0;
    //-----------------------------------------------------------------------
    // Get the number of extra t-shirts ordered
    //-----------------------------------------------------------------------
    $results = $db->query("select sum(ItemCount) count\n                           from   {$ExtraOrdersTable}\n                           where  ChurchID   = '{$ChurchID}'\n                           and    ItemType in ('YM','YL','S','M','LG','XL','XX')\n                        ") or die("Unable to get Extra T-Shirt Count:" . sqlError());
    $row = $results->fetch(PDO::FETCH_ASSOC);
    $ExtraShirtCount = isset($row['count']) ? $row['count'] : 0;
    //-----------------------------------------------------------------------
    // Check with accounting to see what monies have been received
    //-----------------------------------------------------------------------
    $results = $db->query("select sum(Amount) MoneyInOut\n                           from   {$MoneyTable}\n                           where  ChurchID   = {$ChurchID}\n                        ") or die("Unable to get monies in and out:" . sqlError());
    $row = $results->fetch(PDO::FETCH_ASSOC);
    $MoneyInOut = $row['MoneyInOut'];
    //-----------------------------------------------------------------------
    // Calculate the costs of all of this
    //-----------------------------------------------------------------------
    $costDetails["ParticipantCount"] = $ParticipantCount;
    $costDetails["ExtraAdultMealCount"] = $ExtraAdultMealCount;
    $costDetails["ExtraChildMealCount"] = $ExtraChildMealCount;
    $costDetails["ExtraShirtCount"] = $ExtraShirtCount;
    $costDetails["Participant"] = $ParticipantCount * $RegCost;
    $costDetails["ExtraAdultMeals"] = $ExtraAdultMealCount * $AdultMealCost;
    $costDetails["ExtraChildMeals"] = $ExtraChildMealCount * $ChildMealCost;
    $costDetails["ExtraShirts"] = $ExtraShirtCount * $ShirtCost;
    $costDetails["Total"] = $costDetails["Participant"] + $costDetails["ExtraAdultMeals"] + $costDetails["ExtraChildMeals"] + $costDetails["ExtraShirts"];
    $costDetails["Balance"] = $costDetails["Total"] + $MoneyInOut;
    $costDetails["MoneyInOut"] = $MoneyInOut * -1;
    return $costDetails;
}
Exemple #3
0
// 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);
        }
    }
}
fclose($fp);
Exemple #4
0
      <title>
         Enrollment by Congregation
      </title>
   </head>
   <body bgcolor="White">
      <h1 align="center">Enrollment by Congregation</h1>
      <hr>
      <table border="0" width="40%">
   <?php 
//=================================================================================================
// For Each Church see how many kids are actively registered
//=================================================================================================
$total = 0;
$ChuchList = ChurchesRegistered();
foreach ($ChuchList as $ChurchID => $ChurchName) {
    $ChurchCount = count(ActiveParticipants($ChurchID));
    $total += $ChurchCount;
    ?>
         <tr>
            <td width=70%><?php 
    print $ChurchName;
    ?>
&nbsp;</td>
            <td width=30% align=right><?php 
    print $ChurchCount;
    ?>
&nbsp;</td>
         </tr>
         <?php 
}
?>
Exemple #5
0
function PrintRoster($ChurchID)
{
    global $ChurchesTable, $EventsTable, $RegistrationTable, $ParticipantsTable, $TeamMembersTable, $ExtraOrdersTable, $pageBreak, $db;
    $participantList = ActiveParticipants($ChurchID);
    $first = 1;
    foreach ($participantList as $participantID => $participantName) {
        $results = $db->query("select   p.Grade,\n                                             CASE p.ShirtSize\n                                                WHEN 'S'  THEN 'Small'\n                                                WHEN 'M'  THEN 'Medium'\n                                                WHEN 'YL' THEN 'Youth Large'\n                                                WHEN 'XL' THEN 'Extra Large'\n                                                WHEN 'LG' THEN 'Large'\n                                                WHEN 'YM' THEN 'Youth Medium'\n                                                WHEN 'XX' THEN 'Double X-Large'\n                                                ELSE           '<Error>'\n                                             END\n                                             ShirtSize,\n                                             CASE p.MealTicket\n                                                WHEN '3' THEN 'Three Meals'\n                                                WHEN '5' THEN 'Five Meals'\n                                                WHEN 'N' THEN 'No Meals'\n                                                WHEN 'I' THEN 'Included'\n                                                ELSE          '<Error>'\n                                             END\n                                             MealTicket,\n                                             c.ChurchName\n                                    from     {$ParticipantsTable} p,\n                                             {$ChurchesTable}     c\n                                    where    p.ChurchID      = c.ChurchID\n                                    and      p.ChurchID      = {$ChurchID}\n                                    and      p.ParticipantID = {$participantID}\n                                    order by p.LastName,\n                                             p.FirstName") or die("Unable to get participant information:" . sqlError());
        ?>
            <?php 
        $row = $results->fetch(PDO::FETCH_ASSOC);
        $ShirtSize = $row['ShirtSize'];
        $MealTicket = $row['MealTicket'];
        $Grade = $row['Grade'];
        $Church = $row['ChurchName'];
        if ($first == 1) {
            $first = 0;
            ?>
               <h1 align="center" <?php 
            print $pageBreak;
            $pageBreak = "style=\"page-break-before:always;\"";
            ?>
="<?php 
            print $pageBreak;
            $pageBreak = "style=\"page-break-before:always;\"";
            ?>
"><?php 
            print $Church;
            ?>
</h1>
               <hr />
               <table border="0" width="100%">
                  <tr>
                     <td width="10%" bgcolor="#CCCCCC">ID</td>
                     <td width="10%" bgcolor="#CCCCCC">Grade</td>
                     <td width="25%" bgcolor="#CCCCCC">T-Shirt Size</td>
                     <td width="25%" bgcolor="#CCCCCC">Meal Ticket</td>
                     <td width="30%" bgcolor="#CCCCCC">Name</td>
                  </tr>
               <?php 
        }
        ?>
            <tr>
               <td><?php 
        print $participantID;
        ?>
</td>
               <td><?php 
        print $Grade;
        ?>
</td>
               <td><?php 
        print $ShirtSize;
        ?>
</td>
               <td><?php 
        print $MealTicket;
        ?>
</td>
               <td><?php 
        print $participantName;
        ?>
</td>
            </tr>
         <?php 
    }
    ?>
         </table>
       <?php 
}
Exemple #6
0
function ShirtsNeeded($ChurchID, $ChurchName)
{
    global $total;
    global $ChurchesTable, $EventsTable, $RegistrationTable, $ParticipantsTable, $TeamMembersTable, $ExtraOrdersTable, $db;
    //====================================================================
    // Generate a sql "in" clause from the list of active participants
    //====================================================================
    $participantList = ActiveParticipants($ChurchID);
    $inClause = "(0,";
    foreach ($participantList as $participantID => $participantName) {
        $inClause .= "{$participantID},";
    }
    $inClause = trim($inClause, ",") . ")";
    //====================================================================
    // Get shirt count from Participants list
    //====================================================================
    //        print "<br><pre>select   distinct
    //                                        p.ShirtSize,
    //                                        count(p.ShirtSize) ShirtCount
    //                               from     $ParticipantsTable p
    //                               where    p.ChurchID=$ChurchID
    //                               and      p.ParticipantID in $inClause
    //                               group by p.ShirtSize
    //                              </pre>";
    $shirts = $db->query("select   distinct\n                                         p.ShirtSize,\n                                         count(p.ShirtSize) ShirtCount\n                                from     {$ParticipantsTable} p\n                                where    p.ChurchID={$ChurchID}\n                                and      p.ParticipantID in {$inClause}\n                                group by p.ShirtSize\n                               ") or die("Unable to obtain Shirt List:" . sqlError());
    //====================================================================
    // Start with zero counts
    //====================================================================
    $shirt['YM'] = 0;
    $shirt['YL'] = 0;
    $shirt['S'] = 0;
    $shirt['M'] = 0;
    $shirt['LG'] = 0;
    $shirt['XL'] = 0;
    $shirt['XX'] = 0;
    $rowTotal = 0;
    //====================================================================
    // Capture counts for shirts and sum the total
    //====================================================================
    while ($row = $shirts->fetch(PDO::FETCH_ASSOC)) {
        $shirt[$row['ShirtSize']] = $row['ShirtCount'];
        $total[$row['ShirtSize']] += $row['ShirtCount'];
        $rowTotal += $row['ShirtCount'];
        $total['grand'] += $row['ShirtCount'];
    }
    //====================================================================
    // Add in the counts for extra orders for shirts and sum the total
    //====================================================================
    $extraOrders = $db->query("select   ItemType,\n                                              ItemCount\n                                     from     {$ExtraOrdersTable}\n                                     where    ChurchID = {$ChurchID}\n                                     and      ItemType in ('YM','YL','S','M','LG','XL','XX')\n                                     ") or die("Unable to Read Extra Orders Table" . sqlError());
    while ($row = $extraOrders->fetch(PDO::FETCH_ASSOC)) {
        $shirt[$row['ItemType']] += $row['ItemCount'];
        $total[$row['ItemType']] += $row['ItemCount'];
        $rowTotal += $row['ItemCount'];
        $total['grand'] += $row['ItemCount'];
    }
    //====================================================================
    // Print the table row with the data we just collected
    //====================================================================
    ?>
            <tr>
               <td ><?php 
    print $ChurchName;
    ?>
</td>
               <td align="center"><?php 
    print $shirt['YM'];
    ?>
</td>
               <td align="center"><?php 
    print $shirt['YL'];
    ?>
</td>
               <td align="center"><?php 
    print $shirt['S'];
    ?>
</td>
               <td align="center"><?php 
    print $shirt['M'];
    ?>
</td>
               <td align="center"><?php 
    print $shirt['LG'];
    ?>
</td>
               <td align="center"><?php 
    print $shirt['XL'];
    ?>
</td>
               <td align="center"><?php 
    print $shirt['XX'];
    ?>
</td>
               <td align="center" bgcolor="#C0C0C0"><?php 
    print $rowTotal;
    ?>
</td>
            </tr>
         <?php 
}
Exemple #7
0
    $pageBreak = "style=\"page-break-before:always;\"";
    ?>
>
         <table border="0" width="100%">
            <tr>
               <td colspan="5" bgcolor="#C0C0C0">
                     <b>
                        <?php 
    print $ChurchName;
    ?>
                     </b>
                  </div>
               </td>
            </tr>
               <?php 
    $ParticipantList = ActiveParticipants($ChurchID);
    foreach ($ParticipantList as $ParticipantID => $ParticipantName) {
        ?>
                     <tr>
                        <td width="5%" colspan="1">&nbsp;</td>
                        <td width="95%" colspan="4" bgcolor="#F0F0F0"><?php 
        print $ParticipantName;
        ?>
</td>
                     </tr>
                     <?php 
        $EventList = ParticipantEvents($ParticipantID);
        foreach ($EventList as $EventID => $EventName) {
            ?>
                        <tr>
                           <td width="10%" colspan="2">&nbsp;</td>