<?php | |
include('./lib/common.inc.php'); | |
include_header("Map"); | |
?> | |
<div class="msg_list"> | |
<p class="msg_head">Header-1 </p> | |
<div class="msg_body"> | |
orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit | |
</div> | |
<p class="msg_head">Header-2</p> | |
<div class="msg_body"> | |
orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit | |
</div> | |
<p class="msg_head">Header-3</p> | |
<div class="msg_body"> | |
orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit | |
</div> | |
</div> | |
sourced from austender | sourced from austender |
Government Agency Information (2009-07-10): National Archives of Australia, http://www.naa.gov.au under Creative Commons - Attribution 2.5 Australia (CC-BY) | Government Agency Information (2009-07-10): National Archives of Australia, http://www.naa.gov.au under Creative Commons - Attribution 2.5 Australia (CC-BY) |
jpgraph for php | jpgraph for php |
ABR | ABR |
Redhat Liberation fonts | Redhat Liberation fonts |
<?php | |
include_once("./lib/common.inc.php"); | |
$query = "SELECT DATE(importDate) as importday, count(*) as count, min(publishDate) as start, max(publishDate) as end | |
FROM `contractnotice` WHERE childCN = 0 AND parentCN = 0 AND DATE(importDate) in (select * from (SELECT DATE(importDate) | |
FROM `contractnotice` ORDER BY `importDate` DESC limit 1) alias)"; | |
$result = mysql_query($query); | |
echo "<div>"; | |
$stats = mysql_fetch_array($result, MYSQL_BOTH); | |
echo $stats["count"] . " new records in period " . $stats["start"] . " to " . $stats["end"] ."<br>"; | |
$query = "SELECT DATE(importDate) as importday, count(*) as count, min(publishDate) as start, max(publishDate) as end | |
FROM `contractnotice` WHERE (childCN != 0 OR parentCN != 0) AND DATE(importDate) in (select * from (SELECT DATE(importDate) | |
FROM `contractnotice` ORDER BY `importDate` DESC limit 1) alias)"; | |
$result = mysql_query($query); | |
echo "<div>"; | |
$stats = mysql_fetch_array($result, MYSQL_BOTH); | |
echo $stats["count"] . " updated records in period " . $stats["start"] . " to " . $stats["end"] ."<br>"; | |
echo "Last updated: ". $stats["importday"]."<br>"; | |
/* Check for null Procurement method and 0 ABN when not ABN exempt */ | |
include_footer(); | |
?> |
<?php | <?php |
error_reporting(E_ALL); | error_reporting(E_ALL); |
$link = mysql_connect('localhost', 'team7', 'wlUsnD2xu9'); | include_once("../lib/common.inc.php"); |
if (!$link) { | |
die('Could not connect: ' . mysql_error()); | |
} | |
@mysql_select_db("team7") or die("Unable to select database"); | |
$unspscresult = mysql_query ("select * from UNSPSCcategories;"); | $unspscresult = mysql_query ("select * from UNSPSCcategories;"); |
while ($row = mysql_fetch_assoc($unspscresult)) { | while ($row = mysql_fetch_assoc($unspscresult)) { |
$unspsc[$row['Title']] = $row['UNSPSC']; | $unspsc[$row['Title']] = $row['UNSPSC']; |
} | } |
$query = "SELECT CNID,category,value | $query = "SELECT CNID,category,value |
FROM `contractnotice` | FROM `contractnotice` |
WHERE `categoryUNSPSC` IS NULL OR `categoryUNSPSC` = 0"; | WHERE `categoryUNSPSC` IS NULL OR `categoryUNSPSC` = 0"; |
$emptycatresult = mysql_query ($query); | $emptycatresult = mysql_query ($query); |
$missing = Array(); | $missing = Array(); |
if ($emptycatresult){ | if ($emptycatresult){ |
while ($record = mysql_fetch_assoc($emptycatresult)) { | while ($record = mysql_fetch_assoc($emptycatresult)) { |
if ($unspsc[$record['category']] == "") { | if ($unspsc[$record['category']] == "") { |
$missing[$record['category']]= $missing[$record['category']]+ $record['value']; | $missing[$record['category']]= $missing[$record['category']]+ $record['value']; |
// echo "<br>\n Category not found for: \n"; | // echo "<br>\n Category not found for: \n"; |
// print_r($record); | // print_r($record); |
} else { | } else { |
$result = mysql_query("UPDATE contractnotice SET categoryUNSPSC = | $result = mysql_query("UPDATE contractnotice SET categoryUNSPSC = |
'".mysql_real_escape_string($unspsc[$record['category']])."' where CNID = | '".mysql_real_escape_string($unspsc[$record['category']])."' where CNID = |
'".mysql_real_escape_string($record['CNID'])."';"); | '".mysql_real_escape_string($record['CNID'])."';"); |
if ($result) echo $record['CNID']. " set to ". ($unspsc[$record['category']]) . " <br>\n"; | if ($result) echo $record['CNID']. " set to ". ($unspsc[$record['category']]) . " <br>\n"; |
else echo "error".mysql_error(); | else echo "error".mysql_error(); |
} | } |
} | } |
} else echo "error".mysql_error(); | } else echo "error".mysql_error(); |
asort($missing); | asort($missing); |
print_r($missing); | print_r($missing); |
?> | ?> |
<?php | <?php |
include_once ("./lib/common.inc.php"); | include_once ("./lib/common.inc.php"); |
if ($_REQUEST['agency']) { | if ($_REQUEST['agency']) { |
include_header("Agency"); | include_header("Agency"); |
$agency = htmlentities(strip_tags($_REQUEST['agency'])); | $agency = htmlentities(strip_tags($_REQUEST['agency'])); |
echo '<img src="graphs/displayMethodCountGraph.php?agency=' . stripslashes($agency) . '">'; | echo '<img src="graphs/displayMethodCountGraph.php?agency=' . stripslashes($agency) . '">'; |
echo '<img src="graphs/displayCnCGraph.php?agency=' . stripslashes($agency) . '">'; | echo '<img src="graphs/displayCnCGraph.php?agency=' . stripslashes($agency) . '">'; |
echo '<img src="graphs/displayMethodValueGraph.php?agency=' . stripslashes($agency) . '">'; | echo '<img src="graphs/displayMethodValueGraph.php?agency=' . stripslashes($agency) . '">'; |
/*biggest contracts | /*biggest contracts |
spending by year | spending by year |
spending by industry/category | spending by industry/category |
spending by supplier | spending by supplier |
spread procurement methods (stacked bar graph) | spread procurement methods (stacked bar graph) |
+ percent consultancies + percent confidential (bar graph) | + percent consultancies + percent confidential (bar graph) |
Average value by procurement type | Average value by procurement type |
--- info | --- info |
website, procurement plan, annual reports | website, procurement plan, annual reports |
Breakdown percentage,number,value by procurement type | Breakdown percentage,number,value by procurement type |
Histograph, overlaying number value reported per week over X years | Histograph, overlaying number value reported per week over X years |
Compliance statistics: amendments, delay in reporting average and number completely late*/ | Compliance statistics: amendments, delay in reporting average and number completely late*/ |
} else { | } else { |
/* | |
split by portfolio | |
*/ | |
include_header("Agencies"); | include_header("Agencies"); |
$query = "SELECT SUM(value), agencyName | $query = "SELECT SUM(value), agencyName |
FROM `contractnotice` | FROM `contractnotice` |
WHERE childCN = 0 | WHERE childCN = 0 |
GROUP BY agencyName "; | GROUP BY agencyName "; |
$result = mysql_query($query); | $result = mysql_query($query); |
echo "<table>"; | echo "<table>"; |
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { | while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { |
setlocale(LC_MONETARY, 'en_US'); | setlocale(LC_MONETARY, 'en_US'); |
$value = number_format(doubleval($row[0]) , 2); | $value = number_format(doubleval($row[0]) , 2); |
$agency = stripslashes($row[1]); | $agency = stripslashes($row[1]); |
echo ("<tr><td><b><a href=\"displayAgency.php?agency={$agency}\">{$agency}</a></b></td><td>\$$value</td></tr>\n"); | echo ("<tr><td><b><a href=\"displayAgency.php?agency={$agency}\">{$agency}</a></b></td><td>\$$value</td></tr>\n"); |
} | } |
echo "</table>"; | echo "</table>"; |
mysql_free_result($result); | mysql_free_result($result); |
} | } |
include_footer(); | include_footer(); |
?> | ?> |
<?php | <?php |
include_once("./lib/common.inc.php"); | include_once("./lib/common.inc.php"); |
/* | |
split by year | |
*/ | |
/* | /* |
todo: | todo: |
Year/Month drilldown - largest contracts, agencies, suppliers*/ | Year/Month drilldown - largest contracts, agencies, suppliers |
big picture graphs?*/ | |
include_header("Months and Years"); | include_header("Months and Years"); |
$query = "SELECT YEAR(contractStart), MONTH(contractStart), | $query = "SELECT YEAR(contractStart), MONTH(contractStart), |
value FROM `contractnotice` WHERE childCN = 0 GROUP BY MONTH(contractStart), YEAR(contractStart) ORDER BY YEAR(contractStart), MONTH(contractStart) "; | value FROM `contractnotice` WHERE childCN = 0 GROUP BY MONTH(contractStart), YEAR(contractStart) ORDER BY YEAR(contractStart), MONTH(contractStart) "; |
$result = mysql_query($query); | $result = mysql_query($query); |
echo "<table>"; | echo "<table>"; |
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { | while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { |
setlocale(LC_MONETARY, 'en_US'); | setlocale(LC_MONETARY, 'en_US'); |
$value = number_format(doubleval($row["value"]),2); | $value = number_format(doubleval($row["value"]),2); |
$month_name = date( 'F', mktime(0, 0, 0, $row[1]) ); | $month_name = date( 'F', mktime(0, 0, 0, $row[1]) ); |
echo ("<tr><td><b>$month_name {$row[0]}</b></td><td>\$$value</td></tr>"); | echo ("<tr><td><b>$month_name {$row[0]}</b></td><td>\$$value</td></tr>"); |
} | } |
echo "</table>"; | echo "</table>"; |
mysql_free_result($result); | mysql_free_result($result); |
include_footer(); | include_footer(); |
?> | ?> |
<?php | <?php |
include_once ("./lib/common.inc.php"); | include_once ("./lib/common.inc.php"); |
if ($_REQUEST['category']) { | if ($_REQUEST['category']) { |
include_header("Category"); | include_header("Category"); |
echo "<center><h1>".$_REQUEST['category']."</h1></center>"; | echo "<center><h1>".$_REQUEST['category']."</h1></center>"; |
$query = "SELECT CNID, description, value, agencyName, category, contractStart, supplierName | $query = "SELECT CNID, description, value, agencyName, category, contractStart, supplierName |
FROM `contractnotice` | FROM `contractnotice` |
WHERE childCN = 0 | WHERE childCN = 0 |
AND category = '" . $_REQUEST['category'] . "' | AND category = '" . $_REQUEST['category'] . "' |
ORDER BY value DESC"; | ORDER BY value DESC"; |
$result = mysql_query($query); | $result = mysql_query($query); |
echo "<table>"; | echo "<table>"; |
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { | while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { |
setlocale(LC_MONETARY, 'en_US'); | setlocale(LC_MONETARY, 'en_US'); |
$value = number_format(doubleval($row['value']) , 2); | $value = number_format(doubleval($row['value']) , 2); |
echo ("<tr> | echo ("<tr> |
<td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td> | <td><a href=\"displayContract.php?CNID={$row['CNID']}\">{$row['CNID']}</a></td> |
<td><b>{$row['description']}</b></a></td> | <td><b>{$row['description']}</b></a></td> |
<td>\$$value</td><td>{$row['agencyName']}</td> | <td>\$$value</td><td>{$row['agencyName']}</td> |
<td>{$row['contractStart']}</td> | <td>{$row['contractStart']}</td> |
<td>{$row['supplierName']}</td> | <td>{$row['supplierName']}</td> |
</tr>"); | </tr>"); |
} | } |
echo "</table>"; | echo "</table>"; |
mysql_free_result($result); | mysql_free_result($result); |
} else { | } else { |
/* | |
split by main categories | |
*/ | |
include_header("Categories"); | include_header("Categories"); |
$query = "SELECT sum(value), category | $query = "SELECT sum(value), category |
FROM `contractnotice` | FROM `contractnotice` |
WHERE childCN = 0 | WHERE childCN = 0 |
GROUP BY category ORDER BY sum(value) DESC "; | GROUP BY category ORDER BY sum(value) DESC "; |
$result = mysql_query($query); | $result = mysql_query($query); |
echo "<table>"; | echo "<table>"; |
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { | while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { |
setlocale(LC_MONETARY, 'en_US'); | setlocale(LC_MONETARY, 'en_US'); |
$value = number_format(doubleval($row[0]) , 2); | $value = number_format(doubleval($row[0]) , 2); |
echo ("<tr><td><A href=\"displayCategory.php?category={$row[1]}\"><b>{$row[1]}</b></a></td><td>\$$value</td></tr>"); | echo ("<tr><td><A href=\"displayCategory.php?category={$row[1]}\"><b>{$row[1]}</b></a></td><td>\$$value</td></tr>"); |
} | } |
echo "</table>"; | echo "</table>"; |
mysql_free_result($result); | mysql_free_result($result); |
} | } |
include_footer(); | include_footer(); |
?> | ?> |
<?php | <?php |
require_once ('jpgraph/jpgraph.php'); | require_once ('jpgraph/jpgraph.php'); |
require_once ('jpgraph/jpgraph_line.php'); | require_once ('jpgraph/jpgraph_line.php'); |
require_once ('jpgraph/jpgraph_log.php'); | require_once ('jpgraph/jpgraph_log.php'); |
require_once ('jpgraph/jpgraph_mgraph.php'); | require_once ('jpgraph/jpgraph_mgraph.php'); |
require_once ('jpgraph/jpgraph_pie.php'); | require_once ('jpgraph/jpgraph_pie.php'); |
require_once ('jpgraph/jpgraph_bar.php'); | require_once ('jpgraph/jpgraph_bar.php'); |
require_once ('jpgraph/jpgraph_date.php'); | require_once ('jpgraph/jpgraph_date.php'); |
error_reporting(E_ALL ^ E_NOTICE); | |
$link = mysql_connect('localhost', 'root', ''); | $link = mysql_connect('localhost', 'root', ''); |
if (!$link) { | if (!$link) { |
die('Could not connect: ' . mysql_error()); | die('Could not connect: ' . mysql_error()); |
} | } |
@mysql_select_db("contractDashboard") or die("Unable to select database"); | @mysql_select_db("contractDashboard") or die("Unable to select database"); |
function ucsmart($str) { | function ucsmart($str) { |
return preg_replace("/(?<=(?<!:|’s)\W) | return preg_replace("/(?<=(?<!:|’s)\W) |
(A|An|And|At|For|In|Of|On|Or|The|To|With) | (A|An|And|At|For|In|Of|On|Or|The|To|With) |
(?=\W)/e", 'strtolower("$1")', ucwords(strtolower($str))); | (?=\W)/e", 'strtolower("$1")', ucwords(strtolower($str))); |
} | } |
function percent($num_amount, $num_total) { | function percent($num_amount, $num_total) { |
$count1 = $num_amount / $num_total; | $count1 = $num_amount / $num_total; |
$count2 = $count1 * 100; | $count2 = $count1 * 100; |
$count = number_format($count2, 2); | $count = number_format($count2, 2); |
return $count; | return $count; |
} | } |
function array_sum_all($a) { | function array_sum_all($a) { |
if(!is_array($a)) return $a; | if(!is_array($a)) return $a; |
foreach($a as $key=>$value) | foreach($a as $key=>$value) |
$totale += array_sum_all($value); | $totale += array_sum_all($value); |
return $totale; | return $totale; |
} | } |
$agency = mysql_real_escape_string(stripslashes($_REQUEST['agency'])); | $agency = mysql_real_escape_string(stripslashes($_REQUEST['agency'])); |
if ($agency != "") $agencyQ = "agencyName = '" . $agency . "' AND"; | if ($agency != "") $agencyQ = "agencyName = '" . $agency . "' AND"; |
$supplier = mysql_real_escape_string(stripslashes($_REQUEST['supplier'])); | $supplier = mysql_real_escape_string(stripslashes($_REQUEST['supplier'])); |
if ($supplier != "") { | if ($supplier != "") { |
$supplierParts = explode("-", $supplier); | $supplierParts = explode("-", $supplier); |
if ($supplierParts[0] > 0) $supplierQ = "supplierABN = '" . $supplierParts[0] . "' AND"; | if ($supplierParts[0] > 0) $supplierQ = "supplierABN = '" . $supplierParts[0] . "' AND"; |
else $supplierQ = "supplierName LIKE '%" . $supplierParts[1] . "%' AND"; | else $supplierQ = "supplierName LIKE '%" . $supplierParts[1] . "%' AND"; |
} | } |
$year = mysql_real_escape_string(stripslashes($_REQUEST['year'])); | $year = mysql_real_escape_string(stripslashes($_REQUEST['year'])); |
if ($year != "") $yearQ = "agencyName = '" . $agency . "' AND"; | if ($year != "") $yearQ = "agencyName = '" . $agency . "' AND"; |
$start =0.0; | $start =0.0; |
function include_header($title) { | function include_header($title) { |
global $start; | global $start; |
?> | ?> |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
"http://www.w3.org/TR/html4/strict.dtd"> | "http://www.w3.org/TR/html4/strict.dtd"> |
<html> | <html> |
<head> | <head> |
<title>Contract Dashboard - <?=$title?></title> | <title>Contract Dashboard - <?=$title?></title> |
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css"> | <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css"> |
<link type="text/css" rel="stylesheet" href="style.css"> | <link type="text/css" rel="stylesheet" href="style.css"> |
<script type="text/javascript" src="lib/bsn.AutoSuggest_2.1.3_comp.js" charset="utf-8"></script> | |
<link rel="stylesheet" href="autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8" /> | |
<script type="text/javascript" src="lib/jquery.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() | |
{ | |
//hide the all of the element with class msg_body | |
$(".msg_body").hide(); | |
//toggle the componenet with class msg_body | |
$(".msg_head").click(function() | |
{ | |
$(this).next(".msg_body").slideToggle(600); | |
}); | |
}); | |
</script> | |
</head> | </head> |
<body><div id="doc3" class="yui-t4"/> | <body><div id="doc3" class="yui-t4"> |
<div id="hd"> | <div id="hd"> |
<h1> contract dashboard</h1> | <h1> contract dashboard</h1> |
</div> | </div> |
<div id="sitenav"> | <div id="sitenav"> |
<a href="displayAgency.php">agencies</a> | <a href="displayAgency.php">agencies</a> |
<a href="displaySupplier.php">suppliers</a> | <a href="displaySupplier.php">suppliers</a> |
<a href="displayCategory.php">product/service categories</a> | <a href="displayCategory.php">product/service categories</a> |
<a href="displayCalendar.php">time periods</a> | <a href="displayCalendar.php">time periods</a> |
| metrics | | | metrics | |
<a href="displayProcurementMethod.php">procurement method</a> | <a href="displayProcurementMethod.php">procurement method</a> |
<a href="displayConfidentialities.php">contractual confidentiality</a> | <a href="displayConfidentialities.php">contractual confidentiality</a> |
<a href="displayConsultancies.php">consultancies</a> | <a href="displayConsultancies.php">consultancies</a> |
<a href="displayMap.php">postcodes</a> | <a href="displayMap.php">postcodes</a> |
<div id="search"> search <f |