Файловый менеджер - Редактировать - /home/d46091/invoice.ecogenix.in/print_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 invoices 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='invoice.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['consignor_name']); ?></strong><br> <?php echo nl2br(htmlspecialchars($invoice['consignor_address'])); ?><br> Pincode - <?php echo htmlspecialchars($invoice['consignor_pincode']); ?><br> Mob: <?php echo htmlspecialchars($invoice['consignor_phone']); ?> </td> <td><strong>Invoice No:</strong><br><?php echo htmlspecialchars($invoice['invoice_no']); ?></td> <td><strong>Dated:</strong><br><?php echo htmlspecialchars($invoice['invoice_date']); ?></td> </tr> <tr> <td><strong>Delivery Note:</strong><br><?php echo htmlspecialchars($invoice['delivery_note']); ?></td> <td><strong>Mode/Terms of Payment:</strong><br><?php echo htmlspecialchars($invoice['payment_terms']); ?></td> </tr> <tr> <td colspan="4" rowspan="2"> <p> <strong>Consignee (Ship to):</strong><br> <?php echo htmlspecialchars($invoice['consignee_name']); ?><br> <?php echo nl2br(htmlspecialchars($invoice['consignee_address'])); ?> </p> </td> <td><strong>Buyer's Order No:</strong><br><?php echo htmlspecialchars($invoice['buyer_order_no']); ?></td> <td><strong>Dated:</strong><br><?php echo htmlspecialchars($invoice['buyer_order_date']); ?></td> </tr> <tr> <td><strong>Reference No. & Date:</strong><br><?php echo htmlspecialchars($invoice['reference_no']); ?></td> <td><strong>Other References:</strong><br><?php echo htmlspecialchars($invoice['other_references']); ?></td> </tr> <tr> <td colspan="4" rowspan="3"> <p> <strong>Buyer (Bill to):</strong><br> <?php echo htmlspecialchars($invoice['buyer_name']); ?><br> <?php echo nl2br(htmlspecialchars($invoice['buyer_address'])); ?> </p> </td> <td><strong>Dispatch Doc No:</strong><br><?php echo htmlspecialchars($invoice['dispatch_doc_no']); ?></td> <td><strong>Delivery Note Date:</strong><br><?php echo htmlspecialchars($invoice['delivery_note_date']); ?></td> </tr> <tr> <td><strong>Dispatched through:</strong><br><?php echo htmlspecialchars($invoice['dispatched_through']); ?></td> <td><strong>Destination:</strong><br><?php echo htmlspecialchars($invoice['destination']); ?></td> </tr> <tr> <td colspan="2"> <p><strong>Terms of Delivery:</strong> <?php echo htmlspecialchars($invoice['terms_of_delivery']); ?></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> <?php foreach ($items as $item): ?> <tr> <td><?php echo htmlspecialchars($item['description']); ?></td> <td><?php echo htmlspecialchars($item['hsn']); ?></td> <td><?php echo htmlspecialchars($item['qty_shipped']); ?></td> <td><?php echo htmlspecialchars($item['qty_billed']); ?></td> <td><?php echo htmlspecialchars($item['rate']); ?></td> <td><?php echo htmlspecialchars($item['per']); ?></td> <td><?php echo htmlspecialchars($item['amount']); ?></td> </tr> <?php endforeach; ?> </tbody> <tfoot> <tr> <td colspan="5"><?= $invoice['extra_desc']; ?></td> <td><strong>Total</strong></td> <td><strong>₹ <?= $invoice['total_amount']; ?></strong></td> </tr> </tfoot> </table> </div> <div> <p><strong>Amount Chargeable (in words):</strong><br> <?php echo htmlspecialchars($invoice['amount_in_words']); ?></p> <p><strong>Remarks:</strong><br> <?php echo nl2br(htmlspecialchars($invoice['remarks'])); ?></p> <p><strong>Declaration:</strong><br> <?php echo nl2br(htmlspecialchars($invoice['declaration'])); ?></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['consignor_name']); ?></p> <br><br> <p>Authorised Signatory</p> </div> </div> </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.1.32 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка