| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/hans_sites/yogurtlanddelivers.com/ |
Upload File : |
<?php
session_start();
require_once($_SERVER['DOCUMENT_ROOT'].'/php/mysql.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/php/phpCrypto.class.php');
$crypto = new phpCrypto();
function format_cc($str) {
if(substr($str,0,1)=='3') {
return substr($str,0,4).'-'.substr($str,4,6).'-'.substr($str,8,5);
} else {
return substr($str,0,4).'-'.substr($str,4,4).'-'.substr($str,8,4).'-'.substr($str,12,4);
}
}
$open_orders = $db->query("SELECT * FROM yogurtland_delivers.orders WHERE DATE(delivery_time)=CURDATE() AND date_delivered='0000-00-00 00:00:00'");
foreach($open_orders as $k=>$v) {
$cups = $db->query("SELECT * FROM yogurtland_delivers.orders_cups WHERE order_id='".clean($v['id'])."'");
foreach($cups as $cupk=>$cupv) {
$cups[$cupk]['flavors'] = $db->query("SELECT flavor FROM yogurtland_delivers.orders_flavors WHERE order_id='".clean($v['id'])."' AND cup_id='".clean($cupv['id'])."'");
$cups[$cupk]['toppings'] = $db->query("SELECT topping FROM yogurtland_delivers.orders_toppings WHERE order_id='".clean($v['id'])."' AND cup_id='".clean($cupv['id'])."'");
}
$open_orders[$k]['cups'] = $cups;
}
$closed_orders = $db->query("SELECT * FROM yogurtland_delivers.orders WHERE DATE(delivery_time)=CURDATE() AND date_delivered<>'0000-00-00 00:00:00'");
foreach($closed_orders as $k=>$v) {
$cups = $db->query("SELECT * FROM yogurtland_delivers.orders_cups WHERE order_id='".clean($v['id'])."'");
foreach($cups as $cupk=>$cupv) {
$cups[$cupk]['flavors'] = $db->query("SELECT flavor FROM yogurtland_delivers.orders_flavors WHERE order_id='".clean($v['id'])."' AND cup_id='".clean($cupv['id'])."'");
$cups[$cupk]['toppings'] = $db->query("SELECT topping FROM yogurtland_delivers.orders_toppings WHERE order_id='".clean($v['id'])."' AND cup_id='".clean($cupv['id'])."'");
}
$closed_orders[$k]['cups'] = $cups;
}
$current_employee_res = $db->query("SELECT employee_id
FROM yogurtland_delivers.current_driver
WHERE 1
LIMIT 1");
$current_employee = (!empty($current_employee_res)) ? $current_employee_res[0]['employee_id'] : '0';
$all_employees = $db->query("SELECT employee,worker
FROM ylreports_HansKirchhausen.employees
WHERE status='active'
ORDER BY worker ASC");
ob_start();
?>
<script src="https://maps.googleapis.com/maps/api/js?libraries=places&language=en&key=AIzaSyAMa-7Mo7yslrUfVwVM0_SbA8-9ipskfkk"></script>
<script src="/js/view_customer_orders.js"></script>
<div id="real_content">
<div class="current_driver">
<label>Current Driver:
<select name="current_driver" onchange="update_current_driver(this);">
<option value=""></option>
<?php foreach($all_employees as $employee) { ?>
<option value="<?= $employee['employee'];?>" <?= ($current_employee==$employee['employee']) ? 'selected' : '';?>><?= $employee['worker'];?></option>
<?php } ?>
</select>
</label>
</div>
<div class="open_orders">
<div class="get_directions_button" onclick="get_directions();">Get Directions</div>
<div class="orders_header">Open Orders</div>
<div style="clear:both;"></div>
<table class="orders_table">
<tr>
<th style="width:30px;"></th>
<th>Delivery Window</th>
<th>Details</th>
<th>Print</th>
<th>Created</th>
<th>Delivered</th>
<th>Charged</th>
</tr>
<?php
if(!empty($open_orders)) {
foreach($open_orders as $order) {
$total_cups = count($order['cups']);
$cup_types = array();
$cup_types_details = array();
foreach($order['cups'] as $cup) {
$cup_types[$cup['ounces']][] = $cup['name_on_cup'];
$cup_types_details[$cup['ounces']][] = $cup;
}
uksort($cup_types,function($a,$b) {
return $a*1 - $b*1;
});
?>
<tr>
<td><input type="checkbox" class="order_checkbox" name="orders[]" value="<?= $order['id'];?>" /></td>
<td><?= date('g:i ',strtotime($order['delivery_time']));?> - <?= date('g:i a',strtotime('+30 minute',strtotime($order['delivery_time'])));?></td>
<td>
<div class="order_summary_container">
<div><strong><?= $order['cc_last_name'];?> - <?= $total_cups;?></strong></div>
<div><strong><a href="http://maps.apple.com/?q=<?= urlencode($order['full_address']);?>" target="_blank"><?= $order['address'];?></a></strong></div>
<div><?= $order['address_comment'];?></div>
<div><?= ($order['used_current_location']) ? 'Used GPS' : 'Entered Address';?></div>
<div><strong><?= substr($order['cc_phone'],0,3).'-'.substr($order['cc_phone'],3,3).'-'.substr($order['cc_phone'],6,4);?></strong></div>
<?php foreach($cup_types as $cup_type=>$cup_value) { ?>
<div class="cup_type_sizes" onclick="show_cup_details(this);">
<?= count($cup_value);?> (<?= $cup_type;?> oz) - <?= implode(', ',$cup_value);?>
<div class="hidden_stuff">
<?php foreach($cup_types_details[$cup_type] as $cup) {
$total_flavor_list = count($cup['flavors']);
if(count($cup['toppings'])) {
$total_flavor_list = count($cup['toppings']);
}
?>
<div class="order_summary">
<img src="/images/checkout_yogurt.png" />
<div class="order_ounces"><?= $cup['name_on_cup'];?> - <?= $cup['ounces'];?> oz Cup</div>
<div class="order_price">$<?= number_format($cup['price'],2);?></div>
<table>
<tr>
<td class="order_summary_flavor_title">Flavors:</td>
<td class="order_summary_flavor_title">Toppings:</td>
</tr>
<?php for($i=0;$i<$total_flavor_list;$i++) { ?>
<tr>
<?php if(!empty($cup['flavors'][$i])) { ?>
<td><?= $i+1;?>. <?= $cup['flavors'][$i]['flavor'];?></td>
<?php } else { ?>
<td></td>
<?php } ?>
<?php if(!empty($cup['toppings'][$i])) { ?>
<td><?= $i+1;?>. <?= $cup['toppings'][$i]['topping'];?></td>
<?php } else { ?>
<td></td>
<?php } ?>
</tr>
<?php } ?>
</table>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
<div style="display:none;"><a href="/functions/view_step_log.php?ip_address=<?= urlencode($order['ip_address']);?>" target="_blank">View Notes</a></div>
</div>
</td>
<td>
<?php if($order['date_printed']!='0000-00-00 00:00:00') { ?>
<div class="order_button_finished" onclick="mark_order_printed(this,'<?= $order['id'];?>');"><?= date('g:i',strtotime($order['date_printed']));?></div>
<?php } else { ?>
<div class="order_button_not_finished" onclick="mark_order_printed(this,'<?= $order['id'];?>');">Done</div>
<?php } ?>
</td>
<td>
<?php if($order['date_yogurt_created']!='0000-00-00 00:00:00') { ?>
<div class="order_button_finished" onclick="mark_order_created(this,'<?= $order['id'];?>');"><?= date('g:i',strtotime($order['date_yogurt_created']));?></div>
<?php } else { ?>
<div class="order_button_not_finished" onclick="mark_order_created(this,'<?= $order['id'];?>');">Done</div>
<?php } ?>
</td>
<td>
<?php if($order['date_delivered']!='0000-00-00 00:00:00') { ?>
<div class="order_button_finished" onclick="mark_order_delivered(this,'<?= $order['id'];?>');"><?= date('g:i',strtotime($order['date_delivered']));?></div>
<?php } else { ?>
<div class="order_button_not_finished" onclick="mark_order_delivered(this,'<?= $order['id'];?>');">Done</div>
<?php } ?>
</td>
<td style="position:relative;">
<?php if($order['paid_for']=='1') { ?>
<div class="order_button_finished">Paid</div>
<?php } else { ?>
<div class="order_button_not_finished" onclick="$(this).siblings('.credit_card_info').toggle();">Charge Card</div>
<div class="credit_card_info" style="display:none;padding:10px;">
<div style="white-space:nowrap;"><?= format_cc($crypto->decrypt($order['real_card_num']));?></div>
<div><?= $order['cc_exp_month'].'/'.$order['cc_exp_year'];?></div>
<div>CVV: <?= $crypto->decrypt($order['real_cvv']);?></div>
<div>Amount: $<?= number_format(round($order['total_cost'],2),2);?></div>
<button onclick="mark_card_approved(this,'<?= $order['id'];?>');">Card Approved</button>
</div>
<?php } ?>
</td>
</tr>
<?php
}
}
?>
</table>
<br />
<div class="orders_header">Todays Completed Orders</div>
<table class="orders_table finished_orders_table">
<tr>
<th>Delivery Window</th>
<th>Details</th>
<th>Print</th>
<th>Created</th>
<th>Delivered</th>
</tr>
<?php
if(!empty($closed_orders)) {
foreach($closed_orders as $order) {
$total_cups = count($order['cups']);
$cup_types = array();
$cup_types_details = array();
foreach($order['cups'] as $cup) {
$cup_types[$cup['ounces']][] = $cup['name_on_cup'];
$cup_types_details[$cup['ounces']][] = $cup;
}
uksort($cup_types,function($a,$b) {
return $a*1 - $b*1;
});
?>
<tr>
<td><?= date('g:i ',strtotime($order['delivery_time']));?> - <?= date('g:i a',strtotime('+30 minute',strtotime($order['delivery_time'])));?></td>
<td>
<div class="order_summary_container">
<div><strong><?= $order['cc_last_name'];?> - <?= $total_cups;?></strong></div>
<div><strong><?= $order['address'];?></strong></div>
<div><strong><?= substr($order['cc_phone'],0,3).'-'.substr($order['cc_phone'],3,3).'-'.substr($order['cc_phone'],6,4);?></strong></div>
<?php foreach($cup_types as $cup_type=>$cup_value) { ?>
<div class="cup_type_sizes" onclick="show_cup_details(this);">
<?= count($cup_value);?> (<?= $cup_type;?> oz) - <?= implode(', ',$cup_value);?>
<div class="hidden_stuff">
<?php foreach($cup_types_details[$cup_type] as $cup) {
$total_flavor_list = count($cup['flavors']);
if(count($cup['toppings'])) {
$total_flavor_list = count($cup['toppings']);
}
?>
<div class="order_summary">
<img src="/images/checkout_yogurt.png" />
<div class="order_ounces"><?= $cup['name_on_cup'];?> - <?= $cup['ounces'];?> oz Cup</div>
<div class="order_price">$<?= number_format($cup['price'],2);?></div>
<table>
<tr>
<td class="order_summary_flavor_title">Flavors:</td>
<td class="order_summary_flavor_title">Toppings:</td>
</tr>
<?php for($i=0;$i<$total_flavor_list;$i++) { ?>
<tr>
<?php if(!empty($cup['flavors'][$i])) { ?>
<td><?= $i+1;?>. <?= $cup['flavors'][$i]['flavor'];?></td>
<?php } else { ?>
<td></td>
<?php } ?>
<?php if(!empty($cup['toppings'][$i])) { ?>
<td><?= $i+1;?>. <?= $cup['toppings'][$i]['topping'];?></td>
<?php } else { ?>
<td></td>
<?php } ?>
</tr>
<?php } ?>
</table>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
<div><a href="/functions/view_step_log.php?ip_address=<?= urlencode($order['ip_address']);?>" target="_blank">View Notes</a></div>
</div>
</td>
<td>
<?php if($order['date_printed']!='0000-00-00 00:00:00') { ?>
<div class="order_button_finished"><?= date('g:i',strtotime($order['date_printed']));?></div>
<?php } else { ?>
<div class="order_button_not_finished">Done</div>
<?php } ?>
</td>
<td>
<?php if($order['date_yogurt_created']!='0000-00-00 00:00:00') { ?>
<div class="order_button_finished"><?= date('g:i',strtotime($order['date_yogurt_created']));?></div>
<?php } else { ?>
<div class="order_button_not_finished">Done</div>
<?php } ?>
</td>
<td>
<?php if($order['date_delivered']!='0000-00-00 00:00:00') { ?>
<div class="order_button_finished"><?= date('g:i',strtotime($order['date_delivered']));?></div>
<?php } else { ?>
<div class="order_button_not_finished">Done</div>
<?php } ?>
</td>
</tr>
<?php
}
}
?>
</table>
</div>
</div>
<?php
$title = 'Yogurtland Delivers - Orders';
$page = 'view_orders';
$html = ob_get_clean();
include('layout.php');
?>