| Server IP : 104.21.21.239 / Your IP : 216.73.217.74 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
use classes\lib\CGRewards;
include('mod/_mod_security.php');
$criteria = '';
$filter = '';
if (!empty($_POST['cgrm_date_start']) && is_date($_POST['cgrm_date_start'])) :
$criteria .= " AND c.update_date >= " . nzdate($_POST['cgrm_date_start']) . " ";
$filter .= '<br> Updated start date: ' . $_POST['cgrm_date_start'];
endif;
if (!empty($_POST['cgrm_date_end']) && is_date($_POST['cgrm_date_end'])) :
$criteria .= " AND c.update_date <= " . nzdatetime($_POST['cgrm_date_end'] . ' 23:59:59') . " ";
$filter .= '<br> Updated end date: ' . $_POST['cgrm_date_end'];
endif;
$sql = "SELECT c.*, h.hotel_name
FROM concierges c
LEFT JOIN hotels h ON (h.hotel_id = c.hotel_id)
WHERE c.cgr = 1 AND c.cgr_approved = 1 AND c.status = 1
$criteria
ORDER BY c.cgr_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('CG Rewards Master Pull');
$rpt->report_start();
$rpt->header_start();
if (!empty($filter)) :
$rpt->header_row_start();
$rpt->header_cell_add('Filters: '.$filter, ['colspan'=>'11', 'class'=>'large']);
$rpt->header_row_end();
endif;
$rpt->header_row_start();
$rpt->header_cell_add('First Name', ['width'=>'70']);
$rpt->header_cell_add('Last Name', ['width'=>'70']);
$rpt->header_cell_add('Email', ['width'=>'70']);
$rpt->header_cell_add('Unique ID', ['width'=>'70']);
$rpt->header_cell_add('Role (default, optional)', ['width'=>'70']);
$rpt->header_cell_add('Group (optional)', ['width'=>'70']);
$rpt->header_cell_add('Photo URL', ['width'=>'70']);
$rpt->header_cell_add('Birthday (optional)', ['width'=>'70']);
$rpt->header_cell_add('Hired Date', ['width'=>'70']);
$rpt->header_cell_add('Country (optional)', ['width'=>'70']);
$rpt->header_cell_add('SupervisorID (optional)', ['width'=>'70']);
$rpt->header_row_end();
$rpt->header_end();
$rpt->data_start();
$ids_to_update = [];
while($row = $result->fetch(PDO::FETCH_OBJ)) :
$rpt->data_row_start();
$rpt->data_cell_add($row->first_name);
$rpt->data_cell_add($row->last_name);
$rpt->data_cell_add((!empty($row->cgr_email) ? $row->cgr_email : $row->primary_email));
$rpt->data_cell_add($row->cgr_id);
$rpt->data_cell_add(($row->cgr_manager == 1 ? 'manager' : 'employee'));
$rpt->data_cell_add($row->hotel_name . ';' . $row->title);
$rpt->data_cell_add('');
$rpt->data_cell_add('');
$rpt->data_cell_add('');
$rpt->data_cell_add('US');
$rpt->data_cell_add('');
$rpt->data_row_end();
$ids_to_update[] = $row->concierge_id;
endwhile;
$rpt->data_end();
if ($_POST['output_format'] == 'csv') :
CGRewards::update_master_pull_date($ids_to_update);
endif;
$rpt->report_end();
$rpt->output_report();
?>