<?php
include('includes/session.php');
include('includes/config.php');
date_default_timezone_set('Asia/Kolkata'); 
if(isset($_POST['submit']))
{
$servername = "localhost";
$username = "avitac_user26";
$password = "h5*4ge2HToIK";
$dbname = "avitac_cms";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
if(! get_magic_quotes_gpc())
{
$uid=$_SESSION['id'];
$phase=strtoupper($_POST['phase']);
$uniqueid=strtoupper($_POST['uniqueid']);
$name=strtoupper($_POST['name']);
$designation=strtoupper($_POST['designation']);
$title=strtoupper($_POST['title']);
$sanctioned=($_POST['sanctioned']);
$reportsub=($_POST['reportsub']);
$seedrequested=($_POST['seedrequested']);
$installments=($_POST['installments']);
$amountreceived=($_POST['amountreceived']);
$srdate=($_POST['srdate']);
$purpose=($_POST['purpose']);
$utilize=($_POST['utilize']);
$publications=($_POST['publications']);
$patent=($_POST['patent']);
$outcome=($_POST['outcome']);
$remarks=($_POST['remarks']);		
}
else
{
$uid=$_SESSION['id'];	
$phase=strtoupper($_POST['phase']);
$uniqueid=strtoupper($_POST['uniqueid']);
$name=strtoupper($_POST['name']);
$designation=strtoupper($_POST['designation']);
$title=strtoupper($_POST['title']);
$sanctioned=($_POST['sanctioned']);
$reportsub=($_POST['reportsub']);
$seedrequested=($_POST['seedrequested']);
$installments=($_POST['installments']);
$amountreceived=($_POST['amountreceived']);
$srdate=($_POST['srdate']);
$purpose=($_POST['purpose']);
$utilize=($_POST['utilize']);
$publications=($_POST['publications']);
$patent=($_POST['patent']);
$outcome=($_POST['outcome']);
$remarks=($_POST['remarks']);	
			 }

$date=date("d/m/Y");
//SELECT
$query1= "SELECT * from users WHERE id='$uid'";
$result= mysqli_query($conn,$query1);
while($row = mysqli_fetch_array($result))
{
	$uname= $row['fullName'];
	$uemail= $row['userEmail'];
}
	
//Insert Query of SQL
$query="INSERT INTO seed_money ". "(SmNo,userId,userName,userEmail,Phase,UniqueId,Name,Designation,Title,AmountSanctioned,Report,SeedRequested,Installments,AmountReceived,Srdate,Purpose,Utilize,Publications,Patent,Outcome,Remarks,Date)". " values('1','$uid','$uname','$uemail','$phase','$uniqueid','$name','$designation','$title','$sanctioned','$reportsub','$seedrequested','$installments',$amountreceived,'$srdate','$purpose','$utilize','$publications','$patent','$outcome','$remarks','$date')";
if (mysqli_query($conn , $query)) 
{
    $last_id = mysqli_insert_id($conn);
    $in="SM-" . $last_id;
	$sql1="UPDATE seed_money SET SmNo='$in' WHERE id='$last_id'";
	$retval=mysqli_query($conn, $sql1);
	echo"<script> alert('Seed Money Request has been Submitted Successfully.'); </script>";

			}
			else{
			    echo("Error description: " . mysqli_error($conn));
			}
}
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">

    <title>AVIT | User Register Complaint</title>

    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/nav.css" rel="stylesheet">
    <!--external css-->
    <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="assets/js/bootstrap-datepicker/css/datepicker.css" />
    <link rel="stylesheet" type="text/css" href="assets/js/bootstrap-daterangepicker/daterangepicker.css" />
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/style-responsive.css" rel="stylesheet">
    <style>
		label{
			font-weight: bold;
		}
		input{
			text-transform: uppercase;
		}
	  </style>
	  <script>
//function do_check()
//{
//  var str1 = $("#phone").val();
//  var str2 = $("#ephone").val();
//
//  if (str1 == str2)
//  {
//	  alert("Phone No. and Emergency No. Should not be same !");
//	  document.getElementById('ephone').style.borderColor = "red";
//	  $('#submit').prop('disabled',true);
//  }
//  else
//  {
//	  document.getElementById('ephone').style.borderColor = "#ccc";
//	  $('#submit').prop('disabled',false);
//	  return false;
//  }
//}
	  </script>
  </head>

  <body>

  <section id="container" >
     <?php include("includes/header.php");?>
      <?php include("includes/sidebar.php");?>
      <section id="main-content">
          <section class="wrapper" style="margin-top: 0px; margin-bottom: 0px;">
          	<h3 align="center"> SEED MONEY PROJECT DETAILS</h3>
          	
          	<!-- BASIC FORM ELEMENTS -->
          	<div class="row mt">
          		<div class="col-lg-12">
                  	<div class="col-sm-12 form-panel">
					  <h5 align="center" style="text-align:justify; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; color:#ff6347;"><strong>
Note: An asterisk (✱) indicates a required field. On submission, mandatory fields which are empty / Fields with Invalid values are highlighted in red</strong><br/><br/></h5>

<form action="" method="post" enctype="multipart/form-data" >
<div class="row">
<div class="col-sm-12">
<div class="form-group col-sm-3">
	<label>Select Phase<span style="color:#F00;"> ✱</span></label>
<select class="form-control" name="phase" required>
<option value="">Select Phase</option>
<option value="PHASE I">PHASE I</option>
<option value="PHASE II">PHASE II</option>
<option value="PHASE III">PHASE III</option>
	</select>
</div>

<div class="form-group col-sm-3">
	<label>Unique Id <span style="color:#F00;"> ✱</span></label>
<input type="text" name="uniqueid" required="" class="form-control" >
</div>

<div class="form-group col-sm-3">
	<label>PI/Co- PI Name <span style="color:#F00;"> ✱</span></label>
<input type="text" name="name" required="" class="form-control" >
</div>

<div class="form-group col-sm-3">
	<label>Designation <span style="color:#F00;"> ✱</span></label>
<input type="text" name="designation" required="" class="form-control" >
</div>

<div class="form-group col-sm-4">
	<label>Title of the Project <span style="color:#F00;"> ✱</span></label>
<input type="text" name="title" required="" class="form-control" >
</div>

<div class="form-group col-sm-4">
	<label>Amount Sanctioned (in Rs.) <span style="color:#F00;"> ✱</span></label>
<input type="number" name="sanctioned" required="" class="form-control" >
</div>

<div class="form-group col-sm-4">
	<label>Quarterly report submission details<span style="color:#F00;"> ✱</span></label>
<select class="form-control" name="reportsub" required>
<option value="">Select</option>
<option value="I">I</option>
<option value="II">II</option>
<option value="III">III</option>
<option value="IV">IV</option>
	</select>
</div>

<div class="form-group col-sm-3">
	<label>Seed Money Requested<span style="color:#F00;"> ✱</span></label>
<select class="form-control" name="seedrequested" required>
<option value="">Select</option>
<option value="I">I</option>
<option value="II">II</option>
<option value="III">III</option>
<option value="IV">IV</option>
	</select>
</div>

<div class="form-group col-sm-3">
	<label>No of Installments Received <span style="color:#F00;"> ✱</span></label>
<input type="text" name="installments" required="" class="form-control" >
</div>

<div class="form-group col-sm-2">
	<label>Amount Received <span style="color:#F00;"> ✱</span></label>
<input type="number" name="amountreceived" required="" class="form-control" >
</div>

<div class="form-group col-sm-4">
	<label>Seed Money Requested Date & Amount <span style="color:#F00;"> ✱</span></label>
<input type="text" name="srdate" required="" class="form-control" >
</div>

<div class="form-group col-sm-6">
	<label>Purpose of the Money Request <span style="color:#F00;"> ✱</span></label>
	<textarea name="purpose" required="" max-length="450" title="Maximum Characters 450" class="form-control" cols="2"></textarea>
</div>

<div class="form-group col-sm-6">
	<label>Utilization of Money date & Amount <span style="color:#F00;"> ✱</span></label>
	<textarea name="utilize" required="" class="form-control" title="Maximum Characters 450" max-length="450" cols="2"></textarea>
</div>

<div class="form-group col-sm-2">
	<label>No. of Publications <span style="color:#F00;"> ✱</span></label>
	<input type="number" name="publications" required="" class="form-control" >
</div>

<div class="form-group col-sm-10">
	<label>Patent (If Any) <span style="color:#F00;"> ✱</span></label>
	<input type="text" name="patent" required="" class="form-control" >
</div>

<div class="form-group col-sm-6">
	<label>Outcome of the Project <span style="color:#F00;"> ✱</span></label>
	<textarea name="outcome" required="" title="Maximum Characters 450" max-length="450" class="form-control" cols="2"></textarea>
</div>

<div class="form-group col-sm-6">
	<label>Remarks <span style="color:#F00;"> ✱</span></label>
	<textarea name="remarks" required="" title="Maximum Characters 450" max-length="450" class="form-control" cols="2"></textarea>
</div>

<div class="form-group col-sm-12">
	<div class="col-sm-10">
<center><button type="submit" name="submit" id="submit" class="btn btn-success">Submit</button>
							   <button type="reset" name="submit" class="btn btn-warning" style="margin-left: 10px;">Reset</button></center>
</div>
</div>
	</div>
						  </div>
                          

                          </form>
                          </div>
                          </div>  	
		</section>
      </section>
    <?php include("includes/footer.php");?>
  </section>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script class="include" type="text/javascript" src="assets/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="assets/js/jquery.scrollTo.min.js"></script>
    <script src="assets/js/jquery.nicescroll.js" type="text/javascript"></script>


    <!--common script for all pages-->
    <script src="assets/js/common-scripts.js"></script>

    <!--script for this page-->
    <script src="assets/js/jquery-ui-1.9.2.custom.min.js"></script>

	<!--custom switch-->
	<script src="assets/js/bootstrap-switch.js"></script>
	
	<!--custom tagsinput-->
	<script src="assets/js/jquery.tagsinput.js"></script>
	
	<!--custom checkbox & radio-->
	
	<script type="text/javascript" src="assets/js/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
	<script type="text/javascript" src="assets/js/bootstrap-daterangepicker/date.js"></script>
	<script type="text/javascript" src="assets/js/bootstrap-daterangepicker/daterangepicker.js"></script>
	
	<script type="text/javascript" src="assets/js/bootstrap-inputmask/bootstrap-inputmask.min.js"></script>
	
	
	<script src="assets/js/form-component.js"></script>    
    
    
  <script>
      //custom select box

      $(function(){
          $('select.styled').customSelect();
      });

  </script>

  </body>
</html>
