Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.133.136.95
Current Path : /var/www/html/oums/ |
| Current File : /var/www/html/oums/items.php |
<!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="jscript/mainpage.js" type="text/javascript"></script>
<script src="jquery/jquery-3.1.0/jquery.min.js" type="text/javascript"></script>
<SCRIPT TYPE="text/javascript">
$(document).ready(function() {
$("#del").click(function() {
if ($('input[type=checkbox]:checked').length < 1) {
alert("Select records to delete!");
return false;
}
});
});
</SCRIPT>
</head>
<body>
<?php
include("header.php");
include("sys_module.php");
get_page_info(basename($_SERVER['PHP_SELF']));
@$page_mode = "";
?>
<form name="<?php echo @$link_name; ?>" id="<?php echo @$link_name; ?>" action="<?php echo @$link_path; ?>" method="post">
<div id="page-middle">
<div class="page-container-head">
<div id="page-container-titl"><?php echo @$page_mode . " " . @$link_tit; ?></div>
<div id="page-container-link"><?php echo @$link_but; ?></div>
</div>
<div id="page-container-body">
<div class="grid_outer">
<table class="table_grid" border="1">
<tr>
<th> # </th>
<th> Item Code </th>
<th> Item Name </th>
<th> Cat. Code </th>
<th> Min. Qty. </th>
<th> Max. Qty. </th>
<th> Pack. Qty. </th>
<th> <input type="checkbox" id="CheckAll" name="CheckAll" onClick="check_all(document.items)" /></th>
</tr>
<?php
include("mysql_db_connect.php");
$mysql = "select * from masitem order by fitemcode";
$myres = mysqli_query($mycon, $mysql);
$i = 0;
while ($row = @mysqli_fetch_assoc($myres)) {
if ($i % 2 == 0) {
$classname = "evenRow";
} else {
$classname = "oddRow";
}
?>
<tr class="<?php if (isset($classname)) echo $classname; ?>" ondblClick="window.location='items_save.php?id=<?php echo $row["fitemcode"]; ?>'">
<td width="3%" align="center"> <?php echo $i + 1; ?> </td>
<td width="10%" align="center"><?php echo $row["fitemcode"]; ?></td>
<td width="40%" align="left"><?php echo $row["fitemname"]; ?></td>
<td width="10%" align="center"><?php echo $row["fitemtype"]; ?></td>
<td width="10%" align="center"><?php echo $row["fminiquan"]; ?></td>
<td width="10%" align="center"><?php echo $row["fmaxiquan"]; ?></td>
<td width="10%" align="center"><?php echo $row["fpackquan"]; ?></td>
<td width="3%" align="center"><input type="checkbox" name="check_list[]" id="check_list[]" value="<?php echo $row["fitemcode"]; ?>"></td>
</tr>
<?php
$i++;
}
?>
</table>
</div>
</div>
</div>
</form>
</body>
</html>
<?php
if (isset($_POST['delete'])) { //check to see if the delete button has been pressed
include("mysql_db_connect.php");
if (isset($_POST['check_list'])) { //check to see if any boxes have been checked
$num = 0; //used to count the number of rows that were deleted
$box = $_POST['check_list'];
while (list($key, $val) = @each($box)) { //loop through all the checkboxes
if (strtoupper($val) == "") {
echo ("<script language=\"JavaScript\" type=\"text/JavaScript\">\n");
echo ("alert('Items cannot be deleted!');\n");
echo ("</script>\n");
} else {
$num++;
$mysqldel = "delete from masitem where fitemcode='$val'"; //delete any that match id
$resdel = mysqli_query($mycon, $mysqldel); //send the query to mysql
}
}
if ($num > 0) {
//print the logs that were deleted
echo "<meta http-equiv=\"refresh\" content=\"0;URL=items.php\">";
echo ("<script language=\"JavaScript\" type=\"text/JavaScript\">\n");
echo ("alert(\"$num\"+' items deleted!');\n");
echo ("</script>\n");
}
} else { //no boxes checked
echo ("<script language=\"JavaScript\" type=\"text/JavaScript\">\n");
echo ("alert('No items selected!');\n");
echo ("</script>\n");
}
}
?>
|