	<?php ob_start(); ?>
	<!DOCTYPE html>
	<html>
	<?php include "layouts/db_connect.php"; ?>
	<?php
		session_start('ERP');
if(isset($_SESSION['code'])) {
	  $code = $_SESSION['code'];
	  $scode = $_SESSION['code'];
	   
		$staff = $_SESSION['name'];
		 $postt = $_SESSION['postt'];
		  $mfin222 = $_SESSION['mfin222'];
	} 
	?>
		<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		
		<!-- Meta, title, CSS, favicons, etc. -->
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta http-equiv="X-UA-Compatible" content="chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1">
			<link href="../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<style>

table, th, td {
    border: 1px solid black;
}
#customers {
    font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

#customers td, #customers th {
    border: 1px solid #ddd;
    padding: 8px;
}

#customers tr:nth-child(even){background-color: #f2f2f2;}

#customers tr:hover {background-color: #ddd;}

#customers th {
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: left;
    background-color: #4CAF50;
    color: white;
}
</style>
<title>INFOSSEL SOFT SOLUTIONS </title> </head>
<body>
<?php
			  
  $idd=$_REQUEST['id'];
	$sql=mysqli_query($conn, "select * from pending where id=$idd");
$row2=mysqli_fetch_array($sql);
$n = mysqli_num_rows($sql);
	$hpl =$row2['hpl'];
	$mfin3 = $row2['mfin'];
	$mfin4 =  $row2['mfin'];
 ?>
    <!--  page-wrapper -->
         <div class="right_col" role="main">

            <div class="row">
                <div class="col-lg-12">
                    <!-- Form Elements -->
  <div class="panel panel-default">
<td><h3><center><font face="Courier New" color="red">Pending</font></h3>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="udelete5.php?id=<?php echo $idd; ?>" data-toggle="tooltip" title="With Photo!"><i class="fa fa-camera fa-2x" style="color:blue;"  aria-hidden="true"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="udeletec.php?id=<?php echo $idd; ?>" data-toggle="tooltip" title="Closing Amt"><i class="fa fa-close fa-2x" style="color:black;"  aria-hidden="true"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="udeletef8.php?id=<?php echo $row2['hpl'];?>&mfin2=<?php echo $row2['mfin']; ?>"  data-toggle="tooltip" title="Full View!"><i class="fa fa-feed fa-2x" style="color:red;" aria-hidden="true"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php $ff = $row2['lat']; if($ff>0) { ?>	<a href="https://www.google.com/maps/?q=<?php echo $row2['lat'];?>,<?php echo $row2['lang'];?>"  data-toggle="tooltip" title="Google Map !" title="Full View!" target="_blank"><i class="fa fa-map-marker fa-2x" style="color:purple;" aria-hidden="true"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <?php }
else { ?>
<a href="https://senthoormotorfinance.in/col/geo2.php?hpl=<?php echo $hpl; ?>&mfin=<?php echo $mfin; ?>"  data-toggle="tooltip" title="Add Google Map !" title="Full View!" target="_blank"><i class="fa fa-location-arrow fa-2x" style="color:purple;" aria-hidden="true"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<?php	
} 
 ?>
	<a href="index2.php"  data-toggle="tooltip" title="Home"><i class="fa fa-home fa-2x" style="color:red;" aria-hidden="true"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
		<a href="star.php?id=<?php echo $idd; ?>"  data-toggle="tooltip" title="Add to Fav"><i class="fa fa-star fa-2x" style="color:red;" aria-hidden="true"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
	</td> 
   <div class="panel-body">
                            <div class="row">
							 <div class="col-lg-6">
<table id="customers">
<thead>
<tr>

<th><b><?php echo $row2['fname']; ?> : <?php echo $row2['hpl']; ?></b></th>

</tr></thead><tbody>

<tr><td><b><font size="2">
 <?php
$sql22 = mysqli_query($conn, "select * from addr where hpl='$hpl' && mfin='$mfin4' order by id asc");
$row3 = mysqli_fetch_array($sql22);
$nn = mysqli_num_rows($sql22);
$iddf = $row3['id'];

if($nn>0) {

$iddf = $row3['id'];
for($i=1;$i<7;$i++){
	$iddf++;
$sql223 = mysqli_query($conn, "select * from addr where id='$iddf'");
$row33 = mysqli_fetch_array($sql223);
	?>
<b><font size="2" color="blue"><?php echo $row33['addr']; ?></font></b></br>
<?php } }  

$sql22 = mysqli_query($conn, "select * from addr where hpl='$hpl' && mfin='$mfin4' order by id asc");
$row3 = mysqli_fetch_array($sql22);
$nn = mysqli_num_rows($sql22);
$iddf = $row3['id'];

if($nn>0) {
?>
<b><font size="2" color="black">Work Address : </font></b></br>
<?php
$iddf = $row3['id'];
for($i=1;$i<7;$i++){
	$iddf++;
$sql223 = mysqli_query($conn, "select * from addr where id='$iddf' order by id asc");
$row33 = mysqli_fetch_array($sql223);
	?>
<b><font size="2" color="blue"><?php echo $row33['oadd']; ?></font></b></br>
<?php } }  ?>
<b><font size="4" color="red"><a href="tel:<?php echo $row2['pno']; ?>">Phone : <?php echo $row2['pno']; ?></a> </font>  </b></br>
<font size="3" color="blue">Phone Office : <?php echo $row2['pnooffice']; ?></br>
Phone Resi :  <?php echo $row2['pnoresi']; ?></font></b></br>
<a href="https://api.whatsapp.com/send?phone=91<?php echo $row2['pno'];?>&text=Hi"  data-toggle="tooltip" title="WhatsApp!"><i class="fa fa-whatsapp fa-4x" style="color:green;" aria-hidden="true"></i></a>
</td></tr>

<tr>
<td><b><font size="2">Area : <?php echo $row2['area']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Profession   : <?php echo $row2['profession']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Response Date   : <?php echo $row2['rdate']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Remarks   : <?php echo $row2['remarks']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">My Remarks   : <?php echo $row2['myremarks']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Responce Date   : <?php echo $row2['resdate']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Party Aadhar   : <?php echo $row2['gi1']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Co-Obgnt Aadhar   : <?php echo $row2['bi1']; ?></font></b></td>
</tr>
<th><b>Co-Obligant : </b></th>
<tr><td><b><font size="2">
 <?php
$sql22 = mysqli_query($conn, "select * from addr where hpl='$hpl' && mfin='$mfin4' order by id asc");
$row3 = mysqli_fetch_array($sql22);
$nn = mysqli_num_rows($sql22);
if($nn>0) {
$iddf = $row3['id'];
for($i=1;$i<=7;$i++){
	
$sql22 = mysqli_query($conn, "select * from addr where id='$iddf'");
$row3 = mysqli_fetch_array($sql22);
	?>
<b><font size="2" color="red"><?php echo $row3['co']; ?></font></b></br>
<?php $iddf++; } } ?>

</td></tr>

<th><b>Vehicle : <?php echo $row2['vno']; ?></b></th>
<tr>
<td><b><font size="2">Vehicle : <?php echo $row2['vname']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Model : <?php echo $row2['model']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Color  : <?php echo $row2['color']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Engine No  : <?php echo $row2['eno']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Chasis No   : <?php echo $row2['cno']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Broker   : <?php echo $row2['bname']; ?></font></b></td>
</tr>


<th><b>Loan : <?php echo $row2['hpl']; ?> - <?php echo $row2['fname']; ?></b></th>

<tr>
<td><b><font size="2">Loan Date   : <?php echo $row2['hpdate']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Loan Amount   : <?php echo $row2['hpamt']; ?></font></b></td>
</tr>
<?php $sq666 = mysqli_query($conn, "select * from customerdetails where hpl='$hpl' && mfin='$mfin4'");
$row666 = mysqli_fetch_array($sq666);
 ?>
<tr>
<td><b><font size="2">Due Amt   : <?php echo $row666['total']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Total Dues  : <?php echo $row2['duemnt']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Paid Dues  : <?php echo $row2['paymnt']; ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Pend Dues  : <?php echo $row2['pendmnt']; ?></font></b></td>
</tr>
<?php $a1 = $row2['penamt'];
$a2 = $row2['defamt'];
$a3 = $row2['hlbal'];
$tot  = $a1 - $a2 - $a3;
if($tot < 0) {
$tot = 0;	
}
?>
<tr>
<td><b><font size="2">Pend Amt  : <?php echo round($tot,0); ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Def Amount  : <?php echo round($row2['defamt'],0); ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">HL Amt  : <?php echo round($row2['hlbal'],0); ?></font></b></td>
</tr>
<?php $bb1 = $tot;
$bb2 = $row2['defamt'];
$bb3 = $row2['hlbal'];
if($bb3<0) { $bb3 = 0; }
if($bb2<0) { $bb2 = 0; }
$bbb = $bb1 + $bb2 + $bb3; ?>
<tr>
<td><b><font size="2">Total Pend  : <?php echo round($bbb,0); ?></font></b></td>
</tr>
<tr>
<td><b><font size="2">Last Paid  : <?php echo $row2['lddate']; ?></font></b></td>
  </tr> 


</tbody>

</table>
<div>
 <form name="form177" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
 <B>Add Remark and Next Visit Date</B>
 <?php $sql555=mysqli_query($conn, "select * from customerdetails where hpl='$hpl' && mfin='$mfin3'");
$row=mysqli_fetch_array($sql555); ?>
 <textarea cols="7"  rows="2" name="myremarks" placeholder="Enter Call History"><?php echo $row['myremarks']; ?></textarea>
 <input type="date" name="resdate" value="<?php echo $row['resdate']; ?>">
  <input type="hidden" name="hpl" value="<?php echo $row['hpl']; ?>">
 <input type="hidden" value="<?php echo $row['id']; ?>" name="idd">
  <button type="submit" class="btn btn-primary" name="s53">Update Call</button>
	<?php if(isset($_POST['s53']))
							{
								extract($_POST);  
								$sql33=mysqli_query($conn, "select * from appres where mfin='$mfin3' && scode='$scode' && rdate='$resdate' && hpl='$hpl'");
$n33 = mysqli_num_rows($sql33);
if($n33 == 0) {
			$insert22=mysqli_query($conn, "insert into appres(mfin,scode,remarks,rdate,hpl)
					values('$mfin3','$scode','$myremarks','$resdate','$hpl')"); }
$insert=mysqli_query($conn, "update customerdetails set resdate='$resdate',myremarks='$myremarks' where hpl='$hpl' && mfin='$mfin3'"); 
								}		
								?>
 </form>
</div>
<a href="https://senthoormotorfinance.in/col/geo2.php?hpl=<?php echo $hpl; ?>&mfin=<?php echo $mfin; ?>">Add Geo Location</a></br>
<a href="ulive.php?id=<?php echo $idd; ?>">Ultra Live Data</a>
</div>

</div></div>
</div></div></div></div></div></div> </body></html>
