From: root Date: Thu, 26 Jan 2017 05:19:20 +0000 Subject: new sitemap.xml X-Git-Url: http://maxious.lambdacomplex.org/git/?p=contractdashboard.git&a=commitdiff&h=dd43e0aab7579ec544c317ceaa4d6b62adaaa1c3 --- new sitemap.xml --- --- a/displayAgency.php +++ b/displayAgency.php @@ -6,12 +6,6 @@ $agency = htmlentities(strip_tags($_REQUEST['agency'])); include_header($agency); echo '

' . $agency . '

'; - $query = 'SELECT category, min("categoryUNSPSC") AS "categoryUNSPSC", count(*) AS count, sum(value) AS value FROM contractnotice - WHERE "agencyName" LIKE :agency AND ' . " " . $standardQ . ' ' . $yearQ . ' GROUP BY category ORDER BY count(*) DESC LIMIT 10'; - $query = $conn->prepare($query); - $query->bindParam(":agency", $agency); - $query->execute(); - databaseError($conn->errorInfo()); $query = ' SELECT @@ -24,14 +18,24 @@ sum(("procurementMethod" = \'Direct\' OR "procurementMethod" = \'Limited tender\')::int) AS limited, COUNT(*) AS total FROM contractnotice -WHERE "supplierABN" = \'51194660183\' - '; + WHERE "agencyName" LIKE :agency AND ' . " $yearQ $standardQ " ; + $query = $conn->prepare($query); + $query->bindParam(":agency", $agency); + $query->execute(); + databaseError($conn->errorInfo()); + + $stats = reset($query->fetchAll()); + show_stats($stats); /* - * Procurement method in text, seperate Open via SON from Open - * Consultancies, Confidentialities percentage + Compliance statistics: amendments, delay in reporting average and number completely late */ - + $query = 'SELECT category, min("categoryUNSPSC") AS "categoryUNSPSC", count(*) AS count, sum(value) AS value FROM contractnotice + WHERE "agencyName" LIKE :agency AND ' . " $yearQ $standardQ " . ' GROUP BY category ORDER BY count(*) DESC LIMIT 10'; + $query = $conn->prepare($query); + $query->bindParam(":agency", $agency); + $query->execute(); + databaseError($conn->errorInfo()); echo "

Categories

@@ -52,7 +56,7 @@ echo "
Category

"; $query = 'SELECT contractnotice."SONID", min(title) AS title, count(*), sum(value) AS value FROM contractnotice INNER JOIN standingoffers ON contractnotice."SONID" = standingoffers."SONID" -WHERE "agencyName" LIKE :agency AND ' . " " . $standardQ . ' ' . $yearQ . 'AND contractnotice."SONID" != \'\' GROUP BY contractnotice."SONID"'; +WHERE "agencyName" LIKE :agency AND ' . " $yearQ $standardQ " . 'AND contractnotice."SONID" != \'\' GROUP BY contractnotice."SONID"'; $query = $conn->prepare($query); $query->bindParam(":agency", $agency); $query->execute(); --- a/displayProcurementMethod.php +++ b/displayProcurementMethod.php @@ -12,7 +12,7 @@ include_header("Procurement Methods"); $query = 'SELECT SUM(value) as value, "procurementMethod" FROM contractnotice -WHERE "childCN" is null +WHERE ' . $yearQ. " ". $standardQ .' GROUP BY "procurementMethod"'; $query = $conn->prepare($query); --- a/displaySON.php +++ b/displaySON.php @@ -10,13 +10,30 @@ include_header($title); echo "

" . $_REQUEST['SONID'] . " - " . $title . "

"; echo '
View original record @ tenders.gov.au
'; - /* - * Procurement method in text, seperate Open via SON from Open - * Consultancies, Confidentialities percentage - */ + + $query = ' + SELECT +sum((consultancy = \'Yes\')::int) AS consultancy, +sum(("confidentialityContract" = \'Yes\')::int) AS "confidentialityContract", +sum(("confidentialityOutputs" = \'Yes\')::int) AS "confidentialityOutputs", +sum((("procurementMethod" = \'Open\' OR "procurementMethod" = \'Open tender\') AND "SONID" IS null)::int) AS open, +sum((("procurementMethod" = \'Open\' OR "procurementMethod" = \'Open tender\') AND "SONID" IS NOT null)::int) AS "openSON", +sum(("procurementMethod" = \'Prequalified tender\' OR "procurementMethod" = \'Select\')::INT) AS prequalified, +sum(("procurementMethod" = \'Direct\' OR "procurementMethod" = \'Limited tender\')::int) AS limited, +COUNT(*) AS total +FROM contractnotice + WHERE "SONID" = :SONID AND ' . " $yearQ $standardQ " ; + $query = $conn->prepare($query); + $query->bindParam(":SONID", $_REQUEST['SONID']); + $query->execute(); + databaseError($conn->errorInfo()); + + $stats = reset($query->fetchAll()); + show_stats($stats); + $query = 'SELECT category, min("categoryUNSPSC") AS "categoryUNSPSC", count(*) AS count, sum(value) AS value FROM contractnotice -WHERE "SONID" = :SONID +WHERE "SONID" = :SONID AND ' . " $yearQ $standardQ " . ' GROUP BY category'; $query = $conn->prepare($query); $query->bindParam(":SONID", $_REQUEST['SONID']); @@ -35,6 +52,32 @@ $category = urlencode($row['category']); echo(" {$row['category']} + {$row['count']} + \$$value + "); + } + echo "
"; + + $query = 'SELECT text_mode(contractnotice."agencyName") AS agencyname, count(*), sum(value) AS value FROM contractnotice + WHERE ' . $yearQ . ' "childCN" IS NULL AND "SONID" = :SONID GROUP BY "agencyName"'; + $query = $conn->prepare($query); + $query->bindParam(":SONID", $_REQUEST['SONID']); + $query->execute(); + databaseError($conn->errorInfo()); + + echo "

Agencies

+ + + + + + "; + foreach ($query->fetchAll() as $row) { + setlocale(LC_MONETARY, 'en_US'); + $value = number_format(doubleval($row['value']), 2); + + echo(" + "); @@ -67,6 +110,7 @@ "); } + echo "
AgencyContracts CountTotal Contract Value
{$row['agencyname']} {$row['count']} \$$value
\$$value

Contracts

--- a/displaySupplier.php +++ b/displaySupplier.php @@ -34,7 +34,7 @@ sum(("procurementMethod" = \'Direct\' OR "procurementMethod" = \'Limited tender\')::int) AS limited, COUNT(*) AS total FROM contractnotice -WHERE' . $supplierQ . " " . $standardQ ; +WHERE' . $supplierQ . " " . $yearQ . " " .$standardQ ; $query = $conn->prepare($query); if ($supplierParts[0] > 0) { $query->bindParam(":supplierABN", $supplierABN); @@ -48,7 +48,7 @@ show_stats($stats); $query = 'SELECT category, min("categoryUNSPSC") AS "categoryUNSPSC", count(*) AS count, sum(value) AS value FROM contractnotice - WHERE ' . $supplierQ . " " . $standardQ . ' GROUP BY category ORDER BY count(*) DESC LIMIT 10'; + WHERE ' . $supplierQ . " $yearQ $standardQ ". ' GROUP BY category ORDER BY count(*) DESC LIMIT 10'; $query = $conn->prepare($query); if ($supplierParts[0] > 0) { $query->bindParam(":supplierABN", $supplierABN); @@ -79,7 +79,7 @@ echo "
Contract Notice Number

"; - $query = 'SELECT SUM("value") AS "value", count(*), MAX(contractnotice."agencyName") AS agencyname FROM contractnotice JOIN agency_nametoabn ON contractnotice."agencyName"=agency_nametoabn."agencyName" + $query = 'SELECT SUM("value") AS "value", count(*), text_mode(contractnotice."agencyName") AS agencyname FROM contractnotice JOIN agency_nametoabn ON contractnotice."agencyName"=agency_nametoabn."agencyName" WHERE ' . $yearQ . ' ' . $supplierQ . ' "childCN" IS NULL GROUP BY abn ORDER BY SUM("value") DESC'; $query = $conn->prepare($query); --- a/lib/common.inc.php +++ b/lib/common.inc.php @@ -4,11 +4,7 @@ error_reporting(E_ALL ^ E_NOTICE); -$conn = new PDO("pgsql:dbname=contractdashboard;user=postgres;password=snmc;host=localhost"); - -if (!$conn) { - die("A database error occurred.\n"); -} +include('db.inc.php'); define('ROOT', pathinfo(__FILE__, PATHINFO_DIRNAME)); if (strstr($_SERVER['PHP_SELF'], "labs/") || strstr($_SERVER['PHP_SELF'], "admin/") || strstr($_SERVER['PHP_SELF'], "heuristics/")) { @@ -100,6 +96,37 @@ foreach ($a as $key => $value) $totale += array_sum_all($value); return $totale; +} + +function show_stats($stats) { + echo "
"; + if ($stats['consultancy'] > 0) { + echo "Consultancies: {$stats['consultancy']} contracts, ".percent($stats['consultancy'],$stats['total']); + echo "%
"; + } + if ($stats['confidentialityContract']+$stats['confidentialityOutputs'] > 0) { + $confidentialities = $stats['confidentialityContract']+$stats['confidentialityOutputs']; + echo "Confidentialities: $confidentialities contracts, ".percent( $confidentialities,$stats['total'])."%"; + echo "( {$stats['confidentialityContract']} on the contract, {$stats['confidentialityOutputs']} on the outputs)"; + echo "
"; + } + echo "Procurement methods: "; + if ($stats['open'] > 0) { + echo "Open {$stats['open']} contracts, ".percent($stats['open'],$stats['total']); + echo "%, "; + } + if ($stats['openSON'] > 0) { + echo "Open via SON {$stats['openSON']} contracts, ".percent($stats['openSON'],$stats['total']); + echo "%, "; + } + if ($stats['prequalified'] > 0) { + echo "Prequalified {$stats['prequalified']} contracts, ".percent($stats['prequalified'],$stats['total']); + echo "%, "; + } + if ($stats['limited'] > 0) { + echo "limited {$stats['limited']} contracts, ".percent($stats['limited'],$stats['total']); + echo "%, "; + } } // magic query modifiers @@ -157,6 +184,7 @@ pcdt: http://purl.org/procurement/public-contracts-datatypes#"> <?php echo $title; ?> - Contract Dashboard + @@ -288,7 +316,7 @@