<?php include "layouts/menu.php"; ?>    
 <script>
function add3()
{
var x = document.getElementById("1").value;
var y = document.getElementById("bba").value;
document.getElementById("1").value =(x*1)+(y*1);
}
</script>

  <script>
function add()
{
var x = document.getElementById("txt1").value;
var y = document.getElementById("txt2").value;
document.getElementById("tot").value =(x*1)+(y*1);
}
</script>
<script>
function add1()
{
var x1 = document.getElementById("1").value;
var y1 = document.getElementById("2").value;
document.getElementById("txt2").value =(x1*1)*(y1/100);
}
</script>
<script>
function add2()
{
var x1 = document.getElementById("1").value;
var y1 = document.getElementById("3").value;
document.getElementById("txt1").value =parseInt((x1*1)/(y1*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-danger">Edit Registration For Auto Due Loan</h1>
                </div>
                <!--end page header -->
            </div>
            <div class="row">
                <div class="col-lg-12">
				<a href="allcus.php"><button class="btn btn-primary">View</button></a>&nbsp;&nbsp;&nbsp;<a href="edithp.php"><button class="btn btn-primary">Edit</button></a>
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Fill the form
                        </div>
                        <div class="panel-body">
						<?php $hpl=$_REQUEST['hpl'];?>
                            <div class="row">
                                <div class="col-lg-6">
                                   <?php	$qry=mysqli_query($conn, "select * from customerdetails where mfin='$mfin' &&  hpl='$hpl'");
						$n=mysqli_num_rows($qry);
						$row=mysqli_fetch_array($qry);
						 ?>
   <form role="form" name="form1" method="post" action="" enctype="multipart/form-data">
   <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >HPL</label>
      <input type="text" class="form-control" id="inputPassword3" name="hpl" value="<?php echo $row['hpl'];?>" readonly placeholder="E.g 1008" required>
<span class="glyphicon glyphicon-user form-control-feedback"></span> 
 </div>
  <div class="form-group has-success has-feedback">
    <label for="inputEmail3" >Vehicle No</label>
      <input type="text" class="form-control" id="inputEmail3" name="vno" value="<?php echo $row['vno'];?>" placeholder="E.g TN 21 S 2676">
  <span class="glyphicon glyphicon-shopping-cart form-control-feedback"></span>
    </div>
   
  <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Model</label>
      <input type="text" class="form-control" id="inputPassword3" name="model" value="<?php echo $row['model'];?>" placeholder="Vehicle Model">
   <span class="glyphicon glyphicon-time form-control-feedback"></span>
  </div>
    <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Vehicle Name</label>
      <select type="text" class="form-control" id="inputPassword3" name="vname" value="" placeholder="Vehicle Name">
    <span class="glyphicon glyphicon-plane form-control-feedback"></span>
	<option><?php echo $row['vname'];?></option>
	<?php 
$qry=mysqli_query($conn, "select * from mveh");
	while($row2=mysqli_fetch_array($qry))
						{ ?> <option><?php echo $row2['name'];?></option>
						<?php } ?> </select>
    </div>

   <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Color</label>
      <select type="text" class="form-control" id="inputPassword3" name="color" value="" placeholder="Vehicle Color E.g RED">
    <span class="glyphicon glyphicon-tint form-control-feedback"></span>
	<option><?php echo $row['color'];?></option>
	<?php 
$qry=mysqli_query($conn, "select * from mcolor");
	while($row2=mysqli_fetch_array($qry))
						{ ?> <option><?php echo $row2['name'];?></option>
						<?php } ?> </select>
    </div>
 
  <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >H.P Amount</label>
      <input type="text" class="form-control" id="1" name="hpamount"  value="<?php echo $row['hpamount'];?>" placeholder="H.P Amount" onChange="add1()">
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>
   <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Interest in %</label>
      <input type="text" class="form-control" id="2" name="inter"  value="<?php echo $row['inter'];?>" placeholder="2" onChange="add1()">
    <span class="glyphicon glyphicon-info-sign form-control-feedback"></span>
  </div>
  
  <div class="form-group has-success has-feedback">
    <label for="inputPassword3" class="control-label">H.P Date</label>
      <input type="text" class="form-control" id="datepicker"  name="hpdate" value="<?php echo $row['hpdate'];?>" placeholder="H.P Date" ">
 <span class="glyphicon glyphicon-calendar form-control-feedback"></span>
    </div>
   <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Due Month</label>
      <input type="text" class="form-control" id="3" name="duemnt" value="<?php echo $row['duemnt'];?>" placeholder="Due Month" onchange="add2()";>
  <span class="glyphicon glyphicon-time form-control-feedback"></span>
  </div>

  <div class="form-group has-success has-feedback">
    <label for="txt1" >Due Amount</label>
      <input type="text" class="form-control" id="txt1"  name="dueamt" value="<?php echo $row['dueamt'];?>" placeholder="Due Amount" onChange="add()">
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>
  <div class="form-group has-success has-feedback">
    <label for="txt2" >Interest</label>
      <input type="text" class="form-control" id="txt2"  name="interest" value="<?php echo $row['interest'];?>" placeholder="Interest" >
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>
 
   <div class="form-group has-error has-feedback">
    <label for="inputPassword3" >Total Amount</label>
      <input type="text" class="form-control" id="tot" name="total" value="<?php echo $row['total'];?>" placeholder="Total Amount" onClick="add()">
   <span class="glyphicon glyphicon-usd form-control-feedback"></span>
  </div>
	  
  </div>
                                <div class="col-lg-6">  
  <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Name</label>
      <input type="text" class="form-control" id="inputPassword3" name="name" value="<?php echo $row['name'];?>" placeholder="name">
 <span class="glyphicon glyphicon-user form-control-feedback"></span>
  </div>
    <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Phone Number</label>
      <input type="text" class="form-control" id="inputPassword3" name="pno" value="<?php echo $row['pno'];?>" placeholder="name">
 <span class="glyphicon glyphicon-phone-alt form-control-feedback"></span>
  </div>
  <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Address</label>
      <textarea class="form-control" rows="3" name="address" value="<?php echo $row['address'];?>" placeholder="Address"></textarea>
  <span class="glyphicon glyphicon-home form-control-feedback"></span>
  </div>
    <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Area</label>
      <select type="text" class="form-control" id="inputPassword3" name="area" value="" placeholder="">
 <span class="glyphicon glyphicon-phone-alt form-control-feedback"></span>
 <option><?php echo $row['area'];?></option>
	<?php 
$qry=mysqli_query($conn, "select * from marea");
	while($row2=mysqli_fetch_array($qry))
						{ ?> <option><?php echo $row2['name'];?></option>
						<?php } ?> </select>
    </div>
    <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Co-Obligant Details</label>
      <textarea class="form-control" rows="3" name="co" value="<?php echo $row['co'];?>" placeholder=""></textarea>
    <span class="glyphicon glyphicon-user form-control-feedback"></span>
  </div>
  
   <div class="form-group has-success has-feedback">
    <label for="inputPassword3" >Broker Name</label>
      <select type="text" class="form-control" id="inputPassword3" name="bname" value="" placeholder="Broker Name">
    <span class="glyphicon glyphicon-cloud-download form-control-feedback"></span>
	<option><?php echo $row['bname'];?></option>
	<?php 
$qry=mysqli_query($conn, "select * from mbroker");
	while($row2=mysqli_fetch_array($qry))
						{ ?> <option><?php echo $row2['name'];?></option>
						<?php } ?> </select>
    </div>

    <div class="form-group has-warning has-feedback">
    <label for="inputPassword3" >Insurance Date</label>
      <input type="text" class="form-control" id="datepicker2" name="idate" value="<?php echo $row['idate'];?>" placeholder="Insurance Date" >
  <span class="glyphicon glyphicon-calendar form-control-feedback"></span>
  </div>
  <div class="form-group has-warning has-feedback">
    <label for="inputPassword3" >FC Date</label>
      <input type="text" class="form-control" id="datepicker8" name="uname" value="<?php echo $row['uname'];?>" placeholder="Fc Date" >
   <span class="glyphicon glyphicon-calendar form-control-feedback"></span> 
  </div>
  <div class="form-group has-warning has-feedback">
    <label for="inputPassword3" >Tax Date</label>
      <input type="text" class="form-control" id="datepicker9" name="pwd" value="<?php echo $row['pwd'];?>" placeholder="Tax Dtae" >
  <span class="glyphicon glyphicon-calendar form-control-feedback"></span>
  </div>
   <div class="form-group has-warning has-feedback">
    <label for="inputPassword3" >Permit Date</label>
      <input type="text" class="form-control" id="datepicker9" name="pwd" value="<?php echo $row['pwd'];?>" placeholder="Tax Dtae" >
  <span class="glyphicon glyphicon-calendar form-control-feedback"></span>
  </div>
  <div class="form-group">
   
      <button type="submit" class="btn btn-success btn-lg btn-block" name="s2">Register</button>

</div>
      <div class="alert alert-success">
	 <?php
							if(isset($_POST['s2']))
							{
								extract($_POST);
								
								$update=mysqli_query($conn, "update customerdetails set hpl='$hpl',vno='$vno',area='$area',model='$model',vname='$vname',color='$color',hpamount='$hpamount',inter='$inter',hpdate='$hpdate',duemnt='$duemnt',dueamt='$dueamt',interest='$interest',total='$total',name='$name',pno='$pno',address='$address',co='$co',bname='$bname',idate='$idate',uname='$uname',pwd='$pwd' where mfin='$mfin' &&  hpl='$hpl'");
								if($update)
								{ echo "Updated successfully";
								
								}
								else
								{
									echo "Failure";
								}
							}
?>
	  </div>
</form>
  </div>
 
 
</div>
</div></div>
</div></div></div> <?php include "layouts/footer.php"; ?></body></html>
