

<?
session_start();
include("opendb.php");

$tbl="gateentry";
//mysqli_query($db,"drop table $tbl");
mysqli_query($db,"CREATE TABLE $tbl (gateno double(10,2) default 0,jcno double(10,2) default 0,vehicle varchar(200),model varchar(20),regno varchar(20),policereport varchar(100),insurance varchar(200),labour double(10,2) default 0,receivedby varchar(200),entrydate date,duedate date, brcode varchar(20),colour varchar(20),customer varchar(200),owner varchar(200),address varchar(250),license varchar(200),remarks varchar(100),telephone varchar(100),mobile varchar(100),email varchar(100))");
//	mysqli_query($db,"delete from $tbl");


if($sv)
{
 
 $sql="insert into $tbl values('$gateno','$jcno','$vehicle','$model','$regno','$policereport','$insurance','$labour','$receivedby','$entrydate',
'$duedate','$brcode','$colour','$customer','$owner','$address','$license','$remarks','$telephone','$mobile','$email')";
 mysqli_query($db,$sql) or die(mysqli_error($db));

}
if($del)
{
  mysqli_query($db,"delete from machmaster where code='$code'");
}
?>
<title>Demo</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="scripts/jquery-latest.js"></script>
<link type="text/css" href="includes/style1.css" rel="stylesheet" />
<link type="text/css" href="css/form.css" rel="stylesheet" />
<script type="text/javascript">
        $(function() {
          if ($.browser.msie && $.browser.version.substr(0,1)<7)
          {
			$('li').has('ul').mouseover(function(){
				$(this).children('ul').show();
				}).mouseout(function(){
				$(this).children('ul').hide();
				})
          }
        });        
    </script>
<script>
function valid()
{
}
</script>
<body background="back_ground.jpg">
<?php include('logo2.php'); ?>
<?php include('includes/top.php'); ?>
<form name='f1' action='<?print $PHP_SELF?>' onSubmit="return valid()" method='post'> 

<br>
<table class="container"><tr><td>
<font style="font-family: 'Trebuchet MS',Verdana,Helvetica,sans-serif; font-size:15px;">  &nbsp;&nbsp;Master >> <a href="mach_menu.php" style="text-decoration:none;">Machine</a> >> Model Master</font>
<br>
<center>
<body>
<form action="" method="post">
<table width="100%" border="1" cellpadding="1" cellspacing="1" align="center">
  <tr>
    <td colspan="7" bgcolor="#666"><h3 style="color:#fff"><strong>Gate entry</strong></h3></td>
    </tr>
  <tr>
    <td width="135">Serial Number</td>

<?
 $jcres=mysqli_query($db,"select max(gateno) from gateentry where brcode='$brcode'");
 $jcrow=mysqli_fetch_row($jcres);
 if($jcrow[0]<=0)
   $gateno=1;
 else
  $gateno=($jcrow[0]+1);
?>

    <td colspan="4"><input name="gateno" type="text" id="textfield" size="40" value='<?print $gateno?>'/></td>
    <td width="164">job card number</td>

<?
 $jcres=mysqli_query($db,"select max(jcno) from gateentry where brcode='$brcode'");
 $jcrow=mysqli_fetch_row($jcres);
 if($jcrow[0]<=0)
   $jcno=1;
 else
  $jcno=($jcrow[0]+1);
?>
    <td width="327"><input name="jcno" type="text" id="textfield7" size="40" value='<?print $jcno?>' /></td>
   
   
  </tr>
  <tr>
    <td >Date and Time</td>
  <td><input type=text name=entrydate value='<?print date("d-m-Y")?>'</td><td></td><td></td><td></td>
    <td width="164" >service type</td>
    <td width="327"><select name="select2" id="select2">
      <option>SELECT</option>
      <option value="HAI">Insurance</option>
      <option value="HAI">Owner</option>
     

    </select></td>
  </tr>
  <tr>
    <td ><strong>Vehicle Details</strong></td>
    <td colspan="4"><input name="vehdet" type="text" id="textfield3" size="40" /></td>
    <td colspan="2"><h5 style="font-size:11px;padding:0px;margin:0px">&lt;&lt;(enter the registration number here to check if the details already exist)</h5></td>
    </tr>
  <tr>
    <td >Registration Numer</td>
    <td colspan="4"><input name="regno" type="text" id="textfield4" size="40" /></td>
    <td width="164">Insurance company</td>
    <td width="327"><select name="insurance" id="select3">
      <option>SELECT</option>
      <?
 $empre=mysqli_query($db,"select cname from insmaster");
 while($emprow=mysqli_fetch_row($empre))
 {
  print "<option>$emprow[0]</option>";
 }
?>
    </select></td>
  </tr>
  <tr>
    <td >Make</td>
 <td colspan="4"><input name="vehicle" type="text" id="vehicle" size="40" /></td>

    <td width="164">model</td>
    <td width="327"><input name="model" type="text" id="model" size="40" /></td>
  </tr>
  <tr>
    <td >Color</td>
    <td colspan="4"><input name="colour" type="text" id="colour" size="40" /></td>
    
<td width="164">Police Report</td>
    <td width="327"><input name="policereport" type="text" id="model" size="40" /></td>
 
    </tr>
  <tr>
    <td colspan="7" height="4px" bgcolor="#666"><h3 style="color:#fff"><strong>Owner's Details</strong></h3></td>
    </tr>
  <tr>
    <td >Customer Account</td>
    <td colspan="4"><select name='customer' >
<option></option>
<?
$i=1;
$re=mysqli_query($db,"select * from customer order by acname");
while($row=mysqli_fetch_array($re))
{
 print "\n<option value='$row[acname]'>$row[acname]</option>";
 print "\n<script>adr[$i]='$row[addr1] - $row[city] - $row[dist] - $row[stat] - $row[pin] - $row[phone1]' </script>";
 $i++;
}
?>
</select> </td>




</td>
    <td width="164">telephone</td>
    <td width="327"><input name="telephone" type="text" id="textfield8" size="40" /></td>
  </tr>
  <tr>
    <td >Owner's Name</td>
    <td colspan="4"><input name="owner" type="text" id="textfield6" size="40" /></td>
    <td width="164">mobile</td>
    <td width="327"><input name="mobile" type="text" id="textfield9" size="40" /></td>
  </tr>
  <tr>
    <td >address</td>
    <td colspan="4"><textarea name="address" cols="32" id="textarea"></textarea></td>
    <td width="164">email</td>
    <td width="327"><input name="email" type="text" id="textfield10" size="40" /></td>
  </tr>
  <tr>
    <td >license number</td>
    <td colspan="4"><input name="license" type="text" id="textfield5" size="40" /></td>
    <td width="164">estimera exp.date</td>
    <td width="327"><input type="checkbox" name="checkbox" id="checkbox"  /> 
      available</td>
  </tr>
  <tr>
    <td >remarks</td>
    <td colspan="6" ><textarea name="remarks" cols="88" id="textfield2"></textarea></td>
    </tr>

<!--

<?
$result=mysqli_query($db,"select * from gateentry order by jcno");
print "<table cellspacing=1 cellpadding=5 class='report'>";
?>
<tr>
    <td><strong>sl no</strong></td>

    <td colspan="3" ><strong>job card no.</strong></td>
    <td ><strong>date </strong></td>
    <td ><strong>time</strong></td>
    <td ><strong>vehicle account</strong></td>
  </tr>
<?
$i=1;
while($row=mysqli_fetch_row($result))
{
?>

  
   <tr>
    <td ><?print $row[0]?></td>
    <td colspan="3" ><?print $row[1]?></td>
    <td ><?print $row[9]?></td>
    <td >&nbsp;</td>
    <td ><?print $row[4]?></td>
  </tr>
<? 
}
?>
-->
 </table>

</form>
</body>
</html>
<Hr><input type=submit value='Save' name='sv'>

</td></tr></table>

