<aside class="main-sidebar">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
          <!-- Sidebar user panel -->
          <div class="user-panel">
            <div class="pull-left image">
              <img src="../../dist/img/avatar5.png" class="img-circle" alt="User Image">
            </div>
            <div class="pull-left info">
              <p><?php  	
					$user =  $_SESSION['nama'] ;
					echo"$user"; 
					$arr = $_SESSION['akses'];
					$akses = explode( ',', $arr );
					$idd = $_SESSION['idm'];
				?></p>
              <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
            </div>
          </div>

          <!-- sidebar menu: : style can be found in sidebar.less -->
          <ul class="sidebar-menu">
            <li class="header">MAIN NAVIGATION</li>
			
			
			<?php
				echo"
				<li class='treeview'>
				  <a href='#'>
					<i class='fa fa-dashboard'></i> <span>Master Data</span> <i class='fa fa-angle-left pull-right'></i>
				  </a>
				  <ul class='treeview-menu'>";
					$oto = mysql_result(mysql_query("select count(pk) from admindetail where user = $idd and xview = 'Y' and modul ='24'"),0);
					if ($oto > 0 ){
						echo"<li><a href='../customer/data.php'><i class='fa fa-circle-o'></i> Data Customer</a></li>";
					}
					echo"
					<li><a href='../supplier/data.php'><i class='fa fa-circle-o'></i> Data Supplier</a></li>
					<li><a href='../produkcat/data.php'><i class='fa fa-circle-o'></i> Data Kategori Produk</a></li>
					<li><a href='../produk/data.php'><i class='fa fa-circle-o'></i> Data Produk</a></li>
					<li><a href='../gudang/data.php'><i class='fa fa-circle-o'></i> Data Gudang</a></li>
				  </ul>
				</li>";
			
			?>
			
			<?php	
					//1 - Pembelian
					//2 - Penjualan 
					//3 - Sales Order
					//4 - Purchase Order
					$oto = mysql_result(mysql_query("select count(pk) from admindetail where user = $idd and xview = 'Y' and modul in('1','2','3','4')"),0);
					if ($oto > 0 ){
				
						 echo"
						<li class='treeview'>
						  <a href='#'>
							<i class='fa fa-files-o'></i>
							<span>Transaksi</span>
							<i class='fa fa-angle-left pull-right'></i>
						  </a>
						  <ul class='treeview-menu'>";
							$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '1'"),0);
							if ($oto == "Y"){
								echo"<li><a href='../purchase/data.php'><i class='fa fa-circle-o'></i> Pembelian</a></li>";
							}
							$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '2'"),0);
							if ($oto == "Y"){
								echo"<li><a href='../salescs/data.php'><i class='fa fa-circle-o'></i> Penjualan</a></li>";
							}
							$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '4'"),0);
							if ($oto == "Y"){
								echo"<li><a href='../purchasee/data.php'><i class='fa fa-circle-o'></i> Purchase Order</a></li>";
							}
							$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '3'"),0);
							if ($oto == "Y"){
								echo"<li><a href='../saless/data.php'><i class='fa fa-circle-o'></i> Sales Order</a></li>";
							}				
						echo"
						  </ul>
						</li>";
			
					}
			?>
			
			<?php	
					//18 - Retur Pembelian
					//17 - Retur Penjualan 
					//19 - Retur Sales Order
					//20 - Retur Purchase Order
					$oto = mysql_result(mysql_query("select count(pk) from admindetail where user = $idd and xview = 'Y' and modul in('17','18','19','20')"),0);
					if ($oto > 0 ){
				
						 echo"
						<li class='treeview'>
						  <a href='#'>
							<i class='fa fa-files-o'></i>
							<span>Retur </span>
							<i class='fa fa-angle-left pull-right'></i>
						  </a>
						  <ul class='treeview-menu'>";
							$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '18'"),0);
							if ($oto == "Y"){
								echo"<li><a href='../rpurchase/data.php'><i class='fa fa-circle-o'></i> Retur Pembelian</a></li>";
							}
							$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '17'"),0);
							if ($oto == "Y"){
								echo"<li><a href='../rsalescs/data.php'><i class='fa fa-circle-o'></i> Retur Penjualan</a></li>";
							}
							$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = 20"),0);
							if ($oto == "Y"){
								echo"<li><a href='../rpurchasee/data.php'><i class='fa fa-circle-o'></i> Retur Purchase Order</a></li>";
							}
							$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '19'"),0);
							if ($oto == "Y"){
								echo"<li><a href='../rsaless/data.php'><i class='fa fa-circle-o'></i> Retur Sales Order</a></li>";
							}				
						echo"
						  </ul>
						</li>";
			
					}
			?>
            
           
			
			<?php
				//5 - Kartu Stok
				//12 - Adjust
				//13 - Adjust Tax
				//16 - Mutasi
				//21 - Mutasi Tax
				//22 - Stok Gudang
				//23 - Stok Gudang Tax
				$oto = mysql_result(mysql_query("select count(pk) from admindetail where user = $idd and xview = 'Y' and modul in('5','12','13','16','21','22','23')"),0);
				if ($oto > 0 ){
					echo"
					<li class='treeview'>
					  <a href='#'>
						<i class='fa fa-truck'></i>
						<span>Produk</span>
						<i class='fa fa-angle-left pull-right'></i>
					  </a>
					  <ul class='treeview-menu'>";
						$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '5'"),0);
						if ($oto == "Y"){
							echo"<li><a href='../stok/data.php'><i class='fa fa-circle-o'></i> Kartu Stok</a></li>	";
						}
						$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '12'"),0);
						if ($oto == "Y"){	
							echo"<li><a href='../adjust/data.php'><i class='fa fa-circle-o'></i> Adjust </a></li>";
						}
						$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '13'"),0);
						if ($oto == "Y"){	
							echo"<li><a href='../adjusttax/data.php'><i class='fa fa-circle-o'></i> Adjust Tax</a></li>";
						}
						$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '16'"),0);
						if ($oto == "Y"){	
							echo"<li><a href='../mutasi/data.php'><i class='fa fa-circle-o'></i> Mutasi</a></li>";
						}
						$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '21'"),0);
						if ($oto == "Y"){	
							echo"<li><a href='../mutasitax/data.php'><i class='fa fa-circle-o'></i> Mutasi Tax</a></li>";
						}
						$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '22'"),0);
						if ($oto == "Y"){	
							echo"<li><a href='../stokgudang/data.php'><i class='fa fa-circle-o'></i> Stock Gudang</a></li>";
						}
						$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '23'"),0);
						if ($oto == "Y"){	
							echo"<li><a href='../stokgudangtax/data.php'><i class='fa fa-circle-o'></i> Stock Gudang Tax</a></li>";
						}
					echo"
					  </ul>
					</li>";
				}
			
			?>
			
			
			
			
			<?php
				//15 - Limit Customer
				//18 - Pembayaran Customer
				//19 - Harga beli
				$oto = mysql_result(mysql_query("select count(pk) from admindetail where user = $idd and xview = 'Y' and modul in('15','88','88','88','88')"),0);
				if ($oto > 0 ){
			?>
            <li class="treeview">
              <a href="#">
                <i class="fa fa-book"></i>
                <span>Finance</span>
                <i class="fa fa-angle-left pull-right"></i>
              </a>
              <ul class="treeview-menu">
                <?php
				$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '15'"),0);
				if ($oto == "Y"){
					echo" <li><a href='../customer/limit.php'><i class='fa fa-circle-o'></i> Limit Customer </a></li>";
				}
				$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '88'"),0);
				if ($oto == "Y"){
					echo" <li><a href='../bank/data.php'><i class='fa fa-circle-o'></i> Bank </a></li>";
				}
				$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '88'"),0);
				if ($oto == "Y"){
					echo" <li><a href='../biayakat/data.php'><i class='fa fa-circle-o'></i> Kategori Biaya </a></li>";
				}
				$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '88'"),0);
				if ($oto == "Y"){
					echo" <li><a href='../biaya/data.php'><i class='fa fa-circle-o'></i> Biaya </a></li>";
				}
				$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '88'"),0);
				if ($oto == "Y"){
					echo" <li><a href='../produk/hbeli.php'><i class='fa fa-circle-o'></i> Harga Beli </a></li>";
				}
				?>
              </ul>
            </li>   

			<?php
				}
			?>	
			
			
			
 
			
			<?php
				//6 - Laporan Penjualan
				//7 - Laporan Sales Order
				//8 - Laporan Pembelian
				//9 - Laporan Purchase Order
				//10 - Laporan Penjualan by Produk
				//11 - Laporan Sales Order by Produk
				$oto = mysql_result(mysql_query("select count(pk) from admindetail where user = $idd and xview = 'Y' and modul in('6','7','8','9','10','11')"),0);
				if ($oto > 0 ){
			?>	
			<li class="treeview">
              <a href="#">
                <i class="fa fa-calendar"></i>
                <span>Laporan</span>
                <i class="fa fa-angle-left pull-right"></i>
              </a>
              <ul class="treeview-menu">
				<?php


					$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '6'"),0);
					if ($oto == "Y"){
						echo" <li><a href='../laporan/penjualan.php'><i class='fa fa-circle-o'></i> Laporan Penjualan </a></li>";
					}
					$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '7'"),0);
					if ($oto == "Y"){
						echo" <li><a href='../laporan/penjualantax.php'><i class='fa fa-circle-o'></i> Laporan Sales Order </a></li>";
					}
					$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '8'"),0);
					if ($oto == "Y"){
						echo" <li><a href='../laporan/pembelian.php'><i class='fa fa-circle-o'></i> Laporan Pembelian </a></li>";
					}
					$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '9'"),0);
					if ($oto == "Y"){
						echo" <li><a href='../laporan/pembeliantax.php'><i class='fa fa-circle-o'></i> Laporan Purchase Order </a></li>";
					}
					$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '10'"),0);
					if ($oto == "Y"){
						echo" <li><a href='../laporan/penjualanstok.php'><i class='fa fa-circle-o'></i> Lap Penjualan by Produk </a></li>";
					}
					$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '11'"),0);
					if ($oto == "Y"){
						echo" <li><a href='../laporan/penjualantaxstok.php'><i class='fa fa-circle-o'></i> Lap Sales Order by Produk </a></li>";
					}
				?>
				<li><a href='../laporan/invdel.php'><i class='fa fa-circle-o'></i> Laporan Inv Delete </a></li>
              </ul>
            </li>
			<?php
				}
			?>
			
			<?php
			$oto = mysql_result(mysql_query("select xview from admindetail where user = $idd  and modul = '14'"),0);
			if ($oto == "Y"){
			?>
			<li class="treeview">
              <a href="#">
                <i class="fa fa-user"></i>
                <span>User</span>
                <i class="fa fa-angle-left pull-right"></i>
              </a>
              <ul class="treeview-menu">
				<?php
					echo" <li><a href='../user/data.php'><i class='fa fa-circle-o'></i> Data User </a></li>";
				?>
              </ul>
            </li>
			<?php
				}
			?>
          </ul>
        </section>
        <!-- /.sidebar -->
      </aside>