	<?php ob_start(); ?>
	<!DOCTYPE html>
	<html>
	<?php include "layouts/db_connect.php";
				session_start('ERP');
				
				if($_SESSION['uname']==""&&$_SESSION['pwd']=="")
				{
				
					header("location:index.php");
				}
				
	if(isset($_SESSION['code'])) {
	  $code = $_SESSION['code'];
	  $scode = $_SESSION['code'];
	   $mfin = $_SESSION['mfin'];
		$staff = $_SESSION['name'];
		 $postt = $_SESSION['postt'];
	}
							if(isset($_POST))
							{ 
								
								extract($_POST);
									$name = strtoupper($name);
			$fname = strtoupper($fname);
			$profession = strtoupper($profession);
			$co = strtoupper($co);
			$co01 = strtoupper($co01);
			$co02 = strtoupper($co02);
			$coaland = strtoupper($coaland);
			$lmark = strtoupper($lmark);
			$address = strtoupper($address);
			$address1 = strtoupper($address1);
			$address2 = strtoupper($address2);
			$oaddress = strtoupper($oaddress);
			$oaddress1 = strtoupper($oaddress1);
			$oaddress2 = strtoupper($oaddress2);
			$cobname = strtoupper($cobname);
			$cobname2 = strtoupper($cobname2);
				$remarks = strtoupper($remarks);
								
								$hpl = $hpl;
								if($hpl != NULL) {
								
									if($defamt!=$defamt55) {
							$defamt	= $defamt/12;
									}
							$imgveh=$_FILES['imgveh']['name'];
							$img=$_FILES['img']['name'];
							$uimg=$_FILES['uimg']['name'];
if($imgveh==NULL)
{
	$imgveh = $imgveh2;
}	
else {
		$imgveh=$_FILES['imgveh']['name'];
$move11=move_uploaded_file($_FILES['imgveh']['tmp_name'],"user/".$imgveh);
}

if($img==NULL)
{
	$img = $img2;
}	
else {
$img=$_FILES['img']['name'];
$move111=move_uploaded_file($_FILES['img']['tmp_name'],"user/".$img);
}
if($uimg==NULL)
{
$uimg = $uimg2;
}	
else {
		$uimg=$_FILES['uimg']['name'];
$move115=move_uploaded_file($_FILES['uimg']['tmp_name'],"user/".$uimg); 
}
$mfin2 = $mfin2;
$address1 = $address1;
$geo = $geo;
				if($geo!=NULL){
					$sql55 = mysqli_query($conn, "select * from geo where code='$geo'");
					$row55 = mysqli_fetch_array($sql55);
					$lat = $row55['lat'];
					$lang = $row55['lang'];
				}
				$hpdate5 =  date('Y-m-d', strtotime($hpdate));
				date_default_timezone_set('Asia/Kolkata');
$date33 = date('h:i:s a m/d/y');
$dddttt =  date('h:i:s a d/m/y', strtotime($date33));	
$insert=mysqli_query($conn, "update customerdetails set pan='$pan',accname='$accname',bankname='$bankname',bankno='$bankno',ifsc='$ifsc',branch='$branch',altdate='$dddttt',cow01='$cow01',coaland='$coaland',coaland2='$coaland2',hname='$hname',cow02='$cow02',co01='$co01',co02='$co02',co201='$co201',co202='$co202',address1='$address1',address2='$address2',oaddress1='$oaddress1',oaddress2='$oaddress2',lmark='$lmark',cofname='$cofname',cofname2='$cofname2',pmode='$pmode',cow='$cow',cow2='$cow2',oaddress='$oaddress',fname='$fname',eno='$eno',cno='$cno',area='$area',hlamt='$hlamt',hlreturn='$hlreturn',hpdate2='$hpdate2',hpdate5='$hpdate5',cobname2='$cobname2',cobpno2='$cobpno2',co2='$co2',pnooffice='$pnooffice',pnoresi='$pnoresi',profession='$profession',dealer='$dealer',chqamt='$chqamt',defamt='$defamt',irr='$irr',remarks='$remarks',imgveh='$imgveh',altby='$scode',hpl='$hpl',lat='$lat',lang='$lang',uimg='$uimg',vno='$vno',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',cobname='$cobname',cobpno='$cobpno',co='$co',img='$img',bname='$bname',bcommission='$bcommission',document='$document',totalhpamt='$totalhpamt',g1='$g1',g2='$g2',g3='$g3',gi1='$gi1',gi2='$gi2',gi3='$gi3',b1='$b1',b2='$b2',b3='$b3',bi1='$bi1',bi2='$bi2',bi3='$bi3',nname='$nnamef' where id='$idd'");
if($address1 != NULL) {	$delete=mysqli_query($conn, "delete from monaddr where mfin='$mfin2' && hpl='$hpl'");
	$delete2=mysqli_query($conn, "delete from monaddr where mfin='$mfin2' && hpl=$hpl");
$insert2=mysqli_query($conn, "insert into monaddr(mfin,hpl,addr,oadd,co,co2)
								values('$mfin2','$hpl','$name','$name','$cobname','$cobname')");
						//		$fname = "S/O ".$fname;
							//	$cofname = "S/O ".$cofname;
						//		$cofname2 = "S/O ".$cofname2;
								$insert3=mysqli_query($conn, "insert into monaddr(mfin,hpl,addr,oadd,co,co2)
								values('$mfin2','$hpl','$fname','$profession','$cofname','')");
								$insert4=mysqli_query($conn, "insert into monaddr(mfin,hpl,addr,oadd,co,co2)
								values('$mfin2','$hpl','$address','$oaddress','$co','$cow')");
								$insert5=mysqli_query($conn, "insert into monaddr(mfin,hpl,addr,oadd,co,co2)
								values('$mfin2','$hpl','$address1','$oaddress1','$co01','$cow01')");
								$insert6=mysqli_query($conn, "insert into monaddr(mfin,hpl,addr,oadd,co,co2)
								values('$mfin2','$hpl','$address2','$oaddress2','$co02','$cow02')");
								$insert7=mysqli_query($conn, "insert into monaddr(mfin,hpl,addr,oadd,co,co2)
								values('$mfin2','$hpl','$lmark','-','$coaland','')");
								$insert8=mysqli_query($conn, "insert into monaddr(mfin,hpl,addr,oadd,co,co2)
								values('$mfin2','$hpl','$pno','$pnooffice','$cobpno','$cobpno2')"); }
																																																																																																																																																																																																																																																				
									if($insert)
								{
								echo "<script>alert('Updated successfully');window.location.href='monlview.php'</script><br>";
																
								}
								else
								{
									echo "Failure";
								}
							} }
?>
</html>