<?php 
ob_start();
include 'connection.php';
include 'sahavas_function.php';

session_start();

if (!isset($_SESSION['is_logged_in'])) {
    header("Location:login.php");
    die();
    }
	
	
// Check if scroll position is set in session
if(isset($_SESSION['scroll_position'])) {
    $scroll_position = $_SESSION['scroll_position'];
} else {
    $scroll_position = 0; // Default scroll position
}

// Update scroll position if received from client
if(isset($_POST['scroll_position'])) {
    $_SESSION['scroll_position'] = $_POST['scroll_position'];
}	
	
	
date_default_timezone_set('Asia/Calcutta');
$today = date("d/m/y");
$today1 = date("d-m-Y");
$today1a = date("Y-m-d");

$time = date("h:i A");


$currentyear = date("Y");
$currentmonth = date("m");

if($currentmonth>03) { 
$cuyear = date("Y");
$cuyear1 = date("y")+1;
} 
else { 
$cuyear = date("Y")-1;
$cuyear1 =  date("y");
} 
$f_year = "$cuyear"."-"."$cuyear1";


if($currentmonth>03) { 
$cuyear01 = date("Y")-1;
$cuyear11 = date("y");
} 
else { 
$cuyear01 = date("Y")-2;
$cuyear11 =  date("y");
} 
$f_Lyear = "$cuyear01"."-"."$cuyear11";




$querylogin = "select * from  mst_users where user_name = '". $_SESSION["LOGIN_NAME"]."' AND password = '".$_SESSION["EMPLOYEE_PASSWORD"]."'";
$resultlogin = mysqli_query($conn,$querylogin);
while($row=mysqli_fetch_array($resultlogin))
{
$user_name = $row['user_name'];
$user_id = $row['user_id'];
$first_name = $row['first_name'];
$login_type=$row['login_type'];

}
$querycom= "select * from  company_master";
$resultcom = mysqli_query($conn,$querycom);
while($row=mysqli_fetch_array($resultcom))
{
$company_namecnp = $row['company_name'];

}
?>
<? 
$queryls7 = "select * from display_limit";
$resultls7 = mysqli_query($conn,$queryls7);	
while($row=mysqli_fetch_array($resultls7))
{
$display_limit=$row['display_limit'];
}

?>

<!DOCTYPE html>
<html>
<!-- Mirrored from themesdesign.in/xadmino/index.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 03 Feb 2021 12:04:34 GMT -->
<head>
<meta charset="utf-8" />
<title><?php echo $company_namecnp?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta content="Admin Dashboard" name="description" />
<meta content="ThemeDesign" name="author" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="shortcut icon" href="assets/images/favicon.png">
<link href="assets/plugins/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />
<link href="assets/plugins/datatables/responsive.bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="assets/plugins/datatables/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="assets/css/icons.css" rel="stylesheet" type="text/css">
<link href="assets/css/style.css" rel="stylesheet" type="text/css">
<link href="vendors/bower_components/select2/dist/css/select2.min.css" rel="stylesheet" type="text/css">
<link href="vendors/bower_components/bootstrap-select/dist/css/bootstrap-select.min.css" rel="stylesheet" type="text/css">
<link href="vendors/bower_components/multiselect/css/multi-select.css" rel="stylesheet" type="text/css">


 <script type="text/javascript" >
   function preventBack(){window.history.forward();}
    setTimeout("preventBack()", 0);
    window.onunload=function(){null};
</script>

<script>
        window.onload = function() {
            // Set scroll position on page load
            window.scrollTo(0, <?php echo $scroll_position; ?>);

            // Function to save scroll position
            function saveScrollPosition() {
                var scroll_position = window.pageYOffset || document.documentElement.scrollTop;
                var xhr = new XMLHttpRequest();
                xhr.open("POST", window.location.href, true);
                xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                xhr.send("scroll_position=" + scroll_position);
            }

            // Save scroll position on page unload
            window.onunload = saveScrollPosition;
            window.onscroll = saveScrollPosition;
        }
    </script>
</head>
<body class="fixed-left">
<div id="wrapper">
  <div class="topbar">
    <div class="topbar-left">
      <div class="text-center"> <a href="index.php" class="logo"><img src="assets/images/logo_white_2.png"></a> <a href="index.html" class="logo-sm"><img src="assets/images/logo_sm.png" height="36"></a></div>
    </div>
    <div class="navbar navbar-default" role="navigation">
      <div class="container">
        <div class="">
          <div class="pull-left">
            <button type="button" class="button-menu-mobile open-left waves-effect waves-light"> <i class="ion-navicon"></i> </button>
            <span class="clearfix"></span></div>
        
          <ul class="nav navbar-nav navbar-right pull-right">
            
            <li class="hidden-xs"> <a href="#" id="btn-fullscreen" class="waves-effect waves-light"><i class="fa fa-crosshairs"></i></a></li>
            <li class="dropdown"> <a href="#" class="dropdown-toggle profile waves-effect waves-light" data-toggle="dropdown" aria-expanded="true"><img src="assets/images/users/avatar-1.jpg" alt="user-img" class="img-circle"> </a>
              <ul class="dropdown-menu">
                <!--<li><a href="javascript:void(0)"> Profile</a></li>
                <li><a href="javascript:void(0)"><span class="badge badge-success pull-right">5</span> Settings </a></li>-->
               <!-- <li class="divider"></li>-->
                <li><a href="logout.php"> Logout</a></li>
              </ul>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
  <div class="left side-menu">
    <div class="sidebar-inner slimscrollleft">
    <br><br>
      <div id="sidebar-menu">
        <? link_chek();?>
      </div>
      <div class="clearfix"></div>
    </div>
  </div>