<?php

include 'connect.php';
if(!isset($_SESSION)){
    session_start();
}
if(isset($_SESSION['adminemail']))
{
$user=$_SESSION['adminemail'];

$usrtyp=mysql_query("select * from admin where username='$user'");
$usrtyp1=mysql_fetch_array($usrtyp);


$sett=mysql_query("select * from settings");
$settnum=mysql_num_rows($sett);
$sett1=mysql_fetch_array($sett);


if($settnum>0)
{

$compname=strtoupper($sett1['company_name']);

}

else

{

$compname='AGRO INDUSTIRES';

}


$sel=mysql_query("select * from admin where username='$user'");
$nmrw=mysql_num_rows($sel);
$sel1=mysql_fetch_array($sel);

if($nmrw>0)
{

?>


<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title><?php echo $compname; ?></title>

		<meta name="description" content="overview &amp; stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

		<!-- bootstrap & fontawesome -->

		<link rel="stylesheet" href="assets/css/bootstrap.min.css" />

		<link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />



		<!-- page specific plugin styles -->



		<!-- text fonts -->

		<link rel="stylesheet" href="assets/css/fonts.googleapis.com.css" />

		<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
        
        <link rel="stylesheet" href="assets/css/bootstrap-timepicker.min.css" />
        
        <link rel="stylesheet" href="assets/css/bootstrap-datetimepicker.min.css" />

		<!-- ace styles -->
        
        <link rel="stylesheet" href="assets/css/select2.min.css" />

		<link rel="stylesheet" href="assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" />

		<link rel="stylesheet" href="assets/css/daterangepicker.min.css" />
        
        <link rel="stylesheet" href="assets/css/fullcalendar.min.css" />

		<!--[if lte IE 9]>

			<link rel="stylesheet" href="assets/css/ace-part2.min.css" class="ace-main-stylesheet" />

		<![endif]-->

		<!--<link rel="stylesheet" href="assets/css/ace-skins.min.css" />

		<link rel="stylesheet" href="assets/css/ace-rtl.min.css" />-->



		<!--[if lte IE 9]>

		  <link rel="stylesheet" href="assets/css/ace-ie.min.css" />

		<![endif]-->



		<!-- inline styles related to this page -->



		<!-- ace settings handler -->

		<script src="assets/js/ace-extra.min.js"></script>



		<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->



		<!--[if lte IE 8]>

		<script src="assets/js/html5shiv.min.js"></script>

		<script src="assets/js/respond.min.js"></script>

		<![endif]-->

        
<style>

ul.navbar-nav li
{
	border-left:none;
	border-right:none;
}

input[type="text"]
{
	width:220px;
	height:30px;
}

</style>        
        
	</head>

	<body class="no-skin">
		<div id="navbar" class="navbar navbar-default          ace-save-state">
			<div class="navbar-container ace-save-state" id="navbar-container">
				<button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler" data-target="#sidebar">
					<span class="sr-only">Toggle sidebar</span>

					<span class="icon-bar"></span>

					<span class="icon-bar"></span>

					<span class="icon-bar"></span>
				</button>

				<div class="navbar-header pull-left">
					<a href="index.php" class="navbar-brand">
						<small style="text-transform:uppercase; font-size:16px;"><img src="assets/images/icon.png" style="padding:0; margin-top:-7px;" /><?php echo $compname; ?></small>
					</a>
				</div>

				<div class="navbar-buttons navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav" style="color:#FFF;">
						<li class="grey">
							<a href="logout.php">
									<i class="ace-icon fa fa-user"></i> Logout
							</a>
						</li>
					</ul>
				</div>
                
                
                
                <div class="navbar-buttons navbar-header pull-left" role="navigation" style="margin-left:47px;">
					<ul class="nav ace-nav">
						                        
                        <li class="grey"><a href="viewcustomer.php"><i class="ace-icon fa fa-book"></i> <span>Customer</span></a></li>
                        <li class="grey"><a href="viewsupplier.php"><i class="ace-icon fa fa-calendar"></i> Supplier</a></li>
                        
                        <li class="grey dropdown-modal">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">
								<i class="ace-icon fa fa-tasks"></i>
								Product
							</a>
                            
							<ul class="dropdown-menu-left dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
								<li class="dropdown-header">
									<a href="viewproduct_category.php"><i class="ace-icon fa fa-check"></i>Product Category</a>
								</li>
                                <li class="dropdown-header">
									<a href="viewproduct.php"><i class="ace-icon fa fa-check"></i>Product</a>
								</li>
							</ul>								

						</li>
                        
                        <li class="grey"><a href="viewfactory.php"><i class="ace-icon fa fa-group"></i> Factory</a></li>
                        
                        <li class="grey"><a href="viewbank.php"><i class="ace-icon fa fa-bank"></i> Bank</a></li>
                        
                        <li class="grey dropdown-modal">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">
								<i class="ace-icon fa fa-tasks"></i>
								Tools
							</a>
                            
							<ul class="dropdown-menu-left dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
								<li class="dropdown-header">
									<a href="viewdepartment.php"><i class="ace-icon fa fa-check"></i>Department</a>
								</li>
                                <li class="dropdown-header">
									<a href="viewdesignation.php"><i class="ace-icon fa fa-check"></i>Designation</a>
								</li>
								<li class="dropdown-header">
									<a href="viewusers.php"><i class="ace-icon fa fa-check"></i>Users</a>
								</li>
							</ul>

						</li>
                        
                        <li class="grey"><a href="settings.php"><i class="ace-icon fa fa-cogs"></i> Settings</a></li>
						
					</ul>
				</div>
                                
			</div><!-- /.navbar-container -->
		</div>
        
        
        
        <div class="main-container ace-save-state" id="main-container">
			<script type="text/javascript">
				try{ace.settings.loadState('main-container')}catch(e){}
			</script>

			<div id="sidebar" class="sidebar responsive ace-save-state">
				<script type="text/javascript">
					try{ace.settings.loadState('sidebar')}catch(e){}
				</script>

				

				<ul class="nav nav-list">
					<li class="">
						<a href="index.php">
							<i class="menu-icon fa fa-tachometer"></i>
							<span class="menu-text"> Dashboard </span>
						</a>

					</li>
					
					<li class="">
						<a href="viewestimation.php">
							<i class="menu-icon fa fa-leaf"></i>
							<span class="menu-text"> Estimation </span>
						</a>

					</li>

					<li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-book"></i>
							<span class="menu-text">
								Purchase
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">
							
							<li class="">
								<a href="viewpurchaseorder.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Purchase Order
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="viewpurchase.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Purchase
								</a>

								<b class="arrow"></b>
							</li>

						</ul>
					</li>
                    
                    <li class="">
						<a href="viewproduction.php">
							<i class="menu-icon fa fa-leaf"></i>
							<span class="menu-text"> Production </span>
						</a>
						<b class="arrow"></b>
					</li>
                    
                    <li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-list"></i>
							<span class="menu-text">
								Sales
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">
							
							<li class="">
								<a href="viewsalesorder.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Sales Order
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="viewinvoice.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Sales
								</a>

								<b class="arrow"></b>
							</li>
						</ul>
					</li>
                    
                    
                    <li class="">
						<a href="stock.php">
							<i class="menu-icon fa fa-leaf"></i>
							<span class="menu-text"> Stock </span>
						</a>
						<b class="arrow"></b>
					</li>
                    
                    <li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-pencil"></i>
							<span class="menu-text">
								Vouchers
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">
							
							<li class="">
								<a href="viewpayment.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Payment
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="viewreceipt.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Receipt
								</a>

								<b class="arrow"></b>
							</li>
						</ul>
					</li>
                    
                    <li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-file"></i>
							<span class="menu-text">
								Accounts
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">
							
							<li class="">
								<a href="daybook.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Daybook
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="debitor_ledger.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Customers Ledger
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="creditor_ledger.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Suppliers Ledger
								</a>

								<b class="arrow"></b>
							</li>
                                                        
                            <li class="">
								<a href="cash_ledger.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Cash Ledger
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="bank_ledger.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Bank Ledger
								</a>

								<b class="arrow"></b>
							</li>
							
							<li class="">
								<a href="outstandings.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Outstandings
								</a>

								<b class="arrow"></b>
							</li>

						</ul>
					</li>
                    
					<li class="">
						<a href="routewisereport.php">
							<i class="menu-icon fa fa-leaf"></i>
							<span class="menu-text"> Routewise Report </span>
						</a>
						<b class="arrow"></b>
					</li>
					
                    <!-- <li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-cog"></i>
							<span class="menu-text">
								Logistics
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">
							
							<li class="">
								<a href="viewretail_product.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Trace Order
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="retail_label.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Vehicle Logistics
								</a>

								<b class="arrow"></b>
							</li>
						</ul>
					</li> -->
                    
                    
                    <li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-pencil"></i>
							<span class="menu-text">
								Expense
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">
							
							<li class="">
								<a href="viewexpense_category.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Expense Category
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="viewexpense.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Expense
								</a>

								<b class="arrow"></b>
							</li>
							
							<li class="">
								<a href="expenseledger.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Expense Ledger
								</a>

								<b class="arrow"></b>
							</li>
                            
						</ul>
					</li>
					
					
					<li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-cog"></i>
							<span class="menu-text">
								Imprest
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">
							
							<li class="">
								<a href="viewimprest.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Create / View
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="imprestledger.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Imprest Ledger
								</a>

								<b class="arrow"></b>
							</li>
						</ul>
					</li>
					
					
                    <li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-users"></i>
							<span class="menu-text">
								Employee
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">

                            <li class="">
								<a href="viewemployee.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Employees
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="viewattendance.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Attendance
								</a>

								<b class="arrow"></b>
							</li>
							
							<li class="">
								<a href="viewotattendance.php">
									<i class="menu-icon fa fa-caret-right"></i>
									OT Attendance
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="viewadvance.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Advance
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="salary.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Generate Payslip
								</a>

								<b class="arrow"></b>
							</li>
							
							<li class="">
								<a href="kpi.php">
									<i class="menu-icon fa fa-caret-right"></i>
									KPI
								</a>

								<b class="arrow"></b>
							</li>
							
							<li class="">
								<a href="kpireport.php">
									<i class="menu-icon fa fa-caret-right"></i>
									KPI Report
								</a>

								<b class="arrow"></b>
							</li>
							
							<li class="">
								<a href="salarysheet.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Salary Sheet
								</a>

								<b class="arrow"></b>
							</li>
                            
						</ul>
					</li>
                    
                    
                    <li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-list"></i>
							<span class="menu-text">
								Transport
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">
                            
                            <li class="">
								<a href="viewtransport.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Transport
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="viewdelivery.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Delivery
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="viewfuel.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Fuel
								</a>

								<b class="arrow"></b>
							</li>

                             <li class="">
								<a href="fuel_report.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Fuel Report
								</a>

								<b class="arrow"></b>
							</li>


						</ul>
					</li>
                    
                    
                    <li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-list"></i>
							<span class="menu-text">
								CRM
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">
                        
                        	<li class="">
								<a href="viewcrmcustomer.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Farmer Data
								</a>

								<b class="arrow"></b>
							</li>
							
							<li class="">
								<a href="viewteam.php">
									<i class="menu-icon fa fa-caret-right"></i>
									CRM Team Allocate
								</a>

								<b class="arrow"></b>
							</li>

							<li class="">
								<a href="premiumcustomer.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Premium Customers
								</a>

								<b class="arrow"></b>
							</li>

                            
                            <li class="">
								<a href="followup.php">
									<i class="menu-icon fa fa-caret-right"></i>
									New - Follow Up
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="todaysfollowup.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Today's Follow Up
								</a>

								<b class="arrow"></b>
							</li>
							
							<li class="">
								<a href="followupreport.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Follow Up Report
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <li class="">
								<a href="executivereport.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Executives Report
								</a>

								<b class="arrow"></b>
							</li>
							
							<li class="">
								<a href="teamwisereport.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Teamwise Report
								</a>

								<b class="arrow"></b>
							</li>
                            
                            <!-- <li class="">
								<a href="retail_label.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Orders
								</a>

								<b class="arrow"></b>
							</li> -->
                            

						</ul>
					</li>
                    
                    <li class="">
						<a href="viewnewproject.php">
							<i class="menu-icon fa fa-leaf"></i>
							<span class="menu-text"> New Project </span>
						</a>
						<b class="arrow"></b>
					</li>
					
					<li class="">
						<a href="viewcoconutproject.php">
							<i class="menu-icon fa fa-leaf"></i>
							<span class="menu-text"> Coconut Project </span>
						</a>
						<b class="arrow"></b>
					</li>

				</ul><!-- /.nav-list -->

				<div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
					<i id="sidebar-toggle-icon" class="ace-icon fa fa-angle-double-left ace-save-state" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
				</div>
			</div>
        
        
        
        
<?php

}

else
{

$empd=mysql_query("select * from employee where username='$user'");
$empd1=mysql_fetch_array($empd);

$usr=$empd1['ID'];


$c1=mysql_query("select COUNT(ID) from menu where menu='customer' and username='$usr'");
$d1=mysql_result($c1,0);


$c2=mysql_query("select COUNT(ID) from menu where menu='supplier' and username='$usr'");
$d2=mysql_result($c2,0);


$c3=mysql_query("select COUNT(ID) from menu where menu='productcategory' and username='$usr'");
$d3=mysql_result($c3,0);


$c4=mysql_query("select COUNT(ID) from menu where menu='product' and username='$usr'");
$d4=mysql_result($c4,0);


$c5=mysql_query("select COUNT(ID) from menu where menu='factory' and username='$usr'");
$d5=mysql_result($c5,0);


$c6=mysql_query("select COUNT(ID) from menu where menu='bank' and username='$usr'");
$d6=mysql_result($c6,0);


$c7=mysql_query("select COUNT(ID) from menu where menu='department' and username='$usr'");
$d7=mysql_result($c7,0);


$c8=mysql_query("select COUNT(ID) from menu where menu='designation' and username='$usr'");
$d8=mysql_result($c8,0);


$c9=mysql_query("select COUNT(ID) from menu where menu='settings' and username='$usr'");
$d9=mysql_result($c9,0);


$c10=mysql_query("select COUNT(ID) from menu where menu='purchaseorder' and username='$usr'");
$d10=mysql_result($c10,0);


$c11=mysql_query("select COUNT(ID) from menu where menu='purchase' and username='$usr'");
$d11=mysql_result($c11,0);


$c12=mysql_query("select COUNT(ID) from menu where menu='production' and username='$usr'");
$d12=mysql_result($c12,0);


$c13=mysql_query("select COUNT(ID) from menu where menu='salesorder' and username='$usr'");
$d13=mysql_result($c13,0);


$c14=mysql_query("select COUNT(ID) from menu where menu='sales' and username='$usr'");
$d14=mysql_result($c14,0);


$c15=mysql_query("select COUNT(ID) from menu where menu='stock' and username='$usr'");
$d15=mysql_result($c15,0);


$c16=mysql_query("select COUNT(ID) from menu where menu='payment' and username='$usr'");
$d16=mysql_result($c16,0);


$c17=mysql_query("select COUNT(ID) from menu where menu='receipt' and username='$usr'");
$d17=mysql_result($c17,0);


$c18=mysql_query("select COUNT(ID) from menu where menu='daybook' and username='$usr'");
$d18=mysql_result($c18,0);


$c19=mysql_query("select COUNT(ID) from menu where menu='customerledger' and username='$usr'");
$d19=mysql_result($c19,0);


$c20=mysql_query("select COUNT(ID) from menu where menu='supplierledger' and username='$usr'");
$d20=mysql_result($c20,0);


$c21=mysql_query("select COUNT(ID) from menu where menu='cashledger' and username='$usr'");
$d21=mysql_result($c21,0);


$c22=mysql_query("select COUNT(ID) from menu where menu='bankledger' and username='$usr'");
$d22=mysql_result($c22,0);


$c23=mysql_query("select COUNT(ID) from menu where menu='outstandings' and username='$usr'");
$d23=mysql_result($c23,0);


$c24=mysql_query("select COUNT(ID) from menu where menu='expensecategory' and username='$usr'");
$d24=mysql_result($c24,0);


$c25=mysql_query("select COUNT(ID) from menu where menu='expense' and username='$usr'");
$d25=mysql_result($c25,0);


$c26=mysql_query("select COUNT(ID) from menu where menu='imprest' and username='$usr'");
$d26=mysql_result($c26,0);


$c27=mysql_query("select COUNT(ID) from menu where menu='employees' and username='$usr'");
$d27=mysql_result($c27,0);


$c28=mysql_query("select COUNT(ID) from menu where menu='attendance' and username='$usr'");
$d28=mysql_result($c28,0);


$c29=mysql_query("select COUNT(ID) from menu where menu='advance' and username='$usr'");
$d29=mysql_result($c29,0);


$c30=mysql_query("select COUNT(ID) from menu where menu='generatepayslip' and username='$usr'");
$d30=mysql_result($c30,0);


$c31=mysql_query("select COUNT(ID) from menu where menu='kpi' and username='$usr'");
$d31=mysql_result($c31,0);


$c32=mysql_query("select COUNT(ID) from menu where menu='kpireport' and username='$usr'");
$d32=mysql_result($c32,0);


$c33=mysql_query("select COUNT(ID) from menu where menu='salarysheet' and username='$usr'");
$d33=mysql_result($c33,0);


$c34=mysql_query("select COUNT(ID) from menu where menu='transport' and username='$usr'");
$d34=mysql_result($c34,0);


$c35=mysql_query("select COUNT(ID) from menu where menu='delivery' and username='$usr'");
$d35=mysql_result($c35,0);


$c36=mysql_query("select COUNT(ID) from menu where menu='fuel' and username='$usr'");
$d36=mysql_result($c36,0);


$c37=mysql_query("select COUNT(ID) from menu where menu='fuelreport' and username='$usr'");
$d37=mysql_result($c37,0);


$c38=mysql_query("select COUNT(ID) from menu where menu='crmcustomer' and username='$usr'");
$d38=mysql_result($c38,0);


$c39=mysql_query("select COUNT(ID) from menu where menu='crmteamallocate' and username='$usr'");
$d39=mysql_result($c39,0);


$c40=mysql_query("select COUNT(ID) from menu where menu='followup' and username='$usr'");
$d40=mysql_result($c40,0);


$c41=mysql_query("select COUNT(ID) from menu where menu='followupreport' and username='$usr'");
$d41=mysql_result($c41,0);


$c42=mysql_query("select COUNT(ID) from menu where menu='executivesreport' and username='$usr'");
$d42=mysql_result($c42,0);


$c43=mysql_query("select COUNT(ID) from menu where menu='otattendance' and username='$usr'");
$d43=mysql_result($c43,0);


$c44=mysql_query("select COUNT(ID) from menu where menu='todaysfollowup' and username='$usr'");
$d44=mysql_result($c44,0);


$c45=mysql_query("select COUNT(ID) from menu where menu='teamwisereport' and username='$usr'");
$d45=mysql_result($c45,0);


$c46=mysql_query("select COUNT(ID) from menu where menu='newproject' and username='$usr'");
$d46=mysql_result($c46,0);

$c47=mysql_query("select COUNT(ID) from menu where menu='premiumcustomers' and username='$usr'");
$d47=mysql_result($c47,0);

$c48=mysql_query("select COUNT(ID) from menu where menu='coconutproject' and username='$usr'");
$d48=mysql_result($c48,0);


?>

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title><?php echo $compname; ?></title>

		<meta name="description" content="overview &amp; stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

		<!-- bootstrap & fontawesome -->

		<link rel="stylesheet" href="assets/css/bootstrap.min.css" />

		<link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />



		<!-- page specific plugin styles -->



		<!-- text fonts -->

		<link rel="stylesheet" href="assets/css/fonts.googleapis.com.css" />

		<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
        
        <link rel="stylesheet" href="assets/css/bootstrap-timepicker.min.css" />
        
        <link rel="stylesheet" href="assets/css/bootstrap-datetimepicker.min.css" />

		<!-- ace styles -->
        
        <link rel="stylesheet" href="assets/css/select2.min.css" />

		<link rel="stylesheet" href="assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" />

		<link rel="stylesheet" href="assets/css/daterangepicker.min.css" />
        
        <link rel="stylesheet" href="assets/css/fullcalendar.min.css" />

		<!--[if lte IE 9]>

			<link rel="stylesheet" href="assets/css/ace-part2.min.css" class="ace-main-stylesheet" />

		<![endif]-->

		<!--<link rel="stylesheet" href="assets/css/ace-skins.min.css" />

		<link rel="stylesheet" href="assets/css/ace-rtl.min.css" />-->



		<!--[if lte IE 9]>

		  <link rel="stylesheet" href="assets/css/ace-ie.min.css" />

		<![endif]-->



		<!-- inline styles related to this page -->



		<!-- ace settings handler -->

		<script src="assets/js/ace-extra.min.js"></script>



		<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->



		<!--[if lte IE 8]>

		<script src="assets/js/html5shiv.min.js"></script>

		<script src="assets/js/respond.min.js"></script>

		<![endif]-->

        
<style>

ul.navbar-nav li
{
	border-left:none;
	border-right:none;
}

input[type="text"]
{
	width:220px;
	height:30px;
}

</style>        
        
	</head>
	
	

	<body class="no-skin">
		<div id="navbar" class="navbar navbar-default ace-save-state">
			<div class="navbar-container ace-save-state" id="navbar-container">
				<button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler" data-target="#sidebar">
					<span class="sr-only">Toggle sidebar</span>

					<span class="icon-bar"></span>

					<span class="icon-bar"></span>

					<span class="icon-bar"></span>
				</button>

				<div class="navbar-header pull-left">
					<a href="index.php" class="navbar-brand">
						<small style="text-transform:uppercase; font-size:16px;"><?php echo $compname; ?></small>
					</a>
				</div>

				<div class="navbar-buttons navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav" style="color:#FFF;">
						<li class="grey">
							<a href="logout.php">
									<i class="ace-icon fa fa-user"></i> Logout
							</a>
						</li>
					</ul>
				</div>
                
                
                
                <div class="navbar-buttons navbar-header pull-left" role="navigation" style="margin-left:47px;">
					
					<?php
					
					if($d1>0 || $d2>0 || $d3>0 || $d4>0 || $d5>0 || $d6>0 || $d7>0 || $d8>0 || $d9>0)
					{
						
					echo'<ul class="nav ace-nav">';

						if($d1>0)
						{
                        echo'<li class="grey"><a href="viewcustomer.php"><i class="ace-icon fa fa-book"></i> <span>Customer</span></a></li>';
						}
						if($d2>0)
						{
                        echo'<li class="grey"><a href="viewsupplier.php"><i class="ace-icon fa fa-calendar"></i> Supplier</a></li>';
						}
                        
						if($d3>0 || $d4>0)
						{
                        echo'<li class="grey dropdown-modal">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">
								<i class="ace-icon fa fa-tasks"></i>
								Product
							</a>
                            
							<ul class="dropdown-menu-left dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
								<li class="dropdown-header">';
								
								if($d3>0)
								{
									echo'<a href="viewproduct_category.php"><i class="ace-icon fa fa-check"></i>Product Category</a>';
								}
									
								echo'</li>
                                <li class="dropdown-header">';
								
								if($d4>0)
								{
									echo'<a href="viewproduct.php"><i class="ace-icon fa fa-check"></i>Product</a>';
								}
									
								echo'</li>
							</ul>								

						</li>';
						}
                        
						if($d5>0)
						{
                        echo'<li class="grey"><a href="viewfactory.php"><i class="ace-icon fa fa-group"></i> Factory</a></li>';
						}
                        
						if($d6>0)
						{
                        echo'<li class="grey"><a href="viewbank.php"><i class="ace-icon fa fa-bank"></i> Bank</a></li>';
						}
                        
						if($d7>0 || $d8>0)
						{
                        echo'<li class="grey dropdown-modal">
							<a data-toggle="dropdown" class="dropdown-toggle" href="#">
								<i class="ace-icon fa fa-tasks"></i>
								Tools
							</a>
                            
							<ul class="dropdown-menu-left dropdown-navbar dropdown-menu dropdown-caret dropdown-close">';
							
							if($d7>0)
							{
								echo'<li class="dropdown-header">
									<a href="viewdepartment.php"><i class="ace-icon fa fa-check"></i>Department</a>
								</li>';
							}
							if($d8>0)
							{
                                echo'<li class="dropdown-header">
									<a href="viewdesignation.php"><i class="ace-icon fa fa-check"></i>Designation</a>
								</li>';
							}
							
							echo'</ul>

						</li>';
						}
                        
						if($d9>0)
						{
                        echo'<li class="grey"><a href="settings.php"><i class="ace-icon fa fa-cogs"></i> Settings</a></li>';
						}
						
					echo'</ul>';
					
					}
					
					?>
					
				</div>

			</div><!-- /.navbar-container -->
		</div>
        
        
        
        <div class="main-container ace-save-state" id="main-container">
			<script type="text/javascript">
				try{ace.settings.loadState('main-container')}catch(e){}
			</script>

			<div id="sidebar" class="sidebar responsive ace-save-state">
				<script type="text/javascript">
					try{ace.settings.loadState('sidebar')}catch(e){}
				</script>

				<ul class="nav nav-list">				
				
					<li class="">
						<a href="index.php">
							<i class="menu-icon fa fa-tachometer"></i>
							<span class="menu-text"> Dashboard </span>
						</a>

					</li>
				
				<?php
				

				if($d10>0 || $d11>0)
				{
					echo'<li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-book"></i>
							<span class="menu-text">
								Purchase
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">';
							
							if($d10>0)
							{
							echo'<li class="">
								<a href="viewpurchaseorder.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Purchase Order
								</a>

								<b class="arrow"></b>
							</li>';
							}
                            
							if($d11>0)
							{
                            echo'<li class="">
								<a href="viewpurchase.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Purchase
								</a>

								<b class="arrow"></b>
							</li>';
							}

						echo'</ul>
					</li>';
				}
                    
				if($d12>0)
				{
                    echo'<li class="">
						<a href="viewproduction.php">
							<i class="menu-icon fa fa-leaf"></i>
							<span class="menu-text"> Production </span>
						</a>
						<b class="arrow"></b>
					</li>';
				}
                    
				if($d13>0 || $d14>0)
				{
                    echo'<li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-list"></i>
							<span class="menu-text">
								Sales
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">';
							
							if($d13>0)
							{
							echo'<li class="">
								<a href="viewsalesorder.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Sales Order
								</a>

								<b class="arrow"></b>
							</li>';
							}
                            
							if($d14>0)
							{
                            echo'<li class="">
								<a href="viewinvoice.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Sales
								</a>

								<b class="arrow"></b>
							</li>';
							}
							
						echo'</ul>
					</li>';
				}
                
                if($d15>0)
				{
                    echo'<li class="">
						<a href="stock.php">
							<i class="menu-icon fa fa-leaf"></i>
							<span class="menu-text"> Stock </span>
						</a>
						<b class="arrow"></b>
					</li>';
				}
                    
				if($d16>0 || $d17>0)
				{
                    echo'<li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-pencil"></i>
							<span class="menu-text">
								Vouchers
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">';
							
							if($d16>0)
							{
							echo'<li class="">
								<a href="viewpayment.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Payment
								</a>

								<b class="arrow"></b>
							</li>';
							}
                            
							if($d17>0)
							{
                            echo'<li class="">
								<a href="viewreceipt.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Receipt
								</a>

								<b class="arrow"></b>
							</li>';
							}
							
						echo'</ul>
					</li>';
					
				}
                    
				if($d18>0 || $d19>0 || $d20>0 || $d21>0 || $d22>0 || $d23>0)
				{
                    echo'<li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-file"></i>
							<span class="menu-text">
								Accounts
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">';
							
							if($d18>0)
							{
							echo'<li class="">
								<a href="daybook.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Daybook
								</a>

								<b class="arrow"></b>
							</li>';
							}
                            
							if($d19>0)
							{
                            echo'<li class="">
								<a href="debitor_ledger.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Customers Ledger
								</a>

								<b class="arrow"></b>
							</li>';
							}
                            
							if($d20>0)
							{
                            echo'<li class="">
								<a href="creditor_ledger.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Suppliers Ledger
								</a>

								<b class="arrow"></b>
							</li>';
							}
							
                            if($d21>0)
							{
                            echo'<li class="">
								<a href="cash_ledger.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Cash Ledger
								</a>

								<b class="arrow"></b>
							</li>';
							}
                            
							if($d22>0)
							{
                            echo'<li class="">
								<a href="bank_ledger.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Bank Ledger
								</a>

								<b class="arrow"></b>
							</li>';
							}
							
							if($d23>0)
							{
							echo'<li class="">
								<a href="outstandings.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Outstandings
								</a>

								<b class="arrow"></b>
							</li>';
							}

						echo'</ul>
					</li>';
				}
                    
				if($d24>0 || $d25>0)
				{
                    echo'<li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-pencil"></i>
							<span class="menu-text">
								Expense
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">';
							
							if($d24>0)
							{
							echo'<li class="">
								<a href="viewexpense_category.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Expense Category
								</a>

								<b class="arrow"></b>
							</li>';
							}
                            
							if($d25>0)
							{
                            echo'<li class="">
								<a href="viewexpense.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Expense
								</a>

								<b class="arrow"></b>
							</li>';
							}
                            
						echo'</ul>
					</li>';
				}
                    
				if($d26>0)
				{
                    echo'<li class="">
						<a href="viewimprest.php">
							<i class="menu-icon fa fa-leaf"></i>
							<span class="menu-text"> Imprest </span>
						</a>
						<b class="arrow"></b>
					</li>';
				}
                    
				if($d27>0 || $d28>0 || $d29>0 || $d30>0 || $d31>0 || $d32>0 || $d33>0 || $d43>0)
				{
                    echo'<li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-users"></i>
							<span class="menu-text">
								Employee
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">';

						if($d27>0)
						{
                            echo'<li class="">
								<a href="viewemployee.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Employees
								</a>

								<b class="arrow"></b>
							</li>';
						}
                            
						if($d28>0)
						{
                            echo'<li class="">
								<a href="viewattendance.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Attendance
								</a>

								<b class="arrow"></b>
							</li>';
						}
						
						if($d43>0)
						{
                            echo'<li class="">
								<a href="viewattendance.php">
									<i class="menu-icon fa fa-caret-right"></i>
									OT Attendance
								</a>

								<b class="arrow"></b>
							</li>';
						}
                        
						if($d29>0)
						{
                            echo'<li class="">
								<a href="viewadvance.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Advance
								</a>

								<b class="arrow"></b>
							</li>';
						}
                            
						if($d30>0)
						{
                            echo'<li class="">
								<a href="salary.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Generate Payslip
								</a>

								<b class="arrow"></b>
							</li>';
						}
							
						if($d31>0)
						{
							echo'<li class="">
								<a href="kpi.php">
									<i class="menu-icon fa fa-caret-right"></i>
									KPI
								</a>

								<b class="arrow"></b>
							</li>';
						}
							
						if($d32>0)
						{
							echo'<li class="">
								<a href="kpireport.php">
									<i class="menu-icon fa fa-caret-right"></i>
									KPI Report
								</a>

								<b class="arrow"></b>
							</li>';
						}
						
						if($d33>0)
						{							
							echo'<li class="">
								<a href="salarysheet.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Salary Sheet
								</a>

								<b class="arrow"></b>
							</li>';
						}
                            
						echo'</ul>
					</li>';
				}
                    
                if($d34>0 || $d35>0 || $d36>0 || $d37>0)
				{
					
                    echo'<li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-list"></i>
							<span class="menu-text">
								Transport
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">';
                            
							if($d34>0)
							{
                            echo'<li class="">
								<a href="viewtransport.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Transport
								</a>

								<b class="arrow"></b>
							</li>';
							}
                            
							if($d35>0)
							{
                            echo'<li class="">
								<a href="viewdelivery.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Delivery
								</a>

								<b class="arrow"></b>
							</li>';
							}
                            
							if($d36>0)
							{
                            echo'<li class="">
								<a href="viewfuel.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Fuel
								</a>

								<b class="arrow"></b>
							</li>';
							}

							if($d37>0)
							{
                            echo'<li class="">
								<a href="fuel_report.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Fuel Report
								</a>

								<b class="arrow"></b>
							</li>';
							}


						echo'</ul>
					</li>';
				}
                    
                if($d38>0 || $d39>0 || $d40>0 || $d41>0 || $d42>0 || $d44>0 || $d47>0)
				{
                    echo'<li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-list"></i>
							<span class="menu-text">
								CRM
							</span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>

						<ul class="submenu">';
                        
						if($d38>0)
						{
                        	echo'<li class="">
								<a href="viewcrmcustomer.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Farmer Data
								</a>

								<b class="arrow"></b>
							</li>';
						}

						if($d47>0)
						{
                        	echo'<li class="">
								<a href="premiumcustomer.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Premium Customers
								</a>

								<b class="arrow"></b>
							</li>';
						}
							
						if($d39>0)
						{
							echo'<li class="">
								<a href="viewteam.php">
									<i class="menu-icon fa fa-caret-right"></i>
									CRM Team Allocate
								</a>

								<b class="arrow"></b>
							</li>';
						}
                            
						if($d40>0)
						{
                            echo'<li class="">
								<a href="followup.php">
									<i class="menu-icon fa fa-caret-right"></i>
									New - Follow Up
								</a>

								<b class="arrow"></b>
							</li>';
						}
						
						if($d44>0)
						{
                            echo'<li class="">
								<a href="todaysfollowup.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Todays Follow Up
								</a>

								<b class="arrow"></b>
							</li>';
						}
                        
						if($d41>0)
						{
                            echo'<li class="">
								<a href="followupreport.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Follow Up Report
								</a>

								<b class="arrow"></b>
							</li>';
						}
                        
						if($d42>0)
						{
                            echo'<li class="">
								<a href="executivereport.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Executives Report
								</a>

								<b class="arrow"></b>
							</li>';
						}
						
						if($d45>0)
						{
                            echo'<li class="">
								<a href="teamwisereport.php">
									<i class="menu-icon fa fa-caret-right"></i>
									Teamwise Report
								</a>

								<b class="arrow"></b>
							</li>';
						}


						echo'</ul>
					</li>';
				}
				
				if($d46>0)
				{
				echo'<li class="">
						<a href="viewnewproject.php">
							<i class="menu-icon fa fa-leaf"></i>
							<span class="menu-text"> New Project </span>
						</a>
						<b class="arrow"></b>
				</li>';
				}
				
				if($d47>0)
				{
				echo'<li class="">
						<a href="viewcoconutproject.php">
							<i class="menu-icon fa fa-leaf"></i>
							<span class="menu-text"> Coconut Project </span>
						</a>
						<b class="arrow"></b>
				</li>';
				}

				?>
				
				</ul>

				<div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
					<i id="sidebar-toggle-icon" class="ace-icon fa fa-angle-double-left ace-save-state" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
				</div>
			</div>


<?php

}


}


?>