| 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/hotel-prod/public_html/mod/ |
Upload File : |
<?php
//ini_set('display_errors',1);
//error_reporting(E_ALL & ~E_NOTICE);
?>
<?php include('_mod_security.php'); ?>
<?php
//header('Content-Type: application/json');
//var_dump($_GET);
$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(array('label' => 'Route Code', 'dbcol' => 'r.route_code', 'width' => '100px'));
$dbg->add_column(array('label' => 'Route', 'dbcol' => 'r.route', 'width' => '220px'));
$dbg->add_column(array('label' => 'Type', 'dbcol' => 'r.route_type', 'width' => '120px'));
$dbg->add_column(array('label' => 'CG Qty', 'sortable' => false, 'searchable' => false, 'width' => '65px', 'align' => 'right'));
//$dbg->add_column(array('label' => 'Delete', 'sortable' => false, 'searchable' => false, 'width' => '65px', 'align' => 'center', 'update' => true));
$dbg->end_header();
$dbg->end_header_section();
$sql = "SELECT DISTINCT r.route_id, r.route_code, r.route, rd.route_driver_id, CAST(SUM(hp.dist_qty) AS SIGNED) AS qty, ".
"(CASE r.route_type WHEN 1 THEN 'Night' WHEN 2 THEN 'Day' END) AS r_type ".
"FROM routes r INNER JOIN routes_drivers rd ON (r.route_id = rd.route_id) ".
"LEFT OUTER JOIN hotels h ON (r.route_id = h.route_id AND h.status = 1) ".
"LEFT OUTER JOIN hotels_products hp ON (h.hotel_id = hp.hotel_id AND hp.active = 1 AND hp.product_id = ".APP_DEFAULT_PRODUCT.") ".
"WHERE ".$dbg->search_spec()." ".$_GET['parm1']." ".$_GET['parm2']." ".$_GET['parm3']." ".
"GROUP BY r.route_id, r.route_code, r.route, r_type, rd.route_driver_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!');
$dbg->start_data_section();
$total_qty = 0;
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->route_id.'" >'.$row->route_code.'</a>');
$dbg->add_cell('<a href="index.php?IX='.$_GET['ix_form'].'&id='.$row->route_id.'" >'.$row->route.'</a>');
$dbg->add_cell($row->r_type);
$dbg->add_cell(number_format($row->qty, 0, '.', ','));
//$dbg->add_cell('<a href="javascript:confirmDelete(\'Are you sure? This action cannot be reversed.\', \''.$row->route_id.'\', \''.$_GET['div'].'\');"><img src="img/delete_icon.gif" style="border:none;" /></a>');
$dbg->end_row();
$total_qty += $row->qty;
endwhile;
else :
$dbg->start_row();
$dbg->add_cell('No records found');
$dbg->end_row();
endif;
$dbg->end_data_section();
echo json_encode(array('row_count' => $result->rowCount(), 'html' => $dbg->get_html(), 'xls_sql' => $xls_sql_encoded, 'extra_data'=> 'Total CG qty: '.number_format($total_qty, 0, '.', ',')));
return;
break;
case 'delete' :
$sql = "DELETE FROM routes WHERE route_id = ".nz(trim($_GET['id']), '0')." ";
$db->query($sql) or die(json_encode(array('result' => 'Database Error!')));
$sql = "UPDATE hotels SET route = '' WHERE route = ".nz(trim($_GET['id']), '0')." ";
$db->query($sql) or die(json_encode(array('result' => 'Database Error!')));
$msg = 'Success';
echo json_encode(array('result' => $msg));
return;
break;
endswitch;
?>