
<?php
    session_start();
    if ($_SESSION['company'] == "") { 
        exit("Please Login");
    }
    if ($_SESSION['CURRENT_USER'] == "") { 
        exit("Please Login");
    }
include_once './new/connection_sql.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="style.css" rel="stylesheet" type="text/css" media="screen" />


    <title>PASSWORD VIEW</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.css">
    <link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css">
    <!-- <script language="JavaScript" src="js/search_joborder.js"></script> -->
    <script language="JavaScript" src="https://code.jquery.com/jquery-3.3.1.js"></script>
    <script language="JavaScript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
    <script language="JavaScript" src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
 
            <script language="JavaScript" src="js/create_user.js"></script>

</head>
<body>
    <?php
    $stname = "";
    if (isset($_GET['stname'])) {
        $stname = $_GET["stname"];
    }
    ?>
    <input type="hidden" value="" id="cur" />


    <div id="filt_table" class="CSSTableGenerator container"> 
        <table id="testTable"  class="table table-bordered">
            <?php

             $sql = "SELECT * from user_mast ";

            echo "<table id='example'  class='table table-bordered' style='font-size: 14px;'>";

            echo "<thead><tr>";
            echo "<th>#</th>";
            echo "<th>USER NAME</th>";
            echo "<th>PASSWORD</th>";
            echo "<th>COMPANY</th>";  
            echo "<th>DEPARTMENT</th>";  
            echo "<th>SALES EX</th>"; 
            echo "</tr></thead><tbody>"; 
                    foreach ($conn->query($sql) as $row) { 
                        $cuscode=$row['user_name'];
                        $sql_1 = "select * from invpara where flag='". $row['COMCODE'] ."'";
                        $result_1 = $conn->query($sql_1);
                        $row_1 = $result_1->fetch(); 
                        
                        $sql_2 = "select * from s_stomas where CODE='". $row['sal_dep'] ."'";
                        $result_2 = $conn->query($sql_2);
                        $row_2 = $result_2->fetch(); 
                        
                        $sql_3 = "select * from s_salrep where REPCODE='". $row['sal_ex'] ."'";
                        $result_3 = $conn->query($sql_3);
                        $row_3 = $result_3->fetch(); 
 ?> 
                    <tr>
                        <td onclick="custno('<?php echo $row['user_name']; ?>');"><?php echo $i; ?></td>
                       
                        <td onclick="custno('<?php echo $row['user_name']; ?>');"><?php echo $row['user_name']; ?></td>   
                        <td onclick="custno('<?php echo $row['user_name']; ?>');"><?php echo $row['user_pass1']; ?></td>    
                        <td onclick="custno('<?php echo $row['user_name']; ?>');"><?php echo $row_1['COMCODE']?></td>    
                        <td onclick="custno('<?php echo $row['user_name']; ?>');"><?php echo $row_2['DESCRIPTION']; ?></td>     
                        <td onclick="custno('<?php echo $row['user_name']; ?>');"><?php echo $row_3['Name']; ?></td>   

                         

              </tr>

              <?php
              $i= $i+1;
          }
          ?> 
            
        </table> </div>

        <script type="text/javascript">
                $(document).ready(function() {
           var table = $('#example').DataTable( {
            lengthChange: true,
            fixedHeader: true,
            responsive: true,
            "deferRender": true, 
             "order": [[ 0, 'desc' ]], 
            lengthMenu: [[ 25, 50,100, -1 ],[ '25 rows', '50 rows', '100 rows', 'Show all' ]],

        } );

$('div.dataTables_filter input', table.table().container()).focus();
           table.buttons().container()
           .appendTo( '#example_wrapper .col-md-6:eq(0)' );
           
       } );
        </script>

    </body>
    </html>


 