<link rel="stylesheet" href="assets/css/select2.min.css"/>
<table class="webforms mt-0 table-responsive-sm">
			 <tbody id="productrowbox">
			 <tr>
				<th width="40%">Product</th>
				<th width="10%">Instock</th>
				<th width="10%">Qty. (Case)</th>
				<th width="10%">Qty. (Bottle)</th>
				<th width="20%">&nbsp;</th>
			</tr>
			<?php
			
					if($info4edit["info"])
					{
						for($iix=0;$iix<count($info4edit["info"]);$iix++)
						{
							$rowidx = $iix+1;
							$rowinfo = $info4edit["info"][$iix];
				?>
					  
				<tr id="productrow_<?php echo $rowidx;?>">
				<td>
					<input type="hidden" name="transactioninfoids[]" id="transactioninfoids<?php echo $rowidx;?>" value="<?php echo $rowinfo->fld_id;?>"> 				
					<select  id="productid<?php echo $rowidx;?>" name="productid[]" required onchange="showproductinstock(this);" class="js-example-basic-single nxtinput" >
                                                                <option value="">--Select Product Name--</option>
						<?php
						if(is_array($productlist) && count(array_filter($productlist))>0)
						{	
							foreach($productlist as $itemrow)
							{
								$sel_item ="";
								$instock = $itemrow['instock'];
								if($rowinfo->fld_productid==$itemrow['productid'])
								{
									$sel_item = 'selected="selected"';
									$instock = ($itemrow['instock']+$rowinfo->fld_qty);
									$instocktoshow = $instock; 
								}
								if($instock>0)
								{
								?>
										<option value="<?php echo $itemrow['productid']."_".$instock."_".$itemrow['noofbottlesincase'];?>"  <?php echo $sel_item;?>><?php echo $itemrow['name'];?></option>
								<?php
								}
							}
						}
						?> 
				</select>
			</td>
			<td id="instockproductid<?php echo $rowidx;?>"><?php echo $instocktoshow;?>
			</td>
			<td><input type="text" name="qty_case[]" id="qty_case<?php echo $rowidx;?>"  placeholder="Quanity" value="<?php echo $rowinfo->fld_qty_case;?>" onchange="checkQtyRCVD('<?php echo $rowidx;?>');" onkeypress='return event.charCode >= 48 && event.charCode <= 57 || event.charCode==46'>

			<span id="qty_caseemsg<?php echo $rowidx;?>" class=""></span></td>
			<td><input type="text" name="qty_bottle[]" id="qty_bottle<?php echo $rowidx;?>"  placeholder="Quanity" value="<?php echo $rowinfo->fld_qty_bottle;?>" onchange="checkQtyRCVD('<?php echo $rowidx;?>');" onkeypress='return event.charCode >= 48 && event.charCode <= 57 || event.charCode==46'>

			<span id="qty_bottleemsg<?php echo $rowidx;?>" class=""></span></td>
			<td  id="rowid<?php echo $rowidx;?>"></td>
			</tr>					  
				<?php
						}
				?>
				<?php
					}
					else
					{
				?>
			 <tr id="productrow_1">
				<td><select  id="productid1" name="productid[]" required onchange="showproductinstock(this);" class="js-example-basic-single nxtinput">
                                                                <option value="">--Select Product Name--</option>
						<?php
						if(is_array($productlist) && count(array_filter($productlist))>0)
						{	
							foreach($productlist as $itemrow)
							{
								if($itemrow['instock']>0)
								{
								?>
										<option value="<?php echo $itemrow['productid']."_".$itemrow['instock']."_".$itemrow['noofbottlesincase'];?>"  ><?php echo $itemrow['name'];?> </option>
								<?php
								}
							}
						}
						?>                                      
</select></td>
<td id="instockproductid1"><span id="rcvdmsg1" class=""></span></td>
<td><input type="text" name="qty_case[]" id="qty_case1"  placeholder="Quanity" value="0" required="required" data-validation-required-message="This field is required" aria-invalid="false" onchange="checkQtyRCVD('1');" onkeypress='return event.charCode >= 48 && event.charCode <= 57 || event.charCode==46'>
<span id="qty_caseemsg1" class=""></span></td>
<td><input type="text" name="qty_bottle[]" id="qty_bottle1"  placeholder="Quanity" value="0" required="required" data-validation-required-message="This field is required" aria-invalid="false" onchange="checkQtyRCVD('1');" onkeypress='return event.charCode >= 48 && event.charCode <= 57 || event.charCode==46'>
<span id="qty_bottleemsg1" class=""></span></td>
<td>&nbsp;</td>
</tr>
	
<?php
					}
		 ?>
		 
		</tbody> 
		</table> 
		<table class="webforms mt-0 table-responsive-sm">
			 <tbody>
			 <tr>
				 <td></td>
				 <td colspan="3" class="text-right"><a class="btn btn-success text-white" style="cursor:pointer" onclick="return addrow('<?php echo base_url();?>');"><i class="fa fa-plus"></i> Row</a></td>
			 </tr>
			 <tr>
				 <td></td>
				 <td colspan="3"><button class="btn btn-danger">Submit</button></td>
			 </tr>
		 </tbody> 
		</table> 
<script>
	$(document).ready(function() {
    $('.js-example-basic-single').select2();
});
    </script>
    <script src="assets/js/select2.min.js"></script>
