public static function get_processing_orders($Chefs_Tasting = '0', $date = NULL, $trans_id_null = true) {
        if ($date === NULL || !$date) {
            $date = 'DATE_ADD(CURDATE(), INTERVAL 3 DAY)';
        } else {
            $date = "'$date'";
        }
        if ($trans_id_null) {
            $additional = 'AND TransactionNumber IS NULL';
        } else {
            $additional = "AND (TransactionNumber IS NOT NULL OR Chefs_Tasting = '1')";
            //$additional = '';
        }
        //@golive change date - " . Gadget::$date_do->format(DATE_FORMAT_MYSQL) . "
        /* Removed on Feb 17, 2014 by Steve Kleeman
         * Reason: Member wants it to show all orders.
         *
          $orders = dbi()->q_all("SELECT OrderID, DeliveryDate
          FROM Orders
          JOIN OrderDetails USING (OrderID)
          WHERE DeliveryDate = $date
          $additional
          GROUP BY OrderID
          HAVING SUM(IF(Chefs_Tasting = '$Chefs_Tasting', 1, 0)) >= 1
          ORDER BY Sequence ASC"); */

        $orders = dbi()->q_all("SELECT OrderID, DeliveryDate
                                FROM Orders
                                    JOIN OrderDetails USING (OrderID)
                                WHERE DeliveryDate = $date
                                GROUP BY OrderID
                                HAVING SUM(IF(Chefs_Tasting = '$Chefs_Tasting', 1, 0)) >= 1
                                ORDER BY Sequence ASC");
        return new Order_List($orders, $Chefs_Tasting);
    }
Beispiel #2
0
function funky_shutter(){
    global $ajax_status;
    global $ajax_array;
    if($ajax_status != 'success'){
        $ajax_status = 'error';
    }
    $out = $ajax_array;
    $out['status'] = $ajax_status;
    $out['html'] = ob_get_clean();
    $out['queries'] = dbi()->query_count;
    $out['query_time'] = dbi()->query_time;
    
    $suffixes = array('', 'KiB', 'MiB');
    $suf = 0;
    $out['memory'] = memory_get_peak_usage();
    while($out['memory'] > 10240){
        $out['memory'] /= 1024;
        $suf++;
    }
    $out['memory'] = round($out['memory'], 2) . ' ' . $suffixes[$suf];
    
    ob_clean();
    ob_end_clean();
    
    echo json_encode($out);
}
Beispiel #3
0
 /**
  * gets information for a page based on its alias
  *
  * @param   String  $alias  alias of the page, no leading /
  * @return  Page
  */
 public static function get_from_alias($alias){
     $row_page = dbi()->q_1("SELECT * FROM WebPages WHERE Alias = '$alias'");
     if($row_page){
         return new Page($row_page);
     }else{
         return false;
     }
 }
Beispiel #4
0
    public static function get_from_id($ItemID){ // singleton
        $ItemID = (int) $ItemID;
        if(isset(self::$_meals[$ItemID])){
            return self::$_meals[$ItemID];
        }
        $result = dbi()->q_1("SELECT * FROM Items i JOIN Menus m ON i.MenuID = m.MenuID WHERE i.ItemID = '$ItemID' ORDER BY m.Sequence ASC");

        $meal = new Meal($result);
        self::$_meals[$ItemID] = &$meal;
        return $meal;
    }
Beispiel #5
0
 public static function get_from_id($ItemID)
 {
     // singleton
     $ItemID = (int) $ItemID;
     if (isset(self::$_meals[$ItemID])) {
         return self::$_meals[$ItemID];
     }
     $result = dbi()->q_1("SELECT * FROM Items WHERE ItemID = '{$ItemID}'");
     $meal = new Meal($result);
     self::$_meals[$ItemID] =& $meal;
     return $meal;
 }
 public function add_delivery_fee($userzip) {
     $zip = dbi()->q_1("SELECT * FROM ZipCode WHERE ZipCode = '{$userzip}'");
     if (!empty($zip) && $zip->Delivery !== '0.00') {
         $this->Amounts->DeliveryFee = new Amount($zip->Delivery);
     } else {
         $this->Amounts->DeliveryFee = new Amount(0);
     }
 }
                                    'veg' => array()
                        );

                        // Loop over unique counts
                        foreach ($unique_counts as $k => $v) {
                            echo "<th>{$k}x</th>";

                            $reg_count_total = dbi()->q_1(" SELECT SUM(Count) as t
                                                            FROM KitchenReport1
                                                            WHERE ItemID = {$order->ItemID}
                                                                AND Count = {$k}
                                                                AND ItemName NOT LIKE '%- vegetarian%'")->t;

                            $veg_reg_unique_totals->reg[$k] = $reg_count_total;

                            $veg_count_total = dbi()->q_1(" SELECT SUM(Count) as t
                                                            FROM KitchenReport1
                                                            WHERE ItemID = {$order->ItemID}
                                                                AND Count = {$k}
                                                                AND ItemName LIKE '%- vegetarian%'")->t;

                            $veg_reg_unique_totals->veg[$k] = $veg_count_total;
                        }
                        ?>
                        <th>Totals</th>
                    </tr>
                    <?php
                    foreach ($ingredients as $ingredient) {
                        echo "<tr>";
                        echo "<td>{$ingredient->Letter_Code}</td>";
                        echo "<td>{$ingredient->IngredientName}</td>";
// Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate");
// HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// HTTP/1.0
include "header.php";
require_once '../includes/global.inc.php';
// No id was passed so no customer can be edited
if (!isset($_REQUEST['id']) || empty($_REQUEST['id'])) {
    header("Location: Customerslist.php");
    die;
}
// They've hit submit to reset the password
if (isset($_REQUEST['reset_pass'])) {
    $updated = dbi()->update('Customers', array('Password' => Access::create_hash($_REQUEST['new_pass'], 'strong')), 'CustomerID = ' . $_REQUEST['id']);
    if (!$updated) {
        $message = "There was an error updating the customer\\'s password";
    } else {
        $message = "Successfully updated the customer\\'s password";
    }
    echo "<script>alert('" . $message . "'); window.location = 'Customerslist.php';</script>";
}
?>

<link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-win2k-1.css" title="win2k-1">
<script type="text/javascript" src="calendar/calendar.js"></script>
<script type="text/javascript" src="calendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="calendar/calendar-setup.js"></script>
<script type="text/javascript" src="../js/jquery-1.9.1.min.js"></script>
<script language="JavaScript" type="text/javascript">
 public static function check_password($Password, $CustomerID) {
     if ($row = dbi()->q_1("SELECT Password FROM Customers WHERE CustomerID = '$CustomerID'")) {
         return crypt($Password, $row->Password) == $row->Password;
     }
     return false;
 }
Beispiel #10
0
                    </tr>
                </table>
            </form>
        </div>
        <?php 
        require 'footer.php';
        die;
    } else {
        Gadget::redirect('index');
        die;
    }
} elseif (isset($_REQUEST['submit_new_pass'])) {
    // Insert new password and set expires to 0
    $request = dbi()->q_1("SELECT * FROM password_reset_requests WHERE token_id = '" . $_SESSION['token_id'] . "'");
    dbi()->update('Customers', array('Password' => Access::create_hash($_REQUEST['new_pass'], 'strong')), 'CustomerID = ' . $request->CustomerID);
    dbi()->update('password_reset_requests', array('expires' => '0000-00-00 00:00:00'), 'token_id = \'' . $_SESSION['token_id'] . '\'');
    unset($_SESSION['token_id']);
    Gadget::add_message('Your password has been reset!');
    Gadget::redirect('login');
    die;
}
require 'header.php';
?>
<div class="content-padding">
    <form name="forgot-form" class="user-form" id="forgot-form" action="forgot" method="post">
        <table>
            <tr>
                <td>
                    <label for="forgot-email">email:</label>
                </td>
                <td>
<?php
require '../includes/global.inc.php';
//debug(1, 1, 1);
if (!$_SESSION['madison_status_UserName']) {
    Gadget::redirect('/admin');
}
$result = $dbi->q_all("
    SELECT DeliveryDate, ItemName, ItemID, Allergies, Letter_Code, IngredientName, ItemIngredients.Amount, `Count`, FirstName, LastName,
        Comments, CustomerID, kitchen_note, IngredientID, Type, IF((TransactionNumber IS NOT NULL OR Chefs_Tasting = '1'), '1', '0') AS TransactionStatus
    FROM KitchenReport1
        JOIN ItemIngredients USING (ItemID)
        JOIN Ingredients USING (IngredientID)
        LEFT JOIN Customers USING (CustomerID)
    GROUP BY ItemName, Customers.CustomerID, IngredientID, Letter_Code
    ORDER BY ItemName, Customers.CustomerID, Letter_Code");
$meals = array();
foreach ($result as $row) {
    $item                                                      = &$meals[htmlspecialchars($row->ItemName)];
    $item->Ingredients[$row->IngredientID . $row->Letter_Code] = (object) array(
                'IngredientName' => htmlspecialchars($row->IngredientName),
                'Amount'         => $row->Amount,
                'Type'           => $row->Type,
                'Letter_Code'    => htmlspecialchars($row->Letter_Code),
    );
    $item->Customers[$row->CustomerID]                         = (object) array(
                'Allergies'         => htmlspecialchars($row->Allergies),
                'ItemName'          => $row->ItemName,
                'Count'             => $row->Count,
                'Name'              => htmlspecialchars($row->FirstName . ' ' . $row->LastName),
                'Comments'          => htmlspecialchars($row->Comments),
        </table>

        <?php
// If the user has ordered for last week or next, display (if there is one) link to recipe card for that item
        $today      = date('Y-m-d');
        $yesterday  = date('Y-m-d', strtotime('-1 day'));
        $last_week  = date('Y-m-d', strtotime('-1 week'));
        $next_week  = date('Y-m-d', strtotime('+1 week'));
        $next_cards = dbi()->q_all("SELECT Items.ItemName, Items.PDF
                                    FROM Orders
                                        JOIN OrderDetails USING(OrderID)
                                        JOIN Items USING(ItemID)
                                    WHERE Orders.CustomerID = " . $_SESSION['CustomerID'] . "
                                        AND Orders.DeliveryDate BETWEEN '" . $today . "' AND '" . $next_week . "'
                                    GROUP BY Items.ItemID");
        $last_cards = dbi()->q_all("SELECT Items.ItemName, Items.PDF
                                    FROM Orders
                                        JOIN OrderDetails USING(OrderID)
                                        JOIN Items USING(ItemID)
                                    WHERE Orders.CustomerID = " . $_SESSION['CustomerID'] . "
                                        AND Orders.DeliveryDate BETWEEN '" . $last_week . "' AND '" . $yesterday . "'
                                    GROUP BY Items.ItemID");
        if (count($next_cards) > 0) {
            echo '<h2>Next Week\'s Recipe Card(s)</h2>';
            foreach ($next_cards as $next_card) {
                if (!empty($next_card->PDF) && !is_null($next_card)) {
                    echo '<a href="recipes/' . $next_card->PDF . '" target="_blank">' . $next_card->ItemName . '</a><br />';
                } else {
                    echo 'No recipe card yet for ' . $next_card->ItemName;
                }
            }
$skip_session = true;

require str_replace('/system', '', dirname(__FILE__)) . '/includes/global.inc.php';

debug(1, 1, 0);
$date = date(DATE_FORMAT_MYSQL, strtotime('next Tuesday'));
// For only chef tasting
/*$rows   = dbi()->q_all("SELECT OrderID, DeliveryDate
                        FROM Orders
                            JOIN OrderDetails USING (OrderID)
                        WHERE DeliveryDate = '$date'
                            AND Chefs_Tasting = '1'
                        GROUP BY OrderID");*/

// For all orders
$rows   = dbi()->q_all("SELECT OrderID, DeliveryDate
                        FROM Orders
                            JOIN OrderDetails USING (OrderID)
                        WHERE DeliveryDate = '$date'
                        GROUP BY OrderID");
$orders = new Order_List($rows);

switch($date){
    case '2013-12-24':
        $date = '2013-12-23';
        break;
    case '2013-12-31':
        $date = '2013-12-30';
        break;
}
    public function can_be_used($CustomerID, $table, $debug = 0){
        $CustomerID = (int) $CustomerID;
        $table = dbi()->escape($table);

        if(!$CustomerID){ // new customers can use any promo code
            return true;
        }

        $date = Gadget::$date_do->format(DATE_FORMAT_MYSQL);

        if($table === 'Orders' || $table === 'Subscriptions' || $table === 'GiftCertificates') {
            $table = 'Orders';
            $table2 = 'Subscriptions';
            $table3 = 'GiftCertificates';
        } else {
            $table2 = 'Orders';
            $table3 = 'GiftCertificates';
        }

        if($this->One_Time_Only){
            if(dbi()->q_n("SELECT PromoCodeID FROM $table WHERE CustomerID = '$CustomerID' AND DeliveryDate <= '$date' AND PromoCodeID = '$this->PromoCodeID'
                            UNION
                            SELECT PromoCodeID FROM $table2 WHERE CustomerID = '$CustomerID' AND DeliveryDate < '$date' AND PromoCodeID = '$this->PromoCodeID'
                            UNION
                            SELECT PromoCodeID FROM $table3 WHERE CustomerID = '$CustomerID' AND PromoCodeID = '$this->PromoCodeID'")){ // already in use on another order
                return false;
            }
        }

        if($this->New_Customer_Only){
            if ($debug == 1){
                ri("SELECT PromoCodeID FROM $table WHERE CustomerID = '$CustomerID' AND DeliveryDate <= '$date'
                    UNION
                    SELECT PromoCodeID FROM $table2 WHERE CustomerID = '$CustomerID' AND DeliveryDate < '$date'
                    UNION
                    SELECT PromoCodeID FROM $table3 WHERE CustomerID = '$CustomerID'");
            }
            if(dbi()->q_n("SELECT PromoCodeID FROM $table WHERE CustomerID = '$CustomerID' AND DeliveryDate <= '$date'
                            UNION
                            SELECT PromoCodeID FROM $table2 WHERE CustomerID = '$CustomerID' AND DeliveryDate < '$date'
                            UNION
                            SELECT PromoCodeID FROM $table3 WHERE CustomerID = '$CustomerID'")){ // not this customer's first order
                return false;
            }
        }
        return true;
    }
                <tr>
                    <td colspan="2">
                        <input type="submit" class="white-button" value="Submit Changes" />
                    </td>
                </tr>
            </tbody>
        </table>

        <?php 
// If the user has ordered for last week or next, display (if there is one) link to recipe card for that item
$today = date('Y-m-d');
$yesterday = date('Y-m-d', strtotime('-1 day'));
$last_week = date('Y-m-d', strtotime('-1 week'));
$next_week = date('Y-m-d', strtotime('+1 week'));
$next_cards = dbi()->q_all("SELECT Items.ItemName, Items.PDF\n                                    FROM Orders\n                                        JOIN OrderDetails USING(OrderID)\n                                        JOIN Items USING(ItemID)\n                                    WHERE Orders.CustomerID = " . $_SESSION['CustomerID'] . "\n                                        AND Orders.DeliveryDate BETWEEN '" . $today . "' AND '" . $next_week . "'\n                                    GROUP BY Items.ItemID ");
$last_cards = dbi()->q_all("SELECT Items.ItemName, Items.PDF\n                                    FROM Orders\n                                        JOIN OrderDetails USING(OrderID)\n                                        JOIN Items USING(ItemID)\n                                    WHERE Orders.CustomerID = " . $_SESSION['CustomerID'] . "\n                                        AND Orders.DeliveryDate BETWEEN '" . $last_week . "' AND '" . $yesterday . "'\n                                    GROUP BY Items.ItemID ");
if (count($next_cards) > 0) {
    echo '<h2>Next Week\'s Recipe Card(s)</h2>';
    foreach ($next_cards as $next_card) {
        if (!empty($next_card->PDF) && !is_null($next_card)) {
            echo '<a href="recipes/' . $next_card->PDF . '" target="_blank">' . $next_card->ItemName . '</a><br />';
        } else {
            echo 'No recipe card yet for ' . $next_card->ItemName;
        }
    }
}
if (count($last_cards) > 0) {
    echo '<h2>Last Week\'s Recipe Card(s)</h2>';
    foreach ($last_cards as $last_card) {
        if (!empty($last_card->PDF) && !is_null($last_card)) {
            echo '<a href="recipes/' . $last_card->PDF . '" target="_blank">' . $last_card->ItemName . '</a><br />';
Beispiel #16
0
<div id="content-header">
    <div class="content-header-left">
        <div style="margin-top:40px;">
            <span class="header-text">order by:</span><span class="date"><?php echo $_date_ob->format('l F j'); ?></span>
        </div>
        <div>
            <span class="header-text">delivered on:</span><span class="date"><?php echo $_date_do->format('l F j'); ?></span>
        </div>
        <div class="title">
            <a href="/menu" style="color:#86C241;">weekday menu</a>
        </div>
    </div>
    <?php
    if (dbi()->q_1("SELECT * FROM Menus WHERE MenuID = '3' OR MenuID = '10'")->Active === '1') {
        $now = date('Y-m-d');
        $holiday_dates = dbi()->q_1("SELECT * FROM HolidayDate WHERE HolidayDeliverOn >= {$now} ORDER BY HolidayOrderBy ASC");

        if (empty($holiday_dates)) {
            $holiday_display = 'display: none;';
        } else {
            $holiday_display = '';
            $holiday_order_by = date_parse($holiday_dates->HolidayOrderBy);
            $holiday_deliver_on = date_parse($holiday_dates->HolidayDeliverOn);

            $_date_ob->setDate($holiday_order_by['year'], $holiday_order_by['month'], $holiday_order_by['day']);
            $_date_do->setDate($holiday_deliver_on['year'], $holiday_deliver_on['month'], $holiday_deliver_on['day']);
        }
        ?>
        <div class="content-header-left" style="<?php echo $holiday_display; ?>">
            <div style="margin-top:40px;">
                <span class="header-text">order by:</span><span class="date"><?php echo $_date_ob->format('l F j'); ?></span>
     }
     ?>
 </table>
 <h3>Customer Detail</h3>
 <table cellspacing='0' cellpadding='0' style="border-collapse: collapse;">
     <tr>
         <th>Name</th>
         <th># of servings</th>
         <th>Regular / Vegetarian</th>
         <th>Allergies</th>
         <th>Notes</th>
         <th>Kitchen Notes</th>
     </tr>
     <?php
     // Get customer data into an array
     $customers = dbi()->q_all(" SELECT KitchenReport1.*, Customers.*
                                 FROM KitchenReport1
                                     JOIN Customers USING(CustomerID)
                                 WHERE ItemID = '" . $order->ItemID . "'
                                 ORDER BY KitchenReport1.ItemName DESC");
     foreach ($customers as $customer) {
         echo "<tr><td>{$customer->FirstName} {$customer->LastName}</td>";
         echo "<td>{$customer->Count}</td>";
         if (!strpos($customer->ItemName, '- vegetarian')) {
             echo "<td>Regular</td>";
         } else {
             echo "<td>Vegetarian</td>";
         }
         echo "<td>{$customer->Allergies}</td>";
         echo "<td>{$customer->Comments}</td>";
         echo "<td>{$customer->kitchen_note}</td></tr>";
Beispiel #18
0
                    $email->AddAddress($krustomer->Email);
                    $email->AddBCC('*****@*****.**');
                    $email->Subject = 'Madison & Rayne Order Confirmation';
                    $body = <<<EOT
<p style="margin-top:25px;">
    Hi {$krustomer->FirstName},
</p>
<p style="margin-top:25px;">
    Thank you for cooking with Madison &amp; Rayne!  The meals you selected, # of servings, and day of delivery are listed below:
</p>
<p style="margin-top:25px;">
    You have made some great selections from our menu:
    <ul>
EOT;
                    # Get holiday date
                    $holidayDate = dbi()->q_1("SELECT * FROM HolidayDate");
                    $holiday_deliver_on_formatted = date('l, F j<\\s\\u\\p>S</\\s\\u\\p>', strtotime($holidayDate->HolidayDeliverOn));
                    # Print each meal
                    foreach ($order->seperated_meals as $meal) {
                        $deliverMessage = '';
                        if ($meal['Meal']->MenuID === '3' || $meal['Meal']->MenuID === 3) {
                            /* if($holidayDate->HolidayOrderBy >= date('Y-m-d')) {
                               $deliverMessage = " (This item will be delivered on {$holiday_deliver_on_formatted})"    ;
                               } */
                        }
                        $body .= "\n    <li>{$meal['Count']} servings of {$meal['ItemName']}{$deliverMessage}</li>";
                    }
                    $body .= <<<EOT

    </ul>
</p>
Beispiel #19
0
    <p>
        <?php
        //subscription
        $total = new Amount();
        if ($sub) {
            $CostPerMeal           = new Amount(($sub->WeeklyReg * COST_REGULAR_SERVING) + ($sub->WeeklyVeg * COST_VEGETARIAN_SERVING));
            $subscription_subtotal = new Amount($sub->WeeklyMeals * $CostPerMeal->rounded);

            if ($krustomer->PromoCode) {
                $subscription_pretax = $krustomer->PromoCode->apply_discount($subscription_subtotal);
            } else {
                $subscription_pretax = new Amount($subscription_subtotal);
            }

            # Add delivery charge if necessary
            $zip = dbi()->q_1("SELECT * FROM ZipCode WHERE ZipCode = '{$krustomer->DeliveryAddress->Zip}'");
            if (!empty($zip) && $zip->Delivery !== '0.00') {
                $deliveryFee = new Amount($zip->Delivery);
            } else {
                $deliveryFee = new Amount(0);
            }

            $subscription_tax = new Amount($subscription_pretax->rounded * TAX_RATE);
            $total->add($subscription_pretax, $subscription_tax, $deliveryFee);
        }
        //weekly
        if (isset($allOrders)) {
            # Loop through each order to add the total
            foreach ($allOrders as $anOrder) {
                $total->add($anOrder->Amounts->Total->rounded);
            }
     }
     ?>
 </table>
 <h3>Customer Detail</h3>
 <table cellspacing='0' cellpadding='0' style="border-collapse: collapse;">
     <tr>
         <th>Name</th>
         <th># of servings</th>
         <th>Regular / Vegetarian</th>
         <th>Allergies</th>
         <th>Notes</th>
         <th>Kitchen Notes</th>
     </tr>
     <?php
     // Get customer data into an array
     $customers = dbi()->q_all(" SELECT *
                                 FROM KitchenReport1
                                     JOIN Customers USING(CustomerID)
                                 WHERE ItemID = '" . $order->ItemID . "'
                                 ORDER BY KitchenReport1.ItemName DESC");
     foreach ($customers as $customer) {
         echo "<tr><td>{$customer->FirstName} {$customer->LastName}</td>";
         echo "<td>{$customer->Count}</td>";
         if (!strpos($customer->ItemName, '- vegetarian')) {
             echo "<td>Regular</td>";
         } else {
             echo "<td>Vegetarian</td>";
         }
         echo "<td>{$customer->Allergies}</td>";
         echo "<td>{$customer->Comments}</td>";
         echo "<td>{$customer->kitchen_note}</td></tr>";
 public function delete_subscription()
 {
     $date = Gadget::$date_do->format(DATE_FORMAT_MYSQL);
     dbi()->q("DELETE FROM Subscriptions WHERE CustomerID = '{$this->CustomerID}' AND DeliveryDate = '{$date}'");
 }
        $chef_tasting = dbi()->q_all("  SELECT o.*, c.*
                                        FROM Orders o
                                            JOIN OrderDetails od ON od.OrderID = o.OrderID
                                            JOIN Customers c ON c.CustomerID = o.CustomerID
                                        WHERE o.DeliveryDate = '{$q_date_delivery}'
                                            AND od.Chefs_Tasting = 1
                                        GROUP BY o.CustomerID");
        $orders       = array_merge($orders, $chef_tasting);
        foreach ($orders as $order) {
            $details     = dbi()->q_all("   SELECT *
                                            FROM OrderDetails od
                                                JOIN Items i ON od.ItemID = i.ItemID
                                                JOIN Menus m ON m.MenuID = i.MenuID
                                            WHERE od.OrderID = {$order->OrderID} AND od.Count > 0
                                            ORDER BY m.packing_slip_sequence ASC, i.ItemName ASC");
            $veg_details = dbi()->q_all("   SELECT *
                                            FROM OrderDetails od
                                                JOIN Items i ON od.ItemID = i.ItemID
                                                JOIN Menus m ON m.MenuID = i.MenuID
                                            WHERE od.OrderID = {$order->OrderID} AND od.VegCount > 0
                                            ORDER BY m.packing_slip_sequence ASC, i.ItemName ASC");

            $long_delivery = Customer::get_long_delivery($order->Delivery_Window);
            $full_name     = $order->FirstName . " " . $order->LastName;
            $kitchen_note  = (!empty($order->kitchen_note)) ? $order->kitchen_note : "";
            $slip          = "<div class='order'>
                                <div class='header_image'><center><img src='/images/madison-and-rayne-logo-print.png' width='350' ></center></div>
                                <div class='order_inner'>
                                    <table style='width: 100%;'>
                                        <tbody>
                                            <tr>
 }
 ?>
             </table>
             <h3>Customer Detail</h3>
             <table cellspacing='0' cellpadding='0' style="border-collapse: collapse;">
                 <tr>
                     <th>Name</th>
                     <th># of servings</th>
                     <th>Regular / Vegetarian</th>
                     <th>Allergies</th>
                     <th>Notes</th>
                     <th>Kitchen Notes</th>
                 </tr>
                 <?php 
 // Get customer data into an array
 $customers = dbi()->q_all(" SELECT KitchenReport1.*, Customers.*\n                                                FROM KitchenReport1\n                                                    JOIN Customers USING(CustomerID)\n                                                WHERE ItemID = '" . $order->ItemID . "'\n                                                ORDER BY KitchenReport1.ItemName DESC");
 foreach ($customers as $customer) {
     echo "<tr><td>{$customer->FirstName} {$customer->LastName}</td>";
     echo "<td>{$customer->Count}</td>";
     if (!strpos($customer->ItemName, '- vegetarian')) {
         echo "<td>Regular</td>";
     } else {
         echo "<td>Vegetarian</td>";
     }
     echo "<td>{$customer->Allergies}</td>";
     echo "<td>{$customer->Comments}</td>";
     echo "<td>{$customer->kitchen_note}</td></tr>";
 }
 ?>
             </table>
             <?php