First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
+190
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
$ValidAccess = 2010;
|
||||
require_once("include/globals.php");
|
||||
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
// Ensure that only valid user types have access to this module
|
||||
$AllowedUserTypes = array('SuperUser');
|
||||
if (checkPermission($AllowedUserTypes) != 1) {
|
||||
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
||||
$naction = '';
|
||||
header("Location: /?action=$action&naction=$naction$headerArgs&form_message=" . urlencode($form_message) . "&error_message=" . urlencode($error_message));
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
<style>
|
||||
body {
|
||||
font: 12px Arial, Helvetica, sans-serif;
|
||||
padding: 0;
|
||||
}
|
||||
p {
|
||||
padding: 0 0 0 15px;
|
||||
}
|
||||
h3 {
|
||||
font: 14px Arial, Helvetica, sans-serif;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.country, .country a {
|
||||
color: #ffffff;
|
||||
background: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.province, .province a {
|
||||
color: #000000;
|
||||
background: #cccccc;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.small {
|
||||
font: 10px Arial, Helvetica, sans-serif;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
include "db.php";
|
||||
|
||||
unset($prov);
|
||||
unset($country);
|
||||
unset($where);
|
||||
unset($set);
|
||||
|
||||
if (array_key_exists('prov',$_GET) && strlen($_GET['prov'])) $prov = $_GET['prov'];
|
||||
if (array_key_exists('country',$_GET) && strlen($_GET['country'])) $country = $_GET['country'];
|
||||
if (array_key_exists('where',$_GET) && strlen($_GET['where'])) $where = $_GET['where'];
|
||||
if (array_key_exists('set',$_GET) && strlen($_GET['set'])) $set = $_GET['set'];
|
||||
|
||||
if (!isset($prov) && !isset($country) && !isset($set)) {
|
||||
header("Location: /school-list.php?prov=BC");
|
||||
exit();
|
||||
}
|
||||
|
||||
echo("<p>$where</p>\n");
|
||||
|
||||
$displayReseller = false;
|
||||
$cutoff = date("Y-m-d",time() - 60 * 60 * 24 * 30);
|
||||
|
||||
if (isset($prov)) {
|
||||
$query = "select school_name,system_configuration,datediff(expiry_date,curdate()) as days,count(i.record_num) as num_invoices," .
|
||||
"max(school_year),address,city,province,country,url,reseller,principal,principal_email,phone,type,s.status,start_date,expiry_date," .
|
||||
"paypal_enabled,system_access_code,s.display,s.record_num " .
|
||||
"from schools as s left join invoice_header as i on s.record_num = i.school_num " .
|
||||
"where s.status = 'Active' and province = '$prov' " .
|
||||
"$where " .
|
||||
"group by 1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 " .
|
||||
"order by city,school_name";
|
||||
$groupBy = "city";
|
||||
}
|
||||
|
||||
if (isset($country)) {
|
||||
$query = "select school_name,system_configuration,datediff(expiry_date,curdate()) as days,count(i.record_num) as num_invoices," .
|
||||
"max(school_year),address,city,province,country,url,reseller,principal,principal_email,phone,type,s.status,start_date,expiry_date," .
|
||||
"paypal_enabled,system_access_code,s.display,s.record_num " .
|
||||
"from schools as s left join invoice_header as i on s.record_num = i.school_num " .
|
||||
"where s.status = 'Active' and country = '$country' " .
|
||||
"$where " .
|
||||
"group by 1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 " .
|
||||
"order by province,city,school_name";
|
||||
$groupBy = "province";
|
||||
}
|
||||
|
||||
if (!isset($prov) && !isset($country) && isset($set)) {
|
||||
switch ($set) {
|
||||
case 'expiring':
|
||||
$cutoff = date("Y-m-d",time() + 60 * 60 * 24 * 30);
|
||||
$query = "select school_name,system_configuration,datediff(expiry_date,curdate()) as days,count(i.record_num) as num_invoices," .
|
||||
"max(school_year),address,city,province,country,url,reseller,principal,principal_email,phone,type,s.status,start_date,expiry_date," .
|
||||
"paypal_enabled,system_access_code,s.display,s.record_num " .
|
||||
"from schools as s left join invoice_header as i on s.record_num = i.school_num " .
|
||||
"where s.status = 'Active' " .
|
||||
"and expiry_date < '$cutoff' " .
|
||||
"and reseller = 'hotlunch' " .
|
||||
"group by 1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 " .
|
||||
"order by country,province,city,school_name";
|
||||
$groupBy = "province";
|
||||
break;
|
||||
|
||||
case 'new':
|
||||
$query = "select school_name,system_configuration,datediff(expiry_date,curdate()) as days,count(i.record_num) as num_invoices," .
|
||||
"max(school_year),address,city,province,country,url,reseller,principal,principal_email,phone,type,s.status,start_date,expiry_date," .
|
||||
"paypal_enabled,system_access_code,s.display,s.record_num " .
|
||||
"from schools as s left join invoice_header as i on s.record_num = i.school_num " .
|
||||
"where s.status = 'Active' " .
|
||||
"and start_date >= '$cutoff' " .
|
||||
"and reseller = 'hotlunch' " .
|
||||
"group by 1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 " .
|
||||
"order by country,province,city,school_name";
|
||||
$groupBy = "province";
|
||||
break;
|
||||
|
||||
case 'all':
|
||||
$query = "select school_name,system_configuration,datediff(expiry_date,curdate()) as days,count(i.record_num) as num_invoices," .
|
||||
"max(school_year),address,city,province,country,url,reseller,principal,principal_email,phone,type,s.status,start_date,expiry_date," .
|
||||
"paypal_enabled,system_access_code,s.display,s.record_num " .
|
||||
"from schools as s left join invoice_header as i on s.record_num = i.school_num " .
|
||||
"where s.status = 'Active' " .
|
||||
"group by 1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 " .
|
||||
"order by country,province,city,school_name";
|
||||
$groupBy = "province";
|
||||
|
||||
$displayReseller = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$results = db_query($query);
|
||||
|
||||
$prev_country = "-";
|
||||
$prev_province = "-";
|
||||
$prev_city = "-";
|
||||
|
||||
while ($row = db_fetch_array($results)) {
|
||||
extract($row);
|
||||
|
||||
if ($groupBy == "province" && $province != $prev_province) {
|
||||
if ($prev_country != $country) echo("<br><h2>---- $country ----</h2>\n");
|
||||
echo("<h2>$province</h2>\n");
|
||||
$prev_province = $province;
|
||||
$prev_country = $country;
|
||||
}
|
||||
|
||||
if ($city != $prev_city) {
|
||||
echo("<h3>$city</h3>\n");
|
||||
$prev_city = $city;
|
||||
}
|
||||
|
||||
$ncode = "";
|
||||
if ($start_date >= $cutoff) $ncode = " <b>**** NEW ****</b>";
|
||||
|
||||
echo("<p><b><a href='http://$url/' target='_blank'>$school_name</a></b>$ncode<br>\n");
|
||||
echo("$address, $city, $province<br>\n");
|
||||
|
||||
$rcode = "";
|
||||
if ($displayReseller && $reseller != 'hotlunch') $rcode = "<b>($reseller)</b>";
|
||||
if (isset($set)) echo("Start: $start_date / Expiry: $expiry_date $rcode<br>\n");
|
||||
|
||||
$cresults = db_query("SELECT * FROM school_contact_list WHERE school_num = $record_num ORDER BY sequence LIMIT 0,1");
|
||||
if (db_num_rows($cresults) == 1) {
|
||||
$row = db_fetch_array($cresults);
|
||||
extract($row);
|
||||
echo("$contact_name - $contact_phone $contact_email<br>\n");
|
||||
}
|
||||
|
||||
echo("</p>\n");
|
||||
}
|
||||
|
||||
echo("<p><br></p>\n");
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user