 <?php 
 
if( isset($_POST['shopid']) && isset($_POST['owniD']))
  {
  require_once('../buda_pharmacy_class.php');
  $pcon= new buda_pharmacy_class();
 $shopid=$_POST['shopid'];
 $ownID=$_POST['owniD']; 
 $searchValue=$_POST['searchValue'];
//////////////////
 ////////////// 
$getS=$pcon->getSelectedShopOther($shopid);
 if ($getS->rowCount()>0) {
  $shop=$getS->fetch();
 }
    
      
?> 
 
  
 
   <!--NEW USER REGISTRATION FORM, DISPLAYED BY DEFAULTS IN PAGE LOAD-->


<center>
 

<table border="1" style="border-color:white;" id="reg_form_table">
  <tr>
      <td id="td_height" ><label id="inner_top">S/NO</label></td>
      <td id="td_height" ><label id="inner_top">NAME</label></td> <td><label id="inner_top">WEIGHT / VOLUME</label></td>
              <td><label id="inner_top">CATEGORY</label></td>

               <!-- <td id="td_height" ><label id="inner_top">MANUFACTURE (VENDOR)</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;
    $item=$pcon->getItemBySearch($searchValue);
    if ($item->rowCount()>0) {
    $pm=$item->fetchAll();
    foreach ($pm as $key => $p) {
      $itemid=$p['itemid'];
      $chk= $pcon->getThisShopItemPrice($itemid,$shopid,$ownID);
      if ( $chk->rowCount()<=0) {
       
      $cc++;
     
        ?>
   <tr>
      
     <td colspan="8" align="right">
       <sup id="rdn<?php echo $cc;?>"></sup>
     </td>
   </tr>
  <tr>
 <td >
 
     <?php
          echo $p['s_no'];
       ?>
  </td>
  <td >
 
     <?php
          echo $p['itemname'];
       ?>
  </td> 
  <td >
 
     <?php
          echo $p['itemtype'];
       ?>
  </td> 

  <td >
 
        <?php
            echo $p['itemcategory'];
         ?>
    </td> 
    <!-- <td >
 
        <?php
           // echo $p['vendor'];
         ?>
    </td> 
     <td >
 
        <?php
            //echo $p['description'];
         ?>
    </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'];?>"/>
         <input type="text" name="itemcost<?php echo $cc;?>" id="itemcost<?php echo $cc;?>" class="prof_info" /><br/>
         
  </td>
  

  

  <td id="reg_form_table_cell">

    
         <select name="currency<?php echo $cc;?>" id="currency<?php echo $cc;?>" class="prof_info">
          <option value="">select</option>
          <option value="TZS">TZS</option>
          <option value="USD">USD</option>
         </select>  
  </td>
  
 

  <td   >
        <input type="submit"  name="post" value="add" id="submit" onclick="var shopid=$('#shopids').val();var ownID=$('#owniDs').val();var currency=$('#currency<?php echo $cc;?>').val();var itemcost=$('#itemcost<?php echo $cc;?>').val(); var itemid =$('#itemid<?php echo $cc;?>').val();if(currency!='' && itemcost!='') {$.post('createStockPro.php',{itemid:itemid,owniD:ownID,currency:currency,shopid:shopid,itemcost:itemcost},function(data){$('#rdn<?php echo $cc;?>').html(data).show();});} else{document.getElementById('rdn<?php echo $cc;?>').innerHTML='Valide price and currency required!..';}" />
  </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'];?>"/>
         <input type="text" name="itemcost<?php echo $cc;?>" id="itemcost<?php echo $cc;?>" class="prof_info" /><br/>
         
  </td>
  
  <td id="reg_form_table_cell">

    
         <!--<select name="currency<?php// echo $cc;?>" id="currency<?php //echo $cc;?>" class="prof_info"/>
        <!--  <option value="">select</option>--
          <option value="TZS">TZS</option>
          <option value="USD">USD</option>
         </select>--> 
         
          <select name="currency<?php echo $cc;?>" id="currency<?php echo $cc;?>" class="prof_info">
          <option value="">select</option>
          <option value="TZS">TZS</option>
          <option value="USD">USD</option>
         </select>  
  </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'];?>"/>
         <input type="text" name="bestsupply<?php echo $cc;?>" id="bestsupply<?php echo $cc;?>" class="prof_info" /><br/>
         
  </td>

  <td   >
        <input type="submit"  name="post" value="add" id="submit" onclick="var shopid=$('#shopids').val();var ownID=$('#owniDs').val();var currency=$('#currency<?php echo $cc;?>').val();var itemcost=$('#itemcost<?php echo $cc;?>').val(); var bestsupply=$('#bestsupply<?php echo $cc;?>').val(); var itemid =$('#itemid<?php echo $cc;?>').val();if(currency!='' && itemcost!='' && bestsupply !='') {$.post('createStockPro.php',{itemid:itemid,bestsupply:bestsupply,owniD:ownID,currency:currency,shopid:shopid,itemcost:itemcost},function(data){$('#rdn<?php echo $cc;?>').html(data).show();});} else{document.getElementById('rdn<?php echo $cc;?>').innerHTML='Valide price and currency required!..';}" />
  </td>



<!---//////////////////////-->
</tr>
 
 
</form>
  <?php
}
}
 $cc=0;

 ?>
</table>
  
</center>
 <?php

    }
    else{
    echo "NETWORK ERROR!";
  }
  }
  else{
    echo "NETWORK ERROR!";
  }
  ?>
 





