<?
session_start();
header("Cache-control: private");
require("quicklyweb.php");
require("security/secure.php");
beginDocument($lMain, $_SESSION['sess_user']);
echo "<table cellpadding=0 cellspacing=0 border=0 width=720 valign=top align=center><tr>";
echo "<td valign=top align=center width=\"720\" >";
$WhatKind = $lOwing;
$tot_class = "negative";
$config_result = DBquery("SELECT * from Configuration", $db);
$config_row = DBfetch_array($config_result);
$customer_result = DBquery("SELECT * from Customers WHERE Balance < 0", $db);
$customers_overdue = dbnum_rows($customer_result);
$customer_row = DBfetch_array($customer_result);
$overdue_result = DBquery("SELECT SUM(Balance) from Customers WHERE Balance < 0", $db);
$overdue_row = DBfetch_array($overdue_result);
$total_overdue = $overdue_row["SUM(Balance)"];
echo "<table cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"$TABLEBORDER\" border=\"0\" width=720 align=center>";
echo "<tr class='small'>";
echo "<td class=\"menu_icons\"><table><tr><td><a href=\"http://www.quicklyweb.co.uk/account/admin/customers.php?orderby=Balance&logic=DESC\" class=\"menu_icons\"><img src=\"images/icons/icon_warning.gif\" border=0></a></td><td><a href=\"http://www.quicklyweb.co.uk/account/admin/customers.php?orderby=Balance&logic=DESC\" class=\"menu_icons\">There is ".$customers_overdue." customers currently owe ".$total_overdue."</a></td></tr></td></table></td>";
echo "</tr>\n";
echo "</table></td></tr> ";
echo "</table>";
echo "<br>";
echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"720\">";
echo "<tr><td >";
$ticket_result = DBquery("SELECT * FROM Tickets WHERE Status=\"Open\" ORDER BY TicketID DESC", $db);
checkDBError($db);
$ticket_row = DBfetch_array($ticket_result);
$ticketcount = dbnum_rows($ticket_result);
?>
<table cellspacing=0 cellpadding=0 border=0 width=\"720\">
<?
if ($ticket_row) {
$class = "odd";
echo ("<tr class=\"small\"><td class=\"menu_icons\" width=\"720\"><table width=\"720\"><tr>\n");
echo ("<td><a href=\"support.php\" class=\"menu_icons\"><img src=\"images/icons/icon_warning.gif\" border=0></a></td>");
echo ("<td><a href=\"support.php\" class=\"menu_icons\">There is currenlty ".$ticketcount." open support tickets</a></td>");
echo ("</tr></table></td></tr>\n");
} else {
echo ("<tr class='odd'><td>$lNoTicketsFound</td></tr>\n");
}
echo "</table>";
echo "</td></tr>";
echo "</table></td></tr></table>";
endDocument();
?>