Exemple #1
0
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">

   <head>
      <title>
         Summary Expense Report
      </title>
   </head>
   <body bgcolor="White">
   <?php 
//-----------------------------------------------------------------------
// Get the cost for various items
//-----------------------------------------------------------------------
$price = GetPrices();
$RegCost = $price["Registration"];
$ShirtCost = $price["Shirt"];
$AdultMealCost = $price["AdultMeal"];
$ChildMealCost = $price["ChildMeal"];
//-----------------------------------------------------------------------
// Initalize Accumulating Variables
//-----------------------------------------------------------------------
$ParticipantCount = 0;
$ExtraAdultMealCount = 0;
$ExtraChildMealCount = 0;
$ExtraShirtCount = 0;
$costParticipant = 0;
$costExtraAdultMeals = 0;
$costExtraChildMeals = 0;
$costExtraShirts = 0;
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
function PrintReport($ChurchID)
{
    $ChurchName = ChurchName($ChurchID);
    $costDetail = ChurchExpenses($ChurchID);
    //-----------------------------------------------------------------------
    // Get the cost for various items
    //-----------------------------------------------------------------------
    $price = GetPrices();
    $RegCost = $price["Registration"];
    $ShirtCost = $price["Shirt"];
    $AdultMealCost = $price["AdultMeal"];
    $ChildMealCost = $price["ChildMeal"];
    //-----------------------------------------------------------------------
    // Get the Counts for various items purchased
    //-----------------------------------------------------------------------
    $ParticipantCount = $costDetail["ParticipantCount"];
    $ExtraAdultMealCount = $costDetail["ExtraAdultMealCount"];
    $ExtraChildMealCount = $costDetail["ExtraChildMealCount"];
    $ExtraShirtCount = $costDetail["ExtraShirtCount"];
    //-----------------------------------------------------------------------
    // Get the cost for various items Purchased
    //-----------------------------------------------------------------------
    $costParticipant = $costDetail["Participant"];
    $costExtraAdultMeals = $costDetail["ExtraAdultMeals"];
    $costExtraChildMeals = $costDetail["ExtraChildMeals"];
    $costExtraShirts = $costDetail["ExtraShirts"];
    $costTotal = $costDetail["Total"];
    $costBalance = $costDetail["Balance"];
    $MoneyInOut = $costDetail["MoneyInOut"];
    if ($costBalance > 0) {
        $balanceCarity = 'Due';
    } else {
        if ($costBalance < 0) {
            $balanceCarity = 'Credit';
        } else {
            $balanceCarity = '';
        }
    }
    //-----------------------------------------------------------------------
    // Display to the user
    //-----------------------------------------------------------------------
    ?>
      <h1 align="center">Expense Report</h1>
      <h1 align="center">For: <?php 
    print "{$ChurchName}";
    ?>
</h1>

      <table border="1" width="100%">
         <tr>
            <td width="25%">Registered Participants</td>
            <td width="25%" align="center"><?php 
    print $ParticipantCount;
    ?>
</td>
            <td width="25%" align="center">x <?php 
    print FormatMoney($RegCost);
    ?>
</td>
            <td width="25%" align="right"><?php 
    print FormatMoney($costParticipant);
    ?>
</td>
         </tr>
         <tr>
            <td width="25%">Extra Adult Meal Tickets</td>
            <td width="25%" align="center"><?php 
    print $ExtraAdultMealCount;
    ?>
</td>
            <td width="25%" align="center">x <?php 
    print FormatMoney($AdultMealCost);
    ?>
</td>
            <td width="25%" align="right"><?php 
    print FormatMoney($costExtraAdultMeals);
    ?>
</td>
         </tr>
         <tr>
            <td width="25%">Extra Child Meal Tickets</td>
            <td width="25%" align="center"><?php 
    print $ExtraChildMealCount;
    ?>
</td>
            <td width="25%" align="center">x <?php 
    print FormatMoney($ChildMealCost);
    ?>
</td>
            <td width="25%" align="right"><?php 
    print FormatMoney($costExtraChildMeals);
    ?>
</td>
         </tr>
         <tr>
            <td width="25%">Extra T-Shirts</td>
            <td width="25%" align="center"><?php 
    print $ExtraShirtCount;
    ?>
</td>
            <td width="25%" align="center">x <?php 
    print FormatMoney($ShirtCost);
    ?>
</td>
            <td width="25%" align="right"><?php 
    print FormatMoney($costExtraShirts);
    ?>
</td>
         </tr>
         <tr>
            <td width="50%" colspan=2>&nbsp;</td>
            <td width="25%" align="right">Total:</td>
            <td width="25%" align="right"><?php 
    print FormatMoney($costTotal);
    ?>
</td>
         </tr>
         <tr>
            <td width="50%" colspan=2>&nbsp;</td>
            <td width="25%" align="right">Monies Received:</td>
            <td width="25%" align="right"><?php 
    print FormatMoney($MoneyInOut);
    ?>
</td>
         </tr>
         <tr>
            <td width="50%" colspan=2>&nbsp;</td>
            <td width="25%" align="right">Balance <?php 
    print $balanceCarity;
    ?>
:</td>
            <td width="25%" align="right"><?php 
    print FormatMoney($costBalance);
    ?>
</td>
         </tr>
      </table>
      <?php 
}
Exemple #4
0
<?php

//----------------------------------------------------------------------------
// This software is licensed under the MIT license. Use as you wish but give
// and take credit where due.
//
// Author: Paul Lemmons
//----------------------------------------------------------------------------
include 'include/RegFunctions.php';
//----------------------------------------------------------------------------------
// Setup some constants. These are only loosely used in this piece of code. There
// is still way too much hard coded in the logic.
//----------------------------------------------------------------------------------
$prices = GetPrices();
$shirtList = array('YM', 'YL', 'S', 'M', 'LG', 'XL', 'XX');
$mealList = array('AdultMeal', 'ChildMeal');
//-----------------------------------------------------------------------
// Get the active participant list and put it in sql "in" clause format
//-----------------------------------------------------------------------
$participantList = ActiveParticipants($ChurchID);
if (count($participantList) <= 0) {
    $ParticipantTotal = 0;
    $ParticipantMealTotal = 0;
    foreach ($shirtList as $shirtSize) {
        $shirt[$shirtSize] = 0;
    }
    foreach ($mealList as $mealType) {
        $meal[$mealType] = "0";
    }
} else {
    $inClause = "(";