$date = date("Y-m-d"); $time = date("h:i:sa"); if (isset($num)) { $row = $objBuyer->get_buyer($num); if ($row == null) { $objBuyer->add_buyer($num, $name, 1); } else { //do discount stuff } $more = TRUE; $i = 0; $totalcost = 0; while ($more) { if (isset($_REQUEST['pcode' . $i]) && $_REQUEST['pcode' . $i] != "") { //get selling price of product $row = $objProduct->get_product($_REQUEST['pcode' . $i]); $sp = $row['selling_price']; //add to transaction products $objTransp->add_transaction_product($_REQUEST['pcode' . $i], $_REQUEST['quant' . $i], $date, $time, $num, "obed.nsiah"); //reduce product quantity $objProduct->decrease_stock_level($_REQUEST['pcode' . $i], $_REQUEST['quant' . $i]); $totalcost += $_REQUEST['quant' . $i] * $sp; } else { $more = FALSE; } $i++; } $objTrans->add_transaction($date, $time, $num, "obed.nsiah", $totalcost); if ($totalcost > 500) { //send sms about 10% discount; }
$product_id = $_GET['delete']; $terminallist->delete_item_list($product_id); return 'sucess'; } // Terminal Add Function if (isset($_POST['action']) && $_POST['action'] == 'add') { $product_qty = $_POST['latestqty']; $terminallist->add_item_list($product_qty); return 'sucess'; } // Terminal Switch Function if (isset($_POST['action']) && $_POST['action'] == 'switch') { $id = $_POST['id']; unset($_SESSION['terminal_list']); $_SESSION['terminal_list'] = $_SESSION['hold_session'][$id]; unset($_SESSION['hold_session'][$id]); $_SESSION['faizan'] = 1; return 'sucess'; } // Get Single Product Detail for Add Product in Warehouse Page if (isset($_POST['action']) && $_POST['action'] == 'getproductdetail') { $getproduct = $_POST['getproduct']; header('Content-Type: application/json'); echo json_encode($product->get_product($getproduct)); } // Get Single Product Detail for Add Product in Inventory Page if (isset($_POST['action']) && $_POST['action'] == 'getwarehouseproductdetail') { $getproduct = $_POST['getproduct']; header('Content-Type: application/json'); echo json_encode($warehouse->get_products_detail($getproduct)); }
session_start(); if (isset($_GET['selected_pID'])) { if (!empty($_GET['selected_pID'])) { $products = new product($_GET['selected_pID']); $subcategory = new Subcategory($products->scID); $data['cID'] = $subcategory->cID; $data['pro'] = (array) $products; $data = json_encode($data); echo $data; exit; } } if (isset($_GET['selected_scID'])) { if (!empty($_GET['selected_scID'])) { $products = new product(); $data = $products->get_product($_GET['selected_scID']); } } if (isset($_POST['edit_ok'])) { $isValid = True; if (isset($_POST['insert_pName'])) { if (empty($_POST['insert_pName'])) { $isValid = False; $arrErrors[] = 'insert_pName'; } else { $product = new product($_POST['pID']); if ($_POST['insert_pName'] != $product->pName) { $isExist = $product->isUniqueName($_POST['insert_pName']); if ($isExist) { $arrErrors['isUnique'] = 'this product name already exist'; $isValid = False;
<li><a href="inventory.php">Inventory</a></li> <li class="active">Add Inventory Products</li> </ol> <div class="panel panel-info"> <div class="panel-heading"> <h3><?php echo isset($_GET['id']) ? 'Update' : 'Add'; ?> Inventory Products</h3> </div> <div class="panel-body"> <!-- BEGIN DATA TABLE --> <?php $product = new product(); $all_product = $product->get_product(); $warehouse = new warehouse(); $all_product_warehouse = $warehouse->get_products(); $inventory = new inventory(); $ID = isset($_GET['id']) ? $_GET['id'] : NULL; if (isset($_POST['add_inventory'])) { // Update old record if (isset($ID)) { $results = $inventory->inv_update($_POST, $ID); } else { // Insert new $results = $inventory->inv_insert($_POST); } if ($results) { echo '<div class="alert alert-success alert-block fade in alert-dismissable"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php require_once 'header.php'; ?> <section> <hr/> <div class="container"> <div class="row"> <div class="tableHeading"> <p class="nomargin alignCenter">View Products</p> </div> <div class="col-md-12"> <?php $product = new product(); $results = $product->get_product(); if ($results) { ?> <table border="1" cellpadding="5" cellspacing="0" class="table table-hover tableView"> <tr> <th>Product Name</th> <th>Product Supplier</th> <th>Product Cost</th> <th>Product Price</th> <th>Product GST</th> <th>Action</th> </tr> <?php foreach ($results as $res) { echo '<tr>'; echo '<td>' . $res->p_name . '</td>'; echo '<td>' . $res->p_supplier . '</td>';
function get_product() { include_once 'product.php'; $barcode = $_GET['barcode']; $obj = new product(); if (!$obj->connect()) { $json = '{"status":2, "products":{}, "message":"Failed to connect to the database."}'; echo $json; exit; } if ($obj->get_product($barcode)) { $row = $obj->fetch(); $json = '{"status": 0, "products":' . json_encode($row) . ', "message": "Found product."}'; echo $json; } else { $json = '{"status":1, "products":{}, "message":"Sorry we could not execute that."}'; echo $json; } }