Donations tab for campaigns

This commit is contained in:
james 2009-10-11 19:49:04 +00:00
parent c9062e127b
commit bdf2ea7577
3 changed files with 32 additions and 4 deletions

View File

@ -166,8 +166,7 @@ switch($_GET['action']){
if($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);
$goalr=getGoal($r->fundraising_goal);
$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);
@ -202,9 +201,30 @@ switch($_GET['action']){
case "manage_tab_donations":
$campaign_id=intval($_GET['id']);
$q=mysql_query("SELECT * FROM fundraising_campaigns WHERE id='$campaign_id' AND fiscalyear='{$config['FISCALYEAR']}'");
if($campaign=mysql_fetch_object($q)) {
echo "<table class=\"tableview\">";
echo "<tr>";
echo " <th>".i18n("Date")."</th>\n";
echo " <th>".i18n("Donor/Sponsor")."</th>\n";
echo " <th>".i18n("Purpose")."</th>\n";
echo " <th>".i18n("Amount")."</th>\n";
echo " <th>".i18n("Type of Support")."</th>\n";
echo "</tr>\n";
if($r=mysql_fetch_object($q)) {
$q=mysql_query("SELECT * FROM fundraising_donations WHERE fundraising_campaigns_id='$campaign_id'
AND status='received' ORDER BY datereceived DESC");
while($r=mysql_fetch_object($q)) {
$goal=getGoal($r->fundraising_goal);
$q=mysql_query("SELECT * FROM sponsors WHERE id='{$r->sponsors_id}'");
$sponsor=mysql_fetch_object($q);
echo "<tr><td>".format_date($r->datereceived)."</td>\n";
echo " <td>".$sponsor->organization."</td>\n";
echo " <td>".$goal->name."</td>\n";
echo " <td>".format_money($r->value)."</td>\n";
echo " <td>".i18n($r->supporttype)."</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
}
exit;
break;

View File

@ -2,4 +2,10 @@
$campaign_types=array("Mail","Email","Phone","Personal Visit","Event","Other");
$salutations=array("Mr.","Mrs.","Ms","Dr.","Professor");
function getGoal($goal) {
global $config;
$q=mysql_query("SELECT * FROM fundraising_goals WHERE goal='$goal' AND fiscalyear='{$config['FISCALYEAR']}' LIMIT 1");
return mysql_fetch_object($q);
}
?>

View File

@ -55,3 +55,5 @@ UPDATE `reports_items` SET field = 'school_email' WHERE field = 'school_contacte
UPDATE `reports` SET `desc` = 'List of all schools in the database. Name, address, principal and phone.' WHERE `reports`.`system_report_id` =35 ;
ALTER TABLE `fundraising_donations` ADD `supporttype` VARCHAR( 255 ) NOT NULL;