[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: sales-product.php
<?php include("../admin/includes/functions/functions.php");?> <?php include("../admin/db/db.php");?> <?php if(!isset($_SESSION['username_Xw211qAAsq4'])) { header('Location: ../auth/'); exit(); } else{ $pageTitle1 = 'Product Stock'; $shopname = $_SESSION['business_name_Xw211qAAsq4']; $notificationType = "success"; if($_GET['SID']){ $ID = mysqli_real_escape_string($new,$_GET['SID']); $DEL = mysqli_query($new,"DELETE FROM supplier WHERE supplier_id = '$ID'"); echo "<script>"; echo "toastr." . $notificationType . "('Supplier deleted successfully')"; echo "</script>"; header("Location: suppliers"); } if(isset($_POST['update'])){ $pro_id = filter_input(INPUT_POST, 'pro_id', FILTER_SANITIZE_STRING); $pro_id = htmlspecialchars($pro_id, ENT_QUOTES, 'UTF-8'); $product_name = filter_input(INPUT_POST, 'product_name', FILTER_SANITIZE_STRING); $product_name = htmlspecialchars($product_name, ENT_QUOTES, 'UTF-8'); $qty = filter_input(INPUT_POST, 'qty', FILTER_SANITIZE_STRING); $qty = htmlspecialchars($qty, ENT_QUOTES, 'UTF-8'); $price = filter_input(INPUT_POST, 'price', FILTER_SANITIZE_STRING); $price = htmlspecialchars($price, ENT_QUOTES, 'UTF-8'); $supplier_id = filter_input(INPUT_POST, 'supplier_id', FILTER_SANITIZE_STRING); $supplier_id = htmlspecialchars($supplier_id, ENT_QUOTES, 'UTF-8'); $date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING); $date = htmlspecialchars($date, ENT_QUOTES, 'UTF-8'); $stmt = $con->prepare("update products set product_name = ?, qty = ?, price = ?, supplier = ?, date = ? where pro_id = ?"); $stmt->execute(array($product_name,$qty,$price,$supplier_id,$date,$pro_id)); // $responses = "<h5 class='btn btn-success'>Category updated successfuly</h5>"; } ?> <div id="layout-wrapper"> <div class="header-border"></div> <header id="page-topbar"> <?php include("includes/template/header.php");?> </header> <!-- Plugins css --> <link href="plugins/datatables/dataTables.bootstrap4.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/responsive.bootstrap4.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/buttons.bootstrap4.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/select.bootstrap4.css" rel="stylesheet" type="text/css" /> <title><?php echo $shopname?> || <?php echo $pageTitle1;?></title> <script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js'></script> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css'/> <!-- App css --> <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/theme.min.css" rel="stylesheet" type="text/css" /> <div class="vertical-menu"> <?php include("includes/template/sidebar.php");?> </div> <div class="main-content"> <div class="page-content"> <div class="container-fluid"> <!-- start page title --> <div class="row"> <div class="col-12"> <h4 class="mb-0 font-size-18">All Product stock</h4> <div class="page-title-box d-flex align-items-center justify-content-between"> </div> </div> </div> <!-- end page title --> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-body"> <button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target=".bd-example-modal-lg">Add product</button> <br /><br /> <table id="basic-datatable" class="table table-bordered"> <thead> <tr> <th>ID</th> <th>Product name</th> <th>Unit price</th> <th>Qty</th> <th>Supplier</th> <th>Date</th> <th>Action</th> </tr> </thead> <tbody> <?php $cont = 1; $stmt = $con->prepare("SELECT * FROM products,supplier WHERE products.supplier = supplier.supplier_id and products.business_name = ?"); $stmt->execute(array($shopname)); $rows_services = $stmt->fetchAll(); ?> <tr> <?php foreach($rows_services as $service){ ?> <td><?php echo $cont++;?></td> <td><?php echo $service['product_name'];?></td> <td><?php echo number_format($service['price'],2);?></td> <td><?php echo $service['qty'];?></td> <td><?php echo $service['supplier_name'];?></td> <td><?php echo $service['date'];?></td> <td> <?php $edit_data = "edit_".$service["pro_id"];?> <li class="list-inline-item" data-toggle="tooltip" title="Edit"> <a href="#" data-toggle="modal" data-target="#<?php echo $edit_data; ?>" data-placement="top"><i class="fa fa-edit"></i></a> </li> <li class="list-inline-item" data-toggle="tooltip" title="Delete"> <a class="mr-3" href="suppliers?SID=<?php echo $service['pro_id']; ?>" onclick="return confirm('Do you want to delete this service ?')"><i class="far fa-trash-alt" style="color:red"></i> </a> </li> <ul> <!-- EDIT Modal --> <div class="modal fade bd-example-modal-lg12" id="<?php echo $edit_data; ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo $edit_data; ?>" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-body"> <div class="modal-body" style="width: 100%"> <form class="row" enctype="multipart/form-data" method="post"> <div class="col-md-12 col-lg-6"> <div class="form-group row"> <label for="company_name" class="col-sm-5 col-form-label">Product name</label> <div class="col-sm-10"> <input type="text" name="product_name" class="form-control" value="<?php echo $service['product_name']; ?>" style="height : 45px;" autocomplete="off"> </div> </div> <input type="hidden" name="pro_id" value="<?php echo $service['pro_id']; ?>"> <div class="form-group row"> <label for="start_date" class="col-sm-5 col-form-label">Qty </label> <div class="col-sm-10"><input type="number" name="qty" value="<?php echo $service['qty']; ?>" class="form-control" style="height : 45px;" autocomplete="off"> </div> </div> </div> <br /> <div class="col-md-12 col-lg-6"> <div class="form-group row"> <label for="charge_payable" class="col-sm-5 col-form-label">Price </label> <div class="col-sm-10"> <input type="number" name="price" class="form-control" value="<?php echo $service['price']; ?>" style="height : 45px;" autocomplete="off"> </div> </div> <div class="form-group row"> <label for="start_date" class="col-sm-5 col-form-label"> Supplier name</label> <div class="col-sm-10"> <?php $stmt = $con->prepare("SELECT * FROM supplier WHERE business_name = ? order by supplier_name"); $stmt->execute(array($shopname)); $rows_categories = $stmt->fetchAll(); ?> <select class="form-control" name="supplier_id" required > <option value="">Select Supplier</option> <?php foreach($rows_categories as $category){ echo "<option value = '".$category['supplier_id']."'>"; echo $category['supplier_name']; echo "</option>"; } ?> </select> </div> </div> <div class="form-group row"> <label for="start_date" class="col-sm-5 col-form-label"> Date</label> <div class="col-sm-10"> <input type="date" name="date" class="form-control" value="<?php echo $service['date']; ?>" style="height : 45px;"> </div> </div> <br/> <div class="form-group col-md-4"> <button type="submit" name="update" class="btn btn-success form-control">Send</button> </div> </div> </form> </div> </div> </div> </div> </div> </li> </ul> </td> </tr> <?php };?> </tbody> </table> </div> <!-- end card body--> </div> <!-- end card --> </div><!-- end col--> </div> <!-- end row--> </div> <!-- container-fluid --> </div> <!-- End Page-content --> <?php include("includes/template/footer.php");?> </div> </div> <!-- Overlay--> <div class="menu-overlay"></div> <?php include("includes/modals/ProductModal.php");?> <!-- third party js --> <script src="plugins/datatables/jquery.dataTables.min.js"></script> <script src="plugins/datatables/dataTables.bootstrap4.js"></script> <script src="plugins/datatables/dataTables.responsive.min.js"></script> <script src="plugins/datatables/responsive.bootstrap4.min.js"></script> <script src="plugins/datatables/dataTables.buttons.min.js"></script> <script src="plugins/datatables/buttons.bootstrap4.min.js"></script> <script src="plugins/datatables/buttons.print.min.js"></script> <script src="plugins/datatables/dataTables.keyTable.min.js"></script> <script src="plugins/datatables/dataTables.select.min.js"></script> <!-- third party js ends --> <!-- Datatables init --> <script src="assets/pages/datatables-demo.js"></script> <!-- App js --> <script src="assets/js/theme.js"></script> </body> </html> <?php }?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.8 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002