<?
session_start();
include_once('includes/top.php');
include_once('opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
$cd=$_REQUEST['cd'];
if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}

//$invno="547";
$crno=001;
$mxjvres=mysqli_query($db,"select  distinct(tr_no) from journal2_june7 where brcode='3771' and j_type='bp' order by tr_no ");
while ($mxjvrow=mysqli_fetch_array($mxjvres))
{

	
 $sql2="update journal2_june7 set tr_no= '$crno' where brcode='3771' and j_type='bp' and tr_no='$mxjvrow[0]'";
$crno++;

print '<br>'.$sql2;
mysqli_query($db,$sql2);

}
/*
if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}

//$invno="547";
$crno=399;
$mxjvres=mysqli_query($db,"select  distinct(brno) from bnkrec where brcode='3794' order by brno ");
while ($mxjvrow=mysqli_fetch_array($mxjvres))
{

	
 $sql2="update bnkrec set brno= '$crno' where brcode='3794' and brno='$mxjvrow[0]'";
$crno++;

print '<br>'.$sql2;
mysqli_query($db,$sql2);

}

*/

