<?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['comdTY']))
														echo "Comsumption  Added Succfully!!!";
												else
														echo "Add New 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">  
														<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  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">LABOUR</option>
														<option value="2">MATERIAL</option>
														<option value="3">POL</option> 
														<option value="4">BITUMEN VG-30</option>  
														<option value="5">BITUMEN VG-10</option>  
														<option value="6">CEMENT LINE </option> 
														<option value="7">CEMENT OPC</option>  
														<option value="8">STEELLMETALIC IRON</option>  
														<option value="9">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">Vg 30(60/70)</option>
														<option value="2">Vg 10(80/100)</option>
														<option value="3">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"   required   />
        										    </div> 	
													
													
													<div class="col-md-12 text-center"> 
														Rate  Per unit @ Val
        										    	<input  type="text" name="qtyperunit2"   class="form-control mb-1"   required    />
        										    </div> 	
													
													
													 
                                                    <div class="col-md-12 text-center">
        										    	<input  type="submit" class="btn btn-primary mb-2" name="submitComp" value="Add Consumption Record" > 
        										    </div> 
        										    
                                            </div>  
                                    </form>

									
                                         
                    </div>       
                </div>
				
				
				
				
				
				
				 <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"   />
        										    </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  echo $i;?> </option>  
														<?php } ?>		
														
														</select> 
                                                    </div>  
        										    </div>
													
													
													<div class="col-md-12 text-center">  
													<div class="col-md-12 mb-1">  
														<select  class="form-control"  name="RaBillNClub"  onchange="selectRa(this.value)"> 
														<option value="">Select Club Bill No </option>  
														<?php 
															for($i=1;$i<=1000;$i++) {
														?>
															<option value="<?php  echo $i;?>"> <?php  echo $i;?> </option>  
														<?php } ?>		
														
														</select> 
                                                    </div>  
        										    </div>
													
													<div class="col-md-12 text-center"> 
														Vourchar No
        										    	<input  type="text" name="vourchar"  class="form-control mb-1"       />
        										    </div>
													
													<div class="col-md-12 text-center"> 
														Date of Payment
        										    	<input  type="text" name="dpayment" id="dpayment" class="form-control mb-1"   value="NA"  placeholder=""   />
        										    </div>
													 
														
													<div class="col-md-12 text-center"> 
														Amount of work done
        										    	<input  type="number" name="amtwork"  id="amtwork"  class="form-control mb-1"   placeholder=""   />
        										    </div> 
													  	
													<div class="col-md-12 text-center"> 
														royalty
        										    	<input  type="text" name="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"     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"  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"  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"  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="Add New 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']); 
?> 