| 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-dev/public_html/rpt/ |
Upload File : |
<?php include('mod/_mod_security.php'); ?>
<?php
$sql = "SELECT * FROM ( ".
"SELECT ec.event_id, c.concierge_id, c.hotel_id, h.hotel_name, c.first_name, c.last_name, ec.nbr_of_guests, ec.rsvp_1, ec.rsvp_2 ".
"FROM concierges c INNER JOIN events_concierges ec ON c.concierge_id = ec.concierge_id LEFT OUTER JOIN hotels h ON c.hotel_id = h.hotel_id ".
"WHERE ec.event_id = ".nz(trim($_GET['eid']),'0')." AND ec.rsvp_".nz(trim($_GET['venue']),'0')." = 1 ".
"UNION ".
"SELECT eg.event_id, g.guest_id, '0', g.company, g.first_name, g.last_name, eg.nbr_of_guests, eg.rsvp_1, eg.rsvp_2 ".
"FROM guests g INNER JOIN events_guests eg ON g.guest_id = eg.guest_id ".
"WHERE eg.event_id = ".nz(trim($_GET['eid']),'0')." AND eg.rsvp_".nz(trim($_GET['venue']),'0')." = 1 ".
" ) u ORDER BY hotel_name, first_name, last_name ";
//echo " === ".$sql." === ";
$result = $db->query($sql) or die('Database Error!');
$rows = 10;
$cols = 3;
$margin_left = 0.188;
$margin_right = 0.187;
$margin_top = 0.5;
$margin_bottom = 0.5;
$width = 2.625;
$height = 1.0;
$pitch_horiz = 2.75;
$pitch_vert = 1.0;
$spacer_horiz = $pitch_horiz - $width;
if ($_GET['fmt'] == 'word' || $_GET['fmt'] == 'rtf') :
$sectionStyle = array(
'orientation' => 'portrait',
'pageSizeW' => 8.5 * 1440,
'pageSizeH' => 11 * 1440,
'marginTop' => $margin_top * 1440,
'marginBottom' => $margin_bottom * 1440,
'marginLeft' => $margin_left * 1440,
'marginRight' => $margin_right * 1440,
);
$tableStyle = array(
//'borderSize' => 0,
);
$cellStyle = array(
'valign' => 'center',
//'borderSize' => 0,
);
$paragraphStyle = array('align' => 'center');
$fontStyle = array('name' => 'Calibri', 'size' => 11, 'bold' => false, );
$phpWord->addParagraphStyle('pStyle', $paragraphStyle);
$section = $phpWord->addSection($sectionStyle);
//$section->addText('Hello World!');
$r = 0;
$c = 999;
$table = $section->addTable($tableStyle);
while($row = $result->fetch(PDO::FETCH_OBJ)) :
if ($c >= $cols) :
$c = 0;
$r = $r + 1;
$table->addRow($pitch_vert * 1440);
endif;
if ($r >= $rows) :
//$section->addPageBreak();
$r = 0;
endif;
$c = $c + 1;
//$cell = $table->addCell($width, $cellStyle)->addText(htmlspecialchars("Row {$r}, Cell {$c}")."xyz", 'pStyle');
$cell = $table->addCell($width * 1440, $cellStyle);
$textrun = $cell->addTextRun($paragraphStyle);
//$textrun->addText(htmlspecialchars("Row {$r}, Cell {$c}")."xyz", 'pStyle');
$textrun->addText(htmlspecialchars($row->first_name.' '.$row->last_name), $fontStyle);
$textrun->addTextBreak();
$textrun->addText(htmlspecialchars($row->hotel_name), $fontStyle);
$textrun->addTextBreak();
$textrun->addText(htmlspecialchars($row->nbr_of_guests), $fontStyle);
if ($c != $cols) :
$table->addCell($spacer_horiz * 1440)->addText(htmlspecialchars(" "));
endif;
endwhile;
elseif ($_GET['fmt'] == 'pdf') :
$mpdf = new \Mpdf\Mpdf([
'format' => 'Letter',
'margin_left' => $margin_left * 25.4,
'margin_right' => $margin_right * 25.4,
'margin_top' => $margin_top * 25.4,
'margin_bottom' => $margin_bottom * 25.4,
'margin_header' => 0,
'margin_footer' => 0,
]);
$mpdf->debug = false;
$mpdf->keep_table_proportions = true;
$mpdf->SetProtection(array('copy','print'));
$mpdf->SetTitle("Master Hotel Database - Report");
$mpdf->SetAuthor("Davler Media Group");
$mpdf->SetDisplayMode('fullpage');
$html = '<html><body style="font-family: Calibri; font-size: 11pt; line-height: 12pt; ">';
$r = 0;
$c = 999;
while($row = $result->fetch(PDO::FETCH_OBJ)) :
if ($c >= $cols) :
$c = 0;
$r = $r + 1;
endif;
if ($r > $rows) :
$html .= '<pagebreak />';
$r = 1;
endif;
$c = $c + 1;
/*
*/
$cell_left = ($c - 1) * $pitch_horiz * 25.4;
$cell_top = ($r - 1) * $pitch_vert * 25.4;
$html .= '<div style="position:fixed; overflow:hidden; width:'.($width * 25.4).'mm; height:'.($height * 25.4).'mm; left: '.$cell_left.'mm; top:'.$cell_top.'mm; " >';
$html .= '<div style="text-align:center; width:'.($width * 25.4 * 0.95).'mm; height:'.($height * 25.4 * 0.95).'mm; margin-left:'.($width * 25.4 * 0.04).'mm; margin-top:'.($height * 25.4 * 0.02).'mm; overflow:hidden; ">';
$html .= '<table style="overflow:hidden; width:100%;"><tr><td style="white-space:wrap; padding:0; text-align:center; padding-left:2mm; height:'.($height * 25.4 * 0.95).'mm; ">';
$html .= $row->first_name.' '.$row->last_name.'<br />';
$html .= $row->hotel_name.'<br />';
$html .= $row->nbr_of_guests;
$html .= '</td></tr></table>';
$html .= '</div>';
$html .= '</div>';
endwhile;
$html .= '</body></html>';
$html = utf8_encode($html);
$mpdf->WriteHTML($html);
$mpdf->Output();
endif;
?>