<?php 
  require_once("headUserAcc.php");
  if (isset($_POST['admin']))
 {

 
//////////////////
 ////////////// 
//$getS=$pcon->getSelectedShopOther($shopid);
// if ($getS->rowCount()>0) {
 // $shop=$getS->fetch();
 //}
       
?> 
 
  
 
   <!--NEW USER REGISTRATION FORM, DISPLAYED BY DEFAULTS IN PAGE LOAD-->


<center>
 

    <?php
      
    require_once('pharmacyNavLink.php');
 
  ?>
 
<label id="reg_form_tile_label">SUPER PHARMACY REGISTER ITEM LIST!.. </label></p/> 
 
 <!-- <table width="60%">
    <tr>
  <td  align="center">
    
      <form action="defaultShopingCenter.php" method="post">

            <label id="search_lab">
                       <i>
                          Search item here:-
                      </i> 
             </label>
                      <input type="text" class="hotel_info" height="25px" name="searchValue" id="searchValue"  onkeyup ="submision()">
                        <input class="hi" type="hidden" name="owniD" id="owniD" value="<?php // echo $ownID;?>">


                      <input class="hi" type="hidden" name="shopid" id="shopid" value="<?php // echo $shop['shopid'];?>">
 
                      <br/><i>You can search by name and category.</i>

            
      </form>
        
  </td>
</tr>
  </table>-->
<div id="result">
<table border="1" style="border-color:white;" id="reg_form_table">
  <tr>
       <td id="td_height" ><label id="inner_top">S/N</label>
       
       
       
       
        <form action="pharmacyitemlist.php" method="post">

                     <input class="hi" type="hidden" name="admin"  value="<?php echo $admin;?>">

 
                    <input  class="spos" type="submit" value="Order by sn" name="post">

                 </form>
       
       
       </td>
      <td width="40%" id="td_height" ><label id="inner_top">NAME</label>
      
      
      
        <form action="pharmacyitemlist.php" method="post">

                     <input class="hi" type="hidden" name="admin"  value="<?php echo $admin;?>">

 
                    <input  class="spos" type="submit" value="Order by name" name="post">

                 </form>
      
      
      
      </td> <td><label id="inner_top">WEIGHT / VOLUME</label></td>
              <td><label id="inner_top">CATEGORY</label></td>

               <td width="10%" id="td_height" ><label id="inner_top">OPERATION</label></td>

 <!--
                <td id="td_height" ><label id="inner_top">DESCRIPTION</label></td>-->
 
 
               <!-- <td id="td_height" ><label id="inner_top">PRICE</label></td><td  ><label id="inner_top">SELLING CURRENCY</label></td>
                 <td id="td_height" ><label id="inner_top">BEST SUPPLY</label></td>
                <td  ><label id="inner_top">OPERATION</label></td> -->
 
 
                </tr>  

 <input class="hi" type="hidden" name="owniDs" id="owniDs" value="<?php //echo $ownID;?>">


   <input class="hi" type="hidden" name="shopids" id="shopids"  value="<?php // echo $shopid;?>">


 <?php 
 $cc=0;
   /*$chk= $pcon->getShopItemPrices($shopid,$ownID);
      if ( $chk->rowCount()>0) {
       $ch=$chk->fetchAll();
    
    foreach ($ch as $key => $c) {

    $itemid=$c['itemID'];
    $item=$pcon->getThisItem($itemid);
    if ($item->rowCount()>0) {
    $p=$item->fetch();*/
    
      $post=$_POST['post'];
     if($post=="Order by sn"){
      $chkp= $pcon->getAllItemCheck();
      }
      else if($post=="Order by name"){
         $chkp= $pcon->getOrderNameAllItemCheck();
      }
    else{
        $chkp= $pcon->getAllItemCheck();//getShopItemPrices($shopid,$ownID);
        }
  
    
    
    //$chkp= $pcon->getAllItemCheck();//getShopItemPrices($shopid,$ownID);
      if ( $chkp->rowCount()>0) {
       $chp=$chkp->fetchAll();
    
    foreach ($chp as $key => $p) {

    $itemid=$p['itemid'];
   /* $item=$pcon->getCheckedShopItemPrices($itemid,$shopid,$ownID);//getThisItem($itemid);
    if ($item->rowCount()>0) {
    $c=$item->fetch();
      */
      $cc++; 
     
        ?>
 <tr>
      
     <td colspan="10" align="right">
       <sup id="rdn<?php echo $cc;?>"></sup>
     </td>
   </tr> 
  <tr>
 <td>
 
     <?php
          echo $p['s_no'];
       ?>
  </td> 
  <?php 
  /* <td> <?php echo   $p['itemname'];?></td>
  <td> <?php echo   $p['itemtype'];?></td>
  <td> <?php echo   $p['itemcategory'];?></td>*/
  ?>
  
   <td id="reg_form_table_cell">

        <input type="hidden" name="itemid<?php echo $cc;?>" id="itemid<?php echo $cc;?>" value="<?php echo $p['itemid'];?>"/>
         <textarea style="height:35px;" disabled="true" name="itemname<?php echo $cc;?>" id="itemname<?php echo $cc;?>"><?php echo $p['itemname'];?></textarea><br/>
         
  </td>
  
  <td>
 
     <input type="text" disabled="true" name="itemtype<?php echo $cc;?>" id="itemtype<?php echo $cc;?>" class="prof_info" value="<?php echo   $p['itemtype'];?>" />
       
  </td> 

  <td>
        <input type="text" disabled="true" name="itemcategory<?php echo $cc;?>" id="itemcategory<?php echo $cc;?>" class="prof_info" value="<?php echo   $p['itemcategory'];?>" />
  </td> 
    
  <td>
     <input type="submit"  name="postEdit<?php echo $cc;?>" id="postEdit<?php echo $cc;?>" value="Edit" id="submit" onclick="document.getElementById('itemcategory<?php echo $cc;?>').disabled=false;document.getElementById('itemname<?php echo $cc;?>').disabled=false;document.getElementById('itemtype<?php echo $cc;?>').disabled=false;$('#postEdit<?php echo $cc;?>').hide();$('#postUpdate<?php echo $cc;?>').show();" />


        <input type="submit" class="hi" name="postUpdate<?php echo $cc;?>" id="postUpdate<?php echo $cc;?>"value="Update" id="submit" onclick="  var itemtype=$('#itemtype<?php echo $cc;?>').val();var itemcategory=$('#itemcategory<?php echo $cc;?>').val();var itemname=$('#itemname<?php echo $cc;?>').val(); var itemid =$('#itemid<?php echo $cc;?>').val();if(itemname!='' && itemtype!='' && itemcategory!='') {$.post('updateItemDetailPro.php',{itemcategory:itemcategory,itemid:itemid,itemname:itemname,itemtype:itemtype},function(data){$('#rdn<?php echo $cc;?>').html(data).show();});document.getElementById('itemcategory<?php echo $cc;?>').disabled=true;document.getElementById('itemname<?php echo $cc;?>').disabled=true;document.getElementById('itemtype<?php echo $cc;?>').disabled=true;$('#postUpdate<?php echo $cc;?>').hide();$('#postEdit<?php echo $cc;?>').show();} else{document.getElementById('rdn<?php echo $cc;?>').innerHTML='Valide item detail required!..';}" />
  </td>
    
     
 
 
</tr>
 
 
  <?php
//}
}
  $cc=0;

 ?>
</table>
</div> 
</center>
 <?php
}
   
  }
  else{
    echo "NETWORK ERROR!";
  }
  //getAllItemCheck()
  ?>
<script>

  /*function submision(){
    
    var searchValue=$('#searchValue').val();

    var shopid=$('#shopid').val();

    var ownID=$('#owniD').val();
 ;
    $('#result').empty();
    $.post('searchMystockItemForEditing.php',{searchValue:searchValue,shopid:shopid,owniD:ownID},function(data){
      $('#result').html(data);

    });
  }
 
 */
</script>
<?php
 require_once('../footerIns.php');
?>




