:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/www/crm/**
:: Editing File: invoice_print.php
<?php include 'config/db.php'; include 'check_login.php'; // Get invoice ID $invoice_id = isset($_GET['id']) ? intval($_GET['id']) : 0; if ($invoice_id <= 0) { die("Invalid Invoice ID"); } // Fetch invoice + client details $sql = "SELECT i.*, c.name AS client_name, c.address AS client_address, c.phone AS client_contact FROM invoices i JOIN clients c ON i.client_id = c.id WHERE i.id = $invoice_id"; $result = mysqli_query($conn, $sql); $invoice = mysqli_fetch_assoc($result); if (!$invoice) { die("Invoice not found."); } // Fetch invoice items $items = mysqli_query($conn, "SELECT * FROM invoice_items WHERE invoice_id = $invoice_id"); // Function to convert numbers to words function convert_number_to_words($number) { $hyphen = '-'; $conjunction = ' and '; $separator = ', '; $negative = 'negative '; $decimal = ' point '; $dictionary = array( 0 => 'Zero', 1 => 'One', 2 => 'Two', 3 => 'Three', 4 => 'Four', 5 => 'Five', 6 => 'Six', 7 => 'Seven', 8 => 'Eight', 9 => 'Nine', 10 => 'Ten', 11 => 'Eleven', 12 => 'Twelve', 13 => 'Thirteen', 14 => 'Fourteen', 15 => 'Fifteen', 16 => 'Sixteen', 17 => 'Seventeen', 18 => 'Eighteen', 19 => 'Nineteen', 20 => 'Twenty', 30 => 'Thirty', 40 => 'Forty', 50 => 'Fifty', 60 => 'Sixty', 70 => 'Seventy', 80 => 'Eighty', 90 => 'Ninety', 100 => 'Hundred', 1000 => 'Thousand', 100000 => 'Lakh', 10000000 => 'Crore' ); if (!is_numeric($number)) return false; if (($number >= 0 && (int)$number < 0) || (int)$number < 0 - PHP_INT_MAX) return 'Overflow'; if ($number < 0) return $negative . convert_number_to_words(abs($number)); $string = $fraction = null; if (strpos($number, '.') !== false) list($number, $fraction) = explode('.', $number); switch (true) { case $number < 21: $string = $dictionary[$number]; break; case $number < 100: $tens = ((int) ($number / 10)) * 10; $units = $number % 10; $string = $dictionary[$tens]; if ($units) $string .= $hyphen . $dictionary[$units]; break; case $number < 1000: $hundreds = (int) ($number / 100); $remainder = $number % 100; $string = $dictionary[$hundreds] . ' ' . $dictionary[100]; if ($remainder) $string .= $conjunction . convert_number_to_words($remainder); break; default: $baseUnit = pow(1000, floor(log($number, 1000))); $numBaseUnits = (int) ($number / $baseUnit); $remainder = $number % $baseUnit; $string = convert_number_to_words($numBaseUnits) . ' ' . $dictionary[$baseUnit]; if ($remainder) $string .= $remainder < 100 ? $conjunction : $separator; $string .= convert_number_to_words($remainder); break; } if (null !== $fraction && is_numeric($fraction)) { $string .= $decimal; $words = []; foreach (str_split((string) $fraction) as $number) $words[] = $dictionary[$number]; $string .= implode(' ', $words); } return ucfirst($string); } $amount_in_words = convert_number_to_words(round($invoice['grand_total'])) . " Rupees only"; $invoice_date = date('d-m-Y', strtotime($invoice['invoice_date'])); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Invoice #<?= $invoice['invoice_no'] ?> - Kreative Pixelz</title> <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet"> <style> /* (Paste your same CSS from the HTML invoice template here) */ <?php include 'invoice_style.css'; ?> </style> </head> <body> <div class="invoice-container"> <header class="invoice-header"> <div class="company-logo"> <h1><img src="logo/logo.png" width="300px;" alt="Kreative Pixelz Logo"></h1> </div> <div class="company-info"> <p>Kharghar | Vashi | Navi Mumbai</p> <p>Website: www.kreativepixelz.com</p> <p>Phone no.: 8692842333 / Email: info@kreativepixelz.com</p> <p>State: Maharashtra</p> </div> </header> <div class="invoice-title"> <h2>Tax Invoice</h2> </div> <div class="details-section"> <div class="invoice-details"> <p class="section-title">Invoice Details</p> <p><strong>Invoice No.:</strong> <?= $invoice['invoice_no'] ?></p> <p><strong>Date:</strong> <?= $invoice_date ?></p> <p><strong>Payment Type:</strong> <?= $invoice['payment_mode'] ?></p> </div> <div class="client-details"> <p class="section-title">Bill To / Invoice To</p> <p class="client-name"><strong><?= $invoice['client_name'] ?></strong></p> <p><?= nl2br($invoice['receiver_address']) ?></p> <p><strong>Contact:</strong> <?= $invoice['client_contact'] ?></p> </div> </div> <table class="items-table"> <thead> <tr> <th>#</th> <th>Description</th> <th>HSN</th> <th>Qty</th> <th>Price</th> <th>Tax %</th> <th>Amount</th> </tr> </thead> <tbody> <?php $item_sql = "SELECT * FROM invoice_items WHERE invoice_id = $invoice_id"; $items_result = mysqli_query($conn, $item_sql); $total = 0; $i = 1; while ($item = mysqli_fetch_assoc($items_result)) { $amount = $item['quantity'] * $item['price']; $total += $amount; echo "<tr> <td>{$i}</td> <td>{$item['description']}</td> <td>{$item['hsn_code']}</td> <td style='text-align:right'>{$item['quantity']}</td> <td style='text-align:right'>".number_format($item['price'],2)."</td> <td style='text-align:right'>{$item['tax_percent']}%</td> <td style='text-align:right'>".number_format($amount,2)."</td> </tr>"; $i++; } ?> <tr class="total-row"> <td colspan="6" style="color:#12649c;"><strong>Total</strong></td> <td style="color:#12649c;text-align:right;"><strong><?php echo number_format($total, 2); ?></strong></td> </tr> <?php /* <!-- <tr class="total-row"> <td colspan="3" style="color:#12649c"><strong>Total</strong></td> <td style="text-align:right;color:#12649c"><strong><?= $total_qty ?></strong></td> <td colspan="2"></td> <td style="text-align:right;color:#12649c"><strong><?= number_format($invoice['sub_total'],2) ?></strong></td> </tr> --> */ ?> </tbody> </table> <div class="summary-section"> <div class="amount-words"> <p><strong>Invoice Amount In Words:</strong></p> <p class="words-text"><?= $amount_in_words ?></p> </div> <div class="amount-summary"> <table class="summary-table"> <tr><td>Sub Total</td><td><?= number_format($invoice['sub_total'],2) ?></td></tr> <tr><td>Tax Total</td><td><?= number_format($invoice['tax_total'],2) ?></td></tr> <tr><td>Total</td><td><?= number_format($invoice['grand_total'],2) ?></td></tr> <tr class="received"><td>Received</td><td>0.00</td></tr> <tr class="balance"><td>Balance</td><td><strong><?= number_format($invoice['grand_total'],2) ?></strong></td></tr> </table> </div> </div> <!-- Add Bank Details, Terms, QR Code, Sign, Acknowledgment same as your HTML --> <div class="bank-terms-section"> <div class="terms"> <p class="section-title" style="font-size: 16px;">Terms and conditions</p> <ul> <li>Amount once paid is not refundable.</li> <li>Balance payment has to be done within the stipulated timeline.</li> <li>Additional services except mentioned in quotation would charge extra.</li> <li>GST charges not applicable.</li> </ul> </div> <div class="bank-details"> <p class="section-title" style="font-size: 16px;">Bank Details</p> <p><strong>Name:</strong> KOTAK MAHINDRA BANK LIMITED</p> <p><strong>Branch:</strong> Vashi , Navimumbai </p> <p><strong>Account No.:</strong> 9614545938</p> <p><strong>IFSC code:</strong> KKBK0000669</p> <p><strong>Account Holder's Name:</strong> Salil Dastagir Mulla</p> </div> <!-- <div class="qr-code"> <p class="section-title" style="font-size: 16px;">SCAN TO PAY <img src="logo/UPI_logo.svg.png" width=35px; alt="UPI Logo"></p> <img src="logo/barcode.png" width="100px;" alt="QR Code"> </div> --> <!-- ✅ Display QR Section --> <?php // Payment details $upi_id = "9768676862@ptsbi"; $payee_name = "Kreative Pixelz"; $amount = $total; // Example: total amount $note = "Invoice Payment - {$invoice['invoice_no']}"; // UPI payment string $upi_string = "upi://pay?pa={$upi_id}&pn={$payee_name}&am={$amount}&cu=INR&tn={$note}"; // --- Generate QR code locally using Google Chart alternative (PHP QR Encoder) --- function generateQRCode($data, $size = 200) { $url = 'https://api.qrserver.com/v1/create-qr-code/?data=' . urlencode($data) . '&size=' . $size . 'x' . $size; $qr_image = file_get_contents($url); $base64 = base64_encode($qr_image); return 'data:image/png;base64,' . $base64; } $qr_image_src = generateQRCode($upi_string); ?> <div class="qr-code" style="text-align:center; "> <p class="section-title" style="font-size:16px; margin-bottom:20px;"> SCAN TO PAY <img src="logo/UPI_logo.svg.png" width="35" alt="UPI Logo" style="vertical-align:middle;"> </p> <!-- ✅ QR Code Image --> <img src="<?php echo $qr_image_src; ?>" width="100" height="100" alt="UPI QR Code" style="margin-bottom:10px;"> </div> <?php /* <!-- <div class="qr-code" style="text-align:center;margin-top:20px;"> <p class="section-title" style="font-size:16px;"> SCAN TO PAY <img src="logo/UPI_logo.svg.png" width="35" alt="UPI Logo"> </p> <img src="<?php echo $qr_api_url; ?>" width="160" height="160" alt="UPI QR Code"> <p><strong>Amount: ₹<?php echo number_format($amount, 2); ?></strong></p> <p style="font-size:14px;">Pay to: <?php echo $payee_name; ?></p> </div> ----> */ ?> <div class="sign-code"> <p class="section-title" style="font-size: 16px;">Kreative Pixelz </p> <br><img src="logo/sign1.png" width="150px;" alt="Authorized Signature"> <br> <p class="text-center">Authorized Signatory </p> </div> </div> <!-- =================== ACKNOWLEDGMENT SECTION =================== --> <div class="acknowledgement-section"> <p class="section-title" style="margin-bottom:0px;text-align:center;">Acknowledgment</p> <h2 class="text-center" style="text-align:center;margin:0px;color:#3a6c9c">Kreative Pixelz</h2> <br> <div class="ack-details"> <div class="received-info"> <p class="section-title"><?php echo $invoice['client_name']; ?></p> <p><strong>Address:</strong> <?php echo $invoice['client_address']; ?></p> <p><strong>Contact No:</strong> <?php echo $invoice['client_contact']; ?></p> </div> <div class="ack-invoice-info"> <p class="section-title"><strong>Invoice Details</strong></p> <p><strong>Invoice No.:</strong> <?php echo $invoice['invoice_no']; ?></p> <p><strong>Invoice Date:</strong> <?php echo $invoice_date; ?></p> <p><strong>Invoice Amount:</strong> <?php echo number_format($total, 2); ?></p> <div style="margin-top: 45px;"></div> </div> <div class="ack-signature"> <p class="section-title">Receiver's Seal & Sign</p> <div class="signature-line"></div> <div style="margin-top: 60px;"></div> </div> </div> </div> <!-- Just like in your static version --> <footer class="invoice-footer"> <p class="thank-you"><b>This is an computer generated invoice & hence do not require any signature</b></p> </footer> --> </div> <script> window.print(); </script> </body> </html>