
<?
session_start();
include("test.php");
include("opendb.php");
include("includes/function.php");
if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}


        
?>
<!DOCTYPE html>
<html><head>



<style>
.tble1 input {
background-color:transparent;
border: 0px solid;
height:20px;
//width:160px;
color:black;
}
.tble1
{
border-collapse:collapse;

}	

</style>





<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>PSN Telcon</title>
   <script type="text/javascript" src="scripts/jquery-latest.js"></script>
	
      <link type="text/css" href="css2/style1.css" rel="stylesheet" />
      <link type="text/css" href="css2/form1.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>

    <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 type="text/javascript">
    $(document).ready(function() {
        var cont_left = $("#container").position().left;
        $("a img").hover(function() {
            // hover in
            //$(this).parent().parent().css("z-index", 1);
            $(this).animate({
               height: "110",
               width: "110",
              
            }, "fast");
        }, function() {
            // hover out
         //   $(this).parent().parent().css("z-index", 0);
            $(this).animate({
                height: "80",
                width: "80",
                
            }, "fast");
        });
        
        $(".img").each(function(index) {
            var left = (index * 160) + cont_left;
            $(this).css("left", left + "px");
        });
    });




    </script>

<!-- js code below for active enter with textfield-->


<script type="text/javascript">

/***********************************************
* Disable "Enter" key in Form script
* This notice must stay intact for use
***********************************************/
                
function handleEnter (field, event) {
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 

		else
		return true;
	}      


function validnum(str)
{
  var fldid=document.getElementById(str).value;
 if(isNaN(fldid))
  {
   alert('enter digit');
  document.getElementById(str).value=0;
  }
}
</script>


<style>

</style>
<script src="css3-dropdown-menu-demo_files/bsa.js" async="" type="text/javascript"></script><script async="async" src="css3-dropdown-menu-demo_files/s_a5f348233fceef06ba365ab392938d10.js" id="_bsap_js_a5f348233fceef06ba365ab392938d10" type="text/javascript"></script><style id="bsa_css" type="text/css">.one{position:relative}.one .bsa_it_ad{display:block;padding:15px;border:1px solid #e1e1e1;background:#f9f9f9;font-family:helvetica,arial,sans-serif;line-height:100%;position:relative}.one .bsa_it_ad a{text-decoration:none}.one .bsa_it_ad a:hover{text-decoration:none}.one .bsa_it_ad .bsa_it_t{display:block;font-size:12px;font-weight:bold;color:#212121;line-height:125%;padding:0 0 5px 0}.one .bsa_it_ad .bsa_it_d{display:block;font-size:11px;color:#434343;font-size:12px;line-height:135%}.one .bsa_it_ad .bsa_it_i{float:left;margin:0 15px 10px 0}.one .bsa_it_p{display:block;text-align:right;position:absolute;bottom:10px;right:15px}.one .bsa_it_p a{font-size:10px;color:#666;text-decoration:none}.one .bsa_it_ad .bsa_it_p a:hover{font-style:italic}</style></head>
<body style="text-align: center; height:100%;width:100%;margin: 0 auto !important;">
<div class='cont'>

<?php include('includes/top.php'); ?>
<br>
<table id="main_table_wrapper" style="position: relative; top: 0px; width: 800px; margin: 0px auto ! important; text-align: left;" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td>


	<link type="text/css" href="css/jquery-ui-1.8.16.custom.css" rel="stylesheet" />	
		<script type="text/javascript" src="css/jquery-1.6.2.min.js"></script>
		<script type="text/javascript" src="css/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript">
$(function(){

$(".partcode").live("keydown.autocomplete",function(){

$partcode = $(this);

$row = $partcode.parent().parent();
$(this).autocomplete({
		source: function( request, response ) {

		$.ajax({
			url: "search4.php",
			dataType: "json",
			data: "key="+$partcode.val(),
			success: function( data ) {
				response( $.map( data, function( item ) {
					return {
						label: item.partcode+' | '+  item.partname + '| '+ item.supqty +'|'+item.price    ,
						value: item.partcode,
						name:item.partname,
						qty:item.supqty,
						price:item.price,

					}
				}));
			}
		});
	}
	
,
	minLength: 2,
	select: function( event, ui ) {

	$row.find('.partname').val(ui.item.name);
	$row.find('.supqty').val(ui.item.qty);
	$row.find('.rate').val(ui.item.price);
	
	/*log( ui.item ?
	"Selected: " + ui.item.label :
	"Nothing selected, input was " + this.value);
	*/
	 }
	
	});

					
});




$(".partname").live("keydown.autocomplete",function(){

$partcode = $(this);

$row = $partcode.parent().parent();
$(this).autocomplete({
		source: function( request, response ) {

		$.ajax({
			url: "search4.php?type=name",
			dataType: "json",
			data: "key="+$partcode.val(),
			success: function( data ) {
				response( $.map( data, function( item ) {
					return {
						label: item.partcode+' | '+  item.partname + '| '+ item.supqty +'|'+item.price    ,
						value: item.partname,
						code:item.partcode,
						qty:item.supqty,
						price:item.price,

					}
				}));
			}
		});
	}
	
,
	minLength: 2,
	select: function( event, ui ) {

	$row.find('.partcode').val(ui.item.code);
	$row.find('.supqty').val(ui.item.qty);
	$row.find('.rate').val(ui.item.price);
	
	/*log( ui.item ?
	"Selected: " + ui.item.label :
	"Nothing selected, input was " + this.value);
	*/
	 }
	
	});

					
});



$(".service").live("keydown.autocomplete",function(){

$service = $(this);

$row = $service.parent().parent();
$(this).autocomplete({
		source: function( request, response ) {

		$.ajax({
			url: "search4.php?type=service",
			dataType: "json",
			data: "key="+$service.val(),
			success: function( data ) {
				response( $.map( data, function( item ) {
					return {
						label: item.partcode+' | '+  item.partname    ,
						value: item.partcode,
						code:item.partname,


					}
				}));
			}
		});
	}
	
,
	minLength: 2,
	select: function( event, ui ) {

	$row.find('.service').val(ui.item.value);
	$row.find('.servamt').val(ui.item.code);
	
	/*log( ui.item ?
	"Selected: " + ui.item.label :
	"Nothing selected, input was " + this.value);
	*/
	 }
	
	});

					
});



});

function handleEnter (field, event) {
               
		var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
		if (keyCode == 13) {
			var i;
			for (i = 0; i < field.form.elements.length; i++)
				if (field == field.form.elements[i])
					break;
			i = (i + 1) % field.form.elements.length;
			field.form.elements[i].focus();
			return false;
		} 
		else
		return true;
	}   
</script>







<?php echo "<body onload='f1.entrydate.focus()'>\n"; ?>

<link href="css1/xp1.css" type="text/css" rel="stylesheet" media="print,screen"  />


<?

print 'Branch Code:'.$brcode;
$ker=mysqli_query($db,"select brstate from branch where brcode='$brcode'");
$kar=mysqli_fetch_array($ker);
?>
<script>
var cur=1
var partcode=[];
var partname=[];
var lstprice=[];
var handp=[];
var conv=[];
var discar=[];
var cessar=[];
var exq=[];
function delrow(r)
{
 var i=r.parentNode.parentNode.rowIndex
 document.getElementById('myTable').deleteRow(i)
 cur--;
}

function insRow()
{
var x=document.getElementById('myTable').insertRow(1)
var a=x.insertCell(0)
var y=x.insertCell(1)
var z=x.insertCell(2)	
var eng=x.insertCell(3);

var ag=x.insertCell(4)
var z1=x.insertCell(5)	
var dis=x.insertCell(6)
var hnd=x.insertCell(7);
var tot=x.insertCell(8);
var qqty=x.insertCell(9);
var dd1=x.insertCell(10);
var mm1=x.insertCell(11);
var yy1=x.insertCell(12);

var dd=x.insertCell(13);

a.innerHTML=cur;
y.innerHTML="<input type=hidden text readonly name=partcode[] id=partcode"+cur+" class='partcode' size=20 onKeyPress='return handleEnter(this, event)'>";
z.innerHTML="<input type=text name=partname[] id=partname"+cur+" size=20  class='partname' onKeyPress='return handleEnter(this, event)'>"
ag.innerHTML="<input type=text name='qty[]' id=qty"+cur+" size=3 onChange=calcamt(cur) onKeyPress='return handleEnter(this, event)' onKeyup=validnum(this.id)>";
z1.innerHTML="<input type=text  id='rate"+cur+"' name=rate[] size=10  class='rate' onChange=calcamt(cur) onKeyPress='return handleEnter(this, event)' onKeyup=validnum(this.id)>"
dis.innerHTML="<input type=text name='disc[]' id=disc"+cur+" size=6  onChange=calcamt(cur) onKeyPress='return handleEnter(this, event)' onKeyup=validnum(this.id)>";
hnd.innerHTML="<input type=text value='0.0' name='hnd[]' id=hnd"+cur+" size=3 onChange=calcamt(cur)  >";
tot.innerHTML="<input type=text readonly value='total' name='gtot[]'  id=gtot"+cur+" size=8>";
qqty.innerHTML="<input type=text readonly name='exqty[]' id=exqty"+cur+" size=3 class='supqty' >";
var xv="";
xv="<select name='spareengineer[]' id=spareengineer"+cur+" onKeyPress='return handleEnter(this, event)'><option>Orignial</option><option>Commercial</option><option>Used</option>\n";


eng.innerHTML=xv+"</select> ";
dd1.innerHTML="<input type=text value='<?print date('d')?>' name='day[]' id=day"+cur+" size=2>";
mm1.innerHTML="<input type=text value='<?print date('m')?>' name='month[]' id=month"+cur+" size=2>";
yy1.innerHTML="<input type=text value='<?print date('Y')?>' name='year[]' id=year"+cur+" size=4>";

dd.innerHTML="<input type=button value='Del' onClick='delrow(this)'>";

//alert(cur);
cur++; 
f1.partname.focus();


}// end function insrow

function setval(x)
{
 var ele1='partname'+(cur-1);
 var ele2='rate'+(cur-1);
 var hand='hnd'+(cur-1);
 var cpele='cessp'+(cur-1);
 var disele='disc'+(cur-1);
 var cessele='cessp'+(cur-1);
 var qqtyele='exqty'+(cur-1);
 var qele='qty'+(cur-1)

 document.getElementById(qele).value=0;
 document.getElementById(ele1).value=partname[x-1];
 document.getElementById(ele2).value=lstprice[x-1];
 document.getElementById(hand).value=handp[x-1];
 document.getElementById(cpele).value=conv[x-1];
 document.getElementById(disele).value=discar[x-1];
<?
if($kar[0]!='Kerala') 
{
?>
 document.getElementById(cessele).value=0; //cessar[x-1];
<?
}
else
{
?>
 document.getElementById(cessele).value=0; //cessar[x-1];
<?
}
?>
 document.getElementById(qqtyele).value=exq[x-1];

}
function calcamt(y)
{y--;
 var ele2='rate'+(y);
 var qele='qty'+y;  
 var amtele='amt'+y;
 var disele='disc'+y;
 var handele='hnd'+y;
 var vatele='vat'+y;
 var taxele='taxamt'+y;
 var cessele='cesamt'+y;
 var cesspele='cessp'+y;
 var gtotele='gtot'+y;
 var qqtyele='exqty'+y;
handamt=0;
vatamt=0;

 var exisqty=parseFloat(document.getElementById(qqtyele).value);
 
 var qty=parseFloat(document.getElementById(qele).value);
 if(qty>exisqty)
 {
  alert('Insufficient Quantity');
 document.getElementById(qele).value=0;
 document.getElementById(amtele).value=0;

 // return;
 }
 var rate=document.getElementById(ele2).value;
 var amount=parseFloat(qty)*parseFloat(rate);
 var discp=parseFloat(document.getElementById(disele).value);
 if(discp>0)
 {
   disamt=discp;
   amount-=disamt;
 }
//document.getElementById(amtele).value=amount.toFixed(2);
handp=parseFloat(document.getElementById(handele).value);
if(handp>0)
 handamt=handp;
amt1=(amount+handamt);

document.getElementById(gtotele).value=amt1.toFixed(2);
}
//***********************************


function calcamt2(y)
{//y--; 

 var ele2='rate'+(y);
 var qele='qty'+y;
 var amtele='amt'+y;
 var disele='disc'+y;
 var handele='hnd'+y;
 var gtotele='gtot'+y;
 var qqtyele='exqty'+y;
handamt=0;
vatamt=0;

 var qty=document.getElementById(qele).value;
 var exqty2=document.getElementById(qqtyele).value;

 var rate=document.getElementById(ele2).value;
 var amount=parseFloat(qty)*parseFloat(rate);
 var discp=parseFloat(document.getElementById(disele).value);
 if(discp>0)
 {
   disamt=discp;
   amount-=disamt;
 }
//document.getElementById(amtele).value=amount.toFixed(2);
handp=parseFloat(document.getElementById(handele).value);
if(handp>0)
 handamt=handp;
amt1=(amount+handamt);

document.getElementById(gtotele).value=amt1.toFixed(2);
}

//**********************************
var cur2=1;
function delrow2(r)
{
 var i=r.parentNode.parentNode.rowIndex
 document.getElementById('myTable2').deleteRow(i)
 //cur2--;
}
function insRow2()
{
var x=document.getElementById('myTable2').insertRow(cur2)
var a=x.insertCell(0)
var y=x.insertCell(1)
var job=x.insertCell(2)
var z=x.insertCell(3)	

var engs=x.insertCell(4)
var dd3=x.insertCell(5);
var mm3=x.insertCell(6)	
var yy3=x.insertCell(7);
var dd2=x.insertCell(8);
a.innerHTML=cur2
y.innerHTML="<input type=text name=service[] id=service"+cur2+" size=30 class='service' onKeyPress='return handleEnter(this, event)'>"
z.innerHTML="<input type=text name=servamt[] id=servamt"+cur2+" size=8 onChange='calctotal(cur2)' class='servamt' onKeyPress='return handleEnter(this, event)' onKeyup=validnum(this.id)>"

dd2.innerHTML="<input type=button value='Del' onClick='delrow2(this)'>";
var v="";
v="<select name='engineer1[]' id=engineer1"+cur+"><option></option>\n";

<?
 $empre1=mysqli_query($db,"select ename from empprofile where status!='releived' order by ename");
 while($emprow1=mysqli_fetch_row($empre1))
{
print "v=v+'<option>$emprow1[0]</option>' \n";
}
?>
engs.innerHTML=v+"</select> ";

var vx="";
vx="<select name='jobs[]' id=jobs"+cur+"  onKeyPress='return handleEnter(this, event)'><option>Change</option><option>Repair</option>\n";

job.innerHTML=vx+"</select> ";

dd3.innerHTML="<input type=text value='<?print date('d')?>' name='day1[]' id=day"+cur+" size=2>";
mm3.innerHTML="<input type=text value='<?print date('m')?>' name='month1[]' id=month"+cur+" size=2>";
yy3.innerHTML="<input type=text value='<?print date('Y')?>' name='year1[]' id=year"+cur+" size=4>";



cur2++;
} // end function insrow2
function calctotal(vv)
{vv--;
  var sele='servamt'+vv
  var tx='servtx'+vv
  var ed='edutx'+vv;
  var hred='hredutx'+vv;
  var ttele='tot'+vv;

  amt=document.getElementById(sele).value;
  stx=(amt*parseFloat(document.getElementById(tx).value))/100;
  edtx=(stx*parseFloat(document.getElementById(ed).value))/100;
  hredtx=(stx*parseFloat(document.getElementById(hred).value))/100;
  totamt=parseFloat(amt)+parseFloat(stx)+parseFloat(edtx)+parseFloat(hredtx);
  document.getElementById(ttele).value=parseFloat(totamt).toFixed(2);
}
function calctotal2(vv)
{
  var sele='servamt'+vv
  var tx='servtx'+vv
  var ed='edutx'+vv;
  var hred='hredutx'+vv;
  var ttele='tot'+vv;

  amt=document.getElementById(sele).value;
  stx=(amt*parseFloat(document.getElementById(tx).value))/100;
  edtx=(stx*parseFloat(document.getElementById(ed).value))/100;
  hredtx=(stx*parseFloat(document.getElementById(hred).value))/100;
  totamt=parseFloat(amt)+parseFloat(stx)+parseFloat(edtx)+parseFloat(hredtx);
  document.getElementById(ttele).value=parseFloat(totamt).toFixed(2);
}

function valid()
{
   alert('Select Cash or Credit, Cash will be posted automatically');
 if(document.getElementById('ptype').selectedIndex<=0)
 {
   alert('Select Cash or Credit, Cash will be posted automatically');
   return false;
 }
 if(confirm('Do you want to save?')) 
  return true;
 else
  return false;
}
</script>
<style>
#save
{
background:url(images/button.png) no-repeat;
width:109px;
height:39px;
border:0px;
}
</style>
<?
if($show)
{
 $res=mysqli_query($db,"select * from gateentry where jcno='$jcno' and brcode='$brcode'");
 $jrow=mysqli_fetch_array($res);
?>
<form name=f1 action='jobcard1.php' method='post' >
<div style="text-align:right;"><input type='button'  id='save' name='save' value='' onClick='return valid2()'></div>
<table border=1 class='form'>
<h4>JCNo:<input type=text readonly name='jcno' size=5 value='<?print $jcno?>'></h4>

<tr><td>Date </td><td><input type=text readonly name='date' value= '<?print datetohtml($jrow[entrydate])?>' size=8></td>
    <td>RegNo </td><td><input type=text readonly name='msno' value='<?print $jrow[regno]?>' size=12></td>

	<td>Delivery Date</td><td><input type=text readonly name='dcomm' value='<?print datetohtml($jrow[estdate])?>' size=8></td>
	<td>Model </td><td><input type=text readonly name='model' value='<?print $jrow[model]?>' size=8></td>
	<td>Owner </td><td><input type=text readonly name='cname' value='<?print $jrow[owner]?>'></td>
</tr>
<tr>	<td>Make </td><td><input type=text readonly name='stdate' value='<?print $jrow[vehiclename]?>'></td>
	<td>Ins type </td><td><input type=text readonly name='instype' value='<?print $jrow[instype]?>'></td>
	<td>Job Type </td><td><input type=text readonly name='wtstdate' value='<?print $jrow[jobtype]?>' size=8></td>
	<td>ReceivedBy </td><td><input type=text readonly name='wtyenddate' value='<?print $jrow[receivedby]?>' size=8></td>
	<td>KMS </td><td><input type=text name='hmr' size=8 value='<?print $jrow[hmr]?>'></td>

</tr>
<tr>
			<td>User </td><td><input type=text readonly name='user' value='<?print $user?>' size=8></td>
<td>Entry Date </td><td colspan=3>
dd <input type=text readonly name='entrdate1' size=1 value='<?print date('d')?>'>
mm <input type=text readonly name='entrdate2' size=1 value='<?print date('m')?>'>
yy <input type=text readonly name='entrdate3' size=2 value='<?print date('Y')?>'>
</td>
<td>ChasisNO </td><td><input type=text name='chasisno' value='<?print $jrow[chasisno]?>'></td>

<td></td>
<td></td>
<td></td>

</tr>
</table> 
<h4>Parts Request </h4>

<input type="button" onclick="insRow()" value=" Add Item ">
<table border=1  id="myTable" class='tble1' width=100%>


<th> No <th>Part Code<th> Part Name<th>Part type <th>Qty<th>Rate<th>Discount<th> OtherCharges<th>Total<th>Ref<th colspan=3>OrderDate<th>Delete


<?
$tbl="stockrepdet10".$brcode.$user;
mysqli_query($db,"delete from $tbl where supqty<=0 ");

 $res=mysqli_query($db,"select * from ojcardparts where jcno='$jcno' and brcode='$brcode'");
 $i=1;
 $j=100;
 while($jrow=mysqli_fetch_array($res))
  {
$edate1=explode('-',$jrow[edate]);

   print "<tr><td>".$i."</td><td><input type=hidden text readonly name='partcode[]' value='$jrow[2]' onKeyPress='return handleEnter(this, event)' size=12 ></td>";
 print "<td><input type=text size=20 name='partname[]' onKeyPress='return handleEnter(this, event)' value='$jrow[3]'></td>";
 print "<td><input type=text  readonly name='spareengineer[]' id='spareengineer$j' onKeyPress='return handleEnter(this, event)' value='$jrow[engineer]' size=20></td>";
  
 print "<td><input type=text size=4 name='qty[]' id='qty$j' value='$jrow[qty]' onKeyPress='return handleEnter(this, event)' onChange=calcamt2($j) onKeyup=validnum(this.id)></td>";

  print "<td><input type=text size=8  name='rate[]' id='rate$j' onKeyPress='return handleEnter(this, event)' value='$jrow[rate]' onChange=calcamt2($j) onKeyup=validnum(this.id)> </td>";
   print "<td><input type=text size=4 name='disc[]' id='disc$j' onKeyPress='return handleEnter(this, event)' value='$jrow[disc]' onChange=calcamt2($j) onKeyup=validnum(this.id)></td>";


   print "<td><input type=text size=3 name='hnd[]' id='hnd$j' onKeyPress='return handleEnter(this, event)' value='$jrow[hnd]' onChange=calcamt2($j)></td>";

   print "<td><input type=text readonly size=8 name='gtot[]' id='gtot$j' value='$jrow[gtot]'></td>";


 $qtres=mysqli_query($db,"select supqty from $tbl where partcode='$jrow[2]'");
 $qtrow=mysqli_fetch_row($qtres);
   $qqty=($qtrow[0]+$jrow[qty]);


   print "<td><input type=text  readonly name='exqty[]' id='exqty$j' value='$qqty' size=4></td>";

    print "<td><input type=text   name='day[]' id='day$j' value='$edate1[2]' size=2></td>";
    print "<td><input type=text   name='month[]' id='month$j' value='$edate1[1]' size=2></td>";
    print "<td><input type=text   name='year[]' id='year$j' value='$edate1[0]' size=4></td>";

  
if($user!='RAJESHTS'||$user!='RAJESHHYD'||$user!='RAJESHMW'|| $user!='nandakumar'|| $user!='anand')
{
   print "<td><input type=button value='Del' onClick='delrow(this)'></td></tr>";
}
else
{
   print "<td><input type=button value='No' ></td></tr>";
}

   $i++;
   $j++;
  }
?>
</table> 
<h4>Service Details </h4>
 <input type="button" onclick="insRow2()" value="   Add Service   ">
<table border=1 id="myTable2" class='tble1'>
<th>No.<th>Service  <th>Repair/Replace<th>Amt <th>Assigned to<th colspan=3>EnteredOn<th>Del

<?
 $res=mysqli_query($db,"select * from ojcardserv where jcno='$jcno' and brcode='$brcode'");
 $i=1;
 while($jrow=mysqli_fetch_array($res))


  {
$edate2=explode('-',$jrow[edate]);

   print "\n<tr><td>".$i."</td>";
   print "<td><input type=text size=20 name='service[]' value='$jrow[2]' onKeyPress='return handleEnter(this, event)'></td>";
   print "<td><input type=text size=20 name='jobs[]' value='$jrow[4]' onKeyPress='return handleEnter(this, event)'></td>";
  
  print "\n<td><input type=text size=8 name='servamt[]' value='$jrow[3]' id='servamt$i' onChange='calctotal2($i)' onKeyPress='return handleEnter(this, event)' onKeyup=validnum(this.id)></td>";
   


   print "<td><input type=text  readonly name='engineer1[]' id='engineer1$j' value='$jrow[engineer]' size=20 onKeyPress='return handleEnter(this, event)'></td>";
    print "<td><input type=text   name='day1[]' id='day1$j' value='$edate2[2]' size=2></td>";
    print "<td><input type=text   name='month1[]' id='month1$j' value='$edate2[1]' size=2></td>";
    print "<td><input type=text   name='year1[]' id='year1$j' value='$edate2[0]' size=4></td>";



if($user!='RAJESHTS'||$user!='RAJESHHYD'||$user!='RAJESHMW')
{
   print "<td><input type=button value='Del' onClick='delrow2(this)'></td>";
}
else
{
   print "<td><input type=button value='No' ></td>";
}
 
 print "</tr>";
   $i++;
  }
?>
</table><br>

</span>
</form>
<?
}
?>
<CENTER>
<H3><font color='darkbrown'>JOB CARD REPORT / EDIT</font></h3>
</center>
<form name=f2 action='<?print $PHP_SELF?>' method='post' onSubmit='return valid1()'>
Select Jobcard No. <select name=jcno>
<?
$re=mysqli_query($db,"select jcno,regno from gateentry where brcode='$brcode' order by jcno desc");
while($row=mysqli_fetch_row($re))
{
 print "<option value='$row[0]'>$row[0]-$row[1]</option>";
}
?>
</select>
<input type=submit value='Show ->' name='show'>
</form>
<script>
 function valid1()
 {
  if(document.f2.jcno.value.length<=0)
   {
    alert('Invalid jcno');
    return false
   }
 }
function valid2()
 {
  if(document.f1.chasisno.value.length<=0)
   {
    alert('Please enter Chasis NO');
    return false
   }
 else
   {
    document.f1.submit();
   }

 
 }
</script>
