diff --git a/admin/donors_search.php b/admin/donors_search.php index b28fd6f..dcc1bdc 100644 --- a/admin/donors_search.php +++ b/admin/donors_search.php @@ -25,6 +25,7 @@ require("../common.inc.php"); require_once("../user.inc.php"); user_auth_required('committee', 'admin'); + echo "
\n"; //$q=mysql_query("SELECT * FROM award_sponsors WHERE year='".$config['FAIRYEAR']."' ORDER BY organization"); //we want to show all years, infact that year field probably shouldnt even be there. @@ -38,7 +39,7 @@ $sql.=") "; } $query="SELECT * FROM sponsors WHERE 1 $sql ORDER BY organization"; - echo "query=$query"; +// echo "query=$query"; $q=mysql_query($query); diff --git a/admin/fundraising.php b/admin/fundraising.php index b65dd51..05ea1f0 100644 --- a/admin/fundraising.php +++ b/admin/fundraising.php @@ -40,39 +40,83 @@ $(document).ready(function() {

+ - - - - - - - - - - + + + + + + goal' AND fiscalyear='{$config['FISCALYEAR']}' AND status='received'"); + echo mysql_error(); + $recr=mysql_fetch_object($recq); + $received=$recr->received; + if($r->budget) + $percent=round($received/$r->budget*100,1); + else + $percent=0; + + echo ""; + echo ""; + echo ""; + $col=colour_to_percent($percent); + echo ""; + echo "\n"; + } + ?>
GoalBudget AmountAmount Received% to BudgetDeadline
Science Fair - Operating5000300060%March 30 2010
Science Fair - Awards100065065%December 1 2000
Science Olympics5000300020%July 30 2010
$r->name".format_money($r->budget,false)."".format_money($received,false)."{$percent}%".format_date($r->deadline)."

- - - - - - - - + + + + + + + + - - - - - + +fundraising_goal}' AND fiscalyear='{$config['FISCALYEAR']}'"); + $goalr=mysql_fetch_object($goalq); + $recq=mysql_query("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_campaigns_id='$r->id' AND fiscalyear='{$config['FISCALYEAR']}' AND status='received'"); + echo mysql_error(); + $recr=mysql_fetch_object($recq); + $received=$recr->received; + if($r->budget) + $percent=round($received/$r->target*100,1); + else + $percent=0; + $col=colour_to_percent($percent); + + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " "; + echo " "; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n"; + } + ?>
NameTypeStart DateEnd DateGoalTarget($)Received% to Budget
ParentsMailingDecember 1 2009March 31 2010Science Fair - Operating100030030%
Business - CashPersonalSeptember 1 2009December 1 2009Science Fair - Awards100065065%
Business - CashPersonalDescember 1 2009March 31 2010Science Fair - Operating3000270090%
Business - In-kindPhoneJanuary 1 2010February 28 2010Science Fair - Operating100000%
$r->name$r->type".format_date($r->startdate)."".format_date($r->enddate)."$goalr->name".format_money($r->target,false)."".format_money($received,false)."{$percent}%

diff --git a/common.inc.php b/common.inc.php index a3fc9a0..9e2f0bb 100644 --- a/common.inc.php +++ b/common.inc.php @@ -1188,5 +1188,24 @@ function error_($str, $i18n_array=array(), $timeout=-1) notice_($str, $i18n_array, $timeout, 'error'); } +//this function returns a HTML colour code ranging between red and green, with yellow in the middle based on the percent passed into it +function colour_to_percent($percent) { + //0 is red + //50 is yellow + //100 is green + + if($percent<=50) $red=255; + else $red=(100-$percent)*2/100*255;; + + if($percent>50) $green=255; + else $green=($percent)*2/100*255;; + +// echo "red=$red"; +// echo "green=$green"; + $str="#".sprintf("%02s",dechex($red)).sprintf("%02s",dechex($green))."00"; + return $str; +} + + ?>