<style>
  .pwbtn{
    width:50px;
	cursor:pointer;
	margin-left:15px;
  }
  .tblfont{
    font-size:25px;
	margin: 0px 5px 0px 5px;
  }
  .infomsg{
    color:#0000FF; 
	font-size:18px;
  }
  .errmsg{
    color:#FF0000; 
	font-size:18px;
  }	
</style>

<script>
  var loadImage = function(event){
	  var myphoto = document.getElementById('myphoto');
	  myphoto.src = URL.createObjectURL(event.target.files[0]);
	  myphoto.onload = function(){
		  URL.revokeObjecjtURL(myphoto.src)
	  }
  };
  
  function saveSubmit(){
    document.getElementById("frmAdd").submit();
  }
</script>

<?php
  $myprod = new PRODUCT();
  $arrProd = $myprod->getProducts(" ORDER BY tb_order ");
?>
<?php
if( !empty($_SESSION["infomsg"])){
  echo "<span class='infomsg'>" . $_SESSION["infomsg"] . "</span>";
  unset($_SESSION["infomsg"]);
}
?>
<?php
if( !empty($_SESSION["errmsg"])){
  echo "<span class='errmsg'>" . $_SESSION["errmsg"] . "</span>";
  unset($_SESSION["errmsg"]);
}
?>
<?php
if( !empty($_GET["ty"]) ){
  $tblcol = "6";
}else{
  $tblcol = "5";
}
?>


<form action="pg_stock_up.php" method="post">
<table border="1" style="border-collapse:collapse">
  <tr>
    <td colspan="<?= $tblcol ?>">
	
    <?php
	include "pg_stock_header.php";
	?>
	
	</td>
  </tr>
<?php
foreach($arrProd as $tid=>$tprod){
  if($tprod["pstatus"]==0){
    $mystyle="text-decoration:line-through; color:#999999";
  }else{
    $mystyle="";
  }
  ?>
  <tr style="<?= $mystyle ?>">
	<td><span class="tblfont"><img style="height:32px;" src="../img/<?= $tprod["photo"] ?>" /></span></td>
    <td><span class="tblfont"><?= $tprod["name"] ?></span></td>
	<td><span class="tblfont"><?= $tprod["ename"] ?></span></td>
	<td align="center"><span class="tblfont"><?= $tprod["stock"] ?></span></td>
	<?php
	if( $_GET["ty"]!="" ){
	  $txtup = "txtval[$tid]";
	  ?>
	  <td align="center"><input type="text" style="width:50px; height:30px; text-align:center" name="<?= $txtup ?>" /></td>
	  <?php
	}
	?>
  </tr>
  <?php
}
?>
</table>
</form>