<?
ob_start();
session_start();
if(isset($_SESSION['ses_name']))
{
$user=$_SESSION['ses_name'];
}else{
header("location:index.php");
}
$tyrenum_veh='';

include("include/config.php");
require_once "include/Database_functions.php";
$sqlObj=new sqlclass();
$imgvehiclevar='v';

$tablename='cf_vehicle';

		if(isset($_REQUEST['save'])){
		   			
			if(isset($_POST['totalmemcnt'])){
			$totalmemcnt=addslashes($_POST['totalmemcnt']);
			}
			
			if(isset($_POST['vehiclenum'])){
			$vehiclenum= $_POST['vehiclenum'];	
			}else{
			$vehiclenum='';
			}
			
			if(isset($_POST['vehtype'])){
			$vehtype= $_POST['vehtype'];
			}
			
			if(isset($_POST['maxcap'])){
			$maxcap= $_POST['maxcap'];
			}
			
			if(isset($_POST['manufacture'])){
			$manufacture=addslashes($_POST['manufacture']);
			}
			
			if(!empty($_POST['insurdate'])){
			$insurdate = date('Y-m-d', strtotime($_POST['insurdate']));
			}
			
			if(!empty($_POST['polldate'])){
			$polldate = date('Y-m-d', strtotime($_POST['polldate']));
			}
			
			if(isset($_POST['national_no'])){
			$national_no= addslashes($_POST['national_no']);
			}
			
			if(!empty($_POST['national_date'])){
			$nationaldate= date('Y-m-d', strtotime($_POST['national_date']));
			}	
			
			if(isset($_POST['state_no'])){
			$state_no= addslashes($_POST['state_no']);
			}
			
			if(!empty($_POST['state_date'])){
			$statedate= date('Y-m-d', strtotime($_POST['state_date']));
			}	
						
			if(!empty($_POST['chase_no'])){
			$chase_no= addslashes($_POST['chase_no']);
			}
			
			if(!empty($_POST['engine_no'])){
			$engine_no= addslashes($_POST['engine_no']);
			}
			
			if(!empty($_POST['shema_nidhi'])){
			$shemanidhi= date('Y-m-d', strtotime($_POST['shema_nidhi']));
			}
						
			if(isset($_POST['gearoil'])){
			$gearoil = $_POST['gearoil'];
			}
			
			if(isset($_POST['gearoil_change'])){
			$gearoilchange = $_POST['gearoil_change'];
			}
						
			if(isset($_POST['engineoil'])){
			$engineoil = $_POST['engineoil'];
			}
			
			if(isset($_POST['engineoil_change'])){
			$engineoilchange = $_POST['engineoil_change'];
			}
			
			if(isset($_POST['fsalicense'])){
			$fsalicense= addslashes($_POST['fsalicense']);
			}
						
			if(!empty($_POST['taxdate'])){
			$taxdate = date('Y-m-d', strtotime($_POST['taxdate']));
			//$taxdate=$_POST['taxdate'];
			}
			
			if(!empty($_POST['fitnessdate'])){
			$fitdate = date('Y-m-d', strtotime($_POST['fitnessdate']));
			//$fitdate=addslashes($_POST['fitnessdate']);
			}
			
			if(isset($_POST['ratekm'])){
			$ratekm= addslashes($_POST['ratekm']);
			}
			
			if(isset($_POST['haulting_chg'])){
			$haultingchg= addslashes($_POST['haulting_chg']);
			}			
						
			
			
			if(isset($_POST['open_km'])){
			$openkm= addslashes($_POST['open_km']);
			}
			
			if(!empty($_POST['servicedate'])){
			$servicedate = date('Y-m-d', strtotime($_POST['servicedate']));
			}
			
			if(!empty($_POST['servicekm'])){
			$servicekm = addslashes($_POST['servicekm']);
			}
			
			if(!empty($_POST['servicekm_master'])){
			$servicekm_master = addslashes($_POST['servicekm_master']);
			}
			
			if(isset($_POST['emgphno'])){
			$emgphno= addslashes($_POST['emgphno']);
			}
			
			if(isset($_POST['oilservice_km'])){
			$oilservice_km= addslashes($_POST['oilservice_km']);
			}
		
			
			
			/*if($insurdate=='1970-01-01'){
			$insurdate='0000-00-00'; }
			if($taxdate=='1970-01-01'){
			$taxdate='0000-00-00'; }			
			if($fitdate=='1970-01-01')
			{
			$fitdate='0000-00-00';
			}
			
			if($licdate=='1970-01-01')
			{
			$licdate='0000-00-00';
			}
			
			if($polldate=='1970-01-01')
			{
			$polldate='0000-00-00';
			}*/
			
			
			$date=date('Y-m-d');
		
			$sqlObj->tablename=$tablename;
			if($vehiclenum!=''){
			$sqlObj->fieldname='(vehiclenum,type,maxcapacity,manufacture,ratekm,haulting_charge,emgcontactno,open_km,add_date,idate,tdate,fitdate,service_date,service_km,servicekm_master,pollution_date,national_permit,national_permit_dt,state_permit,state_permit_dt,chase_num,engine_num,shema_nidhi,gear,gear_change,engine,engine_change,fsa,oilservicekm)';
			$sqlObj->fieldvalue='"'.$vehiclenum.'","'.$vehtype.'","'.$maxcap.'","'.$manufacture.'","'.$ratekm.'","'.$haulting_chg.'","'.$emgphno.'","'.$openkm.'","'.$date.'","'.$insurdate.'","'.$taxdate.'","'.$fitdate.'","'.$servicedate.'","'.$servicekm.'","'.$servicekm_master.'","'.$polldate.'","'.$national_no.'","'.$nationaldate.'","'.$state_no.'","'.$statedate.'","'.$chase_no.'","'.$engine_no.'","'.$shemanidhi.'","'.$gearoil.'","'.$gearoilchange.'","'.$engineoil.'","'.$engineoilchange.'","'.$fsalicense.'","'.$oilservice_km.'"';
			
			$qsy= "insert into ".$tablename.$sqlObj->fieldname." values(".$sqlObj->fieldvalue.")";		
			
			//exit;
			$CreateVehicle 	= mysql_query($qsy);
			
			$lastid=mysql_insert_id();
			}
			
			
			if($totalmemcnt>=1)
				{
				for($i=1;$i<=$totalmemcnt;$i++)
				{
					if(isset($_POST['fieldtyre'.$i])){
					$tyrename=addslashes($_POST['fieldtyre'.$i]);
					}
															
					if($tyrename != '')
					{
						$qsylabour= "insert into cf_tyre (veh_id,tyre_name) values ('$lastid','$tyrename')";			
						mysql_query($qsylabour);
					}
				}				
			}
		
		if(isset($_REQUEST['page'])){
		$page=$_REQUEST['page'];
		header("location:vechicle-list.php?page=$page");
		}else{
		header("location:vechicle-list.php");
		}
}

		$vehiclenum = '';
		$types='';	
		$maxcapacity = '';
		$manufacture= '';
		$ratekm='';	
		$haulting='';
		
		$emgcontactno= '';
		$insdate= '';		
		$taxdate= '';
		$fitdate= '';
		$openkm='';
		$servicedate='';
		$service_kms='';
		$service_kmsmaster='';
		$pollution='';
		$national='';
		$nationalpermit_dt='';				
		$state='';	
		$statepermit_dt='';
		$chaseno='';
		$engineno='';
		$shemanidhis='';		
		$fsa= '';	
		$gear= '';
		$engine='';	
		$gearchange= '';
		$enginechange= '';
		$oilservicekm='';
		
		
		

		if(isset($_REQUEST['id'])){
		
			$id=$_REQUEST['id'];
			$tablename='cf_vehicle';
			$sqlObj->tablename="cf_vehicle";
			$condition=" where 	id='$id'";
			$sqlObj->condition=$condition;
			$sqlObj->fieldvalue="*";
			$fieldvalue=$sqlObj->fieldvalue;
			$sql=$sqlObj->SelectTable();
			$id= $sql['id'];
			$types= $sql['type'];
			$vehiclenum= $sql['vehiclenum'];
			$maxcapacity= $sql['maxcapacity'];
			$manufacture= $sql['manufacture'];
					
			if($sql['licencedate']!= '0000-00-00'){ $licencedate = date('d-m-Y', strtotime($sql['licencedate']));	}
			$emgcontactno= $sql['emgcontactno'];
			$ratekm= $sql['ratekm'];
			$haulting= $sql['haulting_charge'];
			$openkm= $sql['open_km'];
			$chaseno= $sql['chase_num'];
			$engineno= $sql['engine_num'];
			
					
			if($sql['idate']!= '0000-00-00'){ $insdate = date('d-m-Y', strtotime($sql['idate'])); }		
			if($sql['tdate']!= '0000-00-00'){ $taxdate = date('d-m-Y', strtotime($sql['tdate'])); }	
			if($sql['fitdate']!= '0000-00-00'){ $fitdate = date('d-m-Y', strtotime($sql['fitdate'])); }	
			if($sql['service_date']!= '0000-00-00'){ $servicedate = date('d-m-Y', strtotime($sql['service_date'])); }
			$service_kms=$sql['service_km'];
			$service_kmsmaster=$sql['servicekm_master'];
			if($sql['pollution_date']!= '0000-00-00'){	$pollution = date('d-m-Y', strtotime($sql['pollution_date']));	}
			//echo $pollution;
			$national= $sql['national_permit'];
			if($sql['national_permit_dt']!= '0000-00-00'){ $nationalpermit_dt= date('d-m-Y', strtotime($sql['national_permit_dt']));	}
			$state= $sql['state_permit'];
			if($sql['national_permit_dt']!= '0000-00-00'){ $statepermit_dt= date('d-m-Y', strtotime($sql['state_permit_dt']));	}
			if($sql['shema_nidhi']!= '0000-00-00'){  $shemanidhis= date('d-m-Y', strtotime($sql['shema_nidhi']));	}			
			$fsa= $sql['fsa'];	
			$gear= $sql['gear'];
			$engine= $sql['engine'];
			$gearchange= $sql['gear_change'];
			$enginechange= $sql['engine_change'];
			
			$oilservicekm= $sql['oilservicekm'];	
			
			}
				
	if(isset($_POST['edit'])){
		
			
			if(isset($_POST['totalmemcnt'])){
			$totalmemcnt=addslashes($_POST['totalmemcnt']);
			}
			
			if(isset($_POST['vehiclenum'])){
			$vehiclenum= $_POST['vehiclenum'];	
			}
			
			if(isset($_POST['vehtype'])){
			$vehtype= $_POST['vehtype'];
			}
			
			if(isset($_POST['maxcap'])){
			$maxcap= $_POST['maxcap'];
			}
			
			if(isset($_POST['manufacture'])){
			$manufacture=addslashes($_POST['manufacture']);
			}
			
			if(!empty($_POST['insurdate'])){
			//$insurdate=$_POST['insurdate'];
			$insurdate = date('Y-m-d', strtotime($_POST['insurdate']));
			}
			
			if(!empty($_POST['taxdate'])){
			$taxdate = date('Y-m-d', strtotime($_POST['taxdate']));
			//$taxdate=$_POST['taxdate'];
			}
			
			if(!empty($_POST['fitnessdate'])){
			$fitdate = date('Y-m-d', strtotime($_POST['fitnessdate']));
			//$fitdate=addslashes($_POST['fitnessdate']);
			}
			
			if(!empty($_POST['polldate'])){
			$polldate = date('Y-m-d', strtotime($_POST['polldate']));
			}
			
			if(isset($_POST['national_no'])){
			$national_no= addslashes($_POST['national_no']);
			}
			
			if(!empty($_POST['national_date'])){
			$nationaldate= date('Y-m-d', strtotime($_POST['national_date']));
			}	
			
			if(isset($_POST['state_no'])){
			$state_no= addslashes($_POST['state_no']);
			}
			
			if(!empty($_POST['state_date'])){
			$statedate= date('Y-m-d', strtotime($_POST['state_date']));
			}	
			
			if(!empty($_POST['chase_no'])){
			$chase_no= addslashes($_POST['chase_no']);
			}
			
			if(!empty($_POST['engine_no'])){
			$engine_no= addslashes($_POST['engine_no']);
			}
			
			if(!empty($_POST['shema_nidhi'])){
			$shemanidhi= date('Y-m-d', strtotime($_POST['shema_nidhi']));
			}	
						
			if(isset($_POST['gearoil'])){
			$gearoil = $_POST['gearoil'];
			}
			
			if(isset($_POST['gearoil_change'])){
			$gearoilchange = $_POST['gearoil_change'];
			}
						
			if(isset($_POST['engineoil'])){
			$engineoil = $_POST['engineoil'];
			}
			
			if(isset($_POST['engineoil_change'])){
			$engineoilchange = $_POST['engineoil_change'];
			}
			
			if(isset($_POST['fsalicense'])){
			$fsalicense= addslashes($_POST['fsalicense']);
			}
			
			if(isset($_POST['ratekm'])){
			$ratekm= addslashes($_POST['ratekm']);
			}
			
			if(isset($_POST['haulting_chg'])){
			$haultingchg= addslashes($_POST['haulting_chg']);
			}
			
			if(isset($_POST['emgphno'])){
			$emgphno= addslashes($_POST['emgphno']);
			}
			
			if(isset($_POST['open_km'])){
			$openkm= addslashes($_POST['open_km']);
			}
			
			if(!empty($_POST['servicedate'])){
			$servicedate = date('Y-m-d', strtotime($_POST['servicedate']));
			}
			
			if(!empty($_POST['servicekm'])){
			$servicekm = addslashes($_POST['servicekm']);
			}	
			
			if(!empty($_POST['servicekm_master'])){
			$servicekm_master = addslashes($_POST['servicekm_master']);
			}
			
			if(isset($_POST['oilservice_km'])){
			$oilservice_km= addslashes($_POST['oilservice_km']);
			}
				
			$date=date('Y-m-d');
			

			$sqlObj->tablename=$tablename;
			if(!empty($_POST['vehiclenum'])){
					
			$result=mysql_query("update cf_vehicle set vehiclenum='$vehiclenum',type = '$vehtype',maxcapacity='$maxcap',manufacture='$manufacture',ratekm='$ratekm',haulting_charge='$haultingchg',emgcontactno='$emgphno',idate='$insurdate',tdate='$taxdate',fitdate='$fitdate',open_km='$openkm',service_date='$servicedate'		,service_km='$servicekm',servicekm_master='$servicekm_master',pollution_date='$polldate',national_permit='$national_no',national_permit_dt='$nationaldate',state_permit='$state_no',state_permit_dt='$statedate',chase_num='$chase_no',engine_num='$engine_no',shema_nidhi='$shemanidhi',fsa='$fsalicense',gear='$gearoil',gear_change='$gearoilchange',engine='$engineoil',engine_change='$engineoilchange',
			oilservicekm='$oilservice_km' where id='$id'");
			
							
			mysql_query("delete from cf_tyre where veh_id = '$id'");
			
			if($totalmemcnt>=1)
				{
				for($i=1;$i<=$totalmemcnt;$i++)
				{
				
					if(isset($_POST['fieldtyre'.$i])){
					$tyrename=addslashes($_POST['fieldtyre'.$i]);
					}
															
					if($tyrename != '')
					{
						$qsylabour= "insert into cf_tyre (veh_id,tyre_name) values ('$id','$tyrename')";			
						mysql_query($qsylabour);
					}

				}				
				
			}
			
			header("location:vechicle-list.php");
			}
			}		
		
//}



?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>OIL FILL </title>
<link href="css/styles.css" rel="stylesheet"  />
<link type="text/css" href="css_date/ui-lightness/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
<script type="text/javascript" src="scripts_date/jquery.js"></script>
<script type="text/javascript" src="scripts_date/jquery-calendar-1.7.2.js"></script>
<script>$(document).ready(function(){
$('#indate').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});

$(document).ready(function(){
$('#txdate').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});

$(document).ready(function(){
$('#polldate').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});


$(document).ready(function(){
$('#fitnessdate').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});


$(document).ready(function(){
$('#servicedate').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});

$(document).ready(function(){
$('#national_date').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});

$(document).ready(function(){
$('#state_date').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});

$(document).ready(function(){
$('#shema_nidhi').datepicker({
showOn: 'both',
buttonImage: 'icons_date/calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy'
});
});






	function addmorefiled(cnt){		
	//------Add More Surety (Add Member Form)
  var dec=parseInt(cnt)-parseInt(1);
  if(document.getElementById("rem"+dec)){
  document.getElementById("rem"+dec).innerHTML='<a style="cursor:hand;cursor:pointer;font-weight:bold;" onclick="remfiled('+cnt+')">Remove</a>';
  }
 
  var k=parseInt(cnt)+parseInt(1);
//  var a =  $('#MemberModelName21').html();
  document.getElementById("addmoreid"+cnt).innerHTML=' <table cellpadding="5"><tr><td><p><input type="text" name="fieldtyre'+cnt+'" style="width:100px;border:1px solid #ccc;" class="input1 input3" id="fieldtyre'+cnt+'" placeholder="Tyre Name"></p></td></tr><tr><td><p class="input1 " id="rem'+cnt+'"><a style="cursor:hand;cursor:pointer;font-weight:bold;" onclick="addmorefiled('+k+')">Add More</a></p></td></tr></table><div id="addmoreid'+k+'"></div>';
 if(document.getElementById("totalmemcnt")){
 document.getElementById("totalmemcnt").value=cnt;
 }
  }

</script>



<script type="text/javascript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
function validation(){

if ( ( document.frmname.vehtype[0].checked == false ) && ( document.frmname.vehtype[1].checked == false ) ) { alert ( "Please check Vechicle Type" ); return false; }

if(document.frmname.vehiclenum.value==''){
alert("Enter the Vehicle Number");
document.frmname.vehiclenum.focus();
return false;
}

if(document.frmname.maxcap.value==''){
alert("Enter the Max Capacity");
document.frmname.maxcap.focus();
return false;
}



if(document.frmname.insurdate.value==''){
alert("Enter the Insurance date");
document.frmname.insurdate.focus();
return false;
}

if(document.frmname.taxdate.value==''){
alert("Enter the Tax date");
document.frmname.taxdate.focus();
return false;
}


if(document.frmname.fitnessdate.value==''){
alert("Enter the Fittness date");
document.frmname.fitnessdate.focus();
return false;
}

if(document.frmname.manufacture.value==''){
alert("Enter the Manufacture & Model");
document.frmname.manufacture.focus();
return false;
}

/*var bodyradio = document.getElementsByName("vehbodytype");
    var formValidBody = false;

    var i = 0;
    while (!formValidBody && i < bodyradio.length) {
        if (bodyradio[i].checked) formValidBody = true;
        i++;        
    }

    if (!formValidBody) alert("Please check Body Type");
    return formValidBody;
	
	
	
	
	var radios = document.getElementsByName("vehownedtype");
    var formValid = false;

    var j = 0;
    while (!formValid && j < radios.length) {
        if (radios[j].checked) formValid = true;
        j++;        
    }

    if (!formValid) alert("Please check Owner/CC");
    return formValid;*/
	
if ( ( document.frmname.vehbodytype[0].checked == false ) && ( document.frmname.vehbodytype[1].checked == false ) ) { alert ( "Please check Body Type" ); return false; }



if(document.frmname.ratekm.value==''){
alert("Enter the Rate Per Km");
document.frmname.ratekm.focus();
return false;
}

if(document.frmname.regownername.value==''){
alert("Enter the Owner's name");
document.frmname.regownername.focus();
return false;
}

if(document.frmname.regownerph.value==''){
alert("Enter the Owner's Phno");
document.frmname.regownerph.focus();
return false;
}

if(document.frmname.drivername.value==''){
alert("Enter the Driver name");
document.frmname.drivername.focus();
return false;
}

if(document.frmname.driverph.value==''){
alert("Enter the Driver Phno");
document.frmname.driverph.focus();
return false;
}

if(document.frmname.drvlicno.value==''){
alert("Enter the Driver Licience No");
document.frmname.drvlicno.focus();
return false;
}












/*var cnt=document.getElementById('divcnt').value;chasisnum1 enginenum1
for(i=1;i<=cnt;i++){alert(document.getElementById('vehiclenum'+i).value);
if(document.getElementById('vehiclenum'+i)){
if(document.getElementById('vehiclenum'+i).value==''){
alert("Enter the Vehicle Number");
document.getElementById('vehiclenum'+i).focus();
return false;
}
}
}*/
}
function write_val(value){
 document.getElementById('hidenval').value+="'"+value+"',";
}
</script>

<script type="text/javascript">
function toggle(value){
if(value=='show')
 document.getElementById('mytext').style.visibility='visible';
else
 document.getElementById('mytext').style.visibility='hidden';
}

</script>

<script type="text/javascript">
function toggle(val){

if(val == 'Lease')
{
	document.getElementById('ownedcc').style.display='block';
  	
}
else{
 	document.getElementById('ownedcc').style.display='none';
 	
	}

}

function togglehide(){
	document.getElementById('ownedcc').style.display='none';
 	
	}
</script>

<style>
#ownedcc{
 <?php if($types=='Lease') { ?>
 
	display:block;
	<?php }else { ?>
	display:none;
	<?php } ?>
}
</style>
</head>

	
<body onBlur="togglehide()">
<div class="wrapper">
<div>
<?php 

	include("header.php");
	$r = 1;
?>
 
</div>
 
 <div class="tabbedArea">
 
  
  
  <div class="tabBody">
  
   <h1>Add Vehicle</h1>
   <form name="frmname" method="post" action="">
   <div class="addEmp">
    
   <div class="form1">
    
    <div>
     
      <p class="input1">Vehicle No<span style="color:#FF3300">*</span></p><input type="text" name="vehiclenum" class="input1 input3" value="<?=$vehiclenum?>">
     </div>
     
     <div class="searchField">
     <p class="input1">Vehicle Type<span style="color:#FF3300">*</span></p>
     <div class="box">
     
     <div><input name="vehtype" type="radio" value="Lease" <?php if($types=='Lease'){?> checked="checked"  <?php } ?> onClick="toggle(this.value);" ><label>Lease</label></div>
     <div><input name="vehtype" type="radio" value="Own" <?php if($types=='Own'){?> checked="checked"  <?php }?> onClick="toggle(this.value);"><label>Own</label></div>
    </div>
    </div>
     
     <div>
      <p class="input1">Max Capacity<span style="color:#FF3300">*</span></p><input type="text" name="maxcap" class="input1 input3" value="<?=$maxcapacity?>">
     </div>
     
     
          
    
     
     <div>
      <p class="input1">Vehicle Insurance Valid Till <span style="color:#FF3300">*</span></p><input type="text" name="insurdate" id="indate" size="20" maxlength="100" class="input1" value="<?=$insdate?>" />
     </div> 
	 
	 <div>
      <p class="input1">Vehicle Pollution Till <span style="color:#FF3300">*</span></p><input type="text" name="polldate" id="polldate" size="20" maxlength="100" class="input1" value="<?=$pollution?>" />
     </div>
    
    
     <div>
      <p class="input1">Vehicle Tax Valid Till<span style="color:#FF3300">*</span></p><input type="text" name="taxdate"  id="txdate" class="content input1" size="20" maxlength="100" value="<?=$taxdate?>" />
     </div> 
    
  <div>
      <p class="input1">Vehicle Fittness Valid Till<span style="color:#FF3300">*</span></p><input type="text" id="fitnessdate" name="fitnessdate" class="content input1" size="20" maxlength="100" value="<?=$fitdate?>" />
     </div> 
	 
	<div>
      <p class="input1">National Permit No<span style="color:#FF3300">*</span></p><input type="text" id="national_no" name="national_no" class="content input1" size="20" maxlength="100" value="<?=$national?>" />
     </div>
	 
	 <div>
      <p class="input1">National Permit Valid Till<span style="color:#FF3300">*</span></p><input type="text" id="national_date" name="national_date" class="content input1" size="20" maxlength="100" value="<?=$nationalpermit_dt?>" />
     </div> 
	 
	 <div>
      <p class="input1">State Permit No<span style="color:#FF3300">*</span></p><input type="text" id="state_no" name="state_no" class="content input1" size="20" maxlength="100" value="<?=$state?>" />
     </div>
	 
	 <div>
      <p class="input1">State Permit Valid Till<span style="color:#FF3300">*</span></p><input type="text" id="state_date" name="state_date" class="content input1" size="20" maxlength="100" value="<?=$statepermit_dt?>" />
     </div> 
	
	 
    
   </div>
   
   <div class="form1">
    <div>
      
          
    <br/>
	
	<div>
      <p class="input1">Chase No<span style="color:#FF3300">*</span></p>
      <input type="text" id="chase_no" name="chase_no" class="content input1" size="20" maxlength="100" value="<?=$chaseno?>" />
     </div>
	 
	 <div>
      <p class="input1">Engine No<span style="color:#FF3300">*</span></p>
      <input type="text" id="engine_no" name="engine_no" class="content input1" size="20" maxlength="100" value="<?=$engineno?>" />
     </div>
	
	<div>
      <p class="input1">Shema Nidhi<span style="color:#FF3300">*</span></p><input type="text" id="shema_nidhi" name="shema_nidhi" class="content input1" size="20" maxlength="100" value="<?=$shemanidhis?>" />
     </div>
	 
	<div>
      <p class="input1">FSA Licence<span style="color:#FF3300">*</span></p><input type="text" name="fsalicense" class="input1 input3" value="<?=$fsa?>">
     </div> 
     
    <div>
      <p class="input1">Manufacture & Model(Year)<span style="color:#FF3300">*</span></p><input type="text" name="manufacture" class="input1 input3" value="<?=$manufacture?>">
     </div>   
	
    <div>
      <p class="input1">Rate per KM<span style="color:#FF3300">*</span></p><input type="text" name="ratekm" class="input1 input3" value="<?=$ratekm?>">
     </div>
	 
	 <div>
      <p class="input1">Haulting Charge<span style="color:#FF3300">*</span></p>
	  <select class="chzn-select restselect input3 input1" name="haulting_chg" id="haulting_chg">
                    <option value="">Haulting Chg</option>
                    <?php 
                            $sq_haulting="select * from cf_hault";
                            $arrhault=mysql_query($sq_haulting);
                            while($reshault=mysql_fetch_array($arrhault))
                            {
                        ?>
                    <option value="<?=$reshault['hault_id']?>" <? if($reshault['hault_id']==$haulting) {?>selected<? }?>>
                    <?=$reshault['hault_amt']?>
                    </option>
                    <?php
                                }
                     ?>
					 
					
                  </select>   
     </div>
	 
	 <div>
      <p class="input1">Open Km<span style="color:#FF3300">*</span></p><input type="text" name="open_km" class="input1 input3" value="<?=$openkm?>">
     </div>
     
     <div>
      <p class="input1">Upcoming Service Date<span style="color:#FF3300">*</span></p><input type="text" id="servicedate" name="servicedate" class="content input1" size="20" maxlength="100" value="<?=$servicedate?>" />
     </div> 
     
	 <div>
      <p class="input1">Upcoming Service Km<span style="color:#FF3300">*</span></p><input type="text" id="servicekm" name="servicekm" class="content input1" size="20" maxlength="100" value="<?=$service_kms?>" />
     </div> 
      
	 <div>
      <p class="input1">Service Oil (Master)</p>
      <input type="text" id="servicekm_master" name="servicekm_master" class="content input1" size="20" maxlength="100" value="<?=$service_kmsmaster?>" />      
     </div>    
      
      
    </div>
    
     
   </div>
   
   
   <div class="form1">
    <div>
    
  	
     
	
	 <div>
      <p class="input1">Gear Oil Km (Master)</p>
      <input type="text" id="gearoil" name="gearoil" class="content input1" size="20" maxlength="100" value="<?=$gear?>" />      
     </div>
	 
	 <div>
      <p class="input1">Update Gear Oil Km </p>
      <input type="text" id="gearoil_change" name="gearoil_change" class="content input1" size="20" maxlength="100" value="<?=$gearchange?>" />      
     </div>
	 
	 <div>
      <p class="input1">Engine Oil Km (Master)</p><input type="text" id="engineoil" name="engineoil" class="content input1" size="20" maxlength="100" value="<?=$engine?>" />      
     </div>
	 
	 <div>
      <p class="input1">Update Engine Oil<span style="color:#FF3300">*</span></p><input type="text" id="engineoil_change" name="engineoil_change" class="content input1" size="20" maxlength="100" value="<?=$enginechange?>" />      
     </div>
	 
	 <div>
      <p class="input1">Oil Service</p>
	  <select class="chzn-select restselect input3 input1" name="oilservice_km" id="oilservice_km">
                    <option value="">Km</option>
                    <option value="20000" <? if($oilservicekm=='20000') {?>selected<? }?>>20000</option>
					<option value="40000" <? if($oilservicekm=='40000') {?>selected<? }?>>40000</option>
                  </select>   
     </div>
    
      <div>
      <p class="input1">Emergency Contact No</p><input type="text" name="emgphno" class="input1 input3" value="<?=$emgcontactno?>">
     </div> 

	 
		  <?php 
		   if(!empty($_REQUEST['id']))
		   {
		   	$id=$_REQUEST['id'];
			$sql2 = mysql_query("select * from cf_tyre where veh_id = '$id'");
			if(mysql_num_rows($sql2) > 0)
			{
			$k=1;
				while($result = mysql_fetch_array($sql2))
				{
				$r=$r+1;
		    ?>
           <div>    
           		<p class="input1">Tyre Name</p> 
      			<input type="text" name="fieldtyre<?=$k?>" class="input1 input3" value="<?=$result['tyre_name']?>" placeholder="Rate" >
     	   </div>
           <?php $k++;
		   }
		   
			}
		   }
	 ?>
	 
	 <div>    
		<p class="input1">Tyre Name</p> 
		<input type="text" name="fieldtyre<?=$r?>" class="input1 input3" value="" placeholder="Tyre Name">
   </div>
           
   <div>
	  <p class="input1 " id="rem<?php echo $r;?>"><a style="cursor:hand;cursor:pointer;font-weight:bold;" onClick="addmorefiled('<?php echo $r+1;?>')">Add More</a></p>
	  <div id="addmoreid<?php echo $r+1;?>"></div><input type="hidden" name="totalmemcnt" id="totalmemcnt" value="<?php echo $r;?>"/>
   </div>
     
     </div>
    <div class="searchField">
     <?php
	 	if(isset($_REQUEST['id'])){
	  ?>
      <input name="edit" type="submit" class="input1" value="Edit" onClick="return validation_1();"/>
      <?php }else { ?>
     <input name="save" type="submit" class="input1" value="Save" onClick="return validation_1();"/>
     <?php } ?>
     <input type="button" class="input1" value="Cancel">
     
     
    </div>

   </div>
   
   
   <div class="mand"><p>Fields marked <span style="color:#FF3300">*</span> are Mandatory</p></div>
   
   </div>
   </form>
   </div>
 </div>
 <div class="footer"><p>Powered by <a href="http://www.aadhocc.co.uk/" target="_blank">Aadhocc</a></p></div>
 
</div>
<div class="quicLInksCover">
<?php 
	include("leftlink.php");
?>
 </div>
</body>
</html>
