diff --git a/admin/fundraising_reports.php b/admin/fundraising_reports.php index cd3499f..0210e76 100644 --- a/admin/fundraising_reports.php +++ b/admin/fundraising_reports.php @@ -75,16 +75,16 @@ $(document).ready( function(){

Results of Appeal by Purpose

- +
- Choose an appeal: + Choose a Purpose: - + id\">$r->name\n"; + echo "\n"; } ?> diff --git a/admin/fundraising_reports_std.php b/admin/fundraising_reports_std.php index fdf55a2..ff993a7 100644 --- a/admin/fundraising_reports_std.php +++ b/admin/fundraising_reports_std.php @@ -36,7 +36,7 @@ switch($id) { case 1: if($type=="csv") { - $rep=new lcsv($config['FAIRNAME'],'List of Prospects by Appeal',""); + $rep=new lcsv($config['FAIRNAME']); } else if($type=="pdf") { $rep=new lpdf( i18n($config['fairname']), @@ -119,15 +119,50 @@ break; case 2: + if($type=="csv") { + $rep=new lcsv($config['FAIRNAME'],'Results of Appeal by Purpose',""); + + } else if($type=="pdf") { + $rep=new lpdf( i18n($config['fairname']), + i18n("Results of Appeal by Purpose"), + $_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif" + ); + $rep->newPage(); + $rep->setFontSize(8); + } + $sql="SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISCALYEAR']}' "; + if($_GET['goal']) { + $sql.=" AND goal='".mysql_real_escape_string($_GET['goal'])."'"; + } + $sql.=" ORDER BY name"; + $q=mysql_query($sql); + echo mysql_error(); + + while($r=mysql_fetch_object($q)) { + $rep->heading($r->name)." (".$r->budget.")"; $table=array(); $table['header']=array("Appeal Name","Target","Received","% to Budget","# of Prospects","# of Donors/Sponsors","Rate of Response","Average Amount Given"); - //$table['widths']=array(1.5,1,1,1,0.9,0.9,0.9,0.5); - //$table['dataalign']=array("left","left","left","left","right","right","right","center"); + $table['widths']=array(1.5,0.5,0.5,0.75,0.9,0.9,0.9,0.5); + $table['dataalign']=array("left","right","right","center","center","center","center","right"); + + $cq=mysql_query("SELECT * FROM fundraising_campaigns WHERE fundraising_goal='$r->goal' AND fiscalyear='{$config['FISCALYEAR']}'"); + while($cr=mysql_fetch_object($cq)) { + $table['data'][]=array( + $cr->name, + $cr->target, + $received, + $percenttobudget, + $numprospects, + $numdonors, + $rate, + $avgamount); + } + + $rep->addTable($table); + } - - break; } diff --git a/admin/reports_fundraising.inc.php b/admin/reports_fundraising.inc.php index 82ce791..e32d528 100644 --- a/admin/reports_fundraising.inc.php +++ b/admin/reports_fundraising.inc.php @@ -146,6 +146,7 @@ $report_fundraisings_fields = array( if(in_array('users', $components)) { $users_from = 'LEFT JOIN fundraising_campaigns_users_link ON fundraising_campaigns.id=fundraising_campaigns_users_link.fundraising_campaigns_id LEFT JOIN users ON users.uid=fundraising_campaigns_users_link.users_uid'; + $users_where = "users.deleted!='yes' AND"; } /* @@ -173,6 +174,7 @@ $report_fundraisings_fields = array( $q = " FROM fundraising_campaigns $users_from WHERE + $users_where 1 ";