bloody hell.. more renaming Campaign->Appeal, Goal->Purpose

Begin the actual donations/sponsorships page for donors
Remove students from prospecting, set it to alumni, which wont be active for a while
This commit is contained in:
james 2009-10-09 20:25:01 +00:00
parent 081bc1b187
commit 8ea2823bf1
5 changed files with 179 additions and 44 deletions

View File

@ -76,8 +76,135 @@ switch($_GET['action']) {
break;
case 'sponsorshipinfo_load':
$id=intval($_GET['id']);
$ret=array();
echo json_encode($ret);
echo "<h3>".i18n("Summary")."</h3>\n";
echo "<table cellspacing=3 cellpadding=3>\n";
//LAST DONATION
$q=mysql_query("SELECT * FROM fundraising_donations WHERE sponsors_id='$id' ORDER BY datereceived DESC LIMIT 1");
if($r=mysql_fetch_object($q))
$lastdonation=i18n("%1 on %2",array(format_money($r->value,false),format_date($r->datereceived)),array("Donation amount","Donation date"));
else
$lastdonation=i18n("Never");
//TOTAL THIS YEAR
$q=mysql_query("SELECT SUM(value) AS total FROM fundraising_donations
WHERE sponsors_id='$id'
AND fiscalyear={$config['FISCALYEAR']}
");
if($r=mysql_fetch_object($q))
$totalthisyear=format_money($r->total,false);
else
$totalthisyear=format_money(0);
//TOTAL LAST YEAR
$lastyear=$config['FISCALYEAR']-1;
$q=mysql_query("SELECT SUM(value) AS total FROM fundraising_donations
WHERE sponsors_id='$id'
AND fiscalyear=$lastyear
");
if($r=mysql_fetch_object($q))
$totallastyear=format_money($r->total,false);
else
$totallastyear=format_money(0);
//OUTPUT
echo "<tr><td>".i18n("Last Donation")."</td><td>$lastdonation</td></tr>\n";
echo "<tr><td>".i18n("Total This Year")."</td><td>$totalthisyear</td></tr>\n";
echo "<tr><td>".i18n("Total Last Year")."</td><td>$totallastyear</td></tr>\n";
echo "</table>\n";
echo "<br />\n";
echo "<a href=\"#\" onclick=\"return togglefulldonationhistory()\" id=\"fullhistorylink\">".i18n("View full donation history")."</a>";
echo "<div id=\"fulldonationhistory\" style=\"display: none;\">";
$q=mysql_query("SELECT * FROM fundraising_donations WHERE sponsors_id='$id' ORDER BY datereceived DESC");
echo "FIXME: get the goal and campaign";
echo "<table class=\"tableview\">";
echo "<tr>";
echo " <th>".i18n("Date")."</th>\n";
echo " <th>".i18n("Goal")."</th>\n";
echo " <th>".i18n("Campaign")."</th>\n";
echo " <th>".i18n("Value")."</th>\n";
echo "</tr>";
while($r=mysql_fetch_object($q)) {
echo "<tr>\n";
echo " <td>".format_date($r->datereceived)."</td>\n";
echo " <td>$r->fundraising_goal</td>";
echo " <td>$r->fundraising_campaigns_id</td>";
echo " <td>".format_money($r->value,false)."</td>";
}
echo "</table>\n";
echo "<br />\n";
echo "</div>\n";
echo "<hr />\n";
echo "<h3>".i18n("Add New Donation/Sponsorship")."</h3>\n";
echo "<form>";
echo "<table cellspacing=3 cellpadding=3>";
echo "<tr><td>";
echo i18n("Appeal").":";
echo "</td><td>";
echo "<select id=\"fundraising_campaign_id\" name=\"fundraising_campaigns_id\" onchange=\"campaignchange()\">";
echo "<option value=\"\">".i18n("Choose an appeal")."</option>\n";
//FIXME: only show campaigns that they were included as part of
//we need a campaigns_users_link or campaigns_sponsors_link or something
$q=mysql_query("SELECT * FROM fundraising_campaigns WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY name");
$str="";
while($r=mysql_fetch_object($q)) {
echo "<option value=\"$r->id\">$r->name</option>\n";
$str.="defaultgoals[$r->id]='$r->fundraising_goal';\n";
}
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td>";
echo i18n("Purpose").":";
echo "</td><td>";
echo "<script type=\"text/javascript\">";
echo " var defaultgoals=Array();\n";
echo $str;
echo "</script>\n";
echo "<select name=\"fundraising_goal\">";
echo "<option value=\"\">".i18n("Choose a purpose")."</option>\n";
//FIXME: only show campaigns that they were included as part of
//we need a campaigns_users_link or campaigns_sponsors_link or something
$q=mysql_query("SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY name");
while($r=mysql_fetch_object($q)) {
echo "<option value=\"$r->goal\">$r->name</option>\n";
}
echo "</select>\n";
echo "</td></tr>\n";
echo "<tr><td>".i18n("Date Received").":</td><td><input type=\"text\" class=\"date\" name=\"datereceived\" value=\"".date("Y-m-d")."\"></td></tr>\n";
echo "<tr><td>".i18n("Amount").":</td><td>\$<input type=\"text\" size=\"10\" name=\"value\"></td></tr>\n";
echo "<tr><td>".i18n("Type of Support").":</td><td>";
$supporttypes=array("Gift - no receipt");
if($config['registered_charity'])
$supporttypes[]="Donation - with receipt";
$supporttypes[]="Sponsorship";
echo "<select name=\"supporttype\">\n";
echo "<option value=\"\">Choose type of support</option>\n";
foreach($supporttypes AS $st) {
echo "<option value=\"$st\">".i18n($st)."</option>\n";
}
echo "</select>\n";
echo "</td></tr>\n";
/*
echo "<tr><td></td><td>";
echo "<a href=\"#\" onclick=\"return false;\">".i18n("Generate Thank You")."</a></td>";
echo "</tr>\n";
*/
echo "</table>\n";
echo "</form>\n";
exit;
break;
@ -449,7 +576,7 @@ function draw_activityinfo_form(){
<table class="tableview" style="width:99%">
<thead><tr>
<th>Date</th>
<th>User</th>
<th>Committee Member</th>
<th>Contact Type</th>
<th>Campaign</th>
<th>Notes</th>
@ -661,10 +788,9 @@ function organizationinfo_save() {
function update_sponsorshipinfo()
{
var id=sponsor_id;
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=sponsorshipinfo_load&id="+id,
function(json){
$("#sponsor_id").val(json.id);
});
$("#editor_tab_sponsorship").load("<?=$_SERVER['PHP_SELF']?>?action=sponsorshipinfo_load&id="+id, null,function() {
$(".date").datepicker({ dateFormat: 'yy-mm-dd' });
});
}
function sponsorshipinfo_save() {
@ -747,6 +873,15 @@ function useexistingcontact(uid) {
var id=sponsor_id;
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_addexisting",{id: id, uid: uid} ,function() { update_contactsinfo(); });
}
function togglefulldonationhistory() {
$("#fulldonationhistory").toggle('slow');
}
function campaignchange() {
}
</script>
<?

View File

@ -39,15 +39,15 @@ $(document).ready(function() {
});
</script>
<h3><?=i18n("Fundraising Goals and Progress Year to Date")?></h3>
<h3><?=i18n("Fundraising Purposes and Progress Year to Date")?></h3>
<?
$q=mysql_query("SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY deadline");
?>
<table class="tableview">
<tr>
<th><?=i18n("Purpose")?></th>
<th><?=i18n("Goal")?></th>
<th><?=i18n("Budget Amount")?></th>
<th><?=i18n("Amount Received")?></th>
<th><?=i18n("% to Budget")?></th>
<th><?=i18n("Deadline")?></th>
@ -75,17 +75,17 @@ $q=mysql_query("SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISC
</table>
<br />
<h3><?=i18n("Current Campaigns")?></h3>
<h3><?=i18n("Current Appeals")?></h3>
<table class="tableview">
<tr>
<th><?=i18n("Name")?></th>
<th><?=i18n("Type")?></th>
<th><?=i18n("Start Date")?></th>
<th><?=i18n("End Date")?></th>
<th><?=i18n("Goal")?></th>
<th><?=i18n("Target($)")?></th>
<th><?=i18n("Received")?></th>
<th><?=i18n("% to Budget")?></th>
<th><?=i18n("Purpose")?></th>
</tr>
<?
@ -110,10 +110,10 @@ $q=mysql_query("SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISC
echo " <td>$r->type</td>\n";
echo " <td>".format_date($r->startdate)."</td>\n";
echo " <td>".format_date($r->enddate)."</td>";
echo " <td>$goalr->name</td>";
echo " <td style=\"text-align: right;\">".format_money($r->target,false)."</td>\n";
echo " <td style=\"text-align: right;\">".format_money($received,false)."</td>\n";
echo " <td style=\"text-align: center; background-color: $col;\">{$percent}%</td>\n";
echo " <td>$goalr->name</td>";
echo "</tr>\n";
}
?>
@ -165,14 +165,14 @@ if(mysql_num_rows($q)) {
?>
<br />
<h4>Campaign Follow-Ups</h4>
<h4>Appeal Follow-Ups</h4>
<?
$q=mysql_query("SELECT * FROM fundraising_campaigns WHERE followupdate>=NOW() ORDER BY followupdate LIMIT 5");
echo mysql_error();
if(mysql_num_rows($q)) {
echo "<table class=\"tableview\">";
echo "<tr>";
echo " <th>".i18n("Campaign Name")."</th>\n";
echo " <th>".i18n("Appeal")."</th>\n";
echo " <th>".i18n("Start Date")."</th>\n";
echo " <th>".i18n("Follow-Up Date")."</th>\n";
echo "</tr>\n";
@ -181,7 +181,7 @@ if(mysql_num_rows($q)) {
}
echo "</table>\n";
} else {
echo i18n("No campaign follow-ups");
echo i18n("No appeal follow-ups");
echo "<br />\n";
}

View File

@ -45,7 +45,7 @@ switch($_GET['action']){
?>
<tr><td colspan="6" style="text-align: center;">
<br />
<input type="submit" value="<?=i18n("Save Campaign")?>"></td>
<input type="submit" value="<?=i18n("Save Appeal")?>"></td>
</tr>
</table>
</form>
@ -53,7 +53,7 @@ switch($_GET['action']){
<?
}
?>
<h3><a href="#"><?=i18n("Create New Campaign")?></a></h3>
<h3><a href="#"><?=i18n("Create New Appeal")?></a></h3>
<div id="campaign_new">
<form id="campaigninfo_new" method="post" action="<?=$_SERVER['PHP_SELF']?>" onsubmit="return campaigninfo_save(-1)">
<input type="hidden" name="campaign_id" value="-1" />
@ -63,7 +63,7 @@ switch($_GET['action']){
?>
<tr><td colspan="6" style="text-align: center;">
<br />
<input type="submit" value="<?=i18n("Create Campaign")?>"></td>
<input type="submit" value="<?=i18n("Create Appeal")?>"></td>
</tr>
</table>
</form>
@ -75,7 +75,7 @@ switch($_GET['action']){
case "managelist":
echo i18n("Select a campaign");
echo i18n("Select an appeal");
?>
<table class="tableview">
<tr>
@ -83,10 +83,10 @@ switch($_GET['action']){
<th><?=i18n("Type")?></th>
<th><?=i18n("Start Date")?></th>
<th><?=i18n("End Date")?></th>
<th><?=i18n("Goal")?></th>
<th><?=i18n("Target($)")?></th>
<th><?=i18n("Received")?></th>
<th><?=i18n("% to Budget")?></th>
<th><?=i18n("Purpose")?></th>
</tr>
<?
@ -111,10 +111,10 @@ switch($_GET['action']){
echo " <td>$r->type</td>\n";
echo " <td>".format_date($r->startdate)."</td>\n";
echo " <td>".format_date($r->enddate)."</td>";
echo " <td>$goalr->name</td>";
echo " <td style=\"text-align: right;\">".format_money($r->target,false)."</td>\n";
echo " <td style=\"text-align: right;\">".format_money($received,false)."</td>\n";
echo " <td style=\"text-align: center; background-color: $col;\">{$percent}%</td>\n";
echo " <td>$goalr->name</td>";
echo "</tr>\n";
}
?>
@ -186,7 +186,7 @@ switch($_GET['action']){
echo "</tr>\n";
echo " <td>".i18n("End Date")."</td><td>".format_date($r->enddate)."</td>";
echo "</tr>\n";
echo " <td>".i18n("Default Goal")."</td><td>$goalr->name</td>";
echo " <td>".i18n("Default Purpose")."</td><td>$goalr->name</td>";
echo "</tr>\n";
echo " <td>".i18n("Target")."</td><td>".format_money($r->target,false)."</td>\n";
echo "</tr>\n";
@ -257,7 +257,7 @@ switch($_GET['action']){
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="mentor"><?=i18n("Mentor")?></label><br />
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="committee"><?=i18n("Committee")?></label><br />
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="volunteer"><?=i18n("Volunteer")?></label><br />
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="students"><?=i18n("Students")?></label><br />
<label><input onchange="return prospect_search()" type="checkbox" name="individual_type[]" value="alumni"><?=i18n("Alumni")?></label><br />
</td></tr></table>
</div>
@ -294,7 +294,7 @@ switch($_GET['action']){
function save_campaign_info(){
global $config;
if(!$_POST['name']){
error_("Campaign Name is required");
error_("Appeal Name is required");
return;
}
if(!$_POST['startdate']) $startdate=date("Y-m-d"); else $startdate=$_POST['startdate'];
@ -304,10 +304,10 @@ function save_campaign_info(){
'".mysql_real_escape_string($_POST['name'])."','{$config['FISCALYEAR']}')";
mysql_query($query);
$id = mysql_insert_id();
happy_("Campaign Created");
happy_("Appeal Created");
}else{
$id = $_GET["id"];
happy_("Campaign Saved");
happy_("Appeal Saved");
}
mysql_query("UPDATE fundraising_campaigns SET
name='".mysql_real_escape_string($_POST['name'])."',
@ -320,7 +320,7 @@ function save_campaign_info(){
WHERE id='$id'");
}
send_header("Campaign Management",
send_header("Appeal Management",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Fundraising' => 'admin/fundraising.php'),
@ -473,11 +473,11 @@ function display_campaign_form($r=null) {
</tr>
<tr>
<td><?=i18n("Target")?></td><td>$<input type="text" id="target" name="target" size="10" value="<?=$r->target?>" /></td>
<td><?=i18n("Default Goal")?></td><td colspan="3">
<td><?=i18n("Default Purpose")?></td><td colspan="3">
<?
$fgq=mysql_query("SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY name");
echo "<select name=\"fundraising_goal\">";
echo "<option value=\"\">".i18n("Choose Default Goal")."</option>\n";
echo "<option value=\"\">".i18n("Choose Default Purpose")."</option>\n";
while($fgr=mysql_fetch_object($fgq)) {
if($r->fundraising_goal==$fgr->goal) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$fgr->goal\">".i18n($fgr->name)."</option>\n";
@ -491,9 +491,9 @@ function display_campaign_form($r=null) {
?>
<table cellspacing=2 width=740 border=0>
<tr><td>
<a href="#" onclick="modifycampaigns()">Create/Modify Campaigns</a>
<a href="#" onclick="modifycampaigns()">Create/Modify Appeals</a>
</td><td>
<a href="#" onclick="managecampaigns()">Campaign Management</a>
<a href="#" onclick="managecampaigns()">Appeal Management</a>
</td></tr></table>
<hr />
<div id="campaigndiv" style="width: 780px; display: none;">

View File

@ -122,7 +122,7 @@
echo "<table style=\"width: 100%;\">";
echo "<tr><td>";
echo i18n("Goal Name").":</td><td><input type=\"text\" size=\"40\" name=\"name\" value=\"$r->name\"></td></tr>\n";
echo i18n("Purpose").":</td><td><input type=\"text\" size=\"40\" name=\"name\" value=\"$r->name\"></td></tr>\n";
echo "<tr><td>";
echo i18n("Budget Amount").":</td><td>\$<input size=\"5\" type=\"text\" name=\"budget\" value=\"$r->budget\"></td></tr>";
echo "<tr><td>";
@ -132,20 +132,20 @@
echo "</td></tr>\n";
echo "</table>\n";
echo "<table style=\"width: 100%;\"><tr><td style=\"width: 50%; text-align: center;\">";
echo "<input type=\"submit\" value=\"".i18n("Save Goal")."\" >";
echo "<input type=\"submit\" value=\"".i18n("Save Purpose")."\" >";
echo "</td><td style=\"width: 50%; text-align: right;\">";
echo "<input type=\"button\" value=\"".i18n("Delete Goal")."\" onclick=\"return goal_delete($r->id)\" >";
echo "<input type=\"button\" value=\"".i18n("Delete Purpose")."\" onclick=\"return goal_delete($r->id)\" >";
echo "</td></tr></table>\n";
echo "</form>";
echo "</div>\n";
}
echo "<h3><a href=\"#\">Create New Goal</a></h3>\n";
echo "<h3><a href=\"#\">Create New Purpose</a></h3>\n";
echo "<div id=\"goal_new\">\n";
echo "<form id=\"goal_form\" onsubmit=\"return goal_save()\">\n";
echo "<table style=\"width: 100%;\">";
echo "<tr><td>";
echo i18n("Goal Name").":</td><td><input type=\"text\" size=\"40\" name=\"name\"></td></tr>\n";
echo i18n("Purpose Name").":</td><td><input type=\"text\" size=\"40\" name=\"name\"></td></tr>\n";
echo "<tr><td>";
echo i18n("Budget Amount").":</td><td>\$<input size=\"5\" type=\"text\" name=\"budget\"></td></tr>";
echo "<tr><td>";
@ -156,7 +156,7 @@
echo "</table>\n";
echo "<table style=\"width: 100%;\"><tr><td style=\"width: 50%; text-align: center;\">";
echo "<input type=\"submit\" value=\"".i18n("Create Goal")."\">";
echo "<input type=\"submit\" value=\"".i18n("Create Purpose")."\">";
echo "</td><td style=\"width: 50%; text-align: right;\">";
echo "</td></tr></table>\n";
echo "</form>\n";
@ -240,7 +240,7 @@
case "goal_save":
$id=$_POST['id'];
if(! ($_POST['name'] && $_POST['budget'])) {
error_("Goal name and budget are required");
error_("Purpose name and budget are required");
exit;
}
if($id) {
@ -251,7 +251,7 @@
description='".mysql_real_escape_string($_POST['description'])."'
WHERE id='$id' AND fiscalyear='{$config['FISCALYEAR']}'
");
happy_("Goal Saved");
happy_("Purpose Saved");
}
else {
$goal=strtolower($_POST['name']);
@ -259,7 +259,7 @@
$q=mysql_query("SELECT * FROM fundraising_goals WHERE goal='$goal' AND fiscalyear='{$config['FISCALYEAR']}'");
echo mysql_error();
if(mysql_num_rows($q)) {
error_("The automatically generated goal key (%1) generated from (%2) is not unique. Please try a different Goal Name",array($goal,$_POST['name']));
error_("The automatically generated purpose key (%1) generated from (%2) is not unique. Please try a different Purpose Name",array($goal,$_POST['name']));
exit;
}
@ -270,7 +270,7 @@
'".mysql_real_escape_string($_POST['deadline'])."',
'".mysql_real_escape_string($_POST['description'])."',
'{$config['FISCALYEAR']}')");
happy_("Goal Created");
happy_("Purpose Created");
}
exit;
break;
@ -293,7 +293,7 @@
}
mysql_query("DELETE FROM fundraising_goals WHERE id='$id' AND fiscalyear='{$config['FISCALYEAR']}'");
happy_("Goal Deleted");
happy_("Purpose Deleted");
exit;
break;
@ -417,7 +417,7 @@ function charitychange() {
<ul>
<li><a href="#editor_tab_setup"><span><?=i18n('Module Setup')?></span></a></li>
<li><a href="#editor_tab_levels"><span><?=i18n('Fundraising Levels')?></span></a></li>
<li><a href="#editor_tab_goals"><span><?=i18n('Fundraising Goals')?></span></a></li>
<li><a href="#editor_tab_goals"><span><?=i18n('Fundraising Purposes')?></span></a></li>
</ul>
<div id="editor_tab_setup">

View File

@ -461,7 +461,7 @@ if(is_array($nav)) {
echo "<li><h4 style=\"text-align: center;\">".i18n("Fundraising")."</h4></li>\n";
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/admin/fundraising.php\">".i18n("Fundraising Dashboard").'</a></li>';
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/admin/fundraising_setup.php\">".i18n("Fundraising Setup").'</a></li>';
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/admin/fundraising_campaigns.php\">".i18n("Manage Campaigns").'</a></li>';
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/admin/fundraising_campaigns.php\">".i18n("Manage Appeal").'</a></li>';
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/admin/donors.php\">".i18n("Manage Donors/Sponsors").'</a></li>';
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/admin/reports.php?area=fundraising\">".i18n("Fundraising Reports").'</a></li>';
echo "</ul><br />\n";