Commit working stuff for fundraising so i can update on lightbox

This commit is contained in:
james 2009-09-18 17:06:44 +00:00
parent 17c3e4a732
commit c1d7b8fc24
2 changed files with 69 additions and 27 deletions

View File

@ -24,41 +24,34 @@ if($_GET['action']=="fundraisingmain") {
$typetotal=0;
$typeprobtotal=0;
$sq=mysql_query("SELECT sponsorships.id, sponsors.organization, sponsorships.value, sponsorships.status, sponsorships.probability
$sq=mysql_query("
SELECT sponsorships.id, sponsors.organization AS name, sponsorships.value, sponsorships.status, sponsorships.probability
FROM sponsorships
JOIN sponsors ON sponsorships.sponsors_id=sponsors.id
WHERE (sponsorships.fundraising_type='$r->type' $orsql)
AND sponsorships.year='{$config['FAIRYEAR']}'
ORDER BY status DESC, probability DESC, organization");
UNION
SELECT sponsorships.id, CONCAT(users.firstname,' ',users.lastname) AS name, sponsorships.value, sponsorships.status, sponsorships.probability
FROM sponsorships
JOIN users ON sponsorships.users_uid=users.uid
WHERE (sponsorships.fundraising_type='$r->type' $orsql)
AND sponsorships.year='{$config['FAIRYEAR']}'
ORDER BY status DESC, probability DESC, name
");
echo mysql_error();
while($sr=mysql_fetch_object($sq)) {
echo "<tr id=\"sponsorships_$sr->id\" class=\"fundraising{$sr->status}\">";
echo "<td>";
// echo "<a title=\"".i18n("Remove sponsorship")."\" onclick=\"return confirmClick('Are you sure you want to remove this sponsorship?')\" href=\"fundraising.php?action=sponsorshipdelete&delete=$sr->id\">";
echo "<img style=\"cursor:pointer;\" onclick=\"delete_sponsorship($sr->id)\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\">";
// echo "</a></nobr>";
echo "<img style=\"cursor:pointer;\" onclick=\"delete_sponsorship($sr->id)\" border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\">";
echo "</td>";
echo "<td style=\"cursor: pointer;\" onclick=\"popup_sponsorship_editor('fundraising_sponsorship.php?id=$sr->id&fundraising_type=$r->type')\">";
//echo "<a title=\"".i18n("Edit sponsorship details")."\" onclick=\"return SFIABialog(event,'fundraising_sponsorship.php?id=$sr->id&fundraising_type=$r->type',400,250)\" href=\"#\">$sr->organization</a></td>\n";
echo "$sr->organization</td>\n";
/*
echo "<a href=\"communication.php?action=edit&edit=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";
//only user emails can be deleted, system ones are required and cannot be removed
if($r->type=="user")
{
echo "&nbsp;";
echo "<a onclick=\"return confirmClick('Are you sure you want to remove email?')\" href=\"communication.php?action=delete&delete=$r->id\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
echo "&nbsp;";
echo "<a href=\"communication.php?action=send&send=$r->id\">Send</a>";
}
*/
echo "$sr->name</td>\n";
echo "<td>$sr->status</td>";
echo "<td>";
if($sr->status=="pending")
{
if($sr->status=="pending") {
echo "$sr->probability%";
echo "</td>";
echo "<td><nobr>".format_money($sr->value)."</nobr></td>";

View File

@ -37,17 +37,41 @@
$formaction="sponsorshipadd";
$fundraising_type=$_GET['fundraising_type'];
}
?>
<script type="text/javascript">
function typechange() {
var t=($("[name=sponsortype]:checked").val());
if(t=="organization") {
$("#sponsor_type_organization").show();
$("#sponsor_type_individual").hide();
} else {
$("#sponsor_type_organization").hide();
$("#sponsor_type_individual").show();
}
}
</script>
<?
echo "<form id=\"fundraisingsponsorship\">";
echo "<input type=\"hidden\" name=\"action\" value=\"$formaction\">";
echo "<input type=\"hidden\" name=\"sponsorships_id\" value=\"$id\">";
echo "<table cellspacing=0 cellpadding=0 class=\"tableedit\">";
echo "<tr><th>".i18n("Sponsor")."</th>";
echo "<td>";
if($formaction=="sponsorshipadd") {
echo "<tr><th>".i18n("Sponsor Type")."</th>";
echo "<td>";
echo "<input onchange=\"typechange()\" type=\"radio\" name=\"sponsortype\" value=\"organization\"> ".i18n("Organization");
echo "&nbsp;"; echo "&nbsp;"; echo "&nbsp;";
echo "<input onchange=\"typechange()\" type=\"radio\" name=\"sponsortype\" value=\"individual\"> ".i18n("Individual");
echo "</td></tr>\n";
echo "<tr><th>".i18n("Sponsor")."</th>";
echo "<td>";
$q=mysql_query("SELECT * FROM sponsors ORDER BY organization");
echo mysql_error();
echo "<span id=\"sponsor_type_organization\" style=\"display: none;\">";
echo "<select name=\"sponsors_id\">";
echo "<option value=\"\">".i18n("Choose")."</option>\n";
while($r=mysql_fetch_object($q)) {
@ -55,9 +79,34 @@
echo "<option $sel value=\"$r->id\">$r->organization</option>\n";
}
echo "</select>&nbsp;<a href=\"sponsors.php?action=add\">".i18n("Add")."</a>\n";
echo "</span>";
$q=mysql_query("SELECT users.*, MAX(year) AS year FROM users WHERE (firstname!='' AND lastname!='') GROUP BY uid HAVING deleted='no' ORDER BY lastname,firstname");
echo mysql_error();
echo "<span id=\"sponsor_type_individual\" style=\"display: none;\">";
echo "<select name=\"users_uid\">";
echo "<option value=\"\">".i18n("Choose")."</option>\n";
while($r=mysql_fetch_object($q)) {
if($r->uid==$sponsorship->users_uid) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$r->uid\">[$r->year][$r->uid] $r->lastname, $r->firstname ($r->email)</option>\n";
}
// echo "</select>&nbsp;<a href=\"sponsors.php?action=add\">".i18n("Add")."</a>\n";
echo "</span>";
}
else {
echo $sponsorship->organization;
echo "<tr><th>".i18n("Sponsor Type")."</th>";
echo "<td>";
if($sponsorship->sponsors_id) echo i18n("Organization");
else echo i18n("Individual");
echo "</td></tr>\n";
echo "<tr><th>".i18n("Sponsor")."</th>";
echo "<td>";
echo $sponsorship->organization;
}
echo "</td></tr>\n";