<?php include "layouts/menu.php"; ?> 
    <?php $idd=$_REQUEST['id'];?>
	<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">
                    <h3 class="page-header  alert alert-info">Vehicle Sale</h3>
                </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
	$x=$hpl; 
  $qry2 = mysqli_query($conn, "SELECT * FROM sizzing where id='$idd'");
 $row = mysqli_fetch_array($qry2);


?> 

	<div class="alert alert-info">Welcome <?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" readonly name="hpl" value=" <?php echo $row['hpl'];?>" placeholder="E.g 1008" readonly>
	  <input type="hidden" class="form-control" id="inputPassword3" name="idd" value=" <?php echo $idd;?>" placeholder="E.g 1008" readonly>
    </div>
    <label for="inputPassword3" class="col-sm-2 control-label">Vehicle Name</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" readonly id="inputPassword3" name="name" value="<?php echo $row['name'];?>" placeholder="" readonly>
    </div>
  </div>	


   <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Sizzing Date</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="t1" readonly name="sizdate" value="<?php echo $row['sizdate'];?>" placeholder="Sizzing Date" onfocus="insertDate(this,'DD-MM-YYYY')" required="required">
    </div>
	 
 
    <label for="inputPassword3" class="col-sm-2 control-label">Godown</label>
    <div class="col-sm-4">
      <select type="text" class="form-control" readonly  name="godown" value="" placeholder="" >
	  <option><?php echo $row['godown'];?></option>
	  <?php $sql5 = mysqli_query($conn, "select * from godown"); while($row5 = mysqli_fetch_array($sql5)) { ?>
	  <option><?php echo $row5['name']; ?></option> <?php } ?></select>
    </div>
	 
  </div>
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Sizzed by</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" name="byy" readonly value="<?php echo $row['byy'];?>" placeholder="" >
    </div>
	 
 
    <label for="inputPassword3" class="col-sm-2 control-label">Sizzing Charges</label>
    <div class="col-sm-4">
       <input type="text" class="form-control" name="sizamt" readonly value="<?php echo $row['sizamt'];?>" placeholder="" >
    </div>
	 
  </div>
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Sale Date</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="t1" name="saledate" value="" placeholder="Sizzing Date" onfocus="insertDate(this,'DD-MM-YYYY')" required="required">
    </div>
	 
 
    <label for="inputPassword3" class="col-sm-2 control-label">Sale Amount</label>
    <div class="col-sm-4">
       <input type="text" class="form-control" name="sizamt" value="" placeholder="" >
    </div>
	 
  </div>
   <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Sales To</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" name="buyer" value="" placeholder="" >
    </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);
							$update=mysqli_query($conn, "update sizzing set saledate='$saledate',sizamt='$sizamt',buyer='$buyer' where id='$idd' ");	
								if($update)
								{
									
									echo "Registered Successfully";
									
								}
								else
								{
									echo "Failure";
								}
							}		
							
						   
								
?>	
	  </div>
</form>
</div>
 <div class="col-xs-6 col-md-4">
 <div class="alert alert-info">Get user paid details</div>
  <form name="form2" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
  <div class="form-group">
    Actual Interest
    <div class="col-sm-4">
      <b><p style="color:red;"><?php echo $row['inter'];?>%</b>
    </div>
  </div>
  <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="uid"  value="<?php echo $row['hpl'];?>" placeholder="Enter HPL">
    </div>
  </div>
  
        <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-primary" name="s2">Get Month</button>
    </div>
  </div>
      <div class="alert alert-success">
	  <?php
							if(isset($_POST['s2']))
							{
								extract($_POST);
								$qry=mysqli_query($conn, "select * from user where mfin='$mfin' &&  uid='$uid'");
								$n=mysqli_num_rows($qry);
								if($n==0)
									{
										echo"Noting he has to pay";
									}
								else		
									{
										$aa = $n;
										echo"$n months";
										
									}
							}			
							
						   
								
?><div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
     <i class="fa fa-edit fa-fw"></i><a  href="netamtd.php?hpl=<?php echo $hpl?>"><b>Via Balance Dues</b></a>
    </div>
  </div>

	  </div>
</form>
  <div class="alert alert-info">Your Monthly Due Dates</div>
 <p style="color:red;"><?php
					
						
						$qry=mysqli_query($conn, "select * from customerdetails where mfin='$mfin' &&  hpl='$hpl'");			
	while($row = mysqli_fetch_array($qry)) {
	   $duedat = str_replace('/', '-', $row['hpdate']);}
						?></p>
			<table table border="0" align="center" cellspacing="0" cellpadding="10" width="150">
						
					<?php 
					for($y=0;$y<$sql5;$y++)
						{
						$duedat = date("d-m-Y", strtotime("$duedat + " . 1 . " month"));
					?>
					
						<button class="btn btn-warning text-center">
                        <i class="fa  fa-pencil fa-1x"></i><b><?php echo $duedat;?></b>
                    </button><?php }
	                for($i=$sql6; $i <= $sad; $i++) {
						$duedat = date("d-m-Y", strtotime("$duedat + " . 1 . " month"));
					?>
					
						<button class="btn btn-success text-center">
                        <i class="fa  fa-pencil fa-1x"></i><b><?php echo $duedat;?></b>
                    </button>
						<?php
						}
					
					?>
					</table>
</div>
</div></div>
</div></div></div> <?php include "layouts/footer.php"; ?></body></html>