<?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 
												if(isset($_SESSION['Radded']))
														echo "RA  Added Succfully!!!";
												else
														echo "Add New RA";
 										?>
									
									</h3>  
                            </div>    
							
 
									
                                  <form method="post" autocomplete="off" id="_frm">   
                                            <div class="row"> 
                                               
													
													<div class="col-md-12 text-center"> 
														Date of Recording
        										    	<input  type="text" name="recordingD" id="recordingD" class="form-control mb-1"  value="<?php echo $pw__newage->recordingD;?>"   />
        										    </div>
													 
														
													<div class="col-md-12 text-center">  
													 
														<div class="col-md-12 mb-1">  
														<select  class="form-control"  name="RaBillNO"  onchange="selectRa(this.value)"> 
														<option value="">Select RA Bill No </option>  
														<?php 
															for($i=1;$i<=1000;$i++) {
														?>
															<option value="<?php  echo $i;?>" <?php if($pw__newage->RaBillNO==$i) echo "selected";?> > <?php  echo $i;?> </option>  
														<?php } ?>		
														
														</select> 
                                                    </div> 
													
        										    </div>
													
													<div class="col-md-12 text-center"> 
														Vourchar No
        										    	<input  type="text" name="vourchar"   value="<?php echo $pw__newage->vourchar;?>"  class="form-control mb-1"       />
        										    </div>
													
													<div class="col-md-12 text-center"> 
														Date of Payment
        										    	<input  type="text" name="dpayment"   value="<?php echo $pw__newage->dpayment;?>" id="dpayment" class="form-control mb-1"   placeholder=""   />
        										    </div>
													 
														
													<div class="col-md-12 text-center"> 
														Amount of work done
        										    	<input  type="number" name="amtwork"   value="<?php echo $pw__newage->amtwork;?>"  id="amtwork"  class="form-control mb-1"   placeholder=""   />
        										    </div> 
													  	
													<div class="col-md-12 text-center"> 
														royalty
        										    	<input  type="text" name="royalty"   value="<?php echo $pw__newage->royalty;?>"   id="royalty"  class="form-control mb-1"  value="0" required placeholder="Royalty"   />
        										    </div> 
													
													<div class="col-md-12 text-center"> 
														clause38
        										    	<input  type="text" name="clause38"     value="<?php echo $pw__newage->clause38;?>"   id="clause38" class="form-control mb-1"  value="0" required placeholder="Clause 38"   />
        										    </div> 	
													   
													<div class="col-md-12 text-center"> 
														Cost Of bitumen
        										    	<input  type="number" name="costofBit"  value="<?php echo $pw__newage->costofBit;?>"   id="costofBit"  required   class="form-control mb-1" readonly   placeholder="Cost Of bitumen"   />
        										    </div> 
													  
													<div class="col-md-12 text-center"> 
														Net Payment
        										    	<input  type="text" name="netpayment"  value="<?php echo $pw__newage->netpayment;?>"   id="netpayment"    required   class="form-control mb-1" readonly   />
        										    </div> 	
													
													<div class="col-md-12 text-center"> 
														85% of work Done Amount
        										    	<input  type="text" name="eightPer"  value="<?php echo $pw__newage->eightPer;?>"   id="eightPer"    required  class="form-control mb-1" readonly     />
        										    </div>  
												
													
                                                    <div class="col-md-12 text-center">
        										    	<input  type="submit" class="btn btn-primary mb-2" name="submitLogin" value="Update   RA" > 
        										    	<a class="btn btn-primary mb-2"  href="javascript:void(0)" onclick="calculate();">  Calculate </a>
        										    </div> 
        										    
                                            </div>  
                                    </form>        
                    </div>       
                </div>
				 
				
               
 
              
       
<?php 
include_once("header-footer/footer.php");
unset($_SESSION['comdTY']); 
unset($_SESSION['Radded']); 
?> 