<?
session_start();
include('includes/config.php');
include('defs.php');

if(strlen($_SESSION['aid'])==0)
  { header('location:index.php');
}

$usr=$_SESSION['uname'];



 ?>


 <!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>GLAKB  | User Priveleges</title>

  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../dist/css/adminlte.min.css">
  <!--Function Email Availabilty---->

</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <!-- Navbar -->
<?php include_once("includes/navbar.php");?>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
 <?php include_once("includes/sidebar.php");?>

 
  <div class="content-wrapper">

<?

$result12 = mysqli_query($link, "select Name, Role from user_details where Name='$usr' ");
$row12=  mysqli_fetch_object($result12);
$role = $row12->Role;
if($role=='Operator')
{
echo"<center>";
echo"<br><br><br><br><br>";
echo"<img src='users.png' width='160' height='160'><br>";
echo "<font size=6 color=red><b>ACCESS DENIED!</b><br>";
echo "<font size=4 color=darkblue><b>You Do Not Have Permission to View This Page.</b><br>";
goto a;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
?>
 <html>
<head>
<style>
#customers {
  font-family: Times-Roman;
  border-collapse: collapse;
  width: 98%;
}

#customers td, #customers th {
  border: 1px solid #4444;
  padding: 4px;
}

#customers tr:nth-child(even){background-color:gainsboro ;}


#customers th {
  padding-top: 1px;
  padding-bottom: 1px;
  text-align: center;
background-color:dodgerblue;
    color: white;
}




#customers1 {
  font-family: Times-Roman;
  border-collapse: collapse;
  width: 98%;
}

#customers1 td, #customers1 th {
  border: 1px solid #4444;
  padding: 4px;
}

#customers1 tr:nth-child(even){background-color:gainsboro ;}


#customers1 th {
  padding-top: 1px;
  padding-bottom: 1px;
  text-align: center;
background-color:dodgerblue;
    color: white;
}
</style>   




 




<script language="javascript">	
	

 function formconfirm() {
return confirm("You Clicked the Button. Continue?<? echo "$coursename";?>");
}
                
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

      
         function show_cbo1()
                {
                        var val = document.getElementById('item33').value;
                        
                        location.href = "user_priv.php?M_Head1="+val;
                }
                
  
  
</script>
<form name="m_head" action="" method="POST">
 <table align="center" id="customers1">
       
<tr>
    <th colspan="4"><font size="4" >OPERATOR'S PRIVILEGE FORM</th>

  </tr>
                  
    <td width="250"><b><font size=3 color="black">Select Operator's Name:</b></td>
                        <td>
                                <select class="form-control" name="item33" id="item33" style=font-size="16" onchange="show_cbo1()">
                                <option value="">select</option>
                                <?php 
                                if(isset($_GET['M_Head1']))
                                        {
                                                $M_Head1 = $_GET['M_Head1'];
                                                
                                                
                
                                        }
                                else                        
                                        $M_Head1 = "";
                                        
                                        //include('config.php');
                                        $result = mysqli_query($link, "select Name from user_details where Role='Operator' order by Name");
                                        while($row  = mysqli_fetch_object($result))
                                        {
                                                        if($M_Head1 == $row->Name)
                                                        {
                                                                echo "<option value=\"$row->Name\" selected=\"selected\">$row->Name</option>";
                                                        }        
                                                        else
                                                        {
                                                                echo "<option value=\"$row->Name\">$row->Name</option>";
                                                        }
                                        }
                                ?>
                                </select>



<tr>
    <td colspan="3" align="center">

<input type="submit" name="show" value="Show Privileges" style="background: none; color:#007BFF; border:2px solid #007BFF; padding:2px 20px; border-radius:5px;">
<input type="submit" name="update1" value="Update Privileges" style="background: none; color:#007BFF; border:2px solid #007BFF; padding:2px 20px; border-radius:5px;">

</table>

<style type="text/css">
#content        {width:100%;height:auto;}
#left                 {width:49%;height:auto;float:left;padding-top:1%;font-weight:bold;}
#right                {width:49%;height:auto;float:right;padding-top:1%;font-weight:bold;}
</style>


<body>
<div id="content">
<div id="left">
     


 <?
  




if(isset($_POST['update1']))
{
    $name=$_POST['item33'];
  
if($name=='')
        {

        echo "<script language='javascript'>";
 echo "alert('Please Select Operator Name First!')";
 echo "</script>";
    goto a;
}


if(isset($_POST['agroup']) && $_POST['agroup'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Add-Mheads' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Add-Mheads' ");

if(isset($_POST['atown']) && $_POST['atown'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Add-Cust' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Add-Cust' ");



if(isset($_POST['aroute']) && $_POST['aroute'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Add-Prod' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Add-Prod' ");

if(isset($_POST['ctype']) && $_POST['ctype'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Add-Head' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Add-Head' ");



if(isset($_POST['avend']) && $_POST['avend'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Edit-Mhead' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Edit-Mhead' ");


if(isset($_POST['acust']) && $_POST['acust'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Edit-Head' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Edit-Head' ");



/////////////////////////////////////////////////////////////////////////////////////////////

if(isset($_POST['aobal']) && $_POST['aobal'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Raw-Pur' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Raw-Pur' ");

if(isset($_POST['purch']) && $_POST['purch'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Raw-Out' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Raw-Out' ");


if(isset($_POST['pret']) && $_POST['pret'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Raw-Stock' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Raw-Stock' ");


if(isset($_POST['edpur']) && $_POST['edpur'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Raw-Stocka' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Raw-Stocka' ");

if(isset($_POST['compinv']) && $_POST['compinv'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Inv-Pur' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Inv-Pur' ");


if(isset($_POST['custinv']) && $_POST['custinv'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Inv-Sales' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Inv-Sales' ");


if(isset($_POST['plist']) && $_POST['plist'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='P-List' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='P-List' ");


if(isset($_POST['arepp']) && $_POST['arepp'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Add-Replish' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Add-Replish' ");

if(isset($_POST['dwpur']) && $_POST['dwpur'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Report3' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Report3' ");

if(isset($_POST['vpur']) && $_POST['vpur'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Report2' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Report2' ");


if(isset($_POST['pwpur']) && $_POST['pwpur'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Report4' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Report4' ");

if(isset($_POST['bwpur']) && $_POST['bwpur'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Report1' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Report1' ");

if(isset($_POST['vapur']) && $_POST['vapur'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='View-Pur' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='View-Pur' ");


if(isset($_POST['serchs']) && $_POST['serchs'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='S-Sales' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='S-Sales' ");
// ///////////////////////////////////////////////////////////////////////////////////////////
if(isset($_POST['sales']) && $_POST['sales'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Sales' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Sales' ");

if(isset($_POST['psales']) && $_POST['psales'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='P-Sales' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='P-Sales' ");

if(isset($_POST['edsale']) && $_POST['edsale'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Edit-Sale' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Edit-Sale' ");

if(isset($_POST['dels']) && $_POST['dels'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='D-Sales' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='D-Sales' ");


if(isset($_POST['pled']) && $_POST['pled'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='P-Ledger' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='P-Ledger' ");


if(isset($_POST['stkrep']) && $_POST['stkrep'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Stock' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Stock' ");

if(isset($_POST['vasale']) && $_POST['vasale'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='View-Sales' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='View-Sales' ");



if(isset($_POST['cashp']) && $_POST['cashp'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Cash' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Cash' ");

if(isset($_POST['cashr']) && $_POST['cashr'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Cash-Rec' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Cash-Rec' ");


if(isset($_POST['voucher']) && $_POST['voucher'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='JV' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='JV' ");

if(isset($_POST['dvoucher']) && $_POST['dvoucher'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='JV-Date' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='JV-Date' ");

if(isset($_POST['pvch']) && $_POST['pvch'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='JV-Search' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='JV-Search' ");









if(isset($_POST['pmhead']) && $_POST['pmhead'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Rep-Mhead' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Rep-Mhead' ");


if(isset($_POST['pshead']) && $_POST['pshead'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Rep-Head' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Rep-Head' ");


if(isset($_POST['cashb']) && $_POST['cashb'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Rep-Cust' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Rep-Cust' ");


if(isset($_POST['dtr']) && $_POST['dtr'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Daily-Trans' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Daily-Trans' ");


if(isset($_POST['ptrial']) && $_POST['ptrial'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Rep-Trial' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Rep-Trial' ");
/////////////////////////////////////////////////////

if(isset($_POST['cashss']) && $_POST['cashss'] == 'yes') 
mysqli_query($link, "update user_priv set Role = '1' where Name ='$name' and Form='Cash-Stat' ");
else
mysqli_query($link, "update user_priv set Role = '0' where Name ='$name' and Form='Cash-Stat' ");





echo "<script language='javascript'>";
 echo "alert('Updated Successfully!')";
 echo "</script>";

}


if(isset($_POST['show']))
        {

$name=$_POST['item33'];
if($name=='')
        {

        echo "<script language='javascript'>";
 echo "alert('Please Select Operator Name First!')";
 echo "</script>";
    goto a;
}



?>

<table align="center" id="customers">
<tr>
<th colspan="3"><font size="3">ADDITION MENU PRIVILEGES</th>
</tr>
<td colspan="2">
<?
$as="Add-Mheads";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$as'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">1. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Add Accounts Category:</font></label>
<td colspan="2" align="center">
<input type="checkbox" name="agroup" id="agroup" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />
<tr>
<td colspan="2">
<?




$es="Add-Cust";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$es'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">2. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Add Customer Details:</label>
<td colspan="2" align="center">
<input type="checkbox" name="atown" id="atown" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />
<tr>
<td colspan="2">
  
<?


$amh="Add-Prod";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$amh'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
if ($chk=='1')
?>
<label><font color="black">3. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Add Products:</label>
<td colspan="2" align="center">
<input type="checkbox" name="aroute" id="aroute" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />
<tr>
<td colspan="2">
  <?


$ash="Add-Head";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$ash'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">4. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Add Accounts Heads:</label>
<td colspan="2" align="center">
<input type="checkbox" name="ctype" id="ctype" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />
<tr>
<td colspan="2">
  <?


$eheads="Edit-Mhead";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$eheads'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">5. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Edit Accounts Category:</label>
<td colspan="2" align="center">
<input type="checkbox" name="avend" id="avend" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />



<tr>
<td colspan="2">
  <?


$adclt="Edit-Head";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$adclt'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">6. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Edit Accounts Heads:</label>
<td colspan="2" align="center">
<input type="checkbox" name="acust" id="acust" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />




</table>


<table align="center" id="customers">
 <br>
<tr>
<th colspan="3"><font size="3">RAW MATERIAL MENU PRIVILEGES</th>
</tr>


<tr>
<td colspan="2">
<?
$serch="Raw-Pur";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$serch'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">1. &nbsp&nbsp&nbsp&nbsp Add Raw Material Purchases:</label>
<td colspan="2" align="center">
<input type="checkbox" name="aobal" id="aobal" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />


<tr>
<td colspan="2">
<?
$serch1="Raw-Out";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$serch1'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">2. &nbsp&nbsp&nbsp&nbsp Raw Material to Company:</label>
<td colspan="2" align="center">
<input type="checkbox" name="purch" id="purch" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />



<tr>
    <td colspan="2">
<?

$pret="Raw-Stock";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$pret'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">3. &nbsp&nbsp&nbsp&nbsp Raw Stock Report:</label>
<td colspan="2" align="center">
<input type="checkbox" name="pret" id="pret" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />


<tr>
    <td colspan="2">
<?

$edp="Raw-Stocka";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$edp'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">4. &nbsp&nbsp&nbsp&nbsp Overall Raw Stock Report:</label>
<td colspan="2" align="center">
<input type="checkbox" name="edpur" id="edpur" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />


 


</table>




<table align="center" id="customers">
 <br>
<tr>
<th colspan="3"><font size="3">FURNISHED PRODUCTS MENU PRIVILEGES</th>
</tr>


<tr>
<td colspan="2">
<?
$serch2="Inv-Pur";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$serch2'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">1. &nbsp&nbsp&nbsp&nbsp Company Invoice:</label>
<td colspan="2" align="center">
<input type="checkbox" name="compinv" id="compinv" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />


<tr>
<td colspan="2">
<?
$serch11="Inv-Sales";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$serch11'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">2. &nbsp&nbsp&nbsp&nbsp Customer Invoice:</label>
<td colspan="2" align="center">
<input type="checkbox" name="custinv" id="custinv" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />



<tr>
    <td colspan="2">
<?

$plst="P-List";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$plst'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">3. &nbsp&nbsp&nbsp&nbsp Price List:</label>
<td colspan="2" align="center">
<input type="checkbox" name="plist" id="plist" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />



</table>




</fieldset>
</div>

  <div id="right">

 <table align="center" id="customers">

    
<tr>
<th colspan="3"><font size="3">SALES MENU PRIVILEGES</th>
</tr>
  <td colspan="2">
<?





$sles="Sales";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$sles'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">1. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Sales:</label>
<td colspan="2" align="center">
<input type="checkbox" name="sales" id="sales" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />
<tr>
<td colspan="2">
<?



$pslaes="P-Sales";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$pslaes'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">2. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Process Sales Invoices:</label>
<td colspan="2" align="center">
<input type="checkbox" name="psales" id="psales" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />
<tr>
<td colspan="2">
<?



$edsale="Edit-Sale";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$edsale'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">3. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Edit Sales:</label>
<td colspan="2" align="center">
<input type="checkbox" name="edsale" id="edsale" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />

<tr>
<td colspan="2">
<?


$dsale="D-Sales";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$dsale'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">4. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Delete Sales Invoices:</label>
<td colspan="2" align="center">
<input type="checkbox" name="dels" id="dels" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />

<tr>
<td colspan="2">
<?


$serch="S-Sales";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$serch'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">5. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Search and Print Sales:</label>
<td colspan="2" align="center">
<input type="checkbox" name="serchs" id="serchs" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />

<tr>
<td colspan="2">
<?


$pled="P-Ledger";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$pled'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">6. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Product Ledger:</label>
<td colspan="2" align="center">
<input type="checkbox" name="pled" id="pled" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />
<tr>
<td colspan="2">
<?


$stk="Stock";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$stk'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">7. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Stock Report:</label>
<td colspan="2" align="center">
<input type="checkbox" name="stkrep" id="stkrep" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />

<tr>
<td colspan="2">
<?


$vies="View-Sales";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$vies'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">8. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp View All Sales:</label>
<td colspan="2" align="center">
<input type="checkbox" name="vasale" id="vasale" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />

</table>


<table align="center" id="customers">
  <br>
    
<tr>
<th colspan="3"><font size="3">DAILY TRANSACTION MENU PRIVILEGES</th>
</tr>

<tr>
<td colspan="2" width="200">
<?
$cvch="Cash";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$cvch'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">1.  &nbsp&nbsp&nbsp&nbsp&nbsp&nbspCash Payment Voucher:</label>
<td colspan="2" align="center">
<input type="checkbox" name="cashp" id="cashp" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />
<tr>
<td colspan="2">
  <?


$crvch="Cash-Rec";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$crvch'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">2. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Cash Receiving Voucher:</label>
<td colspan="2" align="center">
<input type="checkbox" name="cashr" id="cashr" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />


<tr>
<td colspan="2">
  
<?
$vch="JV";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$vch'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">4. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Journal Voucher:</label>
<td colspan="2" align="center">
<input type="checkbox" name="voucher" id="voucher" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />
<tr>
<td colspan="2">
  
<?


$pvch="JV-Search";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$pvch'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">5. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Search / Edit / Delete Voucher:</label>
<td colspan="2" align="center">
<input type="checkbox" name="pvch" id="pvch" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />

<tr>
<td colspan="2">




<?

$dvch="JV-Date";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$dvch'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">3. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Change Voucher Date:</label>
<td colspan="2" align="center">
<input type="checkbox" name="dvoucher" id="dvoucher" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />

</table>




 <table align="center" id="customers">
  <br>
    
<tr>
<th colspan="3"><font size="3">ACCOUNTS REPORTS MENU PRIVILEGES</th>
</tr>
  <td colspan="2">
<?


$rmh="Rep-Mhead";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$rmh'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">1. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Accounts Category Report:</label>
<td colspan="2" align="center">
<input type="checkbox" name="pmhead" id="pmhead" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />
<tr>
<td colspan="2">
<?



$rsh="Rep-Head";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$rsh'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">2. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Accounts Head Report:</label>
<td colspan="2" align="center">
<input type="checkbox" name="pshead" id="pshead" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />
<tr>
<td colspan="2">
<?

$rssh="Rep-Cust";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$rssh'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">3. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Customer Status Report:</label>
<td colspan="2" align="center">
<input type="checkbox" name="cashb" id="cashb" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />


<tr>
<td colspan="2">
<?



$cashss="Cash-Stat";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$cashss'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">4. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Cash Statement:</label>
<td colspan="2" align="center">
<input type="checkbox" name="cashss" id="cashss" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />



<tr>
<td colspan="2">
<?



$dt="Daily-Trans";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$dt'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">5. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Daily Transactions Report:</label>
<td colspan="2" align="center">
<input type="checkbox" name="dtr" id="dtr" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />
<tr>
<td colspan="2">
<?


$rtrial="Rep-Trial";
$result = mysqli_query($link, "select Role from user_priv where Name  = '$name' and Form='$rtrial'  ");
$row = mysqli_fetch_object($result);
$chk=$row->Role;
?>
<label><font color="black">6. &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp Trial-Balance Report:</label>
<td colspan="2" align="center">
<input type="checkbox" name="ptrial" id="ptrial" value="yes" 
<?php if($chk === '1') echo 'checked="checked"';?> />

 </table>
</fieldset>
</div>


   

<?


}
a:
        include "footer.php";
?>
</div>
<!-- ./wrapper -->

<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- bs-custom-file-input -->
<script src="../plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- Page specific script -->
<script>
$(function () {
  bsCustomFileInput.init();
});
</script>
</body>
</html>
<?php  ?>