| Server IP : 172.67.201.108 / Your IP : 216.73.217.143 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/tgnewprod/admin/mod/ |
Upload File : |
<?php require('_mod_security.php'); ?>
<?php
$sql = '';
switch ($_GET['func']):
case 'grid' :
require_once('classes/lcs_db_grid.php');
$dbg = new lcs_db_grid;
$dbg->start_header_section();
$dbg->start_header();
$dbg->add_column(['label' => 'Description', 'dbcol' => 'tt.sku_description', 'width' => '220px']);
$dbg->add_column(['label' => 'Price', 'dbcol' => 'tt.price', 'width' => '100px', 'align' => 'right']);
$dbg->add_column(['label' => 'Fee', 'dbcol' => 'tt.fee', 'width' => '100px', 'align' => 'right']);
$dbg->add_column(['label' => 'Capacity', 'dbcol' => 'tt.capacity', 'width' => '100px', 'align' => 'right']);
$dbg->add_column(['label' => 'Capacity Used', 'dbcol' => 'capacity_used', 'searchable' => false, 'width' => '100px', 'align' => 'right']);
$dbg->add_column(['label' => 'Total Paid', 'dbcol' => 'total_paid', 'searchable' => false, 'width' => '100px', 'align' => 'right']);
$dbg->add_column(['label' => 'Active', 'dbcol' => 'tt.active', 'width' => '60px', 'align' => 'center', 'filter' => true]);
$dbg->add_column(['label' => 'Inactivate', 'sortable' => false, 'searchable' => false, 'width' => '65px', 'align' => 'center', 'update' => true]);
//$dbg->add_column(['label' => 'Delete', 'sortable' => false, 'searchable' => false, 'width' => '65px', 'align' => 'center', 'update' => true]);
$dbg->end_header();
$dbg->end_header_section();
$sql = "SELECT tt.*, COALESCE(SUM(p.qty), 0) AS capacity_used, COALESCE(SUM(p.pmt_amt), 0) AS total_paid FROM ticket_tiers tt " .
"LEFT JOIN payments p ON (tt.id = p.ticket_tier_id) " .
"WHERE ".$dbg->search_spec()." ".$_GET['parm1']." ".$_GET['parm2']." ".$_GET['parm3']." " .
"GROUP BY tt.id " .
"ORDER BY ".$dbg->sort_spec();
//echo ' === '.$sql.' === ';
$xls_sql = $sql;
$xls_sql_encoded = xls_sql_encrypt($xls_sql);
$result = $db->query($sql) or die('Database Error!');
$extra_data = '';
$total_tickets_sold = 0;
$total_amount_paid = 0;
$dbg->start_data_section();
if ($result->rowCount() > 0) :
while ($row = $result->fetch(PDO::FETCH_OBJ)) :
$dbg->start_row();
$dbg->add_cell('<a href="index.php?IX='.$_GET['ix_form'].'&id='.$row->id.'" >'.$row->sku_description.'</a>');
$dbg->add_cell($row->price);
$dbg->add_cell($row->fee);
$dbg->add_cell($row->capacity);
$dbg->add_cell($row->capacity_used);
$dbg->add_cell($row->total_paid);
$dbg->add_cell($row->active == 1 ? 'Y' : '');
if ($row->active == 1) :
$dbg->add_cell('<a href="javascript:confirm_inactivate(\'Are you sure?\', \''.$row->id.'\', \''.$_GET['div'].'\');"><img src="img/inactivate_icon.png" style="border:none;" /></a>');
else :
$dbg->add_cell('');
endif;
//$dbg->add_cell('<a href="javascript:confirm_delete(\'Are you sure? This action cannot be reversed.\', \''.$row->id.'\', \''.$_GET['div'].'\');"><img src="img/delete_icon.gif" style="border:none;" /></a>');
$dbg->end_row();
$total_tickets_sold += $row->capacity_used;
$total_amount_paid += $row->total_paid;
endwhile;
$extra_data = 'Total tickets sold: ' . $total_tickets_sold . ' Total sales: ' . number_format($total_amount_paid, 2);
else :
$dbg->start_row();
$dbg->add_cell('No records found');
$dbg->end_row();
endif;
$dbg->end_data_section();
echo json_encode(['row_count' => $result->rowCount(), 'html' => $dbg->get_html(), 'xls_sql' => $xls_sql_encoded, 'extra_data'=> $extra_data]);
return;
break;
/*
case 'delete' :
$sql = "DELETE FROM ticket_tiers WHERE id = ".nz(trim($_GET['id']), '0')." ";
$db->query($sql) or die(json_encode(['result' => 'Database Error!']));
//$sql = "UPDATE events SET location_id = NULL WHERE id = ".nz(trim($_GET['id']), '0')." ";
//$db->query($sql) or die(json_encode(['result' => 'Database Error!']));
$msg = 'Success';
echo json_encode(['result' => $msg]);
return;
break;
*/
case 'inactivate' :
$sql = "UPDATE ticket_tiers SET active = 0 WHERE id = ".nz(trim($_GET['id']), '0')." ";
$db->query($sql) or die(json_encode(['result' => 'Database Error!']));
$msg = 'Success';
echo json_encode(['result' => $msg]);
return;
break;
endswitch;