diff --git a/admin/donors.php b/admin/donors.php index 048e9da..6670d22 100644 --- a/admin/donors.php +++ b/admin/donors.php @@ -81,7 +81,7 @@ switch($_GET['action']) { break; case 'sponsorshipinfo_load': $id=intval($_GET['id']); - echo "

".i18n("Summary")."

\n"; + echo "

".i18n("Summary")."

\n"; echo "\n"; @@ -95,6 +95,7 @@ switch($_GET['action']) { //TOTAL THIS YEAR $q=mysql_query("SELECT SUM(value) AS total FROM fundraising_donations WHERE sponsors_id='$id' + AND status='received' AND fiscalyear={$config['FISCALYEAR']} "); @@ -107,6 +108,7 @@ switch($_GET['action']) { $lastyear=$config['FISCALYEAR']-1; $q=mysql_query("SELECT SUM(value) AS total FROM fundraising_donations WHERE sponsors_id='$id' + AND status='received' AND fiscalyear=$lastyear "); @@ -115,7 +117,6 @@ switch($_GET['action']) { else $totallastyear=format_money(0); - //OUTPUT echo "\n"; echo "\n"; @@ -123,29 +124,59 @@ switch($_GET['action']) { echo "
".i18n("Last Donation")."$lastdonation
".i18n("Total This Year")."$totalthisyear
\n"; echo "
\n"; - echo "".i18n("View full donation history").""; - echo "
"; - $q=mysql_query("SELECT * FROM fundraising_donations WHERE sponsors_id='$id' ORDER BY datereceived DESC"); - echo "FIXME: get the goal and campaign"; + echo "

".i18n("Donations/Sponsorships")."

\n"; + echo "
"; + $q=mysql_query("SELECT fundraising_donations.*, fundraising_campaigns.name AS campaignname FROM fundraising_donations JOIN fundraising_campaigns ON fundraising_donations.fundraising_campaigns_id=fundraising_campaigns.id WHERE sponsors_id='$id' AND status='received' AND fundraising_donations.fiscalyear='{$config['fiscalyear']}' ORDER BY datereceived DESC"); + echo mysql_Error(); + if(mysql_num_rows($q)) { echo ""; echo ""; echo " \n"; echo " \n"; - echo " \n"; + echo " \n"; echo " \n"; echo ""; while($r=mysql_fetch_object($q)) { echo "\n"; echo " \n"; - echo " "; - echo " "; + $goal=getGoal($r->fundraising_goal); + echo " "; + echo " "; echo " "; + echo "\n"; } echo "
".i18n("Date")."".i18n("Goal")."".i18n("Campaign")."".i18n("Appeal")."".i18n("Value")."
".format_date($r->datereceived)."$r->fundraising_goal$r->fundraising_campaigns_id$goal->name$r->campaignname".format_money($r->value,false)."
\n"; - echo "
\n"; + } + else + echo i18n("No donations this year")."
"; + + echo "".i18n("View full donation history").""; + echo "
"; + echo "
"; + echo "".i18n("View this year's donation history").""; + echo ""; + echo ""; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo ""; + + $q=mysql_query("SELECT fundraising_donations.*, fundraising_campaigns.name AS campaignname FROM fundraising_donations JOIN fundraising_campaigns ON fundraising_donations.fundraising_campaigns_id=fundraising_campaigns.id WHERE sponsors_id='$id' AND status='received' ORDER BY datereceived DESC"); + while($r=mysql_fetch_object($q)) { + echo "\n"; + echo " \n"; + $goal=getGoal($r->fundraising_goal); + echo " "; + echo " "; + echo " "; + echo "\n"; + } + echo "
".i18n("Date")."".i18n("Goal")."".i18n("Appeal")."".i18n("Value")."
".format_date($r->datereceived)."$goal->name$r->campaignname".format_money($r->value,false)."
\n"; + echo "
\n"; - echo "
\n"; - echo "

".i18n("Add New Donation/Sponsorship")."

\n"; + echo "
\n"; + echo "

".i18n("Add New Donation/Sponsorship")."

\n"; echo "
"; echo ""; @@ -629,7 +660,7 @@ function draw_activityinfo_form(){ - + @@ -641,7 +672,7 @@ function draw_activityinfo_form(){ "; echo "\n"; - $logtypes=array("Campaign","Phone Call","Email","Personal Visit","Other"); + $logtypes=array("Appeal","Phone Call","Email","Personal Visit","Other"); foreach($logtypes AS $lt) { echo "\n"; } @@ -652,7 +683,7 @@ function draw_activityinfo_form(){ "; - echo "\n"; + echo "\n"; while($r=mysql_fetch_object($q)) { echo "\n"; } @@ -934,7 +965,7 @@ function useexistingcontact(uid) { function togglefulldonationhistory() { $("#fulldonationhistory").toggle('slow'); - + $("#thisyeardonationhistory").toggle('slow'); } function campaignchange() {
Date Committee Member Contact TypeCampaignAppeal Notes