
<?php 
	include_once 'connection.php';
	include 'models/purchase_model.php';
?>	
    <div class="col-md-12 main_div_class" id="add_new_service" style="padding-left:0px;">
       
		<div class="col-md-3 pull-left">
            
			<div class="form-group">
			    <label for="product" class="m-label">Product</label>
			     <?php include 'auto_product_list.php'; ?>
			    
			    
				<!--<select  class="select2 minimal form-control service_id input-height"  title="<?=$_GET['n'];?>"  onChange="get_product_plan(this);"  name="service_id[]" id="service_id">
					<option value="" selected>Select</option>
					<?php foreach($resData_group as $rows){ ?>
						 <optgroup label="<?=ucfirst($rows['group_name']);?>">
								<?php 
							     $keys = array_keys(array_column($resData_item,'group_id'),$rows['group_id']);
								for($tmp_i=0;$tmp_i<count($keys);$tmp_i++){
								?>
									<option  title="<?=$resData_item[$keys[$tmp_i]]['tax'];?>" value="<?=$resData_item[$keys[$tmp_i]]['item_id'];?>" <?php if($resData_purchase_lineitem[$line_number]['service_id'] == $resData_item[$keys[$tmp_i]]['item_id']) echo 'selected'; ?>><?=$resData_item[$keys[$tmp_i]]['item_name'];?></option>																	
								<?php } ?>
						 </optgroup>
					<?php } ?>
				</select>-->
				
				<input type="hidden" value="<?=$_GET['service_no'];?>" name="status_book[]">
				<a href="javascript:;" onclick="remove_items(<?=$_GET['n'];?>)" class="action-remove" id="remove_srv"><i class="fa fa-trash-o"></i></a>
			</div>
		</div>
		
	    
	
		
		<!--<div class="col-md-2 pull-left">
	    	<div class="form-group">
	    	    <label class="m-label">SGST %</label>
		        <input type="hidden" id="sgst_prcnt" readonly value='<?php if(isset($resData_purchase_lineitem[$line_number]['sgst_per'])) echo $resData_purchase_lineitem[$line_number]['sgst_per']; else echo '0'; ?>' class="sgst_prcnt form-control"  name="sgst_prcnt[]">
			    <label class="m-label">SGST Amount</label>
				<div class="input-group">
				<input type="number" id="sgst_amt" readonly title="<?=$_GET['n']; ?>" value='<?php if(isset($resData_purchase_lineitem[$line_number]['sgst_amt'])) echo $resData_purchase_lineitem[$line_number]['sgst_amt']; else echo '0'; ?>' class="sgst_amt input-height form-control" onChange="fun_cal(this)" onkeyup="fun_cal(this)"  name="sgst_amt[]">
	            <div class="input-group-append">
					<span class="input-group-text input-height " style="padding:4px" ><input style="width:45px;" value="" onChange="update_sgst_tax(this);" onkeyup="update_sgst_tax(this);"   type="number" min="1" title="<?=$_GET['n']; ?>" max="100" id="sgst_static_prcnt<?=$_GET['n']; ?>">%</span>
				</div>
		        </div>
			</div>
		</div>-->
	
		<div class="col-md-2 pull-left">
			<div class="form-group">
			    <label class="m-label">Service Qty</label>
				<input type="number" id="service_qty" min="1" value="<?php if(isset($resData_purchase_lineitem[$line_number])){ echo $resData_purchase_lineitem[$line_number]['service_qty'];  }else{ echo "1"; } ?>" class="form-control input-height service_qty" title="<?=$_GET['n'];?>" onChange="fun_cal(this)" onkeyup="fun_cal(this)"   name="service_qty[]">
			</div>
		</div>
	
		<div class="col-md-2 pull-left">
			<div class="form-group">
			    <label class="m-label">Price</label>
			    <?php if(isset($resData_purchase_lineitem[$line_number]['service_price_qty_total']))
			        {
			             $price_total = $resData_purchase_lineitem[$line_number]['service_price_qty_total'];
			      ?>
			         <input type="number" id="service_price" value="<?=$price_total;?>" class="service_price form-control input-height"  title="<?=$_GET['n'];?>" onChange="fun_cal_price(this)" onkeyup="fun_cal_price(this)" name="service_price[]">
			      <?php }else{ ?>
			       <input type="number" id="service_price" class="service_price form-control input-height"   title="<?=$_GET['n'];?>"  onChange="fun_cal_price(this)" onkeyup="fun_cal_price(this)" name="service_price[]">
			      <?php } ?>
			     
				
			</div>
		</div>
	
	    <div class="col-md-2 pull-left">
			<div class="form-group" style="display:none">
				<label for="service_price">Price per unit</label>
				<input type="number" id="price_per_unit" readonly value='<?php echo $resData_purchase_lineitem[$line_number]['service_price'];?>' class="price_per_unit form-control"  name="price_per_unit[]">
			</div>
			
			<div class="form-group">
		        <label class="m-label">CGST %</label>
				<input type="hidden" id="cgst_prcnt" readonly value='<?php if(isset($resData_purchase_lineitem[$line_number]['cgst_per'])) echo $resData_purchase_lineitem[$line_number]['cgst_per']; else echo '0'; ?>' class="tax form-control cgst_prcnt"  name="cgst_prcnt[]">
				<label class="m-label">CGST Amount</label>
				<div class="input-group">
				    <!--new tax fields-->
					<input type="hidden" readonly value='' title="<?=$_GET['n']; ?>" class="tax1_amt input-height form-control"  name="tax1_amt[]">
					<input type="hidden" readonly value='' title="<?=$_GET['n']; ?>" class="tax2_amt input-height form-control"  name="tax2_amt[]">
					<input type="hidden" readonly value='' title="<?=$_GET['n']; ?>" class="tax3_amt input-height form-control"  name="tax3_amt[]">
					<input type="hidden" readonly value='' title="<?=$_GET['n']; ?>" id="product_tax_type<?=$_GET['n']; ?>" class="input-height form-control"  name="tax_type[]">
		            <input   class="input-height  sum_ptax form-control" title="<?=$_GET['n']; ?>"  onChange="fun_cal(this)" onkeyup="fun_cal(this)"  type="number" min="1" max="100" id="sum_ptax<?=$_GET['n']; ?>"  value="" name="sum_ptax[]"> 
		            
		            <input   class="input-height  tax1_per form-control" title="<?=$_GET['n']; ?>"  onChange="fun_cal(this)" onkeyup="fun_cal(this)"  type="hidden" min="1" max="100" id="product_tax_1<?=$_GET['n']; ?>"  value=""  name="tax1_per[]"> 
		            <input  class="input-height tax2_per form-control" onChange="fun_cal(this)" onkeyup="fun_cal(this)"   title="<?=$_GET['n']; ?>" type="hidden" min="1" max="100" id="product_tax_2<?=$_GET['n']; ?>"  value=""   name="tax2_per[]">
		            <input  class="input-height tax3_per form-control" onChange="fun_cal(this)" onkeyup="fun_cal(this)"   title="<?=$_GET['n']; ?>" type="hidden" min="1" max="100" id="product_tax_3<?=$_GET['n']; ?>"  value=""   name="tax3_per[]">
		        
		        </div>
		    </div>
		</div>
		
		
	
		<div class="col-md-1 pull-left">
			<div class="form-group">
			    <!--<label class="m-label">Discount</label>-->
				<input type="hidden" id="service_discount" value="<?php if(isset($resData_purchase_lineitem[$line_number]['service_discount'])) echo $resData_purchase_lineitem[$line_number]['service_discount']; else echo '0'; ?>" class="service_discount input-height form-control" title="<?=$_GET['n'];?>" onChange="fun_cal(this)" onkeyup="fun_cal(this)"  name="service_discount[]">
			</div>
		</div>
		
		
		<div class="col-md-3 pull-left">
			<div class="form-group">
			    <label class="m-label">Total</label>
			     <?php if(isset($resData_purchase_lineitem[$line_number]['service_price_dis_total']))
			        {
			            $items_total = $resData_purchase_lineitem[$line_number]['service_price_dis_total']; 
			       ?>
			         <input type="number" id="service_total" value="" readonly value="<?=$items_total;?>" class="form-control input-height bg-gray service_total" name="service_total[]">
			      <?php }else{ ?>
			       <input type="number" id="service_total" readonly value="" class="form-control service_total input-height bg-gray"  name="service_total[]">
			      <?php } ?>
			    
				
			</div>
		</div>
	</div>
	
	

