| Server IP : 172.67.201.108 / Your IP : 216.73.217.99 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/nymp/wwwdev/rpt/ |
Upload File : |
<?php include('mod/_mod_security.php'); ?>
<?php
//var_dump($_GET);
//exit;
$search_str = '';
$sort_str = '';
$title_user = 'All Users';
if ($_GET['user_id'] > ' ') :
$search_str .= " AND v.create_by = ".nz($_GET['user_id'], '0')." ";
$title_user = trim($_GET['user_id']);
endif;
if ($_GET['inactive_users'] != '1') :
$search_str .= " AND u.active = 1 ";
endif;
if (!empty($_GET['delivered_status'])) :
$search_str .= " AND v.magazines_delivered = ".nz($_GET['delivered_status'])." ";
endif;
if ($_GET['sort'] == 'MD') :
$sort_str .= " v.magazines_delivered, ";
endif;
$sql = "SELECT u.user_id, u.full_name, v.create_date AS verification_date, old_qty as draw ".
",(CASE v.change_draw WHEN 0 THEN '' WHEN 1 THEN new_qty END) AS new_draw ".
",(CASE v.verification_type WHEN 1 THEN 'Phone' WHEN 2 THEN 'In Person' END) AS verification_type ".
",(CASE v.magazines_delivered WHEN 1 THEN 'N' WHEN 2 THEN 'Y' WHEN 3 THEN 'NR' END) AS delivered ".
",(CASE v.all_distributed WHEN 0 THEN 'N' WHEN 1 THEN 'Y' END) AS all_distributed ".
", v.spoke_to, l.location_name, CONCAT(l.bldg_nbr, ' ', l.street) AS address, l.city, l.state, l.zip, v.comments ".
"FROM sys_users u INNER JOIN verifications v ON (v.create_by = u.user_id) INNER JOIN locations l ON (v.location_id = l.location_id) ".
"WHERE u.hidden <> 1 AND DATE(v.create_date) >= ".nzdate($_GET['date_start'])." AND DATE(v.create_date) <= ".nzdate($_GET['date_end'])." ".$search_str.
"ORDER BY ".$sort_str." u.user_id, v.create_date ";
//echo " === ".$sql." === ";
//die();
$result = $db->query($sql) or die('Database Error!');
$margin_left = 0.5;
$margin_right = 0.5;
$margin_top = 1.0;
$margin_bottom = 0.75;
$margin_header = 0.5;
$margin_footer = 0.5;
if ($_GET['fmt'] == 'excel') :
echo '<script>';
echo "window.location.href = 'mod/_export_excel.php?sql=".urlencode(sys_encrypt(gzcompress($sql,6), $_SESSION['rand_key']))."';";
echo '</script>';
elseif ($_GET['fmt'] == 'pdf') :
$mpdf=new mPDF('','Letter'.'-L','','',$margin_left * 25.4,$margin_right * 25.4,$margin_top * 25.4,$margin_bottom * 25.4,$margin_header * 25.4,$margin_footer * 25.4, '');
$mpdf->debug = false;
$mpdf->useOnlyCoreFonts = false; // false is default
$mpdf->keep_table_proportions = true;
$mpdf->SetProtection(array('copy','print'));
$mpdf->SetTitle("Master Hotel Database - Report");
$mpdf->SetAuthor("Davler Media Group");
$mpdf->SetHTMLHeader('<table width="100%" style="vertical-align: bottom; font-size: 11pt; color: #000000;"><tr>'.
'<td width="35%" style="text-align: left;">NYMP Verification Report</td>'.
'<td width="65%" style="text-align: right;">Date Range: '.nzdate_display($_GET['date_start']).' - '.nzdate_display($_GET['date_end']).' - '.$title_user.'</td>'.
'</tr></table><br /><br />');
$mpdf->SetHTMLFooter('<table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 8pt; color: #000000; font-weight: bold; font-style: italic;"><tr>'.
'<td width="33%"><span style="font-weight: bold; font-style: italic;">{DATE m/j/Y}</span></td>'.
'<td width="33%" align="center" style="font-weight: bold; font-style: italic;">Page {PAGENO} of {nbpg}</td>'.
'<td width="33%" style="text-align: right; ">Davler Media Group</td>'.
'</tr></table>');
$mpdf->SetDisplayMode('fullpage');
$html = '<html><body style="font-family: Arial; font-size: 11pt; line-height: 12pt; ">';
$html .= '<table width="100%" style="vertical-align: top; text-align:left; font-size: 10pt; color: #000000; font-weight: normal; border-collapse:collapse;">';
$html .= '<thead style="font-weight:bold;"><tr>';
$html .= '<td width="15%" align="center">Full Name</td>';
$html .= '<td width="10%" align="center">Verification Date</td>';
$html .= '<td width="5%" align="center">Type</td>';
$html .= '<td width="4%" align="center">Delivered</td>';
$html .= '<td width="4%" align="center">All Distributed</td>';
$html .= '<td width="4%" align="center">Draw</td>';
$html .= '<td width="4%" align="center">New Draw</td>';
$html .= '<td width="9%" align="center">Spoke To</td>';
$html .= '<td width="10%" align="center">Location</td>';
$html .= '<td width="10%" align="center">Address</td>';
$html .= '<td width="5%" align="center">City</td>';
$html .= '<td width="5%" align="center">State</td>';
$html .= '<td width="5%" align="center">Zip</td>';
$html .= '<td width="10%" align="center">Comments</td>';
$html .= '</tr></thead><tbody>';
$first_row = true;
while($row = $result->fetch(PDO::FETCH_OBJ)) :
if ($first_row) :
$hold_date = date('Y-m-d', strtotime($row->verification_date));
$hold_user_id = $row->user_id;
$start_time = date_create($row->verification_date);
$first_row = false;
$calls = 0;
$calls_y = 0;
$calls_n = 0;
$calls_nr = 0;
$calls_ad = 0;
endif;
if ($hold_date != date('Y-m-d', strtotime($row->verification_date)) || $hold_user_id != $row->user_id) :
$interval = date_diff($start_time, $end_time);
$html .= '<tr>';
$html .= '<td style="border-top:1px solid #000000; border-bottom:1px solid #000000;" colspan="2">Calling time: '.$interval->format('%h hrs %i min').'</td>';
$html .= '<td style="border-top:1px solid #000000; border-bottom:1px solid #000000;" colspan="2">Calls: '.$calls.'</td>';
$html .= '<td style="border-top:1px solid #000000; border-bottom:1px solid #000000;" colspan="2">Delivered: '.$calls_y.'</td>';
$html .= '<td style="border-top:1px solid #000000; border-bottom:1px solid #000000;" colspan="2">Not delivered: '.$calls_n.'</td>';
$html .= '<td style="border-top:1px solid #000000; border-bottom:1px solid #000000;" colspan="1">Not reported: '.$calls_nr.'</td>';
$html .= '<td style="border-top:1px solid #000000; border-bottom:1px solid #000000;" colspan="5">All distributed: '.$calls_ad.'</td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td> </td>';
$html .= '</tr>';
$hold_date = date('Y-m-d', strtotime($row->verification_date));
$hold_user_id = $row->user_id;
$start_time = date_create($row->verification_date);
$calls = 0;
$calls_y = 0;
$calls_n = 0;
$calls_nr = 0;
$calls_ad = 0;
endif;
$calls = $calls + 1;
if ($row->delivered == 'Y') :
$calls_y = $calls_y + 1;
elseif ($row->delivered == 'N') :
$calls_n = $calls_n + 1;
elseif ($row->delivered == 'NR') :
$calls_nr = $calls_nr + 1;
endif;
if ($row->all_distributed == 'Y') :
$calls_ad = $calls_ad + 1;
endif;
$end_time = date_create($row->verification_date);
$html .= '<tr>';
$html .= '<td>'.$row->full_name.'</td>';
$html .= '<td>'.nzdate_display_datetime($row->verification_date).'</td>';
$html .= '<td>'.$row->verification_type.'</td>';
$html .= '<td align="center">'.$row->delivered.'</td>';
$html .= '<td align="center">'.$row->all_distributed.'</td>';
$html .= '<td align="right">'.$row->draw.'</td>';
$html .= '<td align="right">'.$row->new_draw.'</td>';
$html .= '<td>'.$row->spoke_to.'</td>';
$html .= '<td>'.$row->location_name.'</td>';
$html .= '<td>'.$row->address.'</td>';
$html .= '<td>'.$row->city.'</td>';
$html .= '<td>'.$row->state.'</td>';
$html .= '<td>'.$row->zip.'</td>';
$html .= '<td>'.$row->comments.'</td>';
$html .= '</tr>';
endwhile;
if ($result->rowCount() > 0) :
$interval = date_diff($start_time, $end_time);
$html .= '<tr>';
$html .= '<td style="border-top:1px solid #000000; border-bottom:1px solid #000000;" colspan="2">Calling time: '.$interval->format('%h hrs %i min').'</td>';
$html .= '<td style="border-top:1px solid #000000; border-bottom:1px solid #000000;" colspan="2">Calls: '.$calls.'</td>';
$html .= '<td style="border-top:1px solid #000000; border-bottom:1px solid #000000;" colspan="2">Delivered: '.$calls_y.'</td>';
$html .= '<td style="border-top:1px solid #000000; border-bottom:1px solid #000000;" colspan="2">Not delivered: '.$calls_n.'</td>';
$html .= '<td style="border-top:1px solid #000000; border-bottom:1px solid #000000;" colspan="1">Not reported: '.$calls_nr.'</td>';
$html .= '<td style="border-top:1px solid #000000; border-bottom:1px solid #000000;" colspan="5">All distributed: '.$calls_ad.'</td>';
$html .= '</tr>';
$html .= '<tr>';
$html .= '<td> </td>';
$html .= '</tr>';
endif;
$html .= '<tr>';
$html .= '<td>Total:</td>';
$html .= '<td colspan="4">'.$result->rowCount().'</td>';
$html .= '</tr>';
$html .= '</tbody></table>';
$html .= '</body></html>';
$html = utf8_encode($html);
$mpdf->WriteHTML($html);
$mpdf->Output();
endif;
?>