<?
session_start();
include_once('opendb.php');
include_once('test.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='inde.php'; </script>";
 return;
}
$led=$_REQUEST['led'];
$grp=$_REQUEST['grp'];
$opb=$_REQUEST['opb'];
$drcr=$_REQUEST['drcr'];
$sql="update ledger set grp='$grp',op='$opb',drcr='$drcr' where led='$led' and brcode='$brcode'";
mysqli_query($db,$sql) or die(mysqli_error($db));

$sqlg="update ledger set grp='$grp' where led='$led'";
mysqli_query($db,$sqlg) or die(mysqli_error($db));
log_entry($brcode,$user,$REMOTE_ADDR,"ledger update: $led",$db);

print "<script> alert('data saved');parent.document.location='sealedge.php';window.close(); </script>";
?>

