| Server IP : 172.67.201.108 / Your IP : 216.73.216.11 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/mitzvahm/planner/rpt/ |
Upload File : |
<?php include('mod/_mod_security.php'); ?>
<?php
$sql = "SELECT g1.id, g1.guest_type, g1.primary_guest_id, g1.last_name, g1.first_name, g1.gift_amt, g1.gift_card, g1.gift_other, g1.gift_thank_you, g1.gift_comment, g1.street, g1.street2, g1.city, g1.state, g1.zip, g1.country, ".
" IF(g1.guest_type = 'P',0,1) AS sort_type, IF(g1.guest_type = 'P' OR g1.primary_guest_id = 0,last_name,(SELECT g2.last_name from guests g2 WHERE g2.id = g1.primary_guest_id)) AS sort_name, ".
" IF(g1.guest_type = 'P' OR g1.primary_guest_id = 0, g1.id ,g1.primary_guest_id) AS sort_id ".
" FROM guests g1 WHERE g1.gift_received = 1 AND g1.gift_thank_you = 0 AND ".
"g1.user_id = ".$_SESSION['user_id']." AND g1.event_id = ".$_SESSION['active_event']." ORDER BY sort_name ASC, sort_id ASC, sort_type ASC, last_name ASC, first_name ASC ";
$result = mysqli_query($GLOBALS['con'], $sql) or die('Database error!');
if (mysqli_num_rows($result) <= 0) :
echo 'No data for report!';
exit();
endif;
?>
<table align="center" cellpadding="0" cellspacing="2" border="0">
<thead>
<?php report_fixed_header(); ?>
<tr>
<td width="230" align="center">
Guest Name
</td>
<td width="75" align="center">
Cash/Check
</td>
<td width="75" align="center">
Gift Card
</td>
<td width="140" align="center">
Other Gift
</td>
<td width="140" align="center">
Comments
</td>
<td width="200" align="center">
Address
</td>
</tr>
</thead>
<tfoot>
<?php report_fixed_footer(); ?>
</tfoot>
<tbody>
<?php
while($row = mysqli_fetch_object($result)) :
?>
<tr>
<td>
<?php
if($row->primary_guest_id != 0) :
echo ' ';
endif;
echo format_guest_name($row->id);
$sql = "SELECT DISTINCT * FROM guests WHERE (primary_guest_id = ".$row->id." OR id = ".$row->primary_guest_id." OR (primary_guest_id = ".$row->primary_guest_id." AND primary_guest_id <> 0))".
" AND id <> ".$row->id.
" AND user_id = ".$_SESSION['user_id']." AND event_id = ".$_SESSION['active_event']." ";
$result_family = mysqli_query($GLOBALS['con'], $sql) or die('Database error!');
if ($result_family->num_rows > 0) :
echo '<br /> — Other Family Members —<br />';
while($row_family = mysqli_fetch_object($result_family)) :
echo ' ';
if ($row_family->guest_type == 'C') :
echo '<i>';
endif;
echo format_guest_name($row_family->id).'<br />';
if ($row_family->guest_type == 'C') :
echo '</i>';
endif;
endwhile;
endif;
?>
</td>
<td align="right">
<?php echo number_format($row->gift_amt,2); ?>
</td>
<td align="right">
<?php echo number_format($row->gift_card,2); ?>
</td>
<td>
<?php echo $row->gift_other; ?>
</td>
<td>
<?php echo $row->gift_comment; ?>
</td>
<td>
<?php
if (!empty($row->street)) echo $row->street.'<br />';
if (!empty($row->street2)) echo $row->street2.'<br />';
if (!empty($row->city) || !empty($row->state) || !empty($row->zip)) echo $row->city.' '.$row->state.' '.$row->zip.'<br />';
if (!empty($row->country)) echo $row->country.'<br />';
?>
</td>
</tr>
<?php
endwhile;
?>
<tr>
<td style="font-weight:bold;">
Total owed: <?php echo mysqli_num_rows($result); ?>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</tbody>
</table>