<?php include "layouts/menu.php"; ?> 
    <?php $hpl=$_REQUEST['hpl'];?>
	<script> 
function add() 
{ 
var x = document.getElementById("int2").value; 
var z = document.getElementById("bm1").value; 
var w = document.getElementById("totam").value; 
document.getElementById("totot").value =(((x*1)+(1*w))*(z*1));
} 
</script>
<script> 
function add1() 
{ 
var x = document.getElementById("t1").value; 
var y = document.getElementById("t2").value; 
document.getElementById("totam").value =(x*1)*(y*1); 
} 
</script>
<script>
function add2()
{
var x1 = document.getElementById("1").value;
var y1 = document.getElementById("2").value;
document.getElementById("int3").value =(x1*1)*(y1/100);
}
</script>
<script> 
function add3() 
{ 
var x = document.getElementById("no").value; 
var y = document.getElementById("t2").value; 
document.getElementById("bm1").value =(x*1)-(y*1); 
} 
</script>
<script> 
function adds() 
{ 
var x = document.getElementById("int2").value; 
var y = document.getElementById("int3").value; 
document.getElementById("int3").value =(x*1)*(y/30); 
} 
</script>
<script>
    function diff()
{
    var date14 = document.getElementById("gh").value;
    var date15 = document.getElementById("bm1").value;
	
	var date11 = date14.split("-").reverse().join("-");
	var date22 = date15.split("-").reverse().join("-");

    var one_day=1000*60*60*24;

    var date1 = new Date(date11);
    var date2 = new Date(date22);

      // Convert both dates to milliseconds
      var date1_ms = date1.getTime();
      var date2_ms = date2.getTime();

      // Calculate the difference in milliseconds
      var difference_ms = date2_ms - date1_ms;

      // Convert back to days and return
document.getElementById("int2").value =  Math.round(difference_ms/one_day); 

}
</script>
<script> 
function addss() 
{ 
var x = document.getElementById("int3").value; 
var y = document.getElementById("1").value; 
var z = document.getElementById("totam").value; 
document.getElementById("totot").value =(((x*1)+(y*1))-(z*1)); 
} 
</script>
<script> 
function add4() 
{ 
var x = document.getElementById("totot").value; 
var y = document.getElementById("bm1").value; 
document.getElementById("tamt").value =(x*1)*(y*1); 
} 
</script>
  <!--  page-wrapper -->
         <div class="right_col" role="main">
            <div class="row">
                 <!-- page header -->
                <div class="col-lg-12">
                    <h1 class="page-header  alert alert-info">Fitting / Police Station Entry</h1>
                </div>
                <!--end page header -->
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Details
                        </div>
                        <div class="panel-body">
                            <div class="row">
  <div class="col-xs-12 col-md-8">
    <form name="form1" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
	
 <?php	$qry=mysqli_query($conn, "select * from customerdetails where hpl='$hpl' && mfin='$mfin'");
						$n=mysqli_num_rows($qry);
$row = mysqli_fetch_array($qry);
?> 

	<div class="alert alert-info"><?php echo $row['name'];?></div>
	<img style="margin-left:150px;margin-bottom:20px;"" src="user/<?php echo $row['uimg'];?>" height="100" width="100"/>
   <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">HPL</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputPassword3" name="hpl" value="<?php echo $row['hpl'];?>" placeholder="E.g 1008" readonly>
    </div>
    <label for="inputPassword3" class="col-sm-2 control-label">Name</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputPassword3" name="name" value="<?php echo $row['name'];?>" placeholder="" readonly>
    </div>
  </div>	
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Veh No</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="no" name="vno" value="<?php echo $row['vno'];?>" placeholder="" readonly> 
    </div>
    <label for="inputPassword3" class="col-sm-2 control-label">Phone No</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="gh" name="pno"  value="<?php echo $row['pno'];?>" placeholder="Due Date" onfocus="insertDate(this,'<?php echo $row['hpdate'];?>--/MM/YYYY')">
    </div>
  </div>
    <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Veh Name</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="t1" name="vname" readonly value="<?php echo $row['vname'];?>" placeholder="Due Amount">
    </div>
	   <label for="inputPassword3" class="col-sm-2 control-label">H.P Amount</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="1" name="dueamt" readonly value="<?php echo $row['hpamount'];?>" placeholder="H.P Amount">
    </div>
  </div>
   <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Entry Date</label>
    <div class="col-sm-4">
      <input type="date" class="form-control" id="" name="date" value="" placeholder="Date" required="">
    </div>
	 
 
    <label for="inputPassword3" class="col-sm-2 control-label">Fitting / Police Statiom</label>
    <div class="col-sm-4">
      <select type="text" class="form-control"  name="cat" value="" placeholder="" >
	  <option>Police Station</option>
	 
	  <option>Fitting</option>
	  <option>Other</option>
	  </select>
    </div>
	 
  </div>
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Police Station/Fitting Area</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" name="scat" value="" placeholder="" >
    </div>
	 
 
    <label for="inputPassword3" class="col-sm-2 control-label">Remark</label>
    <div class="col-sm-4">
       <textarea cols="3" rows="3" type="text" class="form-control" name="remark" value="" placeholder="" ></textarea>
    </div>
	 
  </div>
        <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-primary  btn-lg btn-block" name="s11">Add as sizzing</button>
    </div>
  </div>
													<div class="alert alert-warning">
							<?php
							if(isset($_POST['s11']))
							{
								extract($_POST);
								$insert=mysqli_query($conn, "insert into police(mfin,scode,hpl,cat,scat,vno,vname,date,remark,pno)
											 values('$mfin','$scode','$hpl','$cat','$scat','$vno','$vname','$date','$remark','$pno')");
											 
								if($insert)
								{
									            

									echo "Registered Successfully";
									
								}
								else
								{
									echo "Failure";
								}
							}		
							
						   
								
?>	
	  </div>
</form>
</div>
</div>
</div></div></div> <?php include "layouts/footer.php"; ?></body></html>