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

include("opendb.php");
include("test.php"); 
$prod=$_REQUEST[prod];
$qry=mysqli_query($db,"select * from  reportmast where trnstype='$prod' order by trnstype ASC");
$num=mysqli_num_rows($qry);
$rw=mysqli_fetch_array($qry);
$sql="select * from  reportmast where trnstype='$prod' order by trnstype ASC";
//echo $sql;
?>


<?
$qry1=mysqli_query($db,"select distinct(gname) from acgroups order by gname ASC");
$acgrps[]="";
$ctr=1;
?>
<table border=1 cellspacing=1 cellpadding=1 class=report>
<tr><td>Column #3</td><td><select name='jtype1'>
<option value='select'>-select-</option>
<?while($row1=mysqli_fetch_array($qry1)){?>
<option value="<? echo $row1[gname] ?>"<? if($rw[2]==$row1[gname]) echo 'selected="selected"';?>><? echo $row1[gname] ?></option>
<?$acgrps[$ctr++]=$row1[gname];}?>
</select>
</td>

<td><select name='col3drcr'><option value="<?echo $rw[19];?>"><?echo $rw[19]?></option><option value='Dr'>Dr</option><option value='select'>Cr</option><option value='select'>NA</option></td>

<td><input type='text' name='col3name' value='<? echo $rw[10] ?>'></td>
</tr>
<tr><td>Column #4</td><td><select name='jtype2'>
<option value='select'>-select-</option>
<?for ($ctr1=0;$ctr1<$ctr;$ctr1++){?>
<option value="<? echo $acgrps[$ctr1] ?>"<? if($rw[3]==$acgrps[$ctr1]) echo 'selected="selected"';?>><? echo $acgrps[$ctr1] ?></option>
<?}?></select>
</td>
<td><select name='col4drcr'><option value="<?echo $rw[20]?>"><?echo $rw[20]?></option><option value='Dr'>Dr</option><option value='Cr'>Cr</option><option value='NA'>NA</option></td>
<td><input type='text' name='col4name' value='<? echo $rw[11] ?>'></td>
</tr>
<tr><td>Column #5</td><td><select name='jtype3'>
<option value='select'>-select-</option>
<?for ($ctr1=0;$ctr1<$ctr;$ctr1++){?>
<option value="<? echo $acgrps[$ctr1] ?>"<? if($rw[4]==$acgrps[$ctr1]) echo 'selected="selected"';?>><? echo $acgrps[$ctr1] ?>
</option>
<?}?></select>
</td>
<td><select name='col5drcr'><option value="<?echo $rw[21]?>"><?echo $rw[21]?></option><option value='Dr'>Dr</option><option value='Cr'>Cr</option><option value='NA'>NA</option></td>
<td><input type='text' name='col5name' value='<? echo $rw[12] ?>'></td>
</tr>

<tr><td>Column #6</td><td><select name='jtype4'>
<option value='select'>-select-</option>
<?for ($ctr1=0;$ctr1<$ctr;$ctr1++){?>

<option value="<? echo $acgrps[$ctr1] ?>"<? if($rw[5]==$acgrps[$ctr1]) echo 'selected="selected"';?>><? echo $acgrps[$ctr1] ?>
</option>
<?}?></select>
</td>
<td><select name='col6drcr'><option value="<?echo $rw[22]?>"><?echo $rw[22]?></option><option value='Dr'>Dr</option><option value='Cr'>Cr</option><option value='NA'>NA</option></td>
<td><input type='text' name='col6name' value='<? echo $rw[13] ?>'></td>
</tr>
<tr><td>Column #7</td><td><select name='jtype5'>
<option value='select'>-select-</option>
<?for ($ctr1=0;$ctr1<$ctr;$ctr1++){?>
<option value="<? echo $acgrps[$ctr1] ?>"<? if($rw[6]==$acgrps[$ctr1]) echo 'selected="selected"';?>><? echo $acgrps[$ctr1] ?>
</option>
<?}?></select>
</td>
<td><select name='col7drcr'><option value="<?echo $rw[23]?>"><?echo $rw[23]?></option><option value='Dr'>Dr</option><option value='Cr'>Cr</option><option value='NA'>NA</option></td>
<td><input type='text' name='col7name' value='<? echo $rw[14] ?>'></td>
</tr>
<tr><td>Column #8</td><td><select name='jtype6'>
<option value='select'>-select-</option>
<?for ($ctr1=0;$ctr1<$ctr;$ctr1++){?>
<option value="<? echo $acgrps[$ctr1] ?>"<? if($rw[7]==$acgrps[$ctr1]) echo 'selected="selected"';?>><? echo $acgrps[$ctr1] ?>
</option>
<?}?></select>
</td>
<td><select name='col8drcr'><option value="<?echo $rw[24]?>"><?echo $rw[24]?></option><option value='Dr'>Dr</option><option value='Cr'>Cr</option><option value='NA'>NA</option></td>
<td><input type='text' name='col8name' value='<? echo $rw[15] ?>'></td>
</tr>
<tr><td>Column #9</td><td><select name='jtype7'>
<option value='select'>-select-</option>
<?for ($ctr1=0;$ctr1<$ctr;$ctr1++){?>
<option value="<? echo $acgrps[$ctr1] ?>"<? if($rw[8]==$acgrps[$ctr1]) echo 'selected="selected"';?>><? echo $acgrps[$ctr1] ?>
</option>
<?}?></select>
</td>
<td><select name='col9drcr'><option value="<?echo $rw[25]?>"><?echo $rw[25]?></option><option value='Dr'>Dr</option><option value='Cr'>Cr</option><option value='NA'>NA</option></td>
<td><input type='text' name='col9name' value='<? echo $rw[16] ?>'></td>
</tr>
<tr><td>Column #10</td><td><select name='jtype8'>
<option value='select'>-select-</option>
<?for ($ctr1=0;$ctr1<$ctr;$ctr1++){?>
<option value="<? echo $acgrps[$ctr1] ?>"<? if($rw[9]==$acgrps[$ctr1]) echo 'selected="selected"';?>><? echo $acgrps[$ctr1] ?>
</option>
<?}?>

</select>
</td>
<td><select name='col10drcr'><option value="<?echo $rw[26]?>"><?echo $rw[26]?></option><option value='Dr'>Dr</option><option value='Cr'>Cr</option><option value='NA'>NA</option></td>
<td><input type='text' name='col10name' value='<? echo $rw[17] ?>'>

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



