<?php
$con=mysqli_connect("localhost","primarysales","S5L7lF01EQZvQrGK","primarysales_dianaold");
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED);
//including the database connection file


require "racs.php";
require "vtshows.php";
require "style.php";

session_start();// Starting Session
// Storing Session
$user_check=$_SESSION['usernames'];
// SQL Query To Fetch Complete Information Of User
$result=mysqli_query($con,"select usernames from sprdusers where usernames='$user_check'");
$row = mysqli_fetch_assoc($result);
$login_session =$row['usernames'];
if(!isset($login_session)){
mysqli_close($con); // Closing Connection
header('Location:index.php'); // Redirecting To Home Page
}

//getting id from url
$id = $_GET['id'];
//selecting data associated with this particular id
$resultt = mysqli_query($con,"SELECT * FROM whitems WHERE id=$id");
while($row = mysqli_fetch_array($resultt))
{
$name = $row['item_names'];
$pbox = $row['uoms'];
$ppwgt= $row['packet_weight'];
$ndj= $row['packets_per_box'];
$ndr= $row['whole_sale_price'];
$nidd= $row['retail_price'];
$nemn=$row['whole_sale_price']/$row['packets_per_box'];
$ndesg=$row['item_ranges'];
$nwa=$row['sub_ranges'];
$nresig=$row['nresig'];
$ndbcl=$row['ndbclear'];
$nhdcl=$row['nhodclear'];
$nstp=$row['nsettype'];
$nsts=$row['nstatus'];
$ncetsts=$row['ncetissue'];
$npdt=$row['paydate'];
$nrcm=$row['nrecom'];
$nrmrk=$row['nsetdetails'];
$nsetdetails=$row['nsetdetails'];
$paymentdetails=$row['paydetails'];
$nclfileno=$row['nclfileno'];
$pamount=$row['paidamount'];
$dbosamount=$row['ndbos'];
}
?>

<!DOCTYPE html>
<html>
<head>
<?php
include('style.php');
?>
<ul>
 <li><a href="#">Phase-1</a></li>
  <li><a href="#">Phase-2</a></li>
  <li><a href="#">Phase-3</a></li>
  <li><a href="#">Phase-4</a></li>
    <li><a href="stkadd.php">Inventry</a></li>
  <ul style="float:right;list-style-type:none;">
  <li><aa href="#">Welcome | <?php echo $login_session; ?></aa></li>
  <li><a class="active" href="stkadd.php">Home</a></li>
  <li><a href="index.php">Logout</a></li>
  </ul>
</ul>

<heading>
<h1>DTPL-WH-Inventry-Update Form</h1>
</heading>

</head>

<nav>
<h>Quick Links</h><br>
<a href="stkadd.php">Add New</a><br>
<a href="repsum.php">View Summary</a><br>
</nav>

<pragra>
Update the form and press Update button for validation
</pragra>

<body>
<form name="form1" method="post" action="savetra.php">
<table border="5">

<tr>
<td>Item-Name</td>
<td><?php echo $name;?></td>
</tr>
<tr>
<td>Date</td>
<td><input type="date" name="jcdate" value="" required="on"></td>
</tr>
<tr>
<td>Receipt</td>
<td><input type="text" name="rcpts" value="" required="off" autocomplete="off"></td>
</tr>
<tr> 
<td>Issue</td>
<td><input type="text" name="isus" value="" required="off" autocomplete="off"></td>
</tr>
<tr>
<td>DCPL</td>
<td><input type="text" name="dcpls" value="" required="off" autocomplete="off"></td>
</tr>
<tr>
<td>New-Plant</td>
<td><input type="text" name="npl" value="" required="off" autocomplete="off"></td>
</tr>	
<tr>
<td>Return</td>
<td><input type="text" name="rtns" value="" required="off" autocomplete="off"></td>
</tr>
<!--<tr>
<td>Re-Marks</td>
<td><textarea name="comments" id="comments" style="font-family:sans-serif;font-size:1.2em;">
</textarea><br></td>
</tr>-->
<tr>
<td><input type="hidden" name="wgtt" value="<?php echo $pbox;?>"><input type="hidden" name="pbxx" value="<?php echo $ndj;?>"><input type="hidden" name="wsp" value="<?php echo $ndr;?>"><input type="hidden" name="ppp" value="<?php echo $nemn;?>"><input type="hidden" name="id" value="<?php echo $_GET['id'];?>"><input type="hidden" name="itname" value="<?php echo $name;?>"><input type="hidden" name="itrange" value="<?php echo $ndesg;?>"><input type="hidden" name="itsbrange" value="<?php echo $nwa;?>"></td>
<td><input type="submit" name="update" value="Update"></td>
</tr>
</table>
</form>
</body>
</html>
