OwlCyberSecurity - MANAGER
Edit File: generate_pdf.php
<?php require_once 'config/config.php'; require_once 'tcpdf/tcpdf.php'; $id = isset($_GET['id']) ? $_GET['id'] : die('Invalid request'); // Fetch booking data with JOINs $db = getDbInstance(); $db->join('customers c', 'b.customer_id = c.customer_id', 'LEFT'); $db->join('vehicles v', 'b.vehicle_id = v.vehicle_id', 'LEFT'); $db->join('drivers d', 'b.driver_id = d.driver_id', 'LEFT'); $db->where('b.booking_id', $id); // Select all necessary fields $booking = $db->getOne('bookings b', ' b.booking_id, b.booking_date, b.tour_date, b.tour_name, b.rate_per_day, b.no_of_days, b.total_amount, b.advance, b.finalization_date, c.full_name, c.father_name, c.mobile_no, c.cnic, v.transport_type, v.vehicle_number AS vehicle_no, d.driver_name '); if (!$booking) { die('Record not found'); } // ... rest of the PDF code remains the same ... // Create PDF $pdf = new TCPDF(); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('TDCP'); $pdf->SetTitle('Booking Form'); $pdf->SetMargins(15, 20, 15); $pdf->AddPage(); $pdf->SetFont('dejavusans', '', 11); // ✅ Absolute positioning method $pdf->setCellHeightRatio(1.5); // ✅ Insert logos and heading side-by-side using HTML $pdf->setCellHeightRatio(1.5); // Adjust vertical spacing // Left Logo (X=15mm from left, Y=20mm from top) $pdf->Image('left-removebg-preview.jpg', 15, 20, 40, 0, '', '', '', false, 300, 'M'); // Center Text (X=55mm, Y=23mm) $pdf->SetFont('dejavusans', 'B', 14); // Bold and larger font $pdf->SetXY(55, 23); $pdf->MultiCell(100, 10, "TOURISM DEVELOPMENT CORPORATION OF PUNJAB\nSPECIAL BOOKING FORM FOR VEHICLES", 0, 'C', 0, 1, '', '', true, 0, false, true, 0, 'M' ); $pdf->SetFont('dejavusans', '', 11); // Regular, size 11 // Right Logo (X=160mm from left) $pdf->Image('right-removebg-preview.jpg', 160, 20, 40, 0, '', '', '', false, 300, 'M'); $pdf->Ln(20); // Add space // --- BOOKING DETAILS TABLE --- $table = '<table border="1" cellpadding="5" class="table" width="100%">'; foreach ($booking as $field => $value) { $label = ucwords(str_replace('_', ' ', $field)); // Making the first column bold and adding padding $table .= "<tr> <td width='35%' style='font-weight: bold; text-align:left; background-color: #f0f0f0; padding-left: 10px;'><strong>$label</strong></td> <td width='65%' style='text-align:left; padding-left: 10px;'>$value</td> </tr>"; } $table .= '</table>'; $pdf->writeHTML($table, true, false, true, false, ''); // --- PAGE 2: TERMS & CONDITIONS --- $pdf->AddPage(); $pdf->SetFont('dejavusans', '', 11); $terms = <<<EOD <h3>TERMS & CONDITIONS</h3> <p>The Tourism Development Corporation of Punjab Ltd. (Hereinafter called TOUR ORGANIZERS / TRANSPORTER) acts only as agents or contractors providing means of transportation. They assume no responsibility in connection with any injury, damage, loss, loss of life, accident, or delay resulting directly or indirectly from acts of God, breakdown in machinery or equipment, hostilities, civil disturbances, epidemics. TDCP will not be liable to pay the concerned individual or tourist any amount. The TOUR ORGANIZERS / TRANSPORTER shall not be responsible for any additional expenses incurred by tour members due to any of the foregoing clauses. The TOUR ORGANIZERS / TRANSPORTER reserves the right to accept, refuse, retain, or cancel the booking, and their liability will be limited to a full refund of the amount received.</p> <h4>MODE OF PAYMENT</h4> <p>Full payment in advance is required, preferably in cash or cheque in favor of Tourism Development Corporation of Punjab Ltd, Lahore. Booking must be made at least 7 days prior to the departure date.</p> <h4>CANCELLATION & REFUND</h4> <p> <ul> <li>More than 7 days before departure: <strong> 95% </strong></li> <li>3–7 days before departure: <strong>80%</strong></li> <li>2 days before departure: <strong>50%</strong></li> <li>Less than 2 days before departure: <strong>25%</strong></li> <li>No refund will be given for services offered by TDCP but not utilized by the participant.</li> </ul> </p> <br><br> <p><strong>Booked By: _______________________</strong></p> <p><strong>Tourist Signature: ________________</strong></p> <br><br> <p> 68, Trade Centre Block, M.A. Johar Town, Lahore-54782, Pakistan.<br> Ph: 92 42 99231645 | Email: info@tdcp.gov.pk<br> Website: www.tdcp.gop.pk | UAN: 111-111-042 </p> EOD; $pdf->writeHTML($terms, true, false, true, false, ''); // Output $pdf->Output('booking_'.$id.'.pdf', 'D');