Файловый менеджер - Редактировать - /home/d46091/invoice.ecogenix.in/print_sale_invoice.php
Назад
<?php // print_invoice.php - Displays an invoice for printing require_once('includes/connection.php'); // Check if invoice ID is provided if (!isset($_GET['id']) || empty($_GET['id'])) { die("Invoice ID is required"); } $invoiceId = intval($_GET['id']); // Get invoice header $sql = "SELECT * FROM road_challans WHERE id = ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("i", $invoiceId); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows === 0) { die("Invoice not found"); } $invoice = $result->fetch_assoc(); // // Get invoice items // $sql = "SELECT * FROM invoice_items WHERE invoice_id = ? ORDER BY id ASC"; // $stmt = $conn->prepare($sql); // $stmt->bind_param("i", $invoiceId); // $stmt->execute(); // $itemsResult = $stmt->get_result(); // $items = []; // while ($row = $itemsResult->fetch_assoc()) { // $items[] = $row; // } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Invoice #<?php echo htmlspecialchars($invoice['invoice_no']); ?></title> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 20px; background-color: #f4f4f4; } .invoice-container { background-color: white; padding: 20px; border-radius: 5px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); max-width: 800px; margin: 0 auto; } .invoice-header { text-align: center; margin-bottom: 20px; } .invoice-details { display: flex; margin-bottom: 20px; } .invoice-details .left { flex: 1; } .invoice-details .right { flex: 1; } .invoice-details table { width: 100%; border-collapse: collapse; } .invoice-details td { padding: 5px; border: 1px solid #ddd; } .invoice-items { margin-bottom: 20px; } .invoice-items table { width: 100%; border-collapse: collapse; } .invoice-items th, .invoice-items td { border: 1px solid #ddd; padding: 8px; text-align: left; } .invoice-items th { background-color: #f2f2f2; } .invoice-footer { margin-top: 20px; display: flex; justify-content: space-between; } .invoice-total { font-weight: bold; font-size: 18px; text-align: right; margin-top: 10px; } .print-button { text-align: center; margin-top: 20px; } .print-button button { padding: 10px 20px; background-color: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; } .print-button button:hover { background-color: #45a049; } @media print { .print-button { display: none; } body { background-color: white; padding: 0; } .invoice-container { box-shadow: none; padding: 0; } } </style> </head> <body> <div class="print-button"> <button onclick="window.print()">Print Invoice</button> <button onclick="window.location.href='challan.php'">Back to Invoices</button> </div> <div class="invoice-container"> <div class="invoice-header"> <h1>BILL OF SUPPLY</h1> </div> <div class="invoice-details"> <table class="table table-bordered"> <tr> <td colspan="4" rowspan="2"> <strong><?php echo htmlspecialchars($invoice['consignorName']); ?></strong><br> <?php echo nl2br(htmlspecialchars($invoice['consignorAddress'])); ?><br> <?php echo nl2br(htmlspecialchars($invoice['consignorGst'])); ?><br> Pincode - <?php echo htmlspecialchars($invoice['consignorPincode']); ?><br> Mob: <?php echo htmlspecialchars($invoice['consignorPhone']); ?> </td> <td><strong>Invoice No:</strong><br><?php echo htmlspecialchars($invoice['challan_no']); ?></td> <td><strong>Dated:</strong><br><?php echo htmlspecialchars($invoice['date']); ?></td> </tr> <tr> <td><strong>Delivery Note:</strong><br>N/A</td> <td><strong>Terms of Payment:</strong><br>As Per Work Order </td> </tr> <tr> <td colspan="4" rowspan="2"> <p style="margin-top: -10px;"> <strong>Consignee (Ship to):</strong><br> <?php echo htmlspecialchars($invoice['name']); ?><br> <?php echo nl2br(htmlspecialchars($invoice['address1'])); ?> </p> </td> <td><strong>Buyer's Order No:</strong><br><?php echo htmlspecialchars($invoice['purchase_order_no']); ?><br></td> <td><strong>Order Dated:</strong><br><?php echo htmlspecialchars($invoice['order_date']); ?><br></td> </tr> <tr> <!-- <td><strong>Reference No. & Date:</strong><br>N/A</td> <td><strong>Other References:</strong><br>N/A</td> --> <td><strong>Vehicle No:</strong><br><?php echo htmlspecialchars($invoice['vehicle_no']); ?><br></td> <td><strong>Dispatch Vehicle Date:</strong><br><?php echo htmlspecialchars($invoice['d_vehicle_date']); ?><br></td> </tr> <tr> <td colspan="4" rowspan="3"> <p style="margin-top: -4px;"> <strong>Buyer (Bill to):</strong><br> <?php echo htmlspecialchars($invoice['name']); ?><br> <?php echo nl2br(htmlspecialchars($invoice['address1'])); ?> </p> </td> </tr> <tr> <td><strong>Dispatched through:</strong><br>ROAD TRANSPORT</td> <td><strong>Destination:</strong><br><?php echo htmlspecialchars($invoice['destination']); ?></td> </tr> <!-- <tr> <td colspan="2"> <p><strong>Terms of Delivery:</strong> </p> </td> </tr> --> </table> </div> <div class="invoice-items"> <table> <thead> <tr> <th>Description of Goods</th> <th>HSN</th> <th>Quantity Shipped</th> <th>Quantity Billed</th> <th>Rate</th> <th>Per</th> <th>Amount (₹)</th> </tr> </thead> <tbody> <tr> <td><?php echo htmlspecialchars($invoice['description']); ?></td> <td><?php echo htmlspecialchars($invoice['hsn']); ?></td> <td><?php echo htmlspecialchars($invoice['quantity']); ?></td> <td><?php echo htmlspecialchars($invoice['quantity_billed'] ?? 'N/A'); ?></td> <td><?php echo htmlspecialchars($invoice['rate']); ?></td> <td>KG</td> <td style="text-align: end;"><strong>₹<?php echo htmlspecialchars($invoice['amount']); ?></strong></td> </tr> </tbody> <tfoot> <?php if ($invoice['cus_state'] == 'intrastate'): ?> <tr> <th colspan="6" style="text-align: end;">CGST (9%)</th> <td style="text-align: end;"><strong>₹<?= !empty($invoice['cgst']) ? $invoice['cgst'] : '0'; ?></strong></td> </tr> <tr> <th colspan="6" style="text-align: end;">SGST (9%)</th> <td style="text-align: end;"><strong>₹<?= !empty($invoice['sgst']) ? $invoice['sgst'] : '0'; ?></strong></td> </tr> <?php else: ?> <tr> <th colspan="6" style="text-align: end;">IGST (18%)</th> <td style="text-align: end;"><strong>₹<?= !empty($invoice['igst']) ? $invoice['igst'] : '0'; ?></strong></td> </tr> <?php endif; ?> <tr> <th colspan="6" style="text-align: end;">TOTAL</th> <td style="text-align: end;"><strong>₹<?= $invoice['finalAmount']; ?></strong></td> </tr> </tfoot> </table> </div> <div> <p><strong>Amount Chargeable (in words):</strong><br> <?php echo htmlspecialchars($invoice['amountWords']); ?> Only</p> <p><strong>Declaration:</strong><br>We declare that this invoice shows the actual price of the goods described and that all particulars are true and correct.</p> </div> <div class="invoice-footer"> <div class="left"> <!-- Any additional information can go here --> </div> <div class="right"> <p>for <?php echo htmlspecialchars($invoice['consignorName']); ?></p> <br><br> <p>Authorised Signatory</p> </div> </div> </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.1.32 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка