<table class="webforms mt-0 table-responsive-sm">
			 <tbody id="productrowbox">
			 <tr>
				<th width="30%">Product</th>
				<th width="10%">Instock</th>
				<th width="30%">Quantity</th>
				<th width="30%">&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.value,'<?php echo $rowidx;?>');" >
                                                                <option value="">--Select Product Name--</option>
<?php
if(is_array($productlist) && count(array_filter($productlist))>0)
{
	$instocktoshow = 0;
	foreach($productlist as $itemrow)
	{
		$sel_item ="";
		$instock = ($itemrow->incoming-$itemrow->outgoing);
		if($rowinfo->fld_productid==$itemrow->fld_productid)
		{
			$sel_item = 'selected="selected"';
			$instock = ($itemrow->incoming-$itemrow->outgoing)+$rowinfo->fld_qty;
			$instocktoshow = $instock; 
		}	
		
			?>
					<option value="<?php echo $itemrow->fld_productid."_".$instock;?>"  <?php echo $sel_item;?>><?php echo $itemrow->fld_name;?></option>
			<?php
		
	}
}
?> 
				</select>
			</td>
			<td id="instock<?php echo $rowidx;?>">

			<?php echo $instocktoshow;?>
			<span id="rcvdmsg1" class=""></span></td>
			<td><input type="text" name="qty[]" id="qty<?php echo $rowidx;?>"  placeholder="Quanity" value="<?php echo $rowinfo->fld_qty;?>" required="required" data-validation-required-message="This field is required" aria-invalid="false" onchange="checkQtyRCVD('<?php echo $rowidx;?>');" onkeypress='return event.charCode >= 48 && event.charCode <= 57 || event.charCode==46'>

			<span id="qtymsg<?php echo $rowidx;?>" class=""></span></td>
			<td><input type="hidden" step="any" name="price[]" id="price<?php echo $rowidx;?>"  placeholder="Price" value="<?php echo $rowinfo->fld_price;?>" required="required" data-validation-required-message="This field is required" aria-invalid="false" onchange="calcPurchaseAmt();" onkeypress='return event.charCode >= 48 && event.charCode <= 57 || event.charCode==46' >

			<?php
			if($iix==0)
			{
			?>
			<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>
			<?php
			}
			else
			{
			?>
			<a class="btn btn-danger text-white" style="cursor:pointer" onclick="return removerow('<?php echo $rowidx;?>','product', 'edit', '<?php echo base_url();?>');">x</a>
			<?php
			}
			?>
			</td>
			</tr>					  
				<?php
						}
				?>
				<?php
					}
					else
					{
				?>
			 <tr id="productrow_1">
				<td><select  id="productid1" name="productid[]" required onchange="showproductinstock(this.value,'1');" >
                                                                <option value="">--Select Product Name--</option>
<?php
if(is_array($productlist) && count(array_filter($productlist))>0)
{
	
	foreach($productlist as $itemrow)
	{
		$sel_item ="";
		if($results->fld_productid==$itemrow->fld_productid)
		{
			$sel_item = 'selected="selected"';
		}	
		$instock = ($itemrow->incoming-$itemrow->outgoing);
			?>
					<option value="<?php echo $itemrow->fld_productid."_".$instock;?>"  <?php echo $sel_item;?>><?php echo $itemrow->fld_name;?></option>
			<?php
		
	}
}
?>                                                            </select></td>
				<td id="instock1">
															
															<span id="rcvdmsg1" class=""></span></td>
				<td><input type="text" name="qty[]" id="qty1"  placeholder="Quanity" value="" 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="qtymsg1" class=""></span></td>
				<td>
				<input type="hidden" step="any" name="price[]" id="price1"  placeholder="Price" value="0" required="required" data-validation-required-message="This field is required" aria-invalid="false" onchange="calcPurchaseAmt();" onkeypress='return event.charCode >= 48 && event.charCode <= 57 || event.charCode==46' >

				<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>
	
<?php
					}
		 ?>
		</tbody> 
		</table> 
		<table class="webforms mt-0 table-responsive-sm">
			 <tbody>
<input type="hidden" readonly step="any" name="productttotalamount" id="productttotalamount"  placeholder="Total Amount" value="<?php if($info4edit["main"]) { echo $info4edit["main"]->fld_amount; } else { echo "0"; }?>" required="required" data-validation-required-message="This field is required" aria-invalid="false">

		 <tr>
             <td></td>
             <td colspan="3"><button class="btn btn-danger">Submit</button></td>
         </tr>
		 </tbody> 
		</table> 