
<div class="all-wrapper">
  <div class="row">
    <div class="col-md-3">
      <div class="text-center">
  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
  </button>
</div>
<div class="side-bar-wrapper collapse navbar-collapse navbar-ex1-collapse">
  <a href="dashboard.php" class="logo hidden-sm hidden-xs">
    <i class="icon-cloud-download"></i>
    <span>Sumatra Jakarta Admin</span>
  </a>
  <div class="search-box">
    <input type="text" placeholder="SEARCH" class="form-control">
  </div>
  <ul class="side-menu">
    <li>
      <a href="calender.php">
        <!--<span class="badge badge-notifications pull-right alert-animated">5</span>-->
        <i class="icon-calendar"></i> Buletin Board
      </a>
    </li>
  </ul>
  <div class="relative-w">
    <ul class="side-menu">
    <?php
        $sql = mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (1,2)");
		if(mysql_num_rows($sql) > 0)
		{
			?>
      <li>
        <a href="#" class="is-dropdown-menu">
          <span class="badge pull-right"></span>
          <i class="icon-code-fork"></i> Setting
        </a>
        <ul>
         <?php
				while($fetch = mysql_fetch_array($sql))
				{
				$id_application = $fetch['id_application'];
				?>
          <?php if($id_application == "1") { ?> <li>
            <a href="master_user.php">
              <i class="icon-user"></i>
              User
            </a>
          </li><?php }?>
          <?php if($id_application == "2") { ?> <li>
            <a href="master_menu.php">
              <i class="icon-flag"></i>
              Priviledge
            </a>
          </li><?php }?>
           <?php
				}
				?>
        </ul>
      </li>
     <?php
				}
        $sql1 = mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (3,4,5,6,7,8,9,10,24,26,27,28,43,44) ORDER BY id_application DESC");
		if(mysql_num_rows($sql1) > 0)
		{
			?>
           <li>
        <a href="#" class="is-dropdown-menu">
         <!-- <span class="badge pull-right">24</span>-->
          <i class="icon-th"></i> Master
        </a>
        <ul>
         <?php
				while($fetch1 = mysql_fetch_array($sql1))
				{
				$id_application = $fetch1['id_application'];
				?>
				 <?php  if($id_application == "3") { ?><li><a href="master_supplier.php"> <i class="icon-th"></i>Supplier</a></li><?php }?>
                    <?php if($id_application == "4") { ?><li><a href="master_customer.php"> <i class="icon-th"></i>Customer</a></li><?php }?>
                    <?php if($id_application == "5") { ?><li><a href="master_branch.php"> <i class="icon-th"></i>Branch</a></li><?php }?>
                    <?php if($id_application == "6") { ?><li><a href="master_provinsi.php"> <i class="icon-th"></i>Province</a></li><?php }?>
                    <?php if($id_application == "7") { ?><li><a href="master_kota.php"> <i class="icon-th"></i>Kota</a></li><?php }?>
                   <?php if($id_application == "8") { ?> <li><a href="master_payment.php"> <i class="icon-th"></i>Payment Method</a></li><?php }?>
                    <?php if($id_application == "9") { ?><li><a href="master_type.php"> <i class="icon-th"></i>Certificate Type</a></li><?php }?>
                    <?php if($id_application == "10") { ?><li><a href="master_shape.php"> <i class="icon-th"></i>Shape</a></li> <?php }?>
                     <?php if($id_application == "24") { ?><li><a href="master_indicator.php"> <i class="icon-th"></i>Indicator Inventory</a></li> <?php }?>
                     <?php if($id_application == "26") { ?><li><a href="master_diamonds.php"> <i class="icon-th"></i>Diamonds Categorization</a></li> <?php }?>
                     <?php if($id_application == "28") { ?><li><a href="master_gold.php"> <i class="icon-th"></i>Gold</a></li> <?php }?>
					 <?php if($id_application == "27") { ?><li><a href="master_cblb.php"> <i class="icon-th"></i>CB and LB Price</a></li> <?php }?>
                     <?php if($id_application == "43") { ?><li><a href="master_usd.php"> <i class="icon-th"></i>USD - IDR</a></li> <?php }?>
					 <?php if($id_application == "44") { ?><li><a href="master_time.php"> <i class="icon-th"></i>Working Time</a></li> <?php }?>
           <?php
						}
					?>
        </ul>
        <?php
		}
		?>
        </li>
         <?php
		 $sql3 = mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (11,12,13,14,15,34,35,36,37,38,39,44) order by id_application");
		if(mysql_num_rows($sql3) > 0)
		{
		?>
            <li><a href="#" class="is-dropdown-menu"> <i class="icon-gears (alias)"></i>Inventory</a>
            	<ul>
                 <?php
				while($fetch3 = mysql_fetch_array($sql3))
				{
				$id_application = $fetch3['id_application'];
				?>
               		<?php if($id_application == "11") { ?><li><a href="inventory_readyitem.php"> <i class="icon-gears (alias)"></i>Ready Item</a></li><?php }?>
                    <?php if($id_application == "12") { ?><li><a href="inventory_gold.php"> <i class="icon-gears (alias)"></i>Gold</a></li><?php }?>
                    <?php if($id_application == "13") { ?><li><a href="inventory_logam.php"> <i class="icon-gears (alias)"></i>Logam Mulia</a></li><?php }?>
                    <?php if($id_application == "14") { ?><li><a href="inventory_diamond.php"> <i class="icon-gears (alias)"></i>Diamond</a></li><?php }?>
                     <?php if($id_application == "34") { ?><li><a href="inventory_cincin.php"> <i class="icon-gears (alias)"></i>Cincin</a></li><?php }?>
                      <?php if($id_application == "35") { ?><li><a href="inventory_mastura.php"> <i class="icon-gears (alias)"></i>Mastura</a></li><?php }?>
                       <?php if($id_application == "36") { ?><li><a href="inventory_liontin.php"> <i class="icon-gears (alias)"></i>Liontin</a></li><?php }?>
                        <?php if($id_application == "37") { ?><li><a href="inventory_kerabu.php"> <i class="icon-gears (alias)"></i>Kerabu</a></li><?php }?>
                         <?php if($id_application == "38") { ?><li><a href="inventory_gkgr.php"> <i class="icon-gears (alias)"></i>GKGR</a></li><?php }?>
                          <?php if($id_application == "39") { ?><li><a href="inventory_rangka.php"> <i class="icon-gears (alias)"></i>Rangka</a></li><?php }?>
                    <?php if($id_application == "15") { ?><li><a href="inventory_monitoring.php"><i class="icon-search"></i>Status Monitoring</a></li><?php }?>
                     <?php if($id_application == "44") { ?><li><a href="photoalbum.php"><i class="icon-picture"></i>Photo Album</a></li><?php }?>
                     <?php
				}
				?>
                </ul>
                <?php
				}
				?>
            </li>
          <?php 
              $sql44 = mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (16,22,23)");
			if(mysql_num_rows($sql44) > 0)
			{
			?>
             <li><a href="#" class="is-dropdown-menu"> <i class="icon-truck"></i> Consignment</a>
            	<ul>
                 <?php
				while($fetch44 = mysql_fetch_array($sql44))
				{
				$id_application = $fetch44['id_application'];
				?>
               		<?php if($id_application == "16") { ?><li><a href="consigment.php"><i class="icon-pencil"></i>Input</a></li>  <?php }?> 
                    <?php if($id_application == "22") { ?><li><a href="list_consigmentreceive.php"><i class="icon-download-alt"></i>Receive</a></li>  <?php }?> 
                    <?php if($id_application == "23") { ?><li><a href="history_consigment.php"><i class="icon-list-alt"></i>History</a></li> <?php }?>
                    <?php
				}
				?>
                </ul>
            </li>
            <?php
			}
			
              $sql4 = mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (17,18)");
			if(mysql_num_rows($sql4) > 0)
			{
			?>
             <li><a href="#" class="is-dropdown-menu"> <i class="icon-tag"></i> Pre Sales</a>
            	
            	<ul>
                 <?php
				while($fetch4 = mysql_fetch_array($sql4))
				{
				$id_application = $fetch4['id_application'];
				?>
               		<?php if($id_application == "17") { ?><li><a href="presales.php"><i class="icon-pencil"></i>Input</a></li>  <?php }?> 
                    <?php if($id_application == "18") { ?><li><a href="search_presales.php"><i class="icon-search"></i>Searching</a></li> <?php }?>
                    <?php
				}
				?>
                </ul>
            </li>
            <?php
			}
		
         $sql5 = mysql_fetch_array(mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (19)"));
				$id_application = $sql5['id_application'];
             if($id_application == "19") { ?>
      <li>
        <a href="sales.php">
          <!--<span class="badge pull-right">17</span>-->
          <i class="icon-shopping-cart"></i> Sales
        </a>
      </li>
      <?php
			 }
			  $sql88 = mysql_fetch_array(mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (45)"));
				$id_application = $sql88['id_application'];
             if($id_application == "45") { ?>
      <li>
        <a href="paymentsales.php">
          <!--<span class="badge pull-right">12</span>-->
          <i class="icon-usd"></i> Payment Sales
        </a>
      </li>
    <?php
			 }
       $sql6 = mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (20,29)");
			if(mysql_num_rows($sql6) > 0)
			{
			?>
            <li>
            <a href="#" class="is-dropdown-menu">
             <!-- <span class="badge pull-right">11</span>-->
              <i class="icon-archive"></i> Reprint
            </a>
             <ul>
                 <?php
				while($fetch6 = mysql_fetch_array($sql6))
				{
				$id_application = $fetch6['id_application'];
				?>
               		<?php if($id_application == "20") { ?><li><a href="reprint_invoice.php"><i class="icon-file-text"></i>Invoice</a></li>  <?php }?> 
                    <?php if($id_application == "29") { ?><li><a href="reprint_barcode.php"><i class="icon-barcode"></i>Barcode</a></li> <?php }?>
                    <?php
				}
				?>
                </ul>
            </li>
            <?php
			}
		 $sql7 = mysql_fetch_array(mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (21)"));
				$id_application = $sql7['id_application'];
             if($id_application == "21") { ?>
         <li>
        <a href="reminder_payment.php">
          <!--<span class="badge pull-right">17</span>-->
          <i class="icon-calendar"></i> Reminder Payment
        </a>
      </li>
      <?php
			 }
	   $sql9 = mysql_fetch_array(mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (30)"));
				$id_application = $sql9['id_application'];
             if($id_application == "30") { ?>
      <li>
        <a href="stock_ofnumb3.php">
          <!--<span class="badge pull-right">17</span>-->
          <i class="icon-tags"></i> Stock Opname
        </a>
      </li>
      <?php
			 }
	   $sql8 = mysql_fetch_array(mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (25)"));
				$id_application = $sql8['id_application'];
             if($id_application == "25") { ?>
      <li>
        <a href="return_sales.php">
          <!--<span class="badge pull-right">12</span>-->
          <i class="icon-dropbox"></i> Return Sales
        </a>
      </li>
    <?php
			 }
    $sql10 = mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (31,32,33)");
			if(mysql_num_rows($sql10) > 0)
			{
			?>
      <li>
        <a href="#" class="is-dropdown-menu">
         <!-- <span class="badge pull-right">11</span>-->
          <i class="icon-edit"></i> Order Form
        </a>
         <ul>
         <?php
				while($fetch10 = mysql_fetch_array($sql10))
				{
				$id_application = $fetch10['id_application'];
				?>
               		<?php if($id_application == "31") { ?><li><a href="orderform.php"><i class="icon-pencil"></i>Input</a></li>  <?php }?> 
                    <?php if($id_application == "32") { ?><li><a href="orderform_progress.php"><i class="icon-spinner"></i>In Progress</a></li> <?php }?>
                     <?php if($id_application == "33") { ?><li><a href="history_orderform.php"><i class="icon-list-alt"></i>History</a></li> <?php }?>
                    <?php
				}
				?>
        </ul>
      </li>
      <?php
			}
      $sql11 = mysql_query("select * from tbl_priviledge where user_id = '$USERNAME' and id_application in (40,41,42,43)");
			if(mysql_num_rows($sql11) > 0)
			{
			?>
      <li>
        <a href="#" class="is-dropdown-menu">
         <!-- <span class="badge pull-right"></span>-->
          <i class="icon-bar-chart"></i> Report
        </a>
        <ul>
         <?php
				while($fetch11 = mysql_fetch_array($sql11))
				{
				$id_application = $fetch11['id_application'];
				?>
          <li>
            <?php if($id_application == "40") { ?><li><a href="report_inventory.php"><i class="icon-bar-chart"></i>Inventory</a></li>  <?php }?> 
                    <?php if($id_application == "41") { ?><li><a href="report_sales.php"><i class="icon-bar-chart"></i>Sales</a></li> <?php }?>
                     <?php if($id_application == "42") { ?><li><a href="report_payment.php"><i class="icon-bar-chart"></i>Payment</a></li> <?php }?>
                     <?php if($id_application == "43") { ?><li><a href="report_delete.php"><i class="icon-bar-chart"></i>Delete Inventory</a></li> <?php }?>
                     
          
         <?php
			}
			?>
        </ul>
         <?php
			}
			?>
      </li>
      
      <li>
        <a href="logout.php">
          <span class="badge pull-right"></span>
          <i class="icon-signin"></i> Log Out
        </a>
      </li>
    </ul>
  </div>
</div>
    </div>