| Server IP : 104.21.21.239 / 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/mod/ |
Upload File : |
<?php include('_mod_security.php'); ?>
<?php
$sql = "SELECT *, 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.user_id = ".$_SESSION['user_id']." AND g1.event_id = ".$_SESSION['active_event']." ";
$search_parm = mysqli_real_escape_string($GLOBALS['con'], trim($_POST['strSearch']));
if ($search_parm != '') :
$sql = $sql." AND ".search_sql($_POST['strSearch'],'g1.last_name,g1.first_name')." ";
endif;
$sql = $sql." ORDER BY sort_name ASC, sort_id ASC, sort_type ASC, g1.last_name ASC, g1.first_name ASC";
$result = mysqli_query($GLOBALS['con'], $sql);
$xls_sql = "SELECT TRIM(CONCAT(g1.salutation, ' ', g1.first_name, ' ', g1.last_name, ' ', g1.suffix)) AS guest_name, g1.guest_type, ".
"IF(g1.gift_received = 1, 'Y', 'N') AS gift_received, g1.gift_amt, g1.gift_card, g1.gift_other, g1.gift_comment, IF(g1.gift_thank_you = 1, 'Y', 'N') as gift_thank_you_sent, ".
"g1.street, g1.street2, g1.city, g1.state, g1.zip, g1.country ".
" FROM guests g1 WHERE g1.user_id = ".$_SESSION['user_id']." AND g1.event_id = ".$_SESSION['active_event']." ORDER BY ".
" (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))) ASC, ".
" (IF(g1.guest_type = 'P' OR g1.primary_guest_id = 0, g1.id ,g1.primary_guest_id)) ASC, ".
" (IF(g1.guest_type = 'P',0,1)) ASC, ".
" g1.last_name ASC, g1.first_name ASC";
$ix_list = "gifts";
$ix_form = "guest_form&ref=gifts";
?>
<script>
var xstats_on = 0;
switch_gift = function(gid)
{
if (document.getElementById('gift_received_' + gid).checked)
{
document.getElementById('gift_amt_' + gid).disabled = false;
document.getElementById('gift_card_' + gid).disabled = false;
document.getElementById('gift_other_' + gid).disabled = false;
document.getElementById('gift_comment_' + gid).disabled = false;
document.getElementById('gift_thank_you_' + gid).disabled = false;
$('#gift_thank_you_' + gid).show();
}
else
{
$('#gift_amt_' + gid).val('0.00').change();
$('#gift_card_' + gid ).val('0.00').change();
$('#gift_other_' + gid).val('').change();
$('#gift_comment_' + gid).val('').change();
$('#gift_thank_you_' + gid).attr('checked',null).change();
document.getElementById('gift_amt_' + gid).disabled = true;
document.getElementById('gift_card_' + gid).disabled = true;
document.getElementById('gift_other_' + gid).disabled = true;
document.getElementById('gift_comment_' + gid).disabled = true;
document.getElementById('gift_thank_you_' + gid).disabled = true;
$('#gift_thank_you_' + gid).hide();
}
}
gift_received_update = function(gid)
{
$('#ajax_update').load('ajax.php?call=gifts_update&func=received&id=' + gid +
'&received=' + val_checkbox($('input[name=gift_received_' + gid + ']:checked').val()),
function()
{
switch_gift(gid);
live_field('gift_received_' + gid);
//total_stats('received');
} );
}
gift_amt_update = function(gid)
{
val_dollar_field(document.getElementById('gift_amt_' + gid));
if (xstats_on == 1)
$('#ajax_update').load('ajax.php?call=gifts_update&func=amt&id=' + gid +
'&amt=' + encodeURIComponent($('input[name=gift_amt_' + gid + ']').val()),
function()
{
//alert($('input[name=gift_amt_' + gid + ']').val());
live_field('gift_amt_' + gid);
//$('input[name=gift_amt_' + gid + ']').attr('value', $('input[name=gift_amt_' + gid + ']').val());
total_stats('amt');
} );
}
gift_card_update = function(gid)
{
val_dollar_field(document.getElementById('gift_card_' + gid));
if (xstats_on == 1)
$('#ajax_update').load('ajax.php?call=gifts_update&func=card&id=' + gid +
'&card=' + encodeURIComponent($('input[name=gift_card_' + gid + ']').val()),
function()
{
live_field('gift_card_' + gid);
//$('input[name=gift_card_' + gid + ']').attr('value', $('input[name=gift_card_' + gid + ']').val());
total_stats('card');
} );
}
gift_other_update = function(gid)
{
if (xstats_on == 1)
$('#ajax_update').load('ajax.php?call=gifts_update&func=other&id=' + gid +
'&other=' + encodeURIComponent($('input[name=gift_other_' + gid + ']').val()),
function()
{
live_field('gift_other_' + gid);
//$('input[name=gift_other_' + gid + ']').attr('value', $('input[name=gift_other_' + gid + ']').val());
//total_stats(type);
} );
}
gift_comment_update = function(gid)
{
if (xstats_on == 1)
$('#ajax_update').load('ajax.php?call=gifts_update&func=comment&id=' + gid +
'&comment=' + encodeURIComponent($('input[name=gift_comment_' + gid + ']').val()),
function()
{
live_field('gift_comment_' + gid);
//$('input[name=gift_comment_' + gid + ']').attr('value', $('input[name=gift_comment_' + gid + ']').val());
//total_stats(type);
} );
}
gift_thank_you_update = function(gid)
{
if (xstats_on == 1)
$('#ajax_update').load('ajax.php?call=gifts_update&func=thank_you&id=' + gid +
'&thank_you=' + val_checkbox($('input[name=gift_thank_you_' + gid + ']:checked').val()),
function()
{
/*
if (val_checkbox($('input[name=gift_thank_you_' + gid + ']:checked').val()) == 0)
{
$('input[name=gift_thank_you_' + gid + ']').attr('checked', null);
}
else
{
$('input[name=gift_thank_you_' + gid + ']').attr('checked', $('input[name=gift_thank_you_' + gid + ']').attr('checked'));
}
*/
live_field('gift_thank_you_' + gid);
total_stats('thank_you');
} );
}
total_stats = function(type)
{
if (xstats_on != 1) return;
$.ajax({
url: "ajax.php?call=gifts_stats&type=" + type,
cache: false,
dataType: "json",
success: function(json) {
$('#total_gift_' + type).text(json.gift_count);
}
,error: function (request, status, error) { /* alert(status + ", " + error); */ }
})
}
$(document).ready(function()
{
//total_stats('received');
total_stats('amt');
total_stats('card');
total_stats('thank_you');
})
// ****** Prepare popup form settings *****
var win_page = 'page_form.php';
var win_width = 600;
var win_height = 400;
var print_section = 'div_db_grid';
</script>
<h1>Gifts Received Worksheet</h1>
<?php
if (empty($_SESSION['active_event'])) :
?>
<h3>No Bar/Bat Mitzvah defined - please create or activate a Bar/Bat Mitzvah!</h3>
<?php
endif;
?>
<?php get_reports('gift_givers,thankyou_owed,thankyou_written,thank_you_labels,thank_you_envelopes'); ?>
<?php get_notes(); ?>
<?php get_help_guide('help_gifts'); ?>
<?php include('mod/_db_navigator_bar.php'); ?>
<div id="ajax_update" style="width:1px; height:1px; display:none;">
</div>
<form style="" name="frm_gifts" id="frm_gifts" method="post" action="" >
<div class="db-grid" id="div_db_grid">
<table id="db_grid_main" class="dbgrid" align="center" cellpadding="0" cellspacing="1" border="0" >
<thead>
<tr>
<td width="200" align="center" class="data-grid-label">
Name
</td>
<td width="75" align="center" class="data-grid-label">
Gift Received
</td>
<td width="90" align="center" class="data-grid-label">
Thank You Sent
</td>
<td width="85" align="center" class="data-grid-label">
Cash/Check Amt.
</td>
<td width="85" align="center" class="data-grid-label">
Gift Card Amt.
</td>
<td width="180" align="center" class="data-grid-label">
Other Gift
</td>
<td width="180" align="center" class="data-grid-label">
Comment
</td>
</tr>
<tr>
<td align="left" class="data-grid-label">
Totals
</td>
<td id="total_gift_received" align="right" class="data-grid-var">
</td>
<td id="total_gift_thank_you" align="right" class="data-grid-var">
</td>
<td id="total_gift_amt" align="right" class="data-grid-var">
</td>
<td id="total_gift_card" align="right" class="data-grid-var">
</td>
<td class="data-grid-var">
</td>
<td class="data-grid-var">
</td>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_object($result)) :
if ($row->gift_received != '1') :
$disabled = ' disabled="disabled" ';
$gift_disabled = true;
else :
$disabled = '';
$gift_disabled = false;
endif;
?>
<tr>
<td class="data-grid-var" >
<?php
if ($row->guest_type != 'P' && !($row->guest_type == 'C' && $row->primary_guest_id == 0 )) :
echo ' ';
endif;
?>
<a href="index.php?IX=guest_form&id=<?php echo $row->id; ?>&ref=gifts" >
<?php echo format_guest_name_string($row->salutation, $row->first_name, $row->last_name, $row->suffix); ?>
</a>
</td>
<td class="data-grid-var" align="center">
<input name="gift_received_<?php echo $row->id; ?>" id="gift_received_<?php echo $row->id; ?>" type="checkbox" value="1" <?php echo $guest_group; ?> onchange="gift_received_update(<?php echo $row->id; ?>);" <?php if ($row->gift_received == '1') : echo 'checked="checked"'; endif; ?> />
</td>
<td class="data-grid-var" align="center">
<input name="gift_thank_you_<?php echo $row->id; ?>" id="gift_thank_you_<?php echo $row->id; ?>" type="checkbox" value="1" <?php echo $guest_group; ?> onchange="gift_thank_you_update(<?php echo $row->id; ?>);" <?php if ($row->gift_thank_you == '1' && !$gift_disabled) : echo ' checked="checked" '; endif; echo $disabled; if ($gift_disabled) : echo ' style="display:none;" '; endif; ?> />
</td>
<td class="data-grid-var" >
<input name="gift_amt_<?php echo $row->id; ?>" id="gift_amt_<?php echo $row->id; ?>" type="text" value="<?php echo number_format($row->gift_amt,2,'.',','); ?>" maxlength="15" style="width:85px; font-size:12px; text-align:right;" onchange="gift_amt_update(<?php echo $row->id; ?>);" <?php echo $disabled; ?> />
</td>
<td class="data-grid-var" >
<input name="gift_card_<?php echo $row->id; ?>" id="gift_card_<?php echo $row->id; ?>" type="text" value="<?php echo number_format($row->gift_card,2,'.',','); ?>" maxlength="15" style="width:85px; font-size:12px; text-align:right;" onchange="gift_card_update(<?php echo $row->id; ?>);" <?php echo $disabled; ?> />
</td>
<td class="data-grid-var">
<input name="gift_other_<?php echo $row->id; ?>" id="gift_other_<?php echo $row->id; ?>" type="text" value="<?php echo $row->gift_other; ?>" maxlength="50" style="width:180px; font-size:12px;" onchange="gift_other_update(<?php echo $row->id; ?>);" <?php echo $disabled; ?> />
</td>
<td class="data-grid-var">
<input name="gift_comment_<?php echo $row->id; ?>" id="gift_comment_<?php echo $row->id; ?>" type="text" value="<?php echo $row->gift_comment; ?>" maxlength="100" style="width:180px; font-size:12px;" onchange="gift_comment_update(<?php echo $row->id; ?>);" <?php echo $disabled; ?> />
</td>
</tr>
<?php
endwhile;
?>
</tbody>
</table>
<script>
xstats_on = 1;
</script>
</div>
</form>