<?php 
include_once("header-footer/header.php")
?>

<link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
 <script>
			 
			 function selectRa(ra)
			 {   
				var randNo = "<?php echo $_REQUEST['randNo']?>";	
				$.ajax({
				type: 'POST',
				url: "addRabill.php",
				//async: false,			  
				data: {RaBillNo:1,ra:ra,randNo:randNo},	  
				success: function(ajaxresult)
				{    	 
					$("#costofBit").val(ajaxresult); 
				},
				error: function(XMLHttpRequest, textStatus, errorThrown) { 
				alert('Error');
				}
				});
			
			 }
  
  $( function() 
  {
    $( "#recordingD" ).datepicker({
			changeMonth: true,
			changeYear: true,
			yearRange: "1930:2050"
			});
    $( "#dpayment" ).datepicker({
			changeMonth: true,
			changeYear: true,
			yearRange: "1930:2050"
			});
    
  });
  
  </script>
<script>
        $(document).ready(function()
        {   
             //// if( ($(window).width()) > 599) 
             //window.location.href  = URL+'/error/default.php';
           
        	 
				$("#clause38").change(function()
				{     
					
					var val1 = parseFloat($("#costofBit").val()).toFixed(2);// parseFloat()));   
					var ival = parseFloat($("#amtwork").val()-val1);   
					var minusVal = parseFloat((parseFloat($("#royalty").val()))+(parseFloat($("#clause38").val())));					  
					ival1 = ival - (minusVal);    
					$("#netpayment").val(ival1);  
					var ei85 =  parseFloat((((ival1)*85)/100).toFixed(2)); 
					$("#eightPer").val(ei85);   
					//14742039 amount
					//69.08 before 
					//41210 // after    
				});

        		 
        }); 
		
		
		function calculate()
		{ 
			var val1 = parseFloat($("#costofBit").val()).toFixed(2);// parseFloat()));   
			var ival = parseFloat($("#amtwork").val()-val1);   
			var minusVal = parseFloat((parseFloat($("#royalty").val()))+(parseFloat($("#clause38").val())));					  
			ival1 = ival - (minusVal);    
			$("#netpayment").val(ival1);  
			var ei85 =  parseFloat((((ival1)*85)/100).toFixed(2)); 
			$("#eightPer").val(ei85); 
			
		}
		
		 
        </script>
        
        <style>
          .FormRegister
          {
              border: 1px solid #c2c2c2;
              margin: 1px;
              border-radius: 3px;
          }
        </style>
        
    	<link href="<?php echo ROOTPATH;?>/view/css/screen-600.css" rel="stylesheet" type="text/css">
               <?php 
	    include_once(ABS_PATH."/menu.php");
	?> 
               
                <div class="container mt-35">
                    <div class="row justify-content-center FormRegister">
                            <div class="col-12 p-3 text-center"> 
                                    <h3 class="card-title">
										<?php 
										 
												echo "Edit Comsumption";   
													
											$stmt=$conn->prepare("select  cmdt  from    pw__comdtdata where  randumNo=:randumNo ");   
											$stmt->bindValue(':randumNo', $_REQUEST['randNo'], PDO::PARAM_STR); 
											$stmt->execute();   
											$pw__comdtdata = $stmt->fetchAll(PDO::FETCH_OBJ);  
											
											//echo '<pre>'; print_r($pw__comdtdata);die;
 										?> 
									</h3> 
									
									<?php 
										if($_REQUEST['agency']!='') 
										{
									?>
									<marquee>  
											<a  class="btn btn-danger mb-2" href="#">  SELECTED  AGENCY  : <?php echo $pw__newage->name.", Agg No : ".$randNoDetails->AggNo.", Short Name :".$randNoDetails->shortName;?>   </a> 
									</marquee>
									<?php } ?>
                            </div>    
							
							
								<form method="post" autocomplete="off" id="_frm">  

												
												<div class="col-md-12 text-center">  
													 
														<div class="col-md-12 mb-1">  
														RA Bill No 	
														<select  class="form-control"  name="RaBillNO1" required> 
														<option value="">Select RA Bill No </option>  
														<?php 
															for($i=1;$i<=1000;$i++) {
														?>
															<option value="<?php  echo $i;?>" <?php if($editComp->RaBillNO1==$i) echo "selected"; ?>> <?php  echo $i;?> </option>  
														<?php } ?>		
														
														</select> 
                                                    </div> 
													
        										    </div>
													
                                            <div class="row">  
                                                    <div class="col-md-12 mb-1">  
														<select  class="form-control"  name="commodity"  required> 
														<option value="">Select Commodity</option>
														<option value="1" <?php if($editComp->commodity==1) echo "selected"; ?>>LABOUR</option>
														<option value="2" <?php if($editComp->commodity==2) echo "selected"; ?>>MATERIAL</option>
														<option value="3" <?php if($editComp->commodity==3) echo "selected"; ?>>POL</option> 
														<option value="4" <?php if($editComp->commodity==4) echo "selected"; ?>>BITUMEN VG-30</option>  
														<option value="5" <?php if($editComp->commodity==5) echo "selected"; ?>>BITUMEN VG-10</option>  
														<option value="6" <?php if($editComp->commodity==6) echo "selected"; ?>>CEMENT LINE </option> 
														<option value="7" <?php if($editComp->commodity==7) echo "selected"; ?>>CEMENT OPC</option>  
														<option value="8" <?php if($editComp->commodity==8) echo "selected"; ?>>STEELLMETALIC IRON</option>  
														<option value="9" <?php if($editComp->commodity==9) echo "selected"; ?>>STEEL LONG</option> 
														</select>
														</select> 
                                                    </div>
													
													
													<div class="col-md-12 text-center">   
														<div class="col-md-12 mb-1">  
														<select  class="form-control"  name="grade"  > 
														<option value="">Select Grade </option>
														<option value="1" <?php if($editComp->grade==1) echo "selected"; ?>>Vg 30(60/70)</option>
														<option value="2" <?php if($editComp->grade==2) echo "selected"; ?>>Vg 10(80/100)</option>
														<option value="3" <?php if($editComp->grade==3) echo "selected"; ?>>Steel TMT</option>  
													 
														</select>
														</select> 
                                                    </div>  
        										    </div>     
													
													
													<div class="col-md-12 text-center"> 
														Quantity  Per unit Before Val
        										    	<input  type="text" name="qtyperunit1" id="qtyperunit1"  class="form-control mb-1"  value="<?php echo $editComp->qtyperunit1;?>" required   />
        										    </div> 	
													
													
													<div class="col-md-12 text-center"> 
														Quantity  Per unit @ Val
        										    	<input  type="text" name="qtyperunit2"   class="form-control mb-1"  value="<?php echo $editComp->qtyperunit2;?>" required    />
        										    </div> 	
													
													
													 
                                                    <div class="col-md-12 text-center">
        										    	<input  type="submit" class="btn btn-primary mb-2" name="submitComp" value="Update Consumption Record" > 
        										    </div> 
        										    
                                            </div>  
                                    </form>

									
                                         
                    </div>       
                </div>       
       
<?php 
include_once("header-footer/footer.php");
unset($_SESSION['comdTY']); 
unset($_SESSION['Radded']); 
?> 