PK���ȼRY��������€��� �v3.phpUT �øŽg‰gñ“gux �õ��õ��½T]kÛ0}߯pEhìâÙM7X‰çv%”v0֐µ{)Aå:6S$!ÉMJèߕ?R÷!>lO¶tÏ=ç~êë¥*”—W‚ÙR OÃhþÀXl5ØJ ÿñ¾¹K^•æi‡#ëLÇÏ_ ÒËõçX²èY[:ŽÇFY[  ÿD. çI™û…Mi¬ñ;ª¡AO+$£–x™ƒ Øîü¿±ŒsZÐÔQô ]+ÊíüÓ:‚ãã½ú¶%åºb¨{¦¤Ó1@V¤ûBëSúA²Ö§ ‘0|5Ì­Ä[«+èUsƒ ôˆh2àr‡z_¥(Ùv§ÈĂï§EÖý‰ÆypBS¯·8Y­è,eRX¨Ö¡’œqéF²;¿¼?Ø?Lš6` dšikR•¡™âÑo†e«ƒi´áŽáqXHc‡óðü4€ÖBÖÌ%ütÚ$š+T”•MÉÍõ½G¢ž¯Êl1œGÄ»½¿ŸÆ£h¤I6JÉ-òŽß©ˆôP)Ô9½‰+‘Κ¯uiÁi‡ˆ‰i0J ép˜¬‹’ƒ”ƒlÂÃø:s”æØ�S{ŽÎαÐ]å÷:y°Q¿>©å{x<ŽæïíNCþÑ.Mf?¨«2ý}=ûõýî'=£§ÿu•Ü(—¾IIa­"éþ@¶�¿ä9?^-qìÇÞôvŠeÈc ðlacã®xèÄ'®âd¶ çˆSEæódP/ÍÆv{Ô)Ó ?>…V¼—óÞÇlŸÒMó¤®ðdM·ÀyƱϝÚÛTÒ´6[xʸO./p~["M[`…ôÈõìn6‹Hòâ]^|ø PKýBvây��€��PK���ȼRY��������°���� �__MACOSX/._v3.phpUT �øŽg‰gþ“gux �õ��õ��c`cg`b`ðMLVðVˆP€'qƒøˆŽ!!AP&HÇ %PDF-1.7 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R /F2 9 0 R >> >> /MediaBox [0.000 0.000 595.280 841.890] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Producer (���d�o�m�p�d�f� �2�.�0�.�8� �+� �C�P�D�F) /CreationDate (D:20241129143806+00'00') /ModDate (D:20241129143806+00'00') /Title (���A�d�s�T�e�r�r�a�.�c�o�m� �i�n�v�o�i�c�e) >> endobj 6 0 obj << /Type /Page /MediaBox [0.000 0.000 595.280 841.890] /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Filter /FlateDecode /Length 904 >> stream x���]o�J���+F�ͩ����su\ �08=ʩzရ���lS��lc� "Ց� ���wޙ�%�R�DS��� �OI�a`� �Q�f��5����_���םO�`�7�_FA���D�Џ.j�a=�j����>��n���R+�P��l�rH�{0��w��0��=W�2D ����G���I�>�_B3ed�H�yJ�G>/��ywy�fk��%�$�2.��d_�h����&)b0��"[\B��*_.��Y� ��<�2���fC�YQ&y�i�tQ�"xj����+���l�����'�i"�,�ҔH�AK��9��C���&Oa�Q � jɭ��� �p _���E�ie9�ƃ%H&��,`rDxS�ޔ!�(�X!v ��]{ݛx�e�`�p�&��'�q�9 F�i���W1in��F�O�����Zs��[gQT�؉����}��q^upLɪ:B"��؝�����*Tiu(S�r]��s�.��s9n�N!K!L�M�?�*[��N�8��c��ۯ�b�� ��� �YZ���SR3�n�����lPN��P�;��^�]�!'�z-���ӊ���/��껣��4�l(M�E�QL��X ��~���G��M|�����*��~�;/=N4�-|y�`�i�\�e�T�<���L��G}�"В�J^���q��"X�?(V�ߣXۆ{��H[����P�� �c���kc�Z�9v�����? �a��R�h|��^�k�D4W���?Iӊ�]<��4�)$wdat���~�����������|�L��x�p|N�*��E� �/4�Qpi�x.>��d����,M�y|4^�Ż��8S/޾���uQe���D�y� ��ͧH�����j�wX � �&z� endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >> endobj 9 0 obj << /Type /Font /Subtype /Type1 /Name /F2 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >> endobj xref 0 10 0000000000 65535 f 0000000009 00000 n 0000000074 00000 n 0000000120 00000 n 0000000284 00000 n 0000000313 00000 n 0000000514 00000 n 0000000617 00000 n 0000001593 00000 n 0000001700 00000 n trailer << /Size 10 /Root 1 0 R /Info 5 0 R /ID[] >> startxref 1812 %%EOF
Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 128

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 129

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php:1) in /home/u697396820/domains/smartriegroup.com/public_html/assets/images/partners/logo_69cec45839613.php on line 131
setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetMargins(15, 15, 15); $pdf->AddPage(); $pdf->SetFont('helvetica', '', 10); // Logo (normalize PNG transparency to avoid black background in some PNGs) if (!empty($company['logo'])) { $logo_path = dirname(__DIR__) . '/' . $company['logo']; if (file_exists($logo_path)) { $ext = strtolower(pathinfo($logo_path, PATHINFO_EXTENSION)); $final_logo = $logo_path; if ($ext === 'png' && function_exists('imagecreatefrompng')) { $src = @imagecreatefrompng($logo_path); if ($src) { $w = imagesx($src); $h = imagesy($src); // Compose onto white background to avoid black boxes $whiteBg = imagecreatetruecolor($w, $h); $white = imagecolorallocate($whiteBg, 255, 255, 255); imagefilledrectangle($whiteBg, 0, 0, $w, $h, $white); imagealphablending($whiteBg, true); imagecopy($whiteBg, $src, 0, 0, 0, 0, $w, $h); $tmp = sys_get_temp_dir() . '/logo_normalized_' . md5($logo_path) . '.jpg'; imagejpeg($whiteBg, $tmp, 95); imagedestroy($whiteBg); imagedestroy($src); if (file_exists($tmp)) { $final_logo = $tmp; } } } $pdf->Image($final_logo, 15, 15, 50); } } // Status banner $banner = (isset($f['status']) && $f['status'] === 'tentative') ? 'TENTATIVE' : 'CONFIRMATION'; $pdf->SetFont('helvetica', 'B', 12); $pdf->SetFillColor(230,230,230); // Place banner further below to avoid overlap with address and title $pdf->SetXY(150, 50); $pdf->Cell(45, 10, $banner, 1, 1, 'C', true); // Company info right $pdf->SetFont('helvetica', 'B', 14); $pdf->SetXY(120, 15); $pdf->Cell(75, 10, $company['name'] ?? 'Perusahaan', 0, 1, 'R'); $pdf->SetFont('helvetica', '', 9); $pdf->SetXY(120, 25); $pdf->MultiCell(75, 5, ($company['address'] ?? '') . "\nPhone: " . ($company['phone'] ?? '') . "\nEmail: " . ($company['email'] ?? ''), 0, 'R'); // Title $pdf->SetY(50); $pdf->SetFont('helvetica', 'B', 18); $pdf->Cell(180, 10, 'INVOICE HOTEL', 0, 1, 'C'); // Dates and header info similar to example $pdf->SetY(65); $pdf->SetFont('helvetica', '', 10); // Remember starting Y for right column $rightStartY = $pdf->GetY(); // Left column $pdf->Cell(25, 6, 'Date', 0, 0); $pdf->Cell(5, 6, ':', 0, 0); $pdf->Cell(60, 6, date('M j , Y', strtotime($f['date'] ?? date('Y-m-d'))), 0, 1); $pdf->Cell(25, 6, 'To', 0, 0); $pdf->Cell(5, 6, ':', 0, 0); $pdf->Cell(60, 6, $f['to'] ?? '', 0, 1); // Right column placed independently to avoid overlap with header $pdf->SetXY(120, $rightStartY); $pdf->Cell(45, 6, 'Due Date', 0, 0, 'L'); $pdf->Cell(5, 6, ':', 0, 0, 'L'); $pdf->Cell(45, 6, date('M d, Y', strtotime($f['option_date'] ?? date('Y-m-d'))), 0, 1, 'L'); $pdf->SetXY(120, $rightStartY + 6); $pdf->Cell(45, 6, 'From', 0, 0, 'L'); $pdf->Cell(5, 6, ':', 0, 0, 'L'); $pdf->MultiCell(45, 6, $f['from'] ?? '', 0, 'L'); $pdf->Ln(3); $pdf->Line(15, $pdf->GetY(), 195, $pdf->GetY()); $pdf->Ln(3); $pdf->Cell(45, 6, 'Res. No', 0, 0); $pdf->Cell(5, 6, ':', 0, 0); $pdf->Cell(45, 6, $f['ref_no'] ?? '-', 0, 0); $pdf->Cell(45, 6, 'Guest Name', 0, 0); $pdf->Cell(5, 6, ':', 0, 0); $pdf->Cell(35, 6, $f['to'] ?? '', 0, 1); $pdf->Cell(45, 6, 'Arrival date', 0, 0); $pdf->Cell(5, 6, ':', 0, 0); $pdf->Cell(45, 6, date('m/d/Y', strtotime($f['arrival_date'] ?? date('Y-m-d'))), 0, 0); $pdf->Cell(45, 6, 'Depart. Date', 0, 0); $pdf->Cell(5, 6, ':', 0, 0); $pdf->Cell(35, 6, date('m/d/Y', strtotime($f['depart_date'] ?? date('Y-m-d'))), 0, 1); // Show DAY TOTAL aligned to right-column layout $currentY = $pdf->GetY(); $pdf->SetXY(110, $currentY); $pdf->Cell(45, 6, 'DAY TOTAL', 0, 0, 'L'); $pdf->Cell(5, 6, ':', 0, 0, 'L'); $pdf->Cell(45, 6, (int)($f['total_days'] ?? 1) . ' DAY', 0, 1, 'L'); // Rooms table $pdf->Ln(3); $pdf->SetFillColor(240,240,240); $pdf->SetFont('helvetica', 'B', 10); $pdf->Cell(70, 7, 'Hotel Name', 1, 0, 'C', true); $pdf->Cell(20, 7, 'QTY', 1, 0, 'C', true); $pdf->Cell(40, 7, 'Room Type', 1, 0, 'C', true); $pdf->Cell(25, 7, 'Room Rate', 1, 0, 'C', true); $pdf->Cell(25, 7, 'TOTAL', 1, 1, 'C', true); $pdf->SetFont('helvetica', '', 10); $rows = isset($f['rooms']) && is_array($f['rooms']) ? $f['rooms'] : []; $grand = 0; foreach ($rows as $r) { $qty = (int)($r['qty'] ?? 0); $rate = (float)($r['rate'] ?? 0); $lineTotal = isset($r['total']) && $r['total'] !== '' ? (float)$r['total'] : ($qty * $rate); $grand += $lineTotal; $pdf->Cell(70, 7, $r['hotel'] ?? '', 1, 0, 'L'); $pdf->Cell(20, 7, $qty, 1, 0, 'C'); $pdf->Cell(40, 7, $r['type'] ?? '', 1, 0, 'C'); $pdf->Cell(25, 7, number_format($rate, 0, ',', '.'), 1, 0, 'R'); $pdf->Cell(25, 7, number_format($lineTotal, 0, ',', '.'), 1, 1, 'R'); } // Net charge and total $currency = $f['currency'] ?? 'SAR'; $grandCalc = isset($f['grand_total']) && $f['grand_total'] !== '' ? (float)$f['grand_total'] : $grand; $pdf->Cell(155, 7, 'Net Accommodation Charge : '.$currency, 1, 0, 'R'); $pdf->Cell(25, 7, number_format($grandCalc, 0, ',', '.'), 1, 1, 'R'); $pdf->SetFont('helvetica', 'B', 10); $pdf->Cell(155, 7, 'Total : '.$currency, 1, 0, 'R'); $pdf->Cell(25, 7, number_format($grandCalc, 0, ',', '.'), 1, 1, 'R'); $pdf->SetFont('helvetica', '', 10); // Option date $pdf->Cell(180, 7, 'Option Date : Please Send Before '.date('d M Y', strtotime($f['option_date'] ?? date('Y-m-d'))), 1, 1, 'L'); // Remarks if (!empty($f['remarks'])) { $pdf->SetFont('helvetica', 'B', 10); $pdf->Cell(25, 7, 'Remarks', 1, 0, 'L'); $pdf->SetFont('helvetica', '', 10); $pdf->Cell(155, 7, $f['remarks'], 1, 1, 'L'); } // Footer note $pdf->Ln(3); $pdf->SetFont('helvetica', '', 8); $pdf->MultiCell(180, 4, '* We hope that we have covered all your request waiting for your reply by the option date otherwise the reservation will be released automatically without prior notice.', 1, 'L'); // Bank accounts if exist if (!empty($company['bank_account'])) { $bank_account = json_decode($company['bank_account'], true); if (is_array($bank_account)) { $pdf->Ln(4); $pdf->SetFont('helvetica', '', 10); foreach ($bank_account as $bank) { $lines = []; $lines[] = 'Account Name : ' . ($bank['account_name'] ?? ''); $lines[] = 'Bank Name : ' . ($bank['bank_name'] ?? ''); if (!empty($bank['branch'])) { $lines[] = 'Branch : ' . $bank['branch']; } $lines[] = 'Account # : ' . ($bank['account_number'] ?? ''); if (!empty($bank['swift_code'])) { $lines[] = 'SWIFT Code : ' . $bank['swift_code']; } $pdf->MultiCell(180, 5, implode("\n", $lines), 0, 'L'); $pdf->Ln(2); } } } // Best Regards section at bottom-right with director name from companies $pdf->SetY(-55); $pdf->SetFont('helvetica', 'B', 10); $pdf->Cell(180, 6, 'Thanks and Best Regards', 0, 1, 'R'); // Signature image if available (right aligned) if (!empty($company['signature_image'])) { $signature_path = dirname(__DIR__) . '/' . $company['signature_image']; if (file_exists($signature_path)) { // place roughly at right side above name $y = $pdf->GetY(); $pdf->Image($signature_path, 150, $y - 2, 30); } } $pdf->SetFont('helvetica', '', 10); $pdf->Cell(180, 12, $company['director_name'] ?? '', 0, 1, 'R'); // Bottom note $pdf->SetFont('helvetica', '', 8); $pdf->Cell(180, 5, 'Note :', 0, 1, 'L'); $pdf->MultiCell(180, 4, 'Price are subject to change without prior notice, according to the terms and policies of the hotel.', 0, 'L'); // Output: save to file and stream for download $saveDir = dirname(__DIR__) . '/uploads/hotel_invoices/'; if (!is_dir($saveDir)) { @mkdir($saveDir, 0777, true); } $filename = 'HotelInvoice_' . ($f['ref_no'] ?? 'NOREF') . '_' . date('Ymd_His') . '.pdf'; $filePath = $saveDir . $filename; // Save file $pdf->Output($filePath, 'F'); // Stream to browser header('Content-Type: application/pdf'); header('Content-Disposition: inline; filename="' . $filename . '"'); readfile($filePath); // Persist metadata to database (idempotent per generated file) try { // Ensure table exists mysqli_query($conn, "CREATE TABLE IF NOT EXISTS hotel_invoices ( id INT AUTO_INCREMENT PRIMARY KEY, ref_no VARCHAR(100), to_name VARCHAR(255), from_name VARCHAR(255), invoice_date DATE, arrival_date DATE, depart_date DATE, total_days INT, option_date DATE, status ENUM('tentative','confirmation') DEFAULT 'tentative', currency VARCHAR(10) DEFAULT 'SAR', grand_total DECIMAL(18,2) DEFAULT 0, remarks TEXT, file_name VARCHAR(255), file_path VARCHAR(255), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"); $status = (isset($f['status']) && $f['status'] === 'confirmation') ? 'confirmation' : 'tentative'; $stmt = mysqli_prepare($conn, "INSERT INTO hotel_invoices (ref_no, to_name, from_name, invoice_date, arrival_date, depart_date, total_days, option_date, status, currency, grand_total, remarks, file_name, file_path) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $invoice_date = $f['date'] ?? date('Y-m-d'); $arrival_date = $f['arrival_date'] ?? null; $depart_date = $f['depart_date'] ?? null; $total_days = (int)($f['total_days'] ?? 0); $option_date = $f['option_date'] ?? null; $currency = $f['currency'] ?? 'SAR'; $grand_total = (float)($f['grand_total'] ?? 0); $remarks = $f['remarks'] ?? ''; $to_name = $f['to'] ?? ''; $from_name = $f['from'] ?? ''; $ref_no = $f['ref_no'] ?? ''; $relativePath = 'uploads/hotel_invoices/' . $filename; mysqli_stmt_bind_param($stmt, 'ssssssisssdsss', $ref_no, $to_name, $from_name, $invoice_date, $arrival_date, $depart_date, $total_days, $option_date, $status, $currency, $grand_total, $remarks, $filename, $relativePath); mysqli_stmt_execute($stmt); } catch (Exception $e) { // ignore DB save errors to not block PDF output }