From: maxious Date: Wed, 24 Nov 2010 08:28:02 +0000 Subject: Prettier JQuery tables X-Git-Url: http://maxious.lambdacomplex.org/git/?p=contractdashboard.git&a=commitdiff&h=2168524e9590a454062a4c432b1145dabc8002cb --- Prettier JQuery tables --- --- a/about.php +++ b/about.php @@ -1,6 +1,55 @@ + + +
+

Header-1

+
+orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit +
+

Header-2

+
+orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit +
+

Header-3

+
+orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit +
+
+ 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) jpgraph for php ABR Redhat Liberation fonts - + + +"; +$stats = mysql_fetch_array($result, MYSQL_BOTH); +echo $stats["count"] . " new records in period " . $stats["start"] . " to " . $stats["end"] ."
"; + + +$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 "
"; +$stats = mysql_fetch_array($result, MYSQL_BOTH); +echo $stats["count"] . " updated records in period " . $stats["start"] . " to " . $stats["end"] ."
"; + + +echo "Last updated: ". $stats["importday"]."
"; +/* Check for null Procurement method and 0 ABN when not ABN exempt */ + + +include_footer(); +?> --- a/admin/google-example.htm +++ b/admin/google-example.htm --- a/admin/import.bat +++ b/admin/import.bat --- a/admin/import.php +++ b/admin/import.php @@ -1,120 +1,113 @@ "; -$dhandle = opendir($path); -// define an array to hold the files -$files = array(); - -if ($dhandle) { - // loop through all of the files - while (false !== ($fname = readdir($dhandle))) { - if (($fname != '.') && ($fname != '..')) { - echo "$fname".filesize($path.$fname)."
"; - } - } -} - -} else { -$success =0; -$fname = $_REQUEST["fname"]; -echo " ============== $fname ==============
"; -$row = 1; -$handle = fopen($path.$fname, "r"); -//"t" mode string translates windows line breaks to unix -$datamapping0709 = Array("Agency" => "agencyName", "Parent CN ID" => "parentCN", "CN ID" => "CNID", "Publish Date" => "publishDate", "Amendment Date" => "amendDate", "Status" => "", "StartDate" => "contractStart" , "EndDate" => "contractEnd", "Value" => "value", "Description" => "description", "Agency Ref Id" => "agencyID", "Category" => "category", "Procurement Method" => "procurementMethod", "ATM ID" => "atmID", "SON ID" => "SONID","Confidentiality - Contract" => "confidentialityContract", "Confidentiality - Contract Reason(s)" => "confidentialityContractReason", "Confidentiality - Outputs" => "confidentialityOutputs", "Confidentiality - Outputs Reason(s)" => "confidentialityOutputsReason", "Consultancy" => "consultancy", "Consultancy Reason(s)" => "consultancyReason", "Amendment Reason" => "amendmentReason", "Supplier Name" => "supplierName", "Supplier Address" => "supplierAddress", "Supplier City" => "supplierCity", "Supplier Postcode" => "supplierPostcode", "Supplier Country" => "supplierCountry" , "Supplier ABNExempt" => "supplierABNExempt", "Supplier ABN" => "supplierABN" , "Agency Branch" => "contactBranch","Agency Divison" => "contactDivision", "Agency Postcode" => "contactPostcode" , "" => ""); -$headers; -$contractNoticeFields = Array("agencyName", "parentCN", "CNID", "publishDate", "amendDate", "contractStart" , "contractEnd", "value", "description", "agencyID", "category", "procurementMethod", "atmID", "SONID", "confidentialityContract", "confidentialityContractReason", "confidentialityOutputs", "confidentialityOutputsReason", "consultancy", "consultancyReason", "amendmentReason", "supplierName", "supplierAddress", "supplierCity", "supplierPostcode", "supplierCountry" , "supplierABNExempt", "supplierABN", "contactBranch","contactDivision","contactPostcode" ); -$agencyFields = Array("agencyName"); -$supplierFields = Array("supplierName", "supplierAddress", "supplierCity", "supplierPostcode", "supplierCountry" , "supplierABNExempt", "supplierABN" ); - -while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) { - $num = count($data); - - if ($row == 3) - { - $headers = $data; - } - else if ($row > 3) - { - if ($num > count($datamapping0709)) - { - die ("Error in data import; data mapping fields out of bounds or changed
".$fname.print_r($data)); - } - $firstCN= false; - $firstSupplier= true; - $firstAgency= true; - $contractNoticeInsert = "INSERT INTO contractnotice (importFile, ".implode(" , ",$contractNoticeFields). ") VALUES ( \"$fname\" "; - $supplierInsert = "INSERT INTO supplierdetails (".implode(" , ",$supplierFields). ") VALUES ("; - $agencyInsert = "INSERT INTO agency (".implode(" , ",$agencyFields). ") VALUES ("; - - $keys = array_keys($datamapping0709); - for ($c=0; $c < $num; $c++) { - $data[$c] = trim($data[$c],"="); - $data[$c] = trim($data[$c], "\""); - - if (in_array(($datamapping0709[$headers[$c]]),$contractNoticeFields)) - { - if (($datamapping0709[$headers[$c]]) == "parentCN" || ($datamapping0709[$headers[$c]]) == "CNID") - { - $data[$c] = substr($data[$c],2); - if ($data[$c] >0) - { - $contractNoticeInsert .= ($firstCN ? "" : ","). mysql_real_escape_string($data[$c]); - } else - { - $contractNoticeInsert .= ($firstCN ? "" : ",")."''"; - } - } else if (($datamapping0709[$headers[$c]]) == "amendDate" || ($datamapping0709[$headers[$c]]) == "publishDate" || ($datamapping0709[$headers[$c]]) == "contractStart" || ($datamapping0709[$headers[$c]]) == "contractEnd") - { - $contractNoticeInsert .= ($firstCN ? "" : ","). "'".date( 'Y-m-d H:i:s', strtotime($data[$c])). "'"; - } else - { - if (strstr("\" =",$data[$c] > 0)) - { - die ("Invalid Description field" . $contractNoticeInsert); - } - $contractNoticeInsert .= ($firstCN ? "" : ",") . "'". mysql_real_escape_string($data[$c])."'"; - - } - $firstCN = false; - } - if (in_array(($datamapping0709[$headers[$c]]),$supplierFields)) - { - $supplierInsert .= ($firstSupplier ? "" : ",") . "'". mysql_real_escape_string($data[$c])."'"; - $firstSupplier = false; - } - if (in_array(($datamapping0709[$headers[$c]]),$agencyFields)) - { - $agencyInsert .= ($firstAgency ? "" : ",") . "'". mysql_real_escape_string($data[$c])."'"; - $firstAgency = false; - } - - } - $contractNoticeInsert .= ");"; - $supplierInsert .= ");"; - $agencyInsert .= ");"; - -$result = mysql_query($contractNoticeInsert); -if ($result) $success++; -else if (strpos(mysql_error(),"Duplicate entry") === false) echo $data[2] . " failed CN insert.
". mysql_error() ."
$contractNoticeInsert

\n"; - - $result = mysql_query($agencyInsert); -if ($result) $success++; -else if (strpos(mysql_error(),"Duplicate entry") === false) echo $data[2] . " failed agency insert.
". mysql_error() ."
$agencyInsert

\n"; - - $result = mysql_query($supplierInsert); -if ($result) $success++; -else if (strpos(mysql_error(),"Duplicate entry") === false) echo $data[2] . " failed supplier insert.
". mysql_error() ."
$supplierInsert

\n"; - -//echo "
\n"; - } - - $row++; -} -echo "
$success records successfully created"; -fclose($handle); -} + include_once("../lib/common.inc.php"); + $path = 'data/'; + if ($_REQUEST["fname"] == "") { + echo "Get files from: https://www.tenders.gov.au/?event=public.reports.list
"; + $dhandle = opendir($path); + // define an array to hold the files + $files = array(); + + if ($dhandle) { + // loop through all of the files + while (false !== ($fname = readdir($dhandle))) { + if (($fname != '.') && ($fname != '..')) { + echo "$fname" . filesize($path . $fname) . "
"; + } + } + } + } else { + $success = 0; + $fname = $_REQUEST["fname"]; + echo " ============== $fname ==============
"; + flush(); + $row = 1; + $handle = fopen($path . $fname, "r"); + //"t" mode string translates windows line breaks to unix + $datamapping0709 = array("Agency" => "agencyName", "Parent CN ID" => "parentCN", "CN ID" => "CNID", "Publish Date" => "publishDate", "Amendment Date" => "amendDate", "Status" => "", "StartDate" => "contractStart", "EndDate" => "contractEnd", "Value" => "value", "Description" => "description", "Agency Ref Id" => "agencyID", "Category" => "category", "Procurement Method" => "procurementMethod", "ATM ID" => "atmID", "SON ID" => "SONID", "Confidentiality - Contract" => "confidentialityContract", "Confidentiality - Contract Reason(s)" => "confidentialityContractReason", "Confidentiality - Outputs" => "confidentialityOutputs", "Confidentiality - Outputs Reason(s)" => "confidentialityOutputsReason", "Consultancy" => "consultancy", "Consultancy Reason(s)" => "consultancyReason", "Amendment Reason" => "amendmentReason", "Supplier Name" => "supplierName", "Supplier Address" => "supplierAddress", "Supplier City" => "supplierCity", "Supplier Postcode" => "supplierPostcode", "Supplier Country" => "supplierCountry", "Supplier ABNExempt" => "supplierABNExempt", "Supplier ABN" => "supplierABN", "Agency Branch" => "contactBranch", "Agency Divison" => "contactDivision", "Agency Postcode" => "contactPostcode", "" => ""); + $headers; + $contractNoticeFields = array("agencyName", "parentCN", "CNID", "publishDate", "amendDate", "contractStart", "contractEnd", "value", "description", "agencyID", "category", "procurementMethod", "atmID", "SONID", "confidentialityContract", "confidentialityContractReason", "confidentialityOutputs", "confidentialityOutputsReason", "consultancy", "consultancyReason", "amendmentReason", "supplierName", "supplierAddress", "supplierCity", "supplierPostcode", "supplierCountry", "supplierABNExempt", "supplierABN", "contactBranch", "contactDivision", "contactPostcode"); + $agencyFields = array("agencyName"); + $supplierFields = array("supplierName", "supplierAddress", "supplierCity", "supplierPostcode", "supplierCountry", "supplierABNExempt", "supplierABN"); + + while (($data = fgetcsv($handle, 1000, "\t")) !== false) { + $num = count($data); + + if ($row == 3) { + $headers = $data; + } elseif ($row > 3) { + if ($num > count($datamapping0709)) { + die("Error in data import; data mapping fields out of bounds or changed
" . $fname . print_r($data)); + } + $firstCN = false; + $firstSupplier = true; + $firstAgency = true; + $contractNoticeInsert = "INSERT INTO contractnotice (importFile, " . implode(" , ", $contractNoticeFields) . ") VALUES ( \"$fname\" "; + $supplierInsert = "INSERT INTO supplierdetails (" . implode(" , ", $supplierFields) . ") VALUES ("; + $agencyInsert = "INSERT INTO agency (" . implode(" , ", $agencyFields) . ") VALUES ("; + + $keys = array_keys($datamapping0709); + for ($c = 0; $c < $num; $c++) { + $data[$c] = trim($data[$c], "="); + $data[$c] = trim($data[$c], "\""); + + if (in_array(($datamapping0709[$headers[$c]]), $contractNoticeFields)) { + if (($datamapping0709[$headers[$c]]) == "parentCN" || ($datamapping0709[$headers[$c]]) == "CNID") { + $data[$c] = substr($data[$c], 2); + if ($data[$c] > 0) { + $contractNoticeInsert .= ($firstCN ? "" : ",") . mysql_real_escape_string($data[$c]); + } else { + $contractNoticeInsert .= ($firstCN ? "" : ",") . "''"; + } + } elseif (($datamapping0709[$headers[$c]]) == "amendDate" || ($datamapping0709[$headers[$c]]) == "publishDate" || ($datamapping0709[$headers[$c]]) == "contractStart" || ($datamapping0709[$headers[$c]]) == "contractEnd") { + $contractNoticeInsert .= ($firstCN ? "" : ",") . "'" . date('Y-m-d H:i:s', strtotime($data[$c])) . "'"; + } else { + if (strstr("\" =", $data[$c] > 0)) { + die("Invalid Description field" . $contractNoticeInsert); + } + $contractNoticeInsert .= ($firstCN ? "" : ",") . "'" . mysql_real_escape_string($data[$c]) . "'"; + } + $firstCN = false; + } + if (in_array(($datamapping0709[$headers[$c]]), $supplierFields)) { + $supplierInsert .= ($firstSupplier ? "" : ",") . "'" . mysql_real_escape_string($data[$c]) . "'"; + $firstSupplier = false; + } + if (in_array(($datamapping0709[$headers[$c]]), $agencyFields)) { + $agencyInsert .= ($firstAgency ? "" : ",") . "'" . mysql_real_escape_string($data[$c]) . "'"; + $firstAgency = false; + } + } + flush(); + $contractNoticeInsert .= ");"; + $supplierInsert .= ");"; + $agencyInsert .= ");"; + + $result = mysql_query($contractNoticeInsert); + if ($result) + $success++; + elseif (strpos(mysql_error(), "Duplicate entry") === false) + echo $data[2] . " failed CN insert.
" . mysql_error() . "
$contractNoticeInsert

\n"; + + $result = mysql_query($agencyInsert); + if ($result) + $success++; + elseif (strpos(mysql_error(), "Duplicate entry") === false) + echo $data[2] . " failed agency insert.
" . mysql_error() . "
$agencyInsert

\n"; + + $result = mysql_query($supplierInsert); + if ($result) + $success++; + elseif (strpos(mysql_error(), "Duplicate entry") === false) + echo $data[2] . " failed supplier insert.
" . mysql_error() . "
$supplierInsert

\n"; + flush(); + + //echo "
\n"; + } + + $row++; + } + echo "
$success records successfully created"; + flush(); + fclose($handle); + } ?> - --- a/admin/recordsperweek.txt +++ b/admin/recordsperweek.txt --- a/admin/setAgencyStatus.php +++ b/admin/setAgencyStatus.php @@ -1,16 +1,24 @@ \n"; else echo "error".mysql_error(); } foreach ($suspended as $agency) { + $agencyParts = explode("|",$agency); + $agency = $agencyParts[1]; + $agencyInsert = "INSERT INTO agency (agencyName) VALUES ('$agency')"; + $result = mysql_query($agencyInsert); $result = mysql_query("UPDATE agency SET status = 'suspended' where agencyName = '".mysql_real_escape_string($agency)."';") ; if ($result) echo $agency. " set to suspended in ". mysql_affected_rows() . " divisions/branches
\n"; else echo "error".mysql_error(); --- a/admin/setAgencyURLABN.php +++ b/admin/setAgencyURLABN.php @@ -26,9 +26,10 @@ $result = mysql_query("UPDATE agency SET website = 'http://" . $result->visibleUrl . "', abn = '{$abn[0]}' WHERE agencyName = '$agency';"); if ($result) echo $agency . " set in " . mysql_affected_rows() . "
\n"; } else { + echo "invalid ABN"; $result = mysql_query("UPDATE agency SET website = 'http://" . $result->visibleUrl . "' WHERE agencyName = '$agency';"); - if ($result) echo $agency . " set in " . mysql_affected_rows() . "
\n"; + if ($result) echo $agency . " set in " . mysql_affected_rows() . "
\n"; } // fi --- a/admin/updateUNSPSC.php +++ b/admin/updateUNSPSC.php @@ -1,11 +1,7 @@ + + Contract Notice Number + Contract Description + Total Contract Value + Agency + Contract Start Date + Supplier + + "; + while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { + setlocale(LC_MONETARY, 'en_US'); + $value = number_format(doubleval($row['value']) , 2); + echo (" + {$row['CNID']} + {$row['description']} + \$$value{$row['agencyName']} + {$row['contractStart']} + {$row['supplierName']} + "); + } + echo ""; + mysql_free_result($result); } else { - + /* + split by portfolio + */ include_header("Agencies"); $query = "SELECT SUM(value), agencyName FROM `contractnotice` WHERE childCN = 0 GROUP BY agencyName "; $result = mysql_query($query); - echo ""; + echo "
+ + + + + "; while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { setlocale(LC_MONETARY, 'en_US'); $value = number_format(doubleval($row[0]) , 2); --- /dev/null +++ b/displayAmendments.php @@ -1,1 +1,32 @@ + 0) a". +" where ".$agencyQ.$yearQ."CNID = ccn AND (value - pvalue) <> 0 order by diff DESC"; +$result = mysql_query($query); + echo "
AgencyTotal Contracts Value
+ + + + + + + "; +if ($result) { +while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { + setlocale(LC_MONETARY, 'en_US'); + $value = number_format(doubleval($row['value']) , 2); + $pvalue = number_format(doubleval($row['pvalue']) , 2); + $diff = number_format(doubleval($row['diff']) , 2); + echo (""); + echo ""; + echo ""; +} +} else { +echo mysql_error(); +} +echo "
ContractOriginal ValueAmended ValueDifference
{$row['description']}\$$pvalue\$$value\$$diff
"; +mysql_free_result($result); +include_footer(); +?> --- a/displayCalendar.php +++ b/displayCalendar.php @@ -1,25 +1,77 @@

".$_REQUEST['month']."

"; +$monthParts = explode("-",$_REQUEST['month']); + $query = "SELECT CNID, description, value, agencyName, category, contractStart, supplierName + FROM `contractnotice` + WHERE childCN = 0 + AND YEAR(contractStart) = {$monthParts[1]} + AND MONTH(contractStart) = {$monthParts[0]} + ORDER BY value DESC"; + $result = mysql_query($query); +echo ''; + echo ''; + + echo " + + + + + + + + + "; + while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { + setlocale(LC_MONETARY, 'en_US'); + $value = number_format(doubleval($row['value']) , 2); + echo (" + + + + + + "); + } + echo "
Contract Notice NumberContract DescriptionTotal Contract ValueAgencyContract Start DateSupplier
{$row['CNID']}{$row['description']}\$$value{$row['agencyName']}{$row['contractStart']}{$row['supplierName']}
"; + mysql_free_result($result); +} else { /* + split by year todo: -Year/Month drilldown - largest contracts, agencies, suppliers*/ +Year/Month drilldown - largest contracts, agencies, suppliers +count per month +big picture graphs?*/ -include_header("Months and Years"); +echo ''; +echo ''; + + $query = "SELECT YEAR(contractStart), MONTH(contractStart), -value FROM `contractnotice` WHERE childCN = 0 GROUP BY MONTH(contractStart), YEAR(contractStart) ORDER BY YEAR(contractStart), MONTH(contractStart) "; +SUM(value) as val, count(1) as count FROM `contractnotice` WHERE childCN = 0 GROUP BY MONTH(contractStart), YEAR(contractStart) ORDER BY YEAR(contractStart), MONTH(contractStart) "; $result = mysql_query($query); -echo ""; + echo "
+ + + + + + "; while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { setlocale(LC_MONETARY, 'en_US'); -$value = number_format(doubleval($row["value"]),2); +$value = number_format(doubleval($row["val"]),2); $month_name = date( 'F', mktime(0, 0, 0, $row[1]) ); - echo (""); + echo (""); } echo "
Month/YearTotal Contracts ValueNumber of Contracts
$month_name {$row[0]}\$$value
$month_name {$row[0]}\$$value({$row['count']} contracts)
"; mysql_free_result($result); - +} include_footer(); -?> +?> + --- a/displayCategory.php +++ b/displayCategory.php @@ -9,7 +9,16 @@ AND category = '" . $_REQUEST['category'] . "' ORDER BY value DESC"; $result = mysql_query($query); - echo ""; + echo "
+ + + + + + + + + "; while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { setlocale(LC_MONETARY, 'en_US'); $value = number_format(doubleval($row['value']) , 2); @@ -24,14 +33,21 @@ echo "
Contract Notice NumberContract DescriptionTotal Contract ValueAgencyContract Start DateSupplier
"; mysql_free_result($result); } else { - + /* + split by main categories + */ include_header("Categories"); $query = "SELECT sum(value), category FROM `contractnotice` WHERE childCN = 0 GROUP BY category ORDER BY sum(value) DESC "; $result = mysql_query($query); -echo ""; + echo "
+ + + + + "; while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { setlocale(LC_MONETARY, 'en_US'); $value = number_format(doubleval($row[0]) , 2); --- a/displayConfidentialities.php +++ b/displayConfidentialities.php @@ -1,4 +1,31 @@ -agencies that use alot of consultacies +"; +while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { +setlocale(LC_MONETARY, 'en_US'); +$value = number_format(doubleval($row[0]),2); + echo (""); +} +echo "
CategoryTotal Contracts Value
{$row[1]}\$$value
"; +mysql_free_result($result); +include_footer(); +?> + + + --- a/displayConsultancies.php +++ b/displayConsultancies.php @@ -1,4 +1,31 @@ +"; +while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { +setlocale(LC_MONETARY, 'en_US'); +$value = number_format(doubleval($row[0]),2); + echo ("{$row[1]}\$$value"); +} +echo ""; +mysql_free_result($result); +include_footer(); +?> + + + --- a/displayContract.php +++ b/displayContract.php --- a/displayLatestUpdate.php +++ /dev/null @@ -1,23 +1,1 @@ -"; -$stats = mysql_fetch_array($result, MYSQL_BOTH); -echo $stats["count"] . " new records in period " . $stats["start"] . " to " . $stats["end"] ."
"; - - -$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 ""; -$stats = mysql_fetch_array($result, MYSQL_BOTH); -echo $stats["count"] . " updated records in period " . $stats["start"] . " to " . $stats["end"] ."
"; - - -echo "Last updated: ". $stats["importday"]."
"; -/* Check for null Procurement method and 0 ABN when not ABN exempt */ -?> + --- a/displayMap.php +++ b/displayMap.php --- a/displayProcurementMethod.php +++ b/displayProcurementMethod.php @@ -10,8 +10,9 @@ */ include_header("Procurement Methods"); -$query = "SELECT value, procurementMethod +$query = "SELECT SUM(value) as value, procurementMethod FROM `contractnotice` +WHERE childCN = 0 GROUP BY procurementMethod "; $result = mysql_query($query); --- a/displaySupplier.php +++ b/displaySupplier.php @@ -3,13 +3,13 @@ if ($_REQUEST['supplier']) { include_header("Supplier"); - $supplier = htmlentities(strip_tags($_REQUEST['supplier'])); - echo ''; - echo ''; - echo ''; + $supplierS = htmlentities(strip_tags($_REQUEST['supplier'])); + echo ''; + echo ''; + echo ''; /*lobbyist ties - + links to ABR/ASIC/Google News/ASX/Court records total value to various agencies (bar graph) @@ -18,8 +18,42 @@ spread of contract values spread of industries (textual?)*/ + $query = "SELECT CNID, description, value, agencyName, category, contractStart, supplierName + FROM `contractnotice` WHERE + $supplierQ $standardQ + ORDER BY value DESC"; + echo $query; + $result = mysql_query($query); +echo ''; + echo ''; + + echo "
+ + + + + + + + + "; + while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { + setlocale(LC_MONETARY, 'en_US'); + $value = number_format(doubleval($row['value']) , 2); + echo (" + + + + + + "); + } + echo "
Contract Notice NumberContract DescriptionTotal Contract ValueAgencyContract Start DateSupplier
{$row['CNID']}{$row['description']}\$$value{$row['agencyName']}{$row['contractStart']}{$row['supplierName']}
"; + mysql_free_result($result); } else { - + /* + histograph of supplier size/value + */ include_header("Suppliers"); $query = "SELECT SUM(value) as val, supplierName, supplierABN FROM `contractnotice` @@ -28,7 +62,12 @@ ORDER BY val DESC LIMIT 100"; $result = mysql_query($query); - echo ""; + echo "
+ + + + + "; while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { setlocale(LC_MONETARY, 'en_US'); $value = number_format(doubleval($row['val']) , 2); --- a/futureindex.php +++ b/futureindex.php --- a/graphs/displayAgenciesGraph.php +++ b/graphs/displayAgenciesGraph.php @@ -1,7 +1,6 @@ = $startYear) AND childCN = 0 GROUP BY agencyName ORDER BY val DESC limit $topX"; $result = mysql_query($query); --- a/graphs/displayAgencySuppliersGraph.php +++ b/graphs/displayAgencySuppliersGraph.php @@ -2,7 +2,6 @@ include_once ("../lib/common.inc.php"); $agency = "AusAid"; $topX = 15; -$startYear = 2007; $query = "SELECT SUM(value) as val, supplierName FROM `contractnotice` WHERE (YEAR(contractStart) >= $startYear) AND childCN = 0 AND agencyName = '$agency' GROUP BY lower(supplierName) ORDER BY val DESC limit $topX"; $result = mysql_query($query); --- a/graphs/displayCnCGraph.php +++ b/graphs/displayCnCGraph.php @@ -3,8 +3,8 @@ // Width and height of the graph $width = 800; $height = 300; -$query = "select procurementMethod, count(1) as count, value, MONTH(contractStart) as month, YEAR(contractStart) as year from `contractnotice` -where $agencyQ $supplierQ childCN = 0 AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2009 group by procurementMethod,year,month order by procurementMethod,year,month"; +$query = "select procurementMethod, count(1) as count, SUM(value) as val, MONTH(contractStart) as month, YEAR(contractStart) as year from `contractnotice` +where $agencyQ $supplierQ $standardQ group by procurementMethod,year,month order by procurementMethod,year,month"; $result = mysql_query($query); $methods = Array("Direct","Open","Select"); $dates = Array(); @@ -13,7 +13,7 @@ $maxValue = 0; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
SupplierTotal Contract Value