Server IP : 162.214.80.37 / Your IP : 216.73.216.83 Web Server : Apache System : Linux sh013.webhostingservices.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : imyrqtmy ( 2189) PHP Version : 8.2.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home2/imyrqtmy/public_html/Quickex/builty/vendor/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php require_once('tcpdf/tcpdf.php'); include("inc/config.php"); // Database connection // Get ID from URL $id = isset($_GET['id']) ? intval($_GET['id']) : 0; // Fetch data from the `builties` table $query = "SELECT * FROM builties WHERE id = '$id'"; $result = mysqli_query($conn, $query); $data = mysqli_fetch_assoc($result); $origin = $data['origin'] ?? 'N/A'; $destination = $data['destination'] ?? 'N/A'; $origin_address = $data['origin_address'] ?? 'N/A'; $origin_gst = $data['origin_gst'] ?? 'N/A'; $origin_phone = $data['origin_phone'] ?? 'N/A'; $origin_eway = $data['origin_eway'] ?? 'N/A'; $grno = $data['grno'] ?? 'N/A'; $qacl = $data['qacl'] ?? 'N/A'; $transport_by = $data['transport_by'] ?? 'N/A'; $booking_date = $data['booking_date'] ?? 'N/A'; $booking_time = $data['booking_time'] ?? 'N/A'; $destination_address = $data['destination_address'] ?? 'N/A'; $destination_gst = $data['destination_gst'] ?? 'N/A'; $destination_phone = $data['destination_phone'] ?? 'N/A'; $destination_eway = $data['destination_eway'] ?? 'N/A'; $pkg_total = $data['pkg_total'] ?? 'N/A'; $pkg_type = $data['pkg_type'] ?? 'N/A'; $party_invoice = $data['party_invoice'] ?? 'N/A'; $saidtocontent = $data['saidtocontent'] ?? 'N/A'; $quantity = $data['quantity'] ?? 'N/A'; $gross_weight = $data['gross_weight'] ?? 'N/A'; $charge_weight = $data['charge_weight'] ?? 'N/A'; $amount = $data['amount'] ?? 'N/A'; $consignee = $data['consignee'] ?? 'N/A'; $consignor = $data['consignor'] ?? 'N/A'; $freight_rate = $data['freight_rate'] ?? 'N/A'; $freight_amount = $data['freight_amount'] ?? 'N/A'; $cod_rate = $data['cod_rate'] ?? 'N/A'; $cod_amount = $data['cod_amount'] ?? 'N/A'; $fov_rate = $data['fov_rate'] ?? 'N/A'; $fov_amount = $data['fov_amount'] ?? 'N/A'; $doc_rate = $data['doc_rate'] ?? 'N/A'; $doc_amount = $data['doc_amount'] ?? 'N/A'; $cartage_rate = $data['cartage_rate'] ?? 'N/A'; $cartage_amount = $data['cartage_amount'] ?? 'N/A'; $labour_rate = $data['labour_rate'] ?? 'N/A'; $labour_amount = $data['labour_amount'] ?? 'N/A'; $octroi_rate = $data['octroi_rate'] ?? 'N/A'; $octroi_amount = $data['octroi_amount'] ?? 'N/A'; $other_rate = $data['other_rate'] ?? 'N/A'; $other_amount = $data['other_amount'] ?? 'N/A'; $gst_rate = $data['gst_rate'] ?? 'N/A'; $gst_amount = $data['gst_amount'] ?? 'N/A'; $total_amount = $data['total_amount'] ?? 'N/A'; $delivery_detail = $data['delivery_detail'] ?? 'N/A'; $delivery_time = $data['delivery_time'] ?? 'N/A'; $ttb_origin = $data['ttb_origin'] ?? 'N/A'; $to_pay = $data['to_pay'] ?? 'N/A'; $paid = $data['paid'] ?? 'N/A'; if (!$data) { die("No data found for this ID."); } // Define copy names $copies = ["ACCOUNTS COPY", "CONSIGNEE COPY", "CONSIGNOR COPY", "POD COPY"]; // Create new PDF document $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->SetMargins(5, 5, 5); // Reduced margins $pdf->SetAutoPageBreak(TRUE, 5); // Minimized bottom margin $pdf->SetFont('helvetica', '', 9); // Slightly smaller font for compact layout foreach ($copies as $copy) { $pdf->AddPage(); // Ensure each copy starts on a new page // Company Header $companyLogo = 'dist/images/logo.jpeg'; $makeInIndiaLogo = 'dist/images/logo.jpeg'; $companyName = "Quickex Airways & Cargo Logistics"; $companyAddress = "Plot No. A-66, Sector-F1, Shastripuram, <br>Agra (U.P.)"; $companyRegNumber = "UDYAM REGISTRATION NUMBER-UDYAM-UP-01-0031539/M/00006"; $companyPhone = "+91 12345 67890"; // $companyEmail = "info@quickex.com"; $companyGST = "GSTIN: 12ABCDE3456F7Z8"; // Header HTML $html = ' <table width="100%" style="text-align:center;"> <tr> <!-- Left Logo --> <td width="20%" align="left"> <img src="'.$companyLogo.'" width="80"> </td> <!-- Center Content --> <td width="60%" align="center"> <h2 style="font-size:16px; margin:0;">'.$companyName.'</h2> <p style="font-size:9px; margin:0; text-align:center;"> '.$companyAddress.' '.$companyRegNumber.' '.$companyGST.' | Phone: '.$companyPhone.' </p> </td> <!-- Right Logo --> <td width="20%" align="right"> <img src="'.$makeInIndiaLogo.'" width="80"> </td> </tr> </table> <br> <hr> '; $html .= ' <table border="1" cellpadding="5" cellspacing="0"> <tr> <!-- Left Column: Origin & Destination --> <td width="50%" valign="top"> <!-- Origin Section (Boxed) --> <table width="100%" border="1" cellpadding="5" cellspacing="0"> <tr> <td bgcolor="#87CEEB" style="color:red; font-weight:bold; text-align:center; font-size:14px;"> Origin </td> </tr> <tr> <td style="font-size:12px; text-align:center;"><strong>'.$origin.'</strong></td> </tr> </table> <!-- Destination Section (Boxed) --> <table width="100%" border="1" cellpadding="5" cellspacing="0"> <tr> <td bgcolor="#87CEEB" style="color:red; font-weight:bold; text-align:center; font-size:14px;"> Destination </td> </tr> <tr> <td style="font-size:12px; text-align:center;"><strong>'.$destination.'</strong></td> </tr> </table> <!-- Consignor Details --> <table width="100%" cellpadding="3"> <tr> <td><strong>Consignor:</strong> '.$consignor.'</td> </tr> <tr> <td><strong>Address:</strong> '.$origin_address.'</td> </tr> <tr> <td><strong>GST No.:</strong> '.$origin_gst.' </td> </tr> <tr> <td><strong>Phone No:</strong> '.$origin_phone.'</td> </tr> <tr> <td><strong>E-Way Bill No:</strong> '.$origin_eway.'</td> </tr> </table> </td> <!-- Right Column: GR No, GST & QACL, Booking Date & Transport Mode --> <td width="50%" valign="top"> <!-- GR No Section --> <table width="100%" cellpadding="3" border="1"> <tr> <td><strong style="color:red;">GR No:</strong> '.$grno.'</td> </tr> </table> <!-- GSTIN & QACL in Two Boxes --> <table width="100%" cellpadding="3" border="1"> <tr> <td width="50%"><strong style="color:red;">GSTIN:</strong> '.$destination_gst.'</td> <td width="50%"><strong style="color:red;">QACL:</strong> '.$qacl.'</td> </tr> </table> <!-- Booking Date & Time || Transport Mode Parallel --> <table width="100%" cellpadding="3" border="1"> <tr> <td width="50%"><strong style="color:red;">Booking Date:</strong> '.$booking_date.'</td> <td width="50%"><strong style="color:red;">Time:</strong> '.$booking_time.'</td> </tr> </table> <!-- Transport Mode Section Parallel --> <table width="100%" cellpadding="3" border="1"> <tr> <td width="100%"><strong style="color:red;">Transport By:</strong> '.$transport_by.'</td> </tr> </table> <!-- Consignee Details --> <table width="100%" cellpadding="3"> <tr> <td><strong style="color:red;">Consignee:</strong> '.$consignee.'</td> </tr> <tr> <td><strong style="color:red;">Address:</strong> '.$destination_address.'</td> </tr> <tr> <td><strong style="color:red;">GST No.:</strong>'.$destination_gst.'</td> </tr> <tr> <td><strong style="color:red;">Phone No:</strong>'.$destination_phone.'</td> </tr> <tr> <td><strong style="color:red;">E-Way Bill No:</strong> '.$destination_eway.'</td> </tr> </table> </td> </tr> </table>'; // Calculate Total Amount // Function to Convert Numbers to Words // Bank Details // $bank_name = "ICICI Bank"; // $account_name = "Quickex Airways & Cargo Logistics"; // $account_number = "628705011805"; // $ifsc_code = "ICIC0006287"; // $branch_name = "Sanjay Palace, Agra"; // Function to Convert Numbers to Words if (!function_exists('convertNumberToWords')) { function convertNumberToWords($num) { $ones = array("", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"); $tens = array("", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"); if ($num < 20) { return $ones[$num]; } elseif ($num < 100) { return $tens[intval($num / 10)] . " " . $ones[$num % 10]; } elseif ($num < 1000) { return $ones[intval($num / 100)] . " Hundred " . convertNumberToWords($num % 100); } elseif ($num < 100000) { return convertNumberToWords(intval($num / 1000)) . " Thousand " . convertNumberToWords($num % 1000); } elseif ($num < 10000000) { return convertNumberToWords(intval($num / 100000)) . " Lakh " . convertNumberToWords($num % 100000); } else { return convertNumberToWords(intval($num / 10000000)) . " Crore " . convertNumberToWords($num % 10000000); } } } $total_amount = $fov_amount + $doc_amount + $cartage_amount + $labour_amount + $octroi_amount + $other_amount + $gst_amount; // $total_amount = floatval($freight_amount) + floatval($gst_amount); $total_amount_words = strtoupper(convertNumberToWords(intval($total_amount))) . " ONLY"; $html .= ' <table border="1" cellpadding="5" cellspacing="0" width="100%"> <!-- Headings Row --> <tr> <td width="13%" align="center"><strong style="color:red;">No. of Packages</strong></td> <td width="13%" align="center"><strong style="color:red;">Type of Packing</strong></td> <td width="14%" align="center"><strong style="color:red;">Party Invoice No.</strong></td> <td width="23%" align="center"><strong style="color:red;">Said to Contain</strong></td> <td width="10%" align="center"><strong style="color:red;">Qty</strong></td> <td width="12%" align="center"><strong style="color:red;">Gross Weight</strong></td> <td width="15%" align="center"><strong style="color:red;">Charged Weight</strong></td> </tr> <!-- Data Row --> <tr> <td height="50" align="center">'.$quantity.'</td> <td height="50" align="center">'.$pkg_type.'</td> <td width="14%"> <table width="100%" cellspacing="0"> <tr><td height="12" align="left">1. '.$party_invoice.'</td></tr> <tr><td height="12" align="left">2.</td></tr> <tr><td height="12" align="left">3.</td></tr> <tr><td height="12" align="left">4.</td></tr> </table> </td> <td height="50" align="center">'.$saidtocontent.'</td> <td height="50" align="center">'.$quantity.'</td> <td height="50" align="center">'.$gross_weight.'</td> <td height="50" align="center">'.$charge_weight.'</td> </tr> </table>'; $html .= ' <table border="1" cellpadding="5" cellspacing="0" width="100%"> <tr> <!-- 40% Section: Declared Value and Rs. in One Line --> <td width="25%" align="center"><strong style="color:red;">Declared Value</strong></td> <td width="25%" align="left"><strong style="color:red;">Rs.</strong> '.$amount.'</td> <!-- 60% Section: Billing Details --> <td width="50%" colspan="4" align="center"><strong style="color:red;">Billing Details</strong></td> </tr> <tr> <td align="center">Octoroi Will be Pay By</td> <td align="left">Consignee</td> <!-- Empty for Rs. alignment --> <td align="center"><strong style="color:red;">Particulars</strong></td> <td align="center"><strong style="color:red;">Rate</strong></td> <td align="center"><strong style="color:red;">Amount (Rs)</strong></td> <td align="center"><strong style="color:red;">P</strong></td> </tr> <!-- Consignee and Consignor positioned below Rs. --> <tr> <td align="center"></td> <td align="left"style="color:red;">Consignor</td> <td align="center" style="color:red;">F.O.V.</td> <td align="center">'.$fov_rate.'</td> <td align="center">'.$fov_amount.'</td> <td align="center"></td> </tr> <tr> <td rowspan="2" colspan="2" align="center"><strong>Dimension<br> L x W x H in CM</strong></td> <td align="center" style="color:red;">DOC Charges</td> <td align="center">'.$doc_rate.'</td> <td align="center">'.$doc_amount.'</td> <td align="center"></td> </tr> <tr> <td align="center">Cartage</td> <td align="center">'.$cartage_rate.'</td> <td align="center">'.$cartage_amount.'</td> <td align="center"></td> </tr> <tr> <td rowspan="2" colspan="2"> <strong style="color:red;">Delivery Detail:</strong> '.$delivery_detail.' <br><br> <small>Receivers Sign</small> </td> <td align="center" style="color:red;">Labour Handling</td> <td align="center">'.$labour_rate.'</td> <td align="center">'.$labour_amount.'</td> <td align="center"></td> </tr> <tr> <td align="center" style="color:red;">Octroi</td> <td align="center">'.$octroi_rate.'</td> <td align="center">'.$octroi_amount.'</td> <td align="center"></td> </tr> <tr> <td colspan="2" align="center"><strong>Note:</strong> Any applicable notes here</td> <td align="center" style="color:red;">Any Other Charges</td> <td align="center">'.$other_rate.'</td> <td align="center">'.$other_amount.'</td> <td align="center"></td> </tr> <tr> <td colspan="2" align="center"></td> <td align="center" style="color:red;">@GST</td> <td align="center">'.$gst_rate.'</td> <td align="center">'.$gst_amount.'</td> <td align="center"></td> </tr> <tr> <td colspan="2" align="center"></td> <td align="center"></td> <td align="center"><strong style="color:red;">Total</strong></td> <td><strong> '.number_format($total_amount, 2).'</strong></td> <td align="center"></td> </tr> </table> '; $html .= ' <table border="1" cellpadding="5" cellspacing="0" width="100%"> <tr> <!-- First 50% (Left Side) --> <td width="25%" align="center"><strong style="color:red;">TTB at Origin</strong></td> <td width="25%" align="center" rowspan="3"><strong style="color:red;">Consignor Signature</strong></td> <!-- Second 50% (Right Side) --> <td width="50%" align="center" rowspan="2"><strong style="color:red;">Rs. in Words</strong> '.$total_amount_words.'</td> </tr> <tr> <td align="center"><strong style="color:red;">To Pay</strong></td> </tr> <tr> <td align="center"><strong>Paid</strong></td> <td width="50%" align="center"><strong>Signature</strong></td> </tr> </table> '; // Write content to PDF $pdf->writeHTML($html, true, false, true, false, ''); // Footer (Page number and Copy Type) $pdf->SetY(-15); $pdf->SetFont('helvetica', 'I', 9); $pdf->Cell(0, 10, $copy . " | Page " . $pdf->getAliasNumPage() . " of " . $pdf->getAliasNbPages(), 0, 0, 'C'); } // Output single PDF with all copies $pdf->Output('logistics_invoice.pdf', 'I'); ?>