'.__('You don\'t have enough privileges to access this area!').''); } // if transaction is started if (isset($_POST['itemCode'])) { echo ''; echo ''; // update item data $item_code = $dbs->escape_string(trim($_POST['itemCode'])); if (!$item_code) { echo ''; echo ''; exit(); } // check item status first $item_check = $dbs->query("SELECT * FROM stock_take_item WHERE item_code='$item_code'"); $item_check_d = $item_check->fetch_assoc(); if ($item_check->num_rows > 0) { if ($item_check_d['status'] == 'l') { // record to log utility::writeLogs($dbs, 'staff', $_SESSION['uid'], 'stock_take', 'Stock Take ERROR : Item '.$item_check_d['title'].' ('.$item_check_d['item_code'].') is currently ON LOAN'); echo ''; } else if ($item_check_d['status'] == 'e') { echo ''; } else { $listShow = 0; if (isset($_POST['listShow']) && $_POST['listShow'] == '1') { $listShow = 1; } // current time $curr_time = date('Y-m-d H:i:s'); $update = $dbs->query("UPDATE stock_take_item SET status='e', checked_by='".$_SESSION['realname']."', last_update='".$curr_time."' WHERE item_code='$item_code'"); $update = $dbs->query("UPDATE stock_take SET total_item_lost=total_item_lost-1 WHERE is_active=1"); echo ''; } } else { // record to log utility::writeLogs($dbs, 'staff', $_SESSION['uid'], 'stock_take', 'Stock Take ERROR : Item Code '.$item_code.' doesnt exists in stock take data. Invalid Item Code OR Maybe out of Stock Take range'); echo ''; } echo ''; }