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 (0750) : /home2/imyrqtmy/public_html/thesmarthands/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php session_start(); $se = $_SESSION["id"]; if (!isset($_SESSION['id'])) { header("Location: login.php"); } include("inc/config.php");; ?> <!DOCTYPE html> <html lang="en"> <?php require "inc/head.php"; ?> <body> <!-- header--> <?php require "inc/header.php"; ?> <!-- End Main-content Top bar--> <!-- main-content--> <div class="wrapper"> <?php require "inc/sidebar.php"; ?> <div id="content"> <div class="row mb-4"> <div class="col-12"> <div class="card redial-border-light redial-shadow"> <div class="card-body"> <h6 class="header-title pl-3 redial-relative">Invoice</h6> <form action="add_invoice.php" method="post" enctype="multipart/form-data"> <div class="row"> <!-- Left Section: Invoice Details --> <div class="col-md-6"> <!-- Invoice Number --> <?php // Fetch the last invoice number $query = "SELECT invoice_number FROM invoices ORDER BY id DESC LIMIT 1"; $result = $conn->query($query); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $lastInvoiceNumber = $row['invoice_number']; // Extract the numeric part and increment it $numericPart = intval(substr($lastInvoiceNumber, 1)); $newInvoiceNumber = 'A' . str_pad($numericPart + 1, 5, '0', STR_PAD_LEFT); } else { // If no records exist, start with A00001 $newInvoiceNumber = 'A00001'; } ?> <div class="mb-2"> <label class="redial-font-weight-600">Invoice Number</label> <input type="text" name="invoice_number" class="form-control" value="<?php echo $newInvoiceNumber; ?>" readonly> </div> <!-- Invoice Date --> <div class="mb-2"> <label class="redial-font-weight-600">Invoice Date</label> <input type="date" name="invoice_date" class="form-control"> </div> <!-- Due Date --> <div class="mb-2"> <label class="redial-font-weight-600">Due Date</label> <input type="date" name="due_date" class="form-control"> </div> </div> <!-- Right Section: Logo --> <div class="col-md-6 text-center align-self-center"> <img src="dist/images/logo-v2.png" alt="" class="img-fluid" /> <!-- <label class="redial-font-weight-600">Company Logo</label> --> <!-- <div> <input type="file" name="company_logo" accept="image/*"> </div> --> </div> </div> <!-- Billing Details --> <div class="card billing"> <div class="row mt-4"> <!-- Billed By --> <div class="col-md-6"> <h6 class="redial-font-weight-600">Billed By <span style="font-size:11px">(Your Detail)</span></h6> <div class="mb-2"> <label for="">Your Company Name</label> <input type="text" name="own_company" class="form-control" value="Redial" placeholder="Your Company Name"> </div> <div class="mb-2"> <label for="">Your Phone</label> <input type="text" name="own_phone" value="9999999999" class="form-control" placeholder="Your Phone"> </div> <div class="mb-2"> <label for="">Your Email</label> <input type="email" name="own_email" value="info@gmail.com" class="form-control" placeholder="Your Email"> </div> <div class="mb-2"> <label for="">Your GSTIN</label> <input type="text" name="own_gst" value="GST123454434343" class="form-control" placeholder="Your Phone"> </div> </div> <!-- Billed To --> <div class="col-md-6"> <h6 class="redial-font-weight-600">Billed To <span style="font-size:11px">(Client Detail)</span></h6> <div class="mb-2"> <label for="">Company Name</label> <input type="text" name="cli_company" class="form-control" placeholder="Company Name"> </div> <div class="mb-2"> <label for="">Phone</label> <input type="text" name="cli_phone" class="form-control" placeholder="Phone"> </div> <div class="mb-2"> <label for="">Email</label> <input type="email" name="cli_email" class="form-control" placeholder="Email"> </div> <div class="mb-2"> <label for="">GSTIN</label> <input type="text" name="cli_gst" class="form-control" placeholder="GSTIN"> </div> </div> </div> </div> <!-- Product Details Table --> <div class="row mt-4"> <div class="col-12"> <h6 class="redial-font-weight-600">Product Details</h6> <table class="table table-bordered" id="productTable"> <thead> <tr> <th>Product Name</th> <th>Quantity</th> <th>Price</th> <th>Actions</th> </tr> </thead> <tbody> <tr> <td> <input type="text" name="product_name[]" class="form-control" placeholder="Product Name"> </td> <td> <input type="number" name="quantity[]" class="form-control" placeholder="Quantity"> </td> <td> <input type="text" name="price[]" class="form-control" placeholder="Price"> </td> <td> <!-- <button type="button" class="btn btn-danger removeRow" data-bs-toggle="tooltip" title="Delete Project"> <i class='fa fa-trash'></i> </button> --> <button type="button" class="btn btn-outline-danger removeRow"> <i class='fa fa-trash'></i></button> </td> </tr> </tbody> </table> <button type="button" id="addRow" class="btn btn-outline-primary">Add More</button> </div> </div> <!-- Submit Button --> <div class="row mt-4"> <div class="col-12 text-center"> <button type="submit" name="add_invoice" class="btn btn-outline-success">Submit Invoice</button> </div> </div> </form> </div> </div> </div> </div> </div> </div> <script> // Add More Product Rows document.getElementById('addRow').addEventListener('click', function () { const tableBody = document.querySelector('#productTable tbody'); const newRow = document.createElement('tr'); newRow.innerHTML = ` <td><input type="text" name="product_name[]" class="form-control" placeholder="Product Name"></td> <td><input type="number" name="quantity[]" class="form-control" placeholder="Quantity"></td> <td><input type="text" name="price[]" class="form-control" placeholder="Price"></td> <td> <button type="button" class="btn btn-outline-danger removeRow"> <i class='fa fa-trash'></i></button> </td>`; tableBody.appendChild(newRow); }); // Remove Product Row document.addEventListener('click', function (e) { if (e.target && e.target.classList.contains('removeRow')) { e.target.closest('tr').remove(); } }); </script> <!-- End Top To Bottom--> <!-- jQuery --> <script src="dist/js/plugins.min.js"></script> <script src="dist/js/common.js"></script> </body> </html>