<div class="span2" id="sidebar" style="margin-right: 10px; font-size: 18px;">
                    <ul class="nav nav-list bs-docs-sidenav nav-collapse collapse">
                        <?php
                        include '../includes/connection.php';
                  
                        //<?php 
                        // if($_SESSION['role']=="Admin"){

                        if( $permissions['view_dashboard'] == 1 && $_SESSION['business_id']!=0){

                        
                            ?>
                        <li class="active">
                            <a href="../main/dashboard.php"><i class="fa fa-dashboard"></i> Dashboard</a>
                        </li>

                              <?php
                         }
                     //     
                             ?>
                    
                        <?php
                        include '../includes/connection.php';
                        $poduct_number="0";
// Create connection
$sql = mysqli_query($con,"SELECT count(id)as num, (select count(id) from sales) as sales, (select count(id) from users)as users, (select count(id) from staff) as staff FROM products");
//$result = mysqli_query($con, $sql);


    // output data of each row
    while($row = mysqli_fetch_assoc($sql)) {
       $poduct_number=$row['num'];
       $sales_number=$row['sales'];
       $users=$row['users'];
       $stafxp=$row['staff'];
    }







                        ?>


                        <li>
                        <?php 
                        // if($_SESSION['role']=="Admin"){

                        if( $permissions['view_stock'] == 1 && $_SESSION['business_id']!=0){

                        
                            ?>
                            <a href="../stock/stock.php"> <i class="fa fa-shopping-cart"></i> Stock</a>
                             <?php
                         }
                     //     
                             ?>
                        </li>
                        <!-- <li>
                            <a href="form.html"><i class="icon-chevron-right"></i> Forms</a>
                        </li> -->
                      
                        <li>

                            <?php 
                        // if($_SESSION['role']=="Admin"){

                        if( $permissions['view_sales'] == 1 && $_SESSION['business_id']!=0){

                        
                            ?>
                            <a href="../sales/new_order.php"><span class="badge badge-info pull-right"><?php// echo $sales_number; ?></span><i class="fa fa-shopping-bag"></i> &nbsp;Sales</a>

                              <?php
                         }
                     //     
                             ?>
                        </li>
                        <?php 
                        // if($_SESSION['role']=="Admin"){

                        if( $permissions['view_purchase'] == 1 && $_SESSION['business_id']!=0){

                        
                            ?>
                            <li>
                            <a href="../purchases/new_purchase.php"><span class="badge badge-info pull-right"><?php// echo $sales_number; ?></span><i class="fa fa-shopping-bag"></i> &nbsp;Purchase</a>
                        </li>
                         <?php
                         }
                     //     
                             ?>
                            
                        <li>
                            <?php 
                        // if($_SESSION['role']=="Admin"){

                        if( $permissions['view_sales_report'] == 1 && $_SESSION['business_id']!=0){

                        
                            ?>
                            <a href="../reports/sales_report.php"><i class="fa fa-table"></i> &nbsp;Sales Report</a>
                            <?php
                            if ($gbusiness_settings['view_shifts_report']==1 && $_SESSION['business_id']!=0) {
                                                            ?>
                            <a href="../reports/cashout_report.php"><i class="fa fa-table"></i> &nbsp;Shift Report</a>
                             <?php
                                  }
                         }
                     //     
                             ?>
                        </li>

                        <?php 
                        if( $permissions['view_individual_product_sales'] == 1 && $_SESSION['business_id']!=0){
                            ?>
                         <li>

                            <a href="../reports/product_sales.php"><i class="fa fa-table"></i> &nbsp;Individual product sales</a>
                        </li>
                         <?php
                         }
                             ?>
                             <?php 
                        if( $permissions['view_debtors_report'] == 1 && $_SESSION['business_id']!=0){
                            ?>
                       
                        <li>
                            <a href="../sales/payment.php"><i class="fa fa-money"></i> &nbsp;Debts Report</a>
                        </li>
                         <?php
                         }
                             ?>


                         
                   
                       
                        <?php 
                        if( $permissions['view_expenses'] == 1 && $_SESSION['business_id']!=0){
                            ?>

                        <li>
                            <a href="../expenses/expenses.php"><i class="fa fa-credit-card-alt"></i> &nbsp;Expenses</a>
                        </li>
                         <?php
                         }
                             ?>

                             <?php 
                        // if($_SESSION['role']=="Admin"){

                        if( $permissions['view_purchases_report'] == 1 && $_SESSION['business_id']!=0){

                        
                            ?>
                       
                        <li>
                            <a href="../reports/purchases_report.php"><i class="fa fa-table"></i> &nbsp;Purchases Report</a>
                        </li>

                        <?php
                         }
                             ?>

                             <?php 
                        // if($_SESSION['role']=="Admin"){

                        if( $permissions['view_individaul_product_purchases'] == 1 && $_SESSION['business_id']!=0){

                        
                            ?>
                        <li>
                            <a href="../reports/product_purchases.php"><i class="fa fa-table"></i> &nbsp;Individual product purchases</a>
                        </li>
                         <?php
                         }
                     //     
                             ?>

                             <?php 
                        // if($_SESSION['role']=="Admin"){

                        if( $permissions['view_creditors_report'] == 1 && $_SESSION['business_id']!=0){

                        
                            ?>
                        <li>
                            <a href="../purchases/creditors.php"><i class="fa fa-table"></i> &nbsp;Creditors Report</a>
                        </li>

                         <?php
                         }
                         ?>

                          <?php 
                        // if($_SESSION['role']=="Admin"){

                        if( $permissions['view_payment_report'] == 1 && $_SESSION['business_id']!=0){

                            ?>

                             
                        <li>
                            <a href="../purchases/payment_logs.php"><i class="fa fa-table"></i> &nbsp;Payment Report</a>
                        </li>

                        <?php
                         }
                         ?>
                        


                             


                            <?php 
                        // if($_SESSION['role']=="Admin"){

                        if( $permissions['view_transactions_report'] == 1 && $_SESSION['business_id']!=0){

                        
                            ?>
                             
                        <li>
                            <a href="../reports/transactions.php"><i class="fa fa-table"></i> &nbsp;Transactions Report</a>
                        </li>
                         <?php
                         }
                         ?>


                         <?php
                        if( $permissions['view_profit_analysis'] == 1 && $_SESSION['business_id']!=0){
                            ?>
                        
                        
                        <li class="dropdown" >
                                <a href="../main/dashboard.php" data-toggle="dropdown" class="dropdown-toggle"><b class="fa fa-balance-scale"></b>Profit Analysis <b class="caret"></b>

                                </a>
                                <ul class="dropdown-menu" id="menu1">

                         <?php
                        if( $permissions['profit_analysis_by_graph'] == 1 && $_SESSION['business_id']!=0){

                            ?>
                                    <li>
                                        <a href="../reports/income_graph.php"><i class="fa fa-line-chart"></i>&nbsp By graph 

                                        </a>
                                        
                                    </li>
                                    <?php
                         }
                         ?>

                         <?php
                        if( $permissions['profit_analysis_by_table'] == 1 && $_SESSION['business_id']!=0){
                            ?>
                                    <li>
                                        <a href="../stock/profits.php" ><i class="fa fa-table"></i> &nbsp By Table</a>
                                    </li>
                                    <?php
                         }
                         ?>
                                   
                                </ul>
                            </li>
                            <?php
                         }
                         ?>

                         <?php
                        if( $permissions['view_sales_analysis'] == 1 && $_SESSION['business_id']!=0){
                            ?>

                        <li class="dropdown" >
                                <a href="../main/dashboard.php" data-toggle="dropdown" class="dropdown-toggle"><b class="fa fa-balance-scale"></b>Sales Analysis <b class="caret"></b>

                                </a>
                                <ul class="dropdown-menu" id="menu1">
                                    <?php
                        if( $permissions['view_sales_analysis_by_Graph'] == 1 && $_SESSION['business_id']!=0){
                            ?>
                                    <li>
                                        <a href="../reports/sales_graph.php"><i class="fa fa-line-chart"></i>&nbsp By graph 

                                        </a>
                                        
                                    </li>
                                    <?php
                         }
                         ?>

                                        <?php
                        if( $permissions['sales_by_table'] == 1 && $_SESSION['business_id']!=0){
                            ?>
                                    <li>
                                        <a href="../reports/monthly_sales.php" ><i class="fa fa-table"></i> &nbsp By Table</a>
                                    </li>
                                    <li>
                                        <a href="../reports/sale_expense.php" ><i class="fa fa-table"></i> &nbsp Sales-Expense</a>
                                    </li>
                                    <?php
                         }
                         ?>
                                   
                                </ul>
                            </li>
                             <?php
                         }
                         ?>


                                        <?php
                        if( $permissions['view_cash_analysis'] == 1 && $_SESSION['business_id']!=0){
                            ?>
                            <li class="dropdown" >
                                <a href="../main/dashboard.php" data-toggle="dropdown" class="dropdown-toggle"><b class="fa fa-analysis"></b>Cash Analysis <b class="caret"></b>

                                </a>
                                <ul class="dropdown-menu" id="menu1">
                                           <?php
                        if( $permissions['cash_out'] == 1 && $_SESSION['business_id']!=0){
                            ?>
                                    <li>
                                        <a href="../cash/cash_out.php"><i class="fa fa-line-chart"></i> &nbsp; Cash out

                                        </a>
                                        
                                    </li>
                                     <?php
                         }
                         ?>
                                           <?php
                        if( $permissions['cash_at_hand'] == 1 && $_SESSION['business_id']!=0){
                            ?>
                                    <li>
                                        <a href="../cash/cash_athand.php" ><i class="fa fa-table"></i> &nbsp; Cash At hand</a>
                                    </li>
                                     <?php
                         }
                         ?>
                                   
                                </ul>
                            </li>
                            <?php
                         }
                         ?>
                        <!-- <li>
                            <a href="#"><span class="badge badge-info pull-right">11</span> Reports</a>
                        </li>-->
                          
                        
                        <li><?php
                        if( $permissions['view_short_expiries'] == 1 && $_SESSION['business_id']!=0){
                            
                             if ($gbusiness_settings['add_expirydate_onpurchase']==1 && $_SESSION['business_id']!=0) {
                        ?>
                        
                            <a href="../stock/short_expiry.php"><i class="fa fa-eye"></i> &nbsp;Short Expiries</a>
                        </li>
                        <?php
                              }
                         }
                         ?>

                           <?php
                        if( $permissions['view_logs'] == 1 && $_SESSION['business_id']!=0){
                            ?>
                       <li>
                            <a href="../main/logs.php"><i class="fa fa-tasks"></i> &nbsp;Logs</a>
                        </li>
                        <?php
                         }
                         ?>
                        <li></li>

                       

                           
                             <?php
                        
                             if($permissions['business_id'] == 0 && $permissions['branch_id']==0){
                            ?>
                       <li>
            
                            <a href="../business/business.php"><i class="fa fa-tasks"></i> &nbsp;Business</a>
                        </li>
                        <li>
            
                            <a href="../business/business_profile.php"><i class="fa fa-tasks"></i> &nbsp;Business profile</a>
                            <a href="../business/business_licence.php"><i class="fa fa-tasks"></i> &nbsp;Business Licences</a>
                        </li>

                        <li>
            
                            <a href="../branches/branches.php"><i class="fa fa-tasks"></i> &nbsp;Branches</a>
                        </li>
                        <?php
                         }
                         ?>

                         
                       
                    </ul>
                     
                </div>