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"); $id = isset($_GET['id']) ? intval($_GET['id']) : 0; $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'; $party_name = $data['party_name']; $dimension = $data['dimension']; $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."); } $invoice_folder = __DIR__ . "/invoices/"; // Full Path to the Folder $invoice_filename = "invoice_" . $id . ".pdf"; $invoice_path = $invoice_folder . $invoice_filename; // Ensure the "invoices" folder exists and is writable if (!file_exists($invoice_folder)) { mkdir($invoice_folder, 0777, true); } // 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 $pdf->AddPage(); // Company Header // $companyLogo = 'dist/images/logo.jpeg'; $makeInIndiaLogo = 'dist/images/logo.jpeg'; $companyName = "Quickex Airways & Cargo Logistics"; $companyAddress = "Plot No. A-66, Sector-F1, <br> Shastripuram, <br> Agra (U.P.)<br> UDYAM REGISTRATION NUMBER - UDYAM-UP-01-0031539/M/00006"; $companyPhone = "+91 12345 67890"; $companyGST = "GSTIN: 12ABCDE3456F7Z8"; // Header HTML $html = ' <table width="100%"> <tr> <td width="74%" align="left"> <h2 style="font-size:20px;">'.$companyName.'</h2> <p style="font-size:9px;">'.$companyAddress.' <br> '.$companyGST.' <br> Phone: '.$companyPhone.' </p> </td> <td width="18%" align="right"><img src="'.$makeInIndiaLogo.'"width="200"></td> </tr> </table> <br> <hr> <h2 style="font-size:15px; text-align:center;">Invoice</h2> '; // Consignor & Consignee $html .= '<table cellspacing="0" cellpadding="3"> <tr> <td width="50%"> <strong>Party Name:</strong>: TATA INTERNATIONAL LTD<br> <strong>Address:</strong> '.$destination_address.'<br> <strong>GST No:</strong> '.$destination_gst.'<br> <strong>Phone No:</strong> '.$destination_phone.'<br> <strong>E-Way Bill No:</strong> '.$destination_eway.' </td> <td width="50%"> <strong>Invoice:</strong> '.$party_invoice.'<br> <strong>Invoice Date:</strong> '.$booking_date.'<br> <strong>Period:</strong> <br> <strong>Place of Supply: </strong>'.$destination.'<br> </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 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); } } // Calculate Grand Total $total_amount = floatval($freight_amount) + floatval($gst_amount); $total_amount_words = strtoupper(convertNumberToWords(intval($total_amount))) . " ONLY"; // Package Details Table $html .= '<h3>Package Details</h3> <table border="1" cellpadding="3" width="100%"> <tr> <td><strong>GR.Date:</strong></td> <td><strong>Party Name:</strong></td> <td><strong>Station</strong></td> <td><strong>Party Invoice No.:</strong></td> <td><strong>Mode:</strong></td> <td><strong>Dimension:</strong></td> <td><strong>Qty:</strong></td> <td><strong>Weight:</strong></td> <td><strong>RATE:</strong></td> <td><strong>DC:</strong></td> <td><strong>Freight:</strong></td> <td><strong>IGST:</strong></td> <td><strong>Net Amt:</strong></td> </tr> <tr> <td> '.$booking_date.'</td> <td> '.$party_name.'</td> <td> '.$destination.'</td> <td> '.$party_invoice.'</td> <td> '.$transport_by.'</td> <td> '.$dimension.'</td> <td> '.$quantity.'</td> <td> '.$gross_weight.'</td> <td> '.$amount.'</td> <td> '.$doc_amount.'</td> <td> '.$freight_amount.'</td> <td> '.$gst_amount.'</td> <td><strong> '.number_format($total_amount, 2).'</strong></td> </tr> <!-- Grand Total Row --> <tr> <td colspan="12" align="right"><strong>Grand Total:</strong></td> <td colspan="2" align="center"><strong>'.number_format($total_amount, 2).'</strong></td> </tr> <!-- Grand Total in Words Row --> <tr> <td colspan="13" align="left"><strong>Amount in Words: </strong> '.$total_amount_words.'</td> </tr> </table>'; // Add Bank Account Details Section $html .= '<h3>Bank Account Details</h3> <table border="1" cellpadding="5" width="100%"> <tr> <td><strong>Bank Name:</strong></td> <td>'.$bank_name.'</td> </tr> <tr> <td><strong>Account Name:</strong></td> <td>'.$account_name.'</td> </tr> <tr> <td><strong>Account Number:</strong></td> <td>'.$account_number.'</td> </tr> <tr> <td><strong>IFSC Code:</strong></td> <td>'.$ifsc_code.'</td> </tr> <tr> <td><strong>Branch Name:</strong></td> <td>'.$branch_name.'</td> </tr> </table>'; // Terms & Conditions $html .= '<h3>Terms and Conditions</h3> <p>1. HSN Code & GST Rate- ByAir:-996531 (GST @ 18%) ByTrain:-996512 (GST @ 5%), ByRoad:-996511(UNDER RCM)</p> <p>2. Please pay by cheque/DD only if favour of Quickex Airways & Cargo Logistics.</p> <p>3. Payment within 7 Days.</p> <p>4. Payment against this invoice may please we through A/c Payee.</p> <p>5. Subject to Agra Jurisdiction.</p> <p align="right"><strong>For Quickex Airways</strong></p>'; // Output PDF $pdf->writeHTML($html, true, false, true, false, ''); // $pdf->Output('logistics_invoice.pdf', 'I'); $pdf->Output($invoice_path, 'F'); // 'F' saves file instead of displaying // Redirect back after generating header("Location: view-invoice.php?success=Invoice+generated"); exit(); ?>