Uncommitted changes to fundraising reports

This commit is contained in:
james 2009-10-16 21:19:37 +00:00
parent 1869bb79d5
commit 395ed4d084
3 changed files with 48 additions and 11 deletions

View File

@ -75,16 +75,16 @@ $(document).ready( function(){
<h3><a href="#">Results of Appeal by Purpose</a></h3>
<div>
<form method=get action="fundraising_reports_std.php">
<input type="hidden" name="id" value="1">
<input type="hidden" name="id" value="2">
<table><tr><td>
Choose an appeal:
Choose a Purpose:
</td><td>
<select name="fundraising_campaigns_id">
<option value="">All appeals</option>
<select name="goal">
<option value="">All purposes</option>
<?
$q=mysql_query("SELECT * FROM fundraising_campaigns WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY name");
$q=mysql_query("SELECT * FROM fundraising_goals WHERE fiscalyear='{$config['FISCALYEAR']}' ORDER BY name");
while($r=mysql_fetch_object($q)) {
echo "<option value=\"$r->id\">$r->name</option>\n";
echo "<option value=\"$r->goal\">$r->name</option>\n";
}
?>
</select>

View File

@ -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;
}

View File

@ -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
";