ESH/pdf_user_access_report.php
2024-10-23 18:28:06 +05:30

214 lines
3.8 KiB
PHP

<?php
include('pdf_header.php');
//include('pop_up_top.php');
?>
<html>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<body>
<?php
$user_id = $_REQUEST['user_id2'];
$user_name = getFieldFromTable (user_name, tbl_users, user_id, $user_id);
$acc = $_REQUEST['access_id2'];
if ($acc=='W')
{
$access = 'Write';
}
else if ($acc=='R')
{
$access = 'Read';
}
else if ($acc=='E')
{
$access = 'Execute';
}
else if ($acc=='A')
{
$access = 'ALL';
}
?>
<table width="100%" >
<tr><div style="font-size:12px">
<td width="25%" align="left"> Run Date : <?php echo date("d-M-Y"); ?></td>
<td width="50%" align="center" style="font-size:17px"><strong>USER ACCESS REPORT</strong></td>
<td width="25%" align="right"> User : <?php echo $username ?></td>
</tr>
<?php
$sql = mysqli_query($conn,"Select role_id from tbl_users where user_id='$user_id' Order by role_id ASC");
$row1=@mysqli_fetch_array($sql);
$role_id = $row1['role_id'];
$role_name = getFieldFromTable(role_name, role_master, role_id, $role_id);
?>
<tr>
<td align="left">Login : <b><?php echo $user_name?></b></td>
<td colspan='2' align="right">Role : <b><?php echo $role_name?></b>, Access : <?php echo $access?></td>
</tr>
</table>
<hr>
<table width="100%" border="1">
<tr bgcolor="#eeeeee" ><strong>
<td width="5%" align="left">Sr</td>
<td width="10%" align="left">Menu ID</td>
<td width="45%" align="left">Menu</td>
<td width="40%" align="left">Access</td>
</tr></strong>
<?php
$count=1;
if ($acc=='A')
{
$sql2 = mysqli_query($conn,"Select menu_id,access_level from assign_menu where role_id='$role_id' Order by menu_id ASC");
}
else
{
$sql2 = mysqli_query($conn,"Select menu_id,access_level from assign_menu where role_id='$role_id' and access_level='$acc' Order by menu_id ASC");
}
while($row2=@mysqli_fetch_array($sql2))
{
$menu_id = $row2['menu_id'];
$menu_name = getFieldFromTable(menu_name, menu_master, menu_id, $menu_id);
$acc= $row2['access_level'];
if ($acc=='W')
{
$access = 'Write';
}
else if ($acc=='R')
{
$access = 'Read';
}
else if ($acc=='E')
{
$access = 'Execute';
}
?>
<tr>
<td align="left"><?php echo $count?></td>
<td align="left"><?php echo $menu_id?></td>
<td align="left"><?php echo $menu_name?></td>
<td align="left"><?php echo $access?></td>
</tr>
<?php
$count = $count+1;
}
?>
</table>
<table width="100%" border='1'>
<?php
$firms = "";
$sql_firms = mysqli_query($conn,"Select a.firm_id,b.firm_name from user_firms a left join tbl_firms b on a.firm_id = b.firm_id where a.user_id='$user_id' and a.firm_id !='5' Order by b.firm_name ASC");
while($row_firms=@mysqli_fetch_array($sql_firms))
{
$firm_id = $row_firms['role_id'];
$firm_name = $row_firms['firm_name'];
$firms = $firms.', '.$firm_name;
}
?>
<tr bgcolor="#eeeeee" ><strong>
<td align="left">Firm Access</td>
</tr></strong>
<tr>
<td align="left"><?php echo $firms?></td>
</tr>
</table>
<table width="100%" border='1'>
<tr>
<td width='25%'></td>
<td width='25%'></td>
<td width='25%'></td>
<td width='25%'></td>
</tr>
<tr bgcolor="#eeeeee" ><strong>
<td colspan='4' align="left">Client Access</td>
</tr></strong>
<tr>
<?php
$count_client=1;
$count_c = 1;
$row_num =1;
$sql_client = mysqli_query($conn,"Select a.client_id,b.client_name from user_clients a left join client_master b on a.client_id=b.client_id where a.user_id='$user_id' Order by b.client_name ASC");
while ($row_client=@mysqli_fetch_array($sql_client))
{
$client_id = $row_client['client_id'];
$client_name = $row_client['client_name'];
?>
<?php
$count_c = $count_client - ($row_num*4);
if ($count_c < 5)
{
?>
<td align="left"><?php echo $client_name?></td>
<?php
}
else
{
$row_num = $row_num+1;
?>
</tr>
<tr>
<td align="left"><?php echo $client_name?></td>
<?php
}
?>
</tr>
<?php
$count_client=$count_client+1;
}
?>
</table>
<hr>
</body>
</html>
<?php
include('pdf_footer.php');
?>