| Server IP : 104.21.21.239 / Your IP : 216.73.217.139 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-dev/public_html/rpt/ |
Upload File : |
<?php include('mod/_mod_security.php'); ?>
<?php
$criteria = '';
$filter = '';
if (!empty($_POST['hdr_date_start']) && is_date($_POST['hdr_date_start'])) :
$criteria .= " AND v.create_date >= " . nzdate($_POST['hdr_date_start']) . " ";
$filter .= '<br> Last verification start date: ' . $_POST['hdr_date_start'];
endif;
if (!empty($_POST['hdr_date_end']) && is_date($_POST['hdr_date_end'])) :
$criteria .= " AND v.create_date <= " . nzdatetime($_POST['hdr_date_end'] . ' 23:59:59') . " ";
$filter .= '<br> Last verification end date: ' . $_POST['hdr_date_end'];
endif;
if (!empty($_POST['hdr_neighborhood'])) :
$criteria .= " AND h.neighborhood_id = " . nz($_POST['hdr_neighborhood'], '0') . " ";
$filter .= '<br> Neighborhood: ' . lookup_db_field('neighborhoods', 'neighborhood_id', $_POST['hdr_neighborhood'], 'neighborhood_name');
endif;
$sql = "SELECT h.hotel_name, h.bldg_nbr, h.street, h.city, h.state, h.zip, h.category, h.nbr_of_rooms, h.update_date AS hotel_update_date, n.neighborhood_name, v.*, MAX(v.create_date) AS verify_date,
CASE
WHEN v.magazines_delivered = 1 THEN 'Y'
WHEN v.magazines_delivered = 0 THEN 'N'
WHEN v.magazines_delivered = 2 THEN 'NR'
END AS delivery_status
FROM hotels h
INNER JOIN verifications v ON (v.hotel_id = h.hotel_id AND v.verification_id = (
SELECT MAX(v2.verification_id) FROM verifications v2 WHERE v2.hotel_id = h.hotel_id
))
LEFT JOIN neighborhoods n ON (h.neighborhood_id = n.neighborhood_id)
WHERE h.status = 1
$criteria
GROUP BY h.hotel_name, h.neighborhood_id
ORDER BY h.hotel_name, h.hotel_id
";
//error_log($sql);
$result = $db->query($sql) or die('Database Error!');
$row_count = $result->rowCount();
if ($row_count <= 0) :
echo 'No data for report!';
exit();
endif;
$rpt = get_report_class($_POST['output_format']);
$rpt->set_report_title('Hotel Delivery Report');
$rpt->report_start();
$rpt->header_start();
if (!empty($filter)) :
$rpt->header_row_start();
$rpt->header_cell_add('Filters: '.$filter, ['colspan'=>'12', 'class'=>'large', 'align'=>'left']);
$rpt->header_row_end();
endif;
$rpt->header_row_start();
$rpt->header_cell_add('Hotel', ['width'=>'70']);
$rpt->header_cell_add('Neighborhood', ['width'=>'70']);
$rpt->header_cell_add('Category', ['width'=>'20']);
$rpt->header_cell_add('Bldg #', ['width'=>'20']);
$rpt->header_cell_add('Street', ['width'=>'40']);
$rpt->header_cell_add('City', ['width'=>'50']);
$rpt->header_cell_add('State', ['width'=>'20']);
$rpt->header_cell_add('Zip', ['width'=>'15']);
$rpt->header_cell_add('Nbr of Rooms', ['width'=>'15']);
$rpt->header_cell_add('Delivered', ['width'=>'70']);
$rpt->header_cell_add('Last Verify Date', ['width'=>'70']);
$rpt->header_cell_add('Last Update Date', ['width'=>'70']);
$rpt->header_row_end();
$rpt->header_end();
$rpt->data_start();
$tot_hotels = 0;
$tot_rooms = 0;
$tot_verify_date = 0;
while($row = $result->fetch(PDO::FETCH_OBJ)) :
$rpt->data_row_start();
$rpt->data_cell_add($row->hotel_name);
$rpt->data_cell_add($row->neighborhood_name);
$rpt->data_cell_add($row->category);
$rpt->data_cell_add($row->bldg_nbr);
$rpt->data_cell_add($row->street);
$rpt->data_cell_add($row->city);
$rpt->data_cell_add($row->state);
$rpt->data_cell_add($row->zip);
$rpt->data_cell_add($row->nbr_of_rooms, ['align'=>'right']);
$rpt->data_cell_add($row->delivery_status);
$rpt->data_cell_add(nzdate_display($row->verify_date));
$rpt->data_cell_add(nzdate_display($row->hotel_update_date));
$tot_hotels += 1;
$tot_rooms += $row->nbr_of_rooms;
$tot_verify_date += date_timestamp_get(date_create($row->verify_date));
$rpt->data_row_end();
endwhile;
$rpt->data_row_start();
$rpt->data_cell_add('Totals', ['colspan'=>12, 'align'=>'center', 'class'=>'large']);
$rpt->data_row_end();
$rpt->data_row_start();
$rpt->data_cell_add('Nbr of Hotels', ['colspan'=>3, 'align'=>'center', 'class'=>'large']);
$rpt->data_cell_add(number_format($tot_hotels), ['align'=>'right']);
$rpt->data_row_end();
$rpt->data_row_start();
$rpt->data_cell_add('Nbr of Rooms', ['colspan'=>3, 'align'=>'center', 'class'=>'large']);
$rpt->data_cell_add(number_format($tot_rooms), ['align'=>'right']);
$rpt->data_row_end();
$rpt->data_row_start();
$rpt->data_cell_add('Avg Verification Date', ['colspan'=>3, 'align'=>'center', 'class'=>'large']);
$rpt->data_cell_add(date('m/d/Y', intdiv($tot_verify_date, $tot_hotels)));
$rpt->data_row_end();
$rpt->data_end();
$rpt->report_end();
$rpt->output_report();
?>