<!DOCTYPE HTML>
<?php
	require '../config/dbcon.php';
?>
<html lang = "en">
	<head>
	<title>Update Stock</title>
	<script type="text/javascript">
    	function preventBack() {
    		window.history.forward();
    	}
    	setTimeout("preventBack()", 0);
    	window.onunload = function() {
    		null
    	};
    </script>
		<meta charset = "UTF-8" name = "viewport" content = "width=device-width, initial-scale=1" />
		<link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css" />
		<link rel = "stylesheet" type = "text/css" href = "css/jquery.dataTables.css"/>
	</head>
<body>
	<nav class = "navbar navbar-default">
		<div class = "container-fluid">
			<!--a class = "navbar-brand" href = "https://sourcecodester.com">Sourcecodester</a-->
		</div>
	</nav>
	<div class = "col-md-12 well" style="width: 98%; margin-left : 20px; overflow:auto; height: 35%;">
		<hr style = "border-top:1px dotted #000;"/>
		<form action = "upload.php" class = "form-inline" method = "POST" enctype = "multipart/form-data">
			<div class = "form-group">
				<label>CSV File: <input type = "file" name = "file" class = "form-control"/></label>
				<button type = "submit" name = "save" class = "btn btn-primary form-control"><span class = "glyphicon glyphicon-upload"></span> UPLOAD</button>
			</div>
		</form>
		<br />
		<table id = "table" class = "table table-bordered">
			<thead>
				<tr>
					<th style = "width:100px; text-align: left">EDIT</th>
					<th style = "width:100px; text-align: left">PART_NUMBER</th>
        			<th style = "width:400px; text-align: left">PART_DESCRIPTION</th>
        			<th style = "width:100px; text-align: right">LIST</th>
        			<th style = "width:100px; text-align: right">MOQ</th>
        			<th style = "width:100px; text-align: right">LYSALES</th>
        			<th style = "width:100px; text-align: right">CYSALES</th>
        			<th style = "width:100px; text-align: right">TO_ORDER</th>
        			<th style = "width:100px; text-align: right">STOCK</th>
        			<th style = "width:100px; text-align: right">COST</th>
        			<th style = "width:100px; text-align: right">RATE</th>
        			<th style = "width:100px; text-align: right">OPENING</th>
        			<th style = "width:100px; text-align: right">RECEIVED</th>
        			<th style = "width:100px; text-align: right">PENDING</th>
        			<th style = "width:100px; text-align: right">DISPATCH</th>
        			<th style = "width:100px; text-align: right">AAL_PO</th>
        			<th style = "width:100px; text-align: right">PY_STK</th>
        			<th style = "width:100px; text-align: right">TOD_COST</th>
        			<th style = "width:100px; text-align: right">GP</th>
        			<th style = "width:150px; text-align: left">SEGMENT</th>
				</tr>
			</thead>
			<tbody>
				<?php
					$query = $connect->query("SELECT * FROM venkat order by PART_NUMBER");
					while($fetch = $query->fetch_array()){
				?>
				<tr>
					<td style="text-align: left"><?php echo $fetch['Edit']?></td>
					<td style="text-align: left"><?php echo $fetch['PART_NUMBER']?></td>
					<td style="text-align: left"><?php echo $fetch['PART_DESCRIPTION']?></td>
					<td style="text-align: right"><?php echo $fetch['LIST']?></td>
					<td style="text-align: right"><?php echo $fetch['MOQ']?></td>
					<td style="text-align: right"><?php echo $fetch['LYSALES']?></td>
					<td style="text-align: right"><?php echo $fetch['CYSALES']?></td>
					<td style="text-align: right"><?php echo $fetch['TO_ORDER']?></td>
					<td style="text-align: right"><?php echo $fetch['STOCK']?></td>
					<td style="text-align: right"><?php echo $fetch['COST']?></td>
					<td style="text-align: right"><?php echo $fetch['RATE']?></td>
					<td style="text-align: right"><?php echo $fetch['OPENING']?></td>
					<td style="text-align: right"><?php echo $fetch['RECEIVED']?></td>
					<td style="text-align: right"><?php echo $fetch['PENDING']?></td>
					<td style="text-align: right"><?php echo $fetch['DISPATCH']?></td>
					<td style="text-align: right"><?php echo $fetch['AAL_PO']?></td>
					<td style="text-align: right"><?php echo $fetch['PY_STK']?></td>
					<td style="text-align: right"><?php echo $fetch['TOD_COST']?></td>
					<td style="text-align: right"><?php echo $fetch['GP']?></td>
					<td style="text-align: left"><?php echo $fetch['SEGMENT']?></td>
				</tr>
				<?php	
					}
				?>
			</tbody>
		</table>
	</div>
</body>
<script src = "js/jquery-3.2.1.js"></script>
<script src = "js/jquery.dataTables.js"></script>
<script type = "text/javascript">
	$(document).ready(function(){
		$('#table').DataTable();
	});
</script>
</html>