<?php 
require 'database.php';
?>                  
                  <h2 class="inner-tittle"> Offline Payment PIN Generation </H2>
                  
                  <?php 
	if(isset($_POST["createpin"]))
	{
	 extract($_POST);
	  
	  //check existence
	  $rpaylistc = mysqli_query($con, "select * from offlinepay where receiptno='$receiptno'");
	  $rpaylistcounter = mysqli_num_rows($rpaylistc);
	  
	  
	  //add record to paylist
	  //check existence b4 adding
	  if($rpaylistcounter > 0)
	  {
	      echo "<b> <font color='red'> This payment has been treated, verify the receipt number </font></b> <br><br>";
	      
	  }else{
	       $rpaylist = mysqli_query($con, "insert into offlinepay values('', '$memberNo', '$amount', '$receiptno', '$paydate', '$exam', '$regSet', '$username')");
	       if($rpaylist)
		  {   
		     //create link
		    
		   $successurl = "https://register.niqs.org.ng/admin/pingenerator/mature_payment.php";
		  
		     
		     
		     $successurl = $successurl."?memberNumber=".$memberNo."&regSet=".$regSet."&examCentre=".$examCentre."&amount=".$amount."&route=".$route."&service=".$service."&rank=".$rank."&active=".$active;
		     
		    //call link
		    echo '<script>window.location = "'.$successurl.'";</script>';
            
		  }
	  }	  
	  
	  
	}
	
	?>
                    <div class="form-group"> 
                       <form method="post" name="matureofflinepayform" action="index.php?page=matureofflinepay&i=1"> 
                    
		   
                    
					<div class="form-group"> 
                        <label>Membership Number</label> 
                        <input type="text" class="form-control" name="memberNo" placeholder="e.g P00123A" required="" /> 
                    </div> 
					
		   
					
					<div class="form-group"> 
                        <label>Examination</label> 
                        <select class="form-control" name="exam" required="" style="height:auto"/>
							<option value="Mature">Mature</option>
						</select>
                    </div> 

					<div class="form-group"> 
                        <label>Route Category</label> 
                        <select class="form-control" name="route" required="" style="height:auto"/>
							<option value="Military">Military</option>
							<option value="Paramilitary">Paramilitary</option>
							<option value="PhD">PhD</option>
							<option value="Others">Others</option>
						</select>
                    </div> 

					<div class="form-group"> 
                        <label>Service</label> 
                        <select class="form-control" name="service" required="" style="height:auto"/>
							<option>-</option>
							<option>NIGERIAN ARMY</option>
							<option>NIGERIAN AIRFORCE</option>
							<option>NIGERIAN NAVY</option>
							<option>NIGERIAN CUSTOMS SERVICE</option>
							<option>NIGERIAN SECURITY AND CIVIL DEFENSE CORPS</option>
							<option>THE NIGERIAN PRISONS SERVICE</option>
							<option>FEDERAL FIRE SERVICE IN NIGERIA</option>
							<option>NIGERIAN IMMIGRATION SERVICE</option>
							<option>NATIONAL DRUG LAW ENFORCEMENT AGENCY</option>
							<option>NIGERIAN POLICE FORCE</option>
						</select>
                    </div> 
                   <div class="form-group">
				   	<label>Rank</label>
						<select name="rank" class="form-control" required="" style="height:auto"/>
							<option>-</option>
							<option>MAJOR EQUIVALENT</option>
							<option>MAJOR EQUIVALENT AND ABOVE</option>
							<option>CHIEF SUPERINTENDENT EQUIVALENT</option>
							<option>CHIEF SUPERINTENDENT AND ABOVE</option>
						</select>
						
					</div>

					<div class="form-group">
						<label>Active service?</label>
						<select name="active" class="form-control" required="required">
							<option value="">-----------</option>
							<option>YES</option>
							<option>NO</option>
						</select>
						
					</div>


                    <div class="form-group"> 
                        <label>Amount</label> 
                        <input type="text" class="form-control" name="amount" placeholder="Amount Paid" /> 
                    </div> 
                    
                    <div class="form-group"> 
                        <label>Receipt Number</label> 
                        <input type="text" class="form-control" name="receiptno" placeholder="Receipt Number" /> 
                    </div> 
                    
                    
                    
                     <div class="form-group"> 
                        <label>Payment Date</label> 
                        <input type="date" class="form-control" name="paydate" /> 
                    </div> 
			 
			 
                   <div class="form-group">
		<label for="take" class="text-uppercase">Diet</label>
   		 <select class="form-control" name="regSet" required="" style="height:auto">  
		<?php
		 
		  $qset = "select * from phd_set";
		  $rset = mysqli_query($con2, $qset);
		  
		  while($rowset = mysqli_fetch_array($rset))
		  {
			echo "<option>".$rowset['setMonth'].", ".$rowset['setYear']."</option>"; 
		  }
		?><option>JULY, 2022</option>
	</select>
  </div>
                   <div class="form-group">
			<label>Preferred Centre</label>
			<select class="form-control" name="examCentre" required="" style="width:auto; height:auto">
				<option>ABUJA</option><option>LAGOS</option>
				<option>AKURE</option><option>GOMBE</option>
				<option>ENUGU</option><option>PORTHARCOURT</option>
				<option>KADUNA</option><option>KANO</option>
			</select>	
		   </div>	
                    
                    <input name="createpin" type="submit" class="btn btn-default" value="Create PIN" /> 
                    
                </form> 
                
    		</div>
    		
    
    </div>
    
    
  </div>  