Hello
The payroll section is not editable and yet the user was given the permission to read and write. The user with the permission to read and write can't add in figures as shown in the attachment
What could be the problem?
The code is below;
<?PHP php_track_vars ?>
<?PHP
session_start();
$module="payrolls";
include("../../db.php");
// If the session is null then redirect to Login page.
if($user_id=="") { ?>
<script>
parent.location.href="../../index.php";
</script> <?PHP
} else { // if the user is not admin then deny access
$priv_row=$schoolDB->fetchArray($schoolDB->dbquery("select permission from privilege where empid='$priv_id' and module='$module' and br_id='$branch_id'"));
if($priv_row[0] < 2) Header("Location:../../noaccess.php");
}
include("../../colors.php");
include("../newheader.php");
include("../../lang/".$language."/".$module.".php");
$sc_fp=fopen("../../schoolgenlog","a+");
$get_classid=$schoolDB->dbquery("select employee.firstname,employee.lastname,designations.designation,designations.des_id from employee,designations where employee.empid='$adm' and employee.br_id='$branch_id' and employee.br_id=designations.br_id and employee.designation=designations.des_id");
$classid=$schoolDB->fetchArray($get_classid);
$allres=$schoolDB->dbquery("select sal_id,sal_type from salary_types where br_id='$branch_id' and sal_id like 'A%'");
$dedres=$schoolDB->dbquery("select sal_id,sal_type from salary_types where br_id='$branch_id' and sal_id like 'D%'");
$from_date=$year1."-".$month."-"."01";
$todate=date(Ymd,mktime(0,0,0,$month+1,0,$year1));
$to_date=substr($todate,0,4)."-".substr($todate,4,2)."-".substr($todate,6,2);
session_unregister("amt_sess"); ?>
<br><p align="center"><b><?echo $sgstr27;?>
<?echo $month;?>-<?echo $year1;?></b></p>
<form action="genpayroll.php" name="salary_employee">
<table align="center" border="0" width="100%" cellpadding="4" cellspacing="1" bgcolor="<? echo $light; ?>">
<tr>
<td width="50%" bgcolor="<? echo $toolight; ?>"><?echo $sgstr28;?></td>
<td bgcolor="<? echo $toolight; ?>">:</td>
<td bgcolor="<? echo $toolight; ?>" width="50%">
<b><?echo $fn." ".$ln; ?></b>
</td>
</tr>
<tr>
<td bgcolor="<? echo $toolight; ?>"><?echo $sgstr3;?></td>
<td bgcolor="<? echo $toolight; ?>"> : </td>
<td bgcolor="<? echo $toolight; ?>"><b><?echo $adm;?></b></td>
</tr>
<tr>
<td bgcolor="<? echo $toolight; ?>"><?echo $sgstr29;?></td>
<td bgcolor="<? echo $toolight; ?>"> :</td>
<td bgcolor="<? echo $toolight; ?>">
<b><?echo $classid[designation];?> </b>
</td>
</tr>
</table><br>
<table align="center" border="0" width="100%" cellspacing="1" cellpadding="4">
<tr>
<td width="40%" align="center" bgcolor="<? echo $light; ?>">
<font color="#FFFFFF"><b><?echo $sgstr30;?></font></b>
</td>
<td width="40%" align="center" bgcolor="<? echo $light; ?>">
<font color="#FFFFFF"><b><?echo $sgstr31;?></b></font>
</td>
</tr>
<tr>
<td colspan=2 align="center" bgcolor="<? echo $toolight; ?>">
<b><?echo $sgstr32;?></b>
</td>
</tr> <?PHP
$nor=0;
while($allrow=$schoolDB->fetchRow($allres)) {
$res=$schoolDB->dbquery("select amount from salary_details where br_id='$branch_id' and des_id='$classid[3]' and sal_id='$allrow[0]'");
$row=$schoolDB->fetchRow($res); ?>
<tr>
<td width="25%" align="center" bgcolor="<? echo $toolight; ?>">
<b><?echo $allrow[1];?></b>
</td>
<td width="25%" align="center" bgcolor="<? echo $toolight; ?>">
<b><input TYPE="text" NAME="<?echo "amount[$nor]";$nor++;?>" value="<?echo $row[0];?>" readonly></b>
</td>
</tr> <?PHP
} ?>
<tr>
<td colspan=2 align="center" bgcolor="<? echo $toolight; ?>">
<b><?echo $sgstr33;?></b>
</td>
</tr> <?PHP
while($dedrow=$schoolDB->fetchRow($dedres)) {
$res=$schoolDB->dbquery("select amount from salary_details where br_id='$branch_id' and des_id='$classid[3]' and sal_id='$dedrow[0]'");
$row=$schoolDB->fetchRow($res); ?>
<tr>
<td width="25%" align="center" bgcolor="<? echo $toolight; ?>">
<b><?echo $dedrow[1];?></b>
</td>
<td width="25%" align="center" bgcolor="<? echo $toolight; ?>">
<input TYPE="text" NAME="<?echo "amount[$nor]";$nor++;?>" value="<?echo $row[0];?>" readonly></b>
</td>
</tr> <?PHP
} ?>
</table><br>
<table align="center" border="0" cellPadding="4" cellSpacing="1" width="100%">
<tr>
<td width="33%" align="center" bgcolor="<? echo $light; ?>">
<b><font color="white"><?echo $sgstr34;?></b>
</td>
<td width="33%" align="center" bgcolor="<? echo $light; ?>">
<b><font color="white"><?echo $sgstr35;?></b>
</td>
<td width="33%" align="center" bgcolor="<? echo $light; ?>">
<b><font color="white"><?echo $sgstr31;?>(<?echo $sgstr36;?>)</b>
</td>
</tr>
<tr>
<td width="33%" align="center" bgcolor="<?echo $toolight?>" colspan="3">
<b><?echo $sgstr40;?></b>
</td>
</tr> <?PHP
$lsum=0;
$leares=$schoolDB->dbquery("select leave_id,noofleaves,amt_leave from leave_details where br_id='$branch_id' and des_id='$classid[3]'");
while($learow=$schoolDB->fetchRow($leares)) {
$ures=$schoolDB->dbquery("select emp_leaves.usedleaves,leaves.type,emp_leaves.leave_id from emp_leaves,leaves where emp_leaves.br_id='$branch_id' and emp_leaves.br_id=leaves.br_id and emp_leaves.empid='$adm' and leaves.id='$learow[0]' and leaves.id=emp_leaves.leave_id");
$urow=$schoolDB->fetchRow($ures);
if($urow[0]>$learow[1]) {
$uleaves1=$schoolDB->fetchArray($schoolDB->dbquery("select count(status) from tea_attendance where br_id='$branch_id' and empid='$adm' and att_date between '$from_date' and '$to_date' and status='L'"));
$uleaves = $uleaves1[0];
if($uleaves>($urow[0]-$learow[1])) {
$amt[$learow[0]]=($urow[0]-$learow[1])*$learow[2];
$lsum=$lsum+$amt[$learow[0]];
$totamt=$amt[$learow[0]];
} else {
$amt[$learow[0]]=($uleaves)*$learow[2];
$lsum=$lsum+$amt[$learow[0]];
}
}
echo "<tr>";
echo "<td width=33% align=center bgcolor= $toolight> <b>".$urow[1]."</b></td>";
echo "<td width=33% align=center bgcolor= $toolight> <b>".$urow[0]."</b></td>";
echo "<td width=33% align=center bgcolor= $toolight> <b>".$amt[$learow[0]];
if($amt[$learow[0]]!="") {
$se_res=$schoolDB->dbquery("update emp_leaves set amount='$totamt' where empid='$adm' and leave_id='$urow[2]'");
fwrite($sc_fp,$user_id."##".date(YmdHis)."##"."update emp_leaves set amount='$totamt' where empid='$adm' and leave_id='$urow[2]'\n");
}
echo "</b></td>";
echo "</tr>";
}
echo $schoolDB->error();
fclose($sc_fp); ?>
<td width="100%" colspan="4" align="center" >
<input type="submit" value="<?echo $b4;?>" name="B1">
<input type="button" value="<?echo $b2;?>" onClick="javascript:window.location.href='salaries.php'">
</td>
</tr>
<input type="hidden" value="<?echo $adm;?>" name='adm'>
<input type="hidden" value="<?echo $year1;?>" name="year1">
<input type="hidden" value="<?echo $month;?>" name="month">
<input type="hidden" value="<?echo $lsum;?>" name="lsum">
</table>
</form>
What could be the problem?
Your help will be highly appreciated
Thank you
Ronnie
payrollnoteditable.png