From: root Date: Wed, 02 Jun 2010 09:24:49 +0000 Subject: fix value/sum X-Git-Url: http://maxious.lambdacomplex.org/git/?p=contractdashboard.git&a=commitdiff&h=234da1061420d4a311d17af971929f38aa9fff9d --- fix value/sum --- --- a/about.php +++ b/about.php --- 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,6 +1,6 @@ "; $dhandle = opendir($path); --- a/admin/recordsperweek.txt +++ b/admin/recordsperweek.txt --- a/autosuggest_inquisitor.css +++ b/autosuggest_inquisitor.css --- a/contractDashboard.kpf +++ b/contractDashboard.kpf --- a/cutenews/LICENSE.txt +++ b/cutenews/LICENSE.txt --- a/cutenews/README.htm +++ b/cutenews/README.htm --- a/cutenews/data/Default.tpl +++ b/cutenews/data/Default.tpl --- a/cutenews/data/Headlines.tpl +++ b/cutenews/data/Headlines.tpl --- a/cutenews/data/archives/index.htm +++ b/cutenews/data/archives/index.htm --- a/cutenews/data/auto_archive.db.php +++ b/cutenews/data/auto_archive.db.php --- a/cutenews/data/backup/index.html +++ b/cutenews/data/backup/index.html --- a/cutenews/data/cat.num.php +++ b/cutenews/data/cat.num.php --- a/cutenews/data/category.db.php +++ b/cutenews/data/category.db.php --- a/cutenews/data/comments.txt +++ b/cutenews/data/comments.txt --- a/cutenews/data/config.php +++ b/cutenews/data/config.php --- a/cutenews/data/emoticons/index.html +++ b/cutenews/data/emoticons/index.html --- a/cutenews/data/flood.db.php +++ b/cutenews/data/flood.db.php --- a/cutenews/data/index.html +++ b/cutenews/data/index.html --- a/cutenews/data/ipban.db.php +++ b/cutenews/data/ipban.db.php --- a/cutenews/data/news.txt +++ b/cutenews/data/news.txt --- a/cutenews/data/postponed_news.txt +++ b/cutenews/data/postponed_news.txt --- a/cutenews/data/rss.tpl +++ b/cutenews/data/rss.tpl --- a/cutenews/data/rss_config.php +++ b/cutenews/data/rss_config.php --- a/cutenews/data/unapproved_news.txt +++ b/cutenews/data/unapproved_news.txt --- a/cutenews/data/upimages/index.html +++ b/cutenews/data/upimages/index.html --- a/cutenews/data/users.db.php +++ b/cutenews/data/users.db.php --- a/cutenews/example1.php +++ b/cutenews/example1.php --- a/cutenews/example2.php +++ b/cutenews/example2.php --- a/cutenews/inc/about.mdu +++ b/cutenews/inc/about.mdu --- a/cutenews/inc/addnews.mdu +++ b/cutenews/inc/addnews.mdu --- a/cutenews/inc/categories.mdu +++ b/cutenews/inc/categories.mdu --- a/cutenews/inc/debug.mdu +++ b/cutenews/inc/debug.mdu --- a/cutenews/inc/editcomments.mdu +++ b/cutenews/inc/editcomments.mdu --- a/cutenews/inc/editnews.mdu +++ b/cutenews/inc/editnews.mdu --- a/cutenews/inc/editusers.mdu +++ b/cutenews/inc/editusers.mdu --- a/cutenews/inc/functions.inc.php +++ b/cutenews/inc/functions.inc.php --- a/cutenews/inc/help.mdu +++ b/cutenews/inc/help.mdu --- a/cutenews/inc/images.mdu +++ b/cutenews/inc/images.mdu --- a/cutenews/inc/ipban.mdu +++ b/cutenews/inc/ipban.mdu --- a/cutenews/inc/main.mdu +++ b/cutenews/inc/main.mdu --- a/cutenews/inc/massactions.mdu +++ b/cutenews/inc/massactions.mdu --- a/cutenews/inc/options.mdu +++ b/cutenews/inc/options.mdu --- a/cutenews/inc/preview.mdu +++ b/cutenews/inc/preview.mdu --- a/cutenews/inc/shows.inc.php +++ b/cutenews/inc/shows.inc.php --- a/cutenews/inc/tools.mdu +++ b/cutenews/inc/tools.mdu --- a/cutenews/inc/wizards.mdu +++ b/cutenews/inc/wizards.mdu --- a/cutenews/index.php +++ b/cutenews/index.php --- a/cutenews/register.php +++ b/cutenews/register.php --- a/cutenews/remember.js +++ b/cutenews/remember.js --- a/cutenews/rss.php +++ b/cutenews/rss.php --- a/cutenews/rte/blank.htm +++ b/cutenews/rte/blank.htm --- a/cutenews/rte/insert_link.htm +++ b/cutenews/rte/insert_link.htm --- a/cutenews/rte/insert_table.htm +++ b/cutenews/rte/insert_table.htm --- a/cutenews/rte/palette.htm +++ b/cutenews/rte/palette.htm --- a/cutenews/rte/richtext.js +++ b/cutenews/rte/richtext.js --- a/cutenews/rte/rte.css +++ b/cutenews/rte/rte.css --- a/cutenews/search.php +++ b/cutenews/search.php --- a/cutenews/show_archives.php +++ b/cutenews/show_archives.php --- a/cutenews/show_news.php +++ b/cutenews/show_news.php --- a/cutenews/skins/compact.skin.php +++ b/cutenews/skins/compact.skin.php --- a/cutenews/skins/cute.js +++ b/cutenews/skins/cute.js --- a/cutenews/skins/default.skin.php +++ b/cutenews/skins/default.skin.php --- a/cutenews/skins/rss_style.css +++ b/cutenews/skins/rss_style.css --- a/cutenews/skins/simple.skin.php +++ b/cutenews/skins/simple.skin.php --- a/displayAgency.php +++ b/displayAgency.php @@ -19,6 +19,7 @@ --- info website, procurement plan, annual reports + Breakdown of divisions/branches Breakdown percentage,number,value by procurement type Histograph, overlaying number value reported per week over X years Compliance statistics: amendments, delay in reporting average and number completely late*/ --- /dev/null +++ b/displayAmendments.php @@ -1,1 +1,26 @@ + 0) a". +" where ".$agencyQ.$yearQ."CNID = ccn AND (value - pvalue) <> 0 order by diff DESC"; +$result = mysql_query($query); +echo $query; +echo ""; +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 "
{$row['description']}\$$pvalue\$$value\$$diff
"; +mysql_free_result($result); +include_footer(); +?> --- a/displayCalendar.php +++ b/displayCalendar.php @@ -1,28 +1,62 @@

".$_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 "
{$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 +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 ""; 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_name {$row[0]}\$$value
$month_name {$row[0]}\$$value({$row['count']} contracts)
"; mysql_free_result($result); - +} include_footer(); -?> +?> + --- a/displayCategory.php +++ b/displayCategory.php --- 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 ("{$row[1]}\$$value"); +} +echo ""; +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/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 @@ -9,7 +9,7 @@ echo ''; /*lobbyist ties - + links to ABR/ASIC/Google News/ASX/Court records total value to various agencies (bar graph) @@ -19,7 +19,9 @@ spread of industries (textual?)*/ } else { - + /* + histograph of supplier size/value + */ include_header("Suppliers"); $query = "SELECT SUM(value) as val, supplierName, supplierABN FROM `contractnotice` --- a/futureindex.php +++ b/futureindex.php --- a/graphs/displayAgenciesGraph.php +++ b/graphs/displayAgenciesGraph.php --- a/graphs/displayAgencySuppliersGraph.php +++ b/graphs/displayAgencySuppliersGraph.php --- a/graphs/displayCnCGraph.php +++ b/graphs/displayCnCGraph.php @@ -3,7 +3,7 @@ // 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` +$query = "select procurementMethod, count(1) as count, SUM(value) as val, 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"; $result = mysql_query($query); $methods = Array("Direct","Open","Select"); @@ -13,7 +13,7 @@ $maxValue = 0; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { setlocale(LC_MONETARY, 'en_US'); - if ($row['value'] > $maxValue) $maxValue = $row['value']; + if ($row['val'] > $maxValue) $maxValue = $row['val']; $date = date( 'F ', mktime(0, 0, 0, $row["month"]) ). $row["year"]; if (array_search($date,$dates) === false ) { $dates[$row["year"]*100 + $row["month"]] = $date; @@ -57,7 +57,7 @@ $graph2->Set90AndMargin(105, 45, 45, 45); // Setup a title for the graph $graph2->title->Set($agency); -$graph2->SetUserFont("ttf-liberation/LiberationSans-Regular.ttf"); +$graph2->SetUserFont("liberation/LiberationSans-Regular.ttf"); $graph2->title->SetFont(FF_USERFONT, FS_NORMAL, 12); // Setup font for axis $graph2->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 10); --- a/graphs/displayContractPublishedGraph.php +++ b/graphs/displayContractPublishedGraph.php @@ -1,7 +1,7 @@ = 2008) AND childCN = 0 GROUP BY MONTH(publishDate), YEAR(publishDate) @@ -12,11 +12,11 @@ $values = Array(); 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]) ); $dates[] = $month_name." {$row[0]}"; $counts[] = doubleval($row["count"]); - $values[] = doubleval($row["value"]); + $values[] = doubleval($row["val"]); } mysql_free_result($result); @@ -31,8 +31,8 @@ $graph->SetScale('textlog'); // Setup a title for the graph -$graph->title->Set('Contracts Starting - All Agencies since July 2008'); -$graph->SetUserFont("ttf-liberation/LiberationSans-Regular.ttf"); +$graph->title->Set('Contracts Published - All Agencies since July 2008'); +$graph->SetUserFont("liberation/LiberationSans-Regular.ttf"); $graph->title->SetFont(FF_USERFONT,FS_NORMAL,12); // Setup font for axis --- a/graphs/displayContractStartingGraph.php +++ b/graphs/displayContractStartingGraph.php @@ -1,7 +1,7 @@ = 2008) AND childCN = 0 GROUP BY MONTH(contractStart), YEAR(contractStart) @@ -12,11 +12,11 @@ $values = Array(); 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]) ); $dates[] = $month_name." {$row[0]}"; $counts[] = doubleval($row["count"]); - $values[] = doubleval($row["value"]); + $values[] = doubleval($row["val"]); } mysql_free_result($result); @@ -32,7 +32,7 @@ // Setup a title for the graph $graph->title->Set('Contracts Starting - All Agencies since July 2008'); -$graph->SetUserFont("ttf-liberation/LiberationSans-Regular.ttf"); +$graph->SetUserFont("liberation/LiberationSans-Regular.ttf"); $graph->title->SetFont(FF_USERFONT,FS_NORMAL,12); // Setup font for axis --- a/graphs/displayHeatmap.php +++ b/graphs/displayHeatmap.php --- a/graphs/displayMethodCountGraph.php +++ b/graphs/displayMethodCountGraph.php @@ -3,7 +3,7 @@ // 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` +$query = "select procurementMethod, count(1) as count, SUM(value) as 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"; $result = mysql_query($query); $methods = Array("Direct","Open","Select"); @@ -37,7 +37,7 @@ $graph->SetMargin(95, 145, 45, 100); // Setup a title for the graph $graph->title->Set($agencyQ.$supplierQ); -$graph->SetUserFont("ttf-liberation/LiberationSans-Regular.ttf"); +$graph->SetUserFont("liberation/LiberationSans-Regular.ttf"); $graph->title->SetFont(FF_USERFONT, FS_NORMAL, 12); // Setup font for axis $graph->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 10); @@ -80,7 +80,7 @@ $graph2->Set90AndMargin(105, 45, 45, 45); // Setup a title for the graph $graph2->title->Set($agency); -$graph2->SetUserFont("ttf-liberation/LiberationSans-Regular.ttf"); +$graph2->SetUserFont("liberation/LiberationSans-Regular.ttf"); $graph2->title->SetFont(FF_USERFONT, FS_NORMAL, 12); // Setup font for axis $graph2->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 10); --- a/graphs/displayMethodValueGraph.php +++ b/graphs/displayMethodValueGraph.php @@ -3,7 +3,7 @@ // Width and height of the graph $width = 800; $height = 300; -$query = "select procurementMethod, value, MONTH(contractStart) as month, YEAR(contractStart) as year from `contractnotice` +$query = "select procurementMethod, SUM(value) as 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"; $result = mysql_query($query); $methods = Array("Direct","Open","Select"); @@ -37,7 +37,7 @@ $graph->SetMargin(95, 145, 45, 100); // Setup a title for the graph $graph->title->Set($agencyQ.$supplierQ); -$graph->SetUserFont("ttf-liberation/LiberationSans-Regular.ttf"); +$graph->SetUserFont("liberation/LiberationSans-Regular.ttf"); $graph->title->SetFont(FF_USERFONT, FS_NORMAL, 12); // Setup font for axis $graph->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 10); --- a/graphs/displaySuppliersGraph.php +++ b/graphs/displaySuppliersGraph.php --- a/lib/bsn.AutoSuggest_2.1.3_comp.js +++ b/lib/bsn.AutoSuggest_2.1.3_comp.js --- a/lib/common.inc.php +++ b/lib/common.inc.php @@ -1,4 +1,6 @@ 0) $supplierQ = "supplierABN = '" . $supplierParts[0] . "' AND"; - else $supplierQ = "supplierName LIKE '%" . $supplierParts[1] . "%' AND"; + if ($supplierParts[0] > 0) $supplierQ = "supplierABN = '" . $supplierParts[0] . "' AND "; + else $supplierQ = "supplierName LIKE '%" . $supplierParts[1] . "%' AND "; } $year = mysql_real_escape_string(stripslashes($_REQUEST['year'])); -if ($year != "") $yearQ = "agencyName = '" . $agency . "' AND"; +if ($year != "") $yearQ = "YEAR(publishDate) = " . $year . " AND "; $start =0.0; @@ -59,7 +63,7 @@ - +