<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../index.html'; </script>";
 return;
}

include("../opendb.php");
include("../test.php");
print 'Branch Code:'.$brcode;
if($del && $pswd=='deljc')
{
 $r1=mysqli_query($db,"select jvno from jobcardq where jcno='$jcno'  and brcode='$brcode'");
 if(mysqli_num_rows($r1)<=0)
 {
  print "JCNO does not exist";
  return;
 }
 $row1=mysqli_fetch_array($r1);
 //$sql="delete from journal2 where jvno='$row1[jvno]' and no='$jcno' and brcode='$brcode'";
 // mysqli_query($db,$sql) or die(mysqli_error($db));
 //$sql="update jobcard set jvno='0',invno='0',entrydate='0000-00-00' where jcno='$jcno' and brcode='$brcode'";
 // mysqli_query($db,$sql) or die(mysqli_error($db));
log_entry($brcode,$user,$REMOTE_ADDR,"Del Jobcard:$jcno, Journal: $jvno");
print "<b>Record has been deleted</b>";
}
?>
<style>
 td,body{font-family:'arial narrow';font-size:14;letter-spacing:1}
</style>
<center>
<table cellspacing=1 cellpadding=1 bgcolor=red>
<tr><td align=center><font size=5>Cancel a Job Card</font></td></tr>
<tr><td align=center bgcolor=white>


<form action='<?print $PHP_SELF?>'>
<table>
<tr><td>Enter Password </td><td><input type=password name='pswd'></td></tr>
<tr><td>Enter JCNo </td><td><input type=text name='jcno'></td></tr>
<tr><td colspan=2 align=center bgcolor='orange'><input type=submit value='Delete' name='del'></td></tr>
</table>
</form>
</td></tr>
</table>
