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() {
=i18n("Fundraising Goals and Progress Year to Date")?>
+
+$q=mysql_query("SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY deadline");
+
+?>
- Goal |
- Budget Amount |
- Amount Received |
- % to Budget |
- Deadline |
-
-
- Science Fair - Operating | 5000 | 3000 | 60% | March 30 2010 |
- Science Fair - Awards | 1000 | 650 | 65% | December 1 2000 |
- Science Olympics | 5000 | 3000 | 20% | July 30 2010 |
+ =i18n("Goal")?> |
+ =i18n("Budget Amount")?> |
+ =i18n("Amount Received")?> |
+ =i18n("% to Budget")?> |
+ =i18n("Deadline")?> |
+
+ while($r=mysql_fetch_object($q)) {
+ //lookup all donations made towards this goal
+ $recq=mysql_query("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_goal='$r->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 "$r->name | ";
+ echo "".format_money($r->budget,false)." | ";
+ echo "".format_money($received,false)." | ";
+ $col=colour_to_percent($percent);
+ echo "{$percent}% | ";
+ echo "".format_date($r->deadline)." |
\n";
+ }
+ ?>
=i18n("Current Campaigns")?>
- Name |
- Type |
- Start Date |
- End Date |
- Goal |
- Target($) |
- Received |
- % to Budget |
+ =i18n("Name")?> |
+ =i18n("Type")?> |
+ =i18n("Start Date")?> |
+ =i18n("End Date")?> |
+ =i18n("Goal")?> |
+ =i18n("Target($)")?> |
+ =i18n("Received")?> |
+ =i18n("% to Budget")?> |
-
- Parents | Mailing | December 1 2009 | March 31 2010 | Science Fair - Operating | 1000 | 300 | 30% |
- Business - Cash | Personal | September 1 2009 | December 1 2009 | Science Fair - Awards | 1000 | 650 | 65% |
- Business - Cash | Personal | Descember 1 2009 | March 31 2010 | Science Fair - Operating | 3000 | 2700 | 90% |
- Business - In-kind | Phone | January 1 2010 | February 28 2010 | Science Fair - Operating | 1000 | 0 | 0% |
+
+
+ $q=mysql_query("SELECT * FROM fundraising_campaigns WHERE fiscalyear='{$config['FISCALYEAR']}'");
+
+ while($r=mysql_fetch_object($q)) {
+
+ $goalq=mysql_query("SELECT * FROM fundraising_goals WHERE goal='{$r->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 " $r->name | \n";
+ echo " $r->type | \n";
+ echo " ".format_date($r->startdate)." | \n";
+ echo " ".format_date($r->enddate)." | ";
+ echo " $goalr->name | ";
+ echo " ".format_money($r->target,false)." | \n";
+ echo " ".format_money($received,false)." | \n";
+ echo " {$percent}% | \n";
+ echo "
\n";
+ }
+ ?>
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;
+}
+
+
?>