<?php
require_once('functions/functions.php');
require_once('Connections/courier.php');
mysql_select_db($database_courier, $courier);

$userpermid = $_SESSION['myMM_Userid'];
$query_rsodest1 = "select a.*,b.* from securitypermissions a INNER JOIN securitylevel b on a.securitylevel_id=b.id where a.user_id='$userpermid' order by menu_place,menu_position";
$rsodest1 = mysql_query($query_rsodest1, $courier) or die(mysql_error());
$row_rsodest1 = mysql_fetch_assoc($rsodest1);
$totalRows_rsodest1 = mysql_num_rows($rsodest1);
if ($totalRows_rsodest1 == 0) {
    function getUserPerm($Model, $menutype) {
    }
} else {
    function getUserPerm($Model, $menutype) {
        global $rsodest1, $row_rsodest1;
        mysql_data_seek($rsodest1, 0);
        $row_rsodest1 = mysql_fetch_assoc($rsodest1);
        do {
            if ($menutype == 'Sub') {
                if ($row_rsodest1['menu_name'] == $Model) {
                    return "yes";
                }
            }

            if ($menutype == 'Main') {
                if ($row_rsodest1['menu_cartegory'] == $Model) {
                    return "yes";
                    ;
                }
            }
        } while ($row_rsodest1 = mysql_fetch_assoc($rsodest1));
    }
}
?>

<div class="page-sidebar-wrapper">
                <!-- END SIDEBAR -->
                <!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
                <!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
                <div class="page-sidebar navbar-collapse collapse">
                    <!-- BEGIN SIDEBAR MENU -->
                    <!-- DOC: Apply "page-sidebar-menu-light" class right after "page-sidebar-menu" to enable light sidebar menu style(without borders) -->
                    <!-- DOC: Apply "page-sidebar-menu-hover-submenu" class right after "page-sidebar-menu" to enable hoverable(hover vs accordion) sub menu mode -->
                    <!-- DOC: Apply "page-sidebar-menu-closed" class right after "page-sidebar-menu" to collapse("page-sidebar-closed" class must be applied to the body element) the sidebar sub menu mode -->
                    <!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
                    <!-- DOC: Set data-keep-expand="true" to keep the submenues expanded -->
                    <!-- DOC: Set data-auto-speed="200" to adjust the sub menu slide up/down speed -->
                    
                    <!--<ul class="page-sidebar-menu  page-header-fixed page-sidebar-menu-hover-submenu " data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">-->
                    <ul class="page-sidebar-menu  page-header-fixed page-sidebar-menu-compact " data-keep-expanded="false" data-slide-speed="200">
                    <!--<ul class="page-sidebar-menu  page-header-fixed " data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">-->
                        <li class="nav-item start active open">
                            <a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>" class="nav-link nav-toggle">
                                <i class="icon-home"></i>
                                <span class="title">Dashboard</span>
                                <span class="selected"></span>
                                <span class="arrow open"></span>
                            </a>
                        </li>
                        <?php if(getUserPerm('Front Desk','Main')=='yes' || $_SESSION['security']=='admin'){ ?>
                        <li class="nav-item  ">
                            <a href="javascript:;" class="nav-link nav-toggle">
                                <i class="icon-users" style="color:"></i>
                                <span class="title">Front Desk</span>
                                <span class="arrow"></span>
                            </a>
                            <ul class="sub-menu">
                                <?php if(getUserPerm('New Visit','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  ">
                                    <a class="nav-link " onclick="getstep('admin_add_new_visit');">
                                        <span class="title">New Visit</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Clients Being Served','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_main_patients_visit');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Clients Being Served </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Clients Being Served','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_main_patients_visit_closed');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Closed/Finished Visits </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Add New Client','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('add_new_main_patient');">
                                    <a class="nav-link ">
                                        <span class="title"> Add New Client </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Clients Database','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_main_patients');">
                                    <a class="nav-link ">
                                        <span class="title"> Clients Database </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Add New Guest Client','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('add_new_normal_patient');">
                                    <a class="nav-link ">
                                        <span class="title">Add New Guest Client </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Guest CLients','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_normal_patients');">
                                    <a class="nav-link ">
                                        <span class="title"> Guest CLients </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Incoming Payments','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('cashier_list_visits');">
                                    <a class="nav-link ">
                                        <span class="title">Incoming Payments</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Total Payments','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('cashier_list_received_payments');">
                                    <a class="nav-link ">
                                        <span class="title">Total Payments</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('New Visit','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  ">
                                    <a class="nav-link " href="pro-forma" target="_blank">
                                        <span class="title"> Create Pro Forma </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Credit Sales','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('credit_sales_administrative');">
                                    <a class="nav-link ">
                                        <span class="title"> Credit Sales </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Sent Jobs','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_sent_jobs');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Sent Jobs </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Jobs In-Transit','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_jobs_in_transit');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Jobs In-Transit</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Received Jobs','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_received_jobs_admin');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Received Jobs </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm("Reserved Frames",'Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_reserved_frames');">
                                    <a class="nav-link ">
                                        <span class="title">Reserved Frames</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm("Summary of Todays Sales",'Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('summary_today_sales');">
                                    <a class="nav-link ">
                                        <span class="title">Summary of Today's Sales</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm("Create Appointments",'Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="view_calendar('<?php echo $_SESSION['myMM_Userid'];?>');">
                                    <a class="nav-link ">
                                        <span class="title">Create Appointments</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm("Todays Appointments",'Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_appointments_today');">
                                    <a class="nav-link ">
                                        <span class="title">Today's Appointments</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm("Send SMS",'Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('sms_page');">
                                    <a class="nav-link ">
                                        <span class="title">Send SMS</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm("Send SMS",'Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item">
                                    <a class="nav-link" href="https://rns.rxhealthapp.com/upload/index.php" target="_blank">
                                        <span class="title">Upload Patient Folder</span>
                                    </a>
                                </li>
                                <?php } ?>

                            </ul>
                        </li>
                        <?php } ?>
                        
                        <?php if(getUserPerm('Optical Clients','Main')=='yes' || $_SESSION['security']=='admin'){ ?>
                        <li class="nav-item  ">
                            <a href="javascript:;" class="nav-link nav-toggle">
                                <i class="fa fa-heartbeat" style="color:"></i>
                                <span class="title">Optical Clients</span>
                                <span class="arrow"></span>
                            </a>
                            <ul class="sub-menu">
                                <?php if(getUserPerm('Incoming Clients','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_visits_optical','incoming_patients');">
                                    <a class="nav-link ">
                                        <i class="fa fa-users"></i>
                                        <span class="title">Incoming Clients</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Pending Clients','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('Specialist_clients','pending_diagnostic');">
                                    <a class="nav-link ">
                                        <i class="fa fa-users"></i>
                                        <span class="title">Pending Clients</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Discharged Clients','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_visits_optical','discharged');">
                                    <a class="nav-link ">
                                        <i class="fa fa-users"></i>
                                        <span class="title">Completed Clients</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Discharged For Review','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <!-- <li class="nav-item  " onclick="getstep('list_visits_optical','discharged_review');">
                                    <a class="nav-link ">
                                        <i class="fa fa-users"></i>
                                        <span class="title">Discharged For Review</span>
                                    </a>
                                </li> -->
                                <?php } ?>

                                <?php if(getUserPerm('Specialist Clients','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('Specialist_clients','incoming_patients_specialist');">
                                    <a class="nav-link ">
                                        <i class="fa fa-users"></i>
                                        <span class="title">Specialist Clients</span>
                                    </a>
                                </li>
                                <?php } ?>



                            </ul>
                        </li>
                        <?php } ?>
                        
                        <?php if($_SESSION['branch_id'] == 1){ ?>
                        <?php if(getUserPerm('Stores','Main')=='yes' || $_SESSION['security']=='admin'){ ?>
                        <li class="nav-item  ">
                            <a href="javascript:;" class="nav-link nav-toggle">
                                <i class="fa fa-leaf" style="color:"></i>
                                <span class="title">Stores</span>
                                <span class="arrow"></span>
                            </a>
                            <ul class="sub-menu">
                            <?php if(getUserPerm('List of Jobs In-Transit','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                 <li class="nav-item  " onclick="getstep('list_purchase_orders');">
                                    <a class="nav-link ">
                                        <span class="title">Purchase Orders</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Received Items','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_received_items','Normal Order');">
                                    <a class="nav-link ">
                                        <span class="title">Received Items</span>
                                    </a>
                                </li>
                                <?php } ?>
                            <?php if(getUserPerm("Summary of Todays Sales",'Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('summary_today_sales');">
                                    <a class="nav-link ">
                                        <span class="title">Summary of Today's Sales</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Frames & Accessories Sold','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_sales');">
                                    <a class="nav-link ">
                                        <span class="title">Frames & Accessories Sold</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Item Categories','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item" onclick="getstep('list_of_all_categories');">
                                    <a class="nav-link ">
                                        <span class="title">List of Item Categories</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Items','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_all_items_procurement','Optical Item');">
                                    <a class="nav-link ">
                                        <span class="title">List of Non Service Items</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Items','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_all_items_procurement','Optical Service');">
                                    <a class="nav-link ">
                                        <span class="title">List of Service Items</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Unapproved Items','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_all_items_procurement_pending');">
                                    <a class="nav-link ">
                                        <span class="title">List of Unapproved Items</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Items [Re-Order]','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_items_re_order');">
                                    <a class="nav-link ">
                                        <span class="title">List of Items [Re-Order]</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm('Create New Transfer','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('add_new_transfer_order');">
                                    <a class="nav-link ">
                                        <span class="title">Create New Transfer</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm('List of Unsaved Transfers','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_transfer_orders','', 'Not Saved');">
                                    <a class="nav-link ">
                                        <span class="title">List of Unsaved Transfers</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Unapproved Transfers','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_transfer_orders','', 'Unapproved');">
                                    <a class="nav-link ">
                                        <span class="title">List of Unapproved Transfers</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Approved Transfers','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_transfer_orders','', 'Approved');">
                                    <a class="nav-link ">
                                        <span class="title">List of Approved Transfers</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Supplied Transfers','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_transfer_orders','', 'Supplied');">
                                    <a class="nav-link ">
                                        <span class="title">List of Supplied Transfers</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Requisitions Awaiting Supply','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_requisition_orders_approved');">
                                    <a class="nav-link ">
                                        <span class="title">Requisitions Awaiting Supply</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm('Supplied Requisitions','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_requisition_orders','','Supplied');">
                                    <a class="nav-link ">
                                        <span class="title">Supplied Requisitions</span>
                                    </a>
                                </li>
                                <?php } ?>


                                 <?php if(getUserPerm('Recieve Return','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('receive_return','','');">
                                    <a class="nav-link ">
                                        <span class="title">Recieve Return</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm('Stock Taking','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                    <li class="nav-item" onclick="getstep('stock_taking', '','');">
                                        <a class="nav-link ">
                                            <span class="title"> Stock Taking </span>
                                        </a>
                                    </li>

                                <?php } ?>



                            </ul>
                        </li>
                        <?php } ?>
                                <?php } ?>

                        <?php if($_SESSION['branch_id'] == 1){ ?>
                        <?php if(getUserPerm('Procurement','Main')=='yes' || $_SESSION['security']=='admin'){ ?>
                        <li class="nav-item  ">
                            <a href="javascript:;" class="nav-link nav-toggle">
                                <i class="fa fa-hourglass-2" style="color:"></i>
                                <span class="title">Procurement</span>
                                <span class="arrow"></span>
                            </a>
                            <ul class="sub-menu">
                            <?php if(getUserPerm('List of Jobs In-Transit','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_of_jobs_in_transit_procurement');">
                                    <a class="nav-link ">
                                        <span class="title">List of Jobs In-Transit</span>
                                    </a>
                                </li>
                                <?php } ?>
                            <?php if(getUserPerm('Assign Lenses','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li style="display:none" class="nav-item  " onclick="getstep('list_of_lens_prescription');">
                                    <a class="nav-link ">
                                        <span class="title">Assign Lenses</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Purchase Orders - Lens','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                 <li class="nav-item  " onclick="getstep('list_purchase_orders_lens');">
                                    <a class="nav-link ">
                                        <span class="title">Purchase Orders - Lens</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Purchase Orders - Lens Batches','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                 <li class="nav-item  " onclick="getstep('list_purchase_orders_lens_batch');">
                                    <a class="nav-link ">
                                        <span class="title">Purchase Orders - Lens Batches</span>
                                    </a>
                                </li>
                                <?php } ?>
                                
                                <?php if(getUserPerm('Received Items','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_received_items_lens','Lens Order');">
                                    <a class="nav-link ">
                                        <span class="title">Received Lens Items</span>
                                    </a>
                                </li>
                                <?php } ?>
                               
                                <?php if(getUserPerm('List of Received Jobs','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_of_received_jobs');">
                                    <a class="nav-link ">
                                        <span class="title">List of Received Jobs</span>
                                    </a>
                                </li>
                                <?php } ?>
                               
                                <?php if(getUserPerm('List of Jobs In-Progress','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_of_job_in_progress');">
                                    <a class="nav-link ">
                                        <span class="title">List of Jobs In-Progress</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Completed Jobs','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item" onclick="getstep('list_completed_jobs_procurement');">
                                    <a class="nav-link ">
                                        <span class="title">List of Completed Jobs</span>
                                    </a>
                                </li>
                                <?php } ?>
                               <?php if(getUserPerm('List of Approved Transfers','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <!-- <li class="nav-item  " onclick="getstep('list_transfer_orders','', 'Approved');">
                                    <a class="nav-link ">
                                        <span class="title">List of Approved Transfers</span>
                                    </a>
                                </li>  -->
                                <?php } ?>
                               <?php if(getUserPerm('Special Orders - Lens','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('create_special_orders');">
                                    <a class="nav-link ">
                                        <span class="title"> Special Orders - Lens</span>
                                    </a>
                                </li> 
                                <?php } ?>
                            </ul>
                        </li>
                        <?php } ?>
                        <?php } ?>


                                <?php if($_SESSION['branch_id'] == 1 || $_SESSION['branch_id'] == 7){ ?>
                        <?php if(getUserPerm('Lab','Main')=='yes' || $_SESSION['security']=='admin'){ ?>
                        <li class="nav-item  ">
                            <a href="javascript:;" class="nav-link nav-toggle">
                                <i class="fa fa-eyedropper" style="color:"></i>
                                <span class="title">Lab</span>
                                <span class="arrow"></span>
                            </a>
                            <ul class="sub-menu">
                                 <?php if(getUserPerm('List of Jobs In-Transit','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_jobs_in_transit_lab');">
                                    <a class="nav-link ">
                                        <span class="title">List of Jobs In-Transit</span>
                                    </a>
                                </li>
                                <?php } ?>
                                 <?php if(getUserPerm('List of Received Jobs','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_received_jobs_lab');">
                                    <a class="nav-link ">
                                        <span class="title">List of Received Jobs</span>
                                    </a>
                                </li>
                                <?php } ?>
                                 <?php if(getUserPerm('List of Jobs In-Progress','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_job_in_progress_lab');">
                                    <a class="nav-link ">
                                        <span class="title">List of Jobs In-Progress</span>
                                    </a>
                                </li>
                                 <?php } ?>
                                 <?php if(getUserPerm('List of Completed Jobs','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_completed_jobs_lab');">
                                    <a class="nav-link ">
                                        <span class="title">List of Completed Jobs</span>
                                    </a>
                                </li>
                                <?php } ?>
                            </ul>
                        </li>
                        <?php } ?>
                                 <?php } ?>
                        
                        <?php if(getUserPerm('Branch Inventory','Main')=='yes' || $_SESSION['security']=='admin'){ ?>
                        <li class="nav-item  ">
                            <a href="javascript:;" class="nav-link nav-toggle">
                                <i class="fa fa-leaf" style="color:"></i>
                                <span class="title">Branch Inventory</span>
                                <span class="arrow"></span>
                            </a>
                            <ul class="sub-menu">
                                <?php if(getUserPerm('List of All Items','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_all_items');">
                                    <a class="nav-link ">
                                        <span class="title">List of All Items</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Create New Requisition','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                 <li class="nav-item  " onclick="getstep('add_new_requisition_order');">
                                    <a class="nav-link ">
                                        <span class="title">Create New Requisition</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('All Requisition Orders','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_requisition_orders','','');">
                                    <a class="nav-link ">
                                        <span class="title">All Requisition Orders</span>
                                    </a>
                                </li>
                                <?php } ?>
<!--                               <li class="nav-item  " onclick="getstep('list_requisition_orders','','Not Saved');">
                                    <a class="nav-link ">
                                        <span class="title">Unsaved Requisitions</span>
                                    </a>
                                </li>-->
                               <?php if(getUserPerm('Unapproved Requisitions','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <!-- <li class="nav-item  " onclick="getstep('list_requisition_orders','','Unapproved');">
                                    <a class="nav-link ">
                                        <span class="title">Unapproved Requisitions</span>
                                    </a>
                                </li> -->
                               <?php } ?>
                                 <?php if(getUserPerm('Approved Requisitions','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_requisition_orders','','Approved');">
                                    <a class="nav-link ">
                                        <span class="title">Sent Requisition Orders</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm('Requisitions Awaiting Supply','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_requisition_orders_approved');">
                                    <a class="nav-link ">
                                        <span class="title">Requisitions Awaiting Supply</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm('Requisitions In-Transit','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_requisition_orders','','In-Transit');">
                                    <a class="nav-link ">
                                        <span class="title"> Requisitions In-Transit </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Received Requisitions','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_requisition_orders','','Received');">
                                    <a class="nav-link ">
                                        <span class="title">Received Requisitions </span>
                                    </a>
                               </li>
                               <?php } ?>
                               
<!--                               <li class="nav-item  " onclick="getstep('list_all_transfer_orders','','All');">
                                   <a class="nav-link ">
                                       <span class="title"> List of Transfers </span>
                                   </a>
                               </li>-->
                               <?php if(getUserPerm('Transfer In Transit','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_transfer_orders_branch','','In-Transit');">
                                   <a class="nav-link ">
                                       <span class="title"> Transfers In-Transit </span>
                                   </a>
                               </li>
                               <?php } ?>
                               <?php if(getUserPerm('Received Transfers','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_transfer_orders_branch','','Received');">
                                   <a class="nav-link ">
                                       <span class="title"> Received Transfers</span>
                                   </a>
                               </li>
                               <?php } ?>


                               <?php if(getUserPerm('Return to Store','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('return_to_stores');">
                                   <a class="nav-link ">
                                       <span class="title"> Return to Store</span>
                                   </a>
                               </li>
                               <?php } ?>

                                <?php if(getUserPerm('All Return to Store','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item" onclick="getstep('list_return_orders', '','');">
                                   <a class="nav-link ">
                                       <span class="title"> All Returns </span>
                                   </a>
                               </li>

                                <?php } ?>





                            </ul>
                        </li>
                        <?php } ?>

                        <?php if($_SESSION['branch_id'] == 1){ ?>
                        <?php if(getUserPerm('Finance','Main')=='yes' || $_SESSION['security']=='admin'){ ?>
                        <li class="nav-item  ">
                            <a href="javascript:;" class="nav-link nav-toggle">
                                <i class="fa fa-dollar" style="color:"></i>
                                <span class="title">Finance</span>
                                <span class="arrow"></span>
                            </a>
                            <ul class="sub-menu">
                            <?php if(getUserPerm('Purchase Orders','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                 <li class="nav-item  " onclick="getstep('list_purchase_orders_pending');">
                                    <a class="nav-link ">
                                        <span class="title">Purchase Orders</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Purchase Orders -Lens','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                 <li class="nav-item  " onclick="getstep('list_purchase_orders_lens_pending');">
                                    <a class="nav-link ">
                                        <span class="title">Purchase Orders - Lens</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm('Received Items','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_received_items_pending','Normal Order');">
                                    <a class="nav-link ">
                                        <span class="title"> Received Items (Completed)</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm('Received Items not completed','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_received_items_pending_not_completed','Normal Order');">
                                    <a class="nav-link ">
                                        <span class="title">Receive Items</span>
                                    </a>
                                </li>
                                <?php } ?>


                                <?php if(getUserPerm('import excel','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                    <li class="nav-item  " onclick="getstep('import_excel','Normal Order');">
                                        <a class="nav-link ">
                                            <span class="title">Receive Items(Import Excel)</span>
                                        </a>
                                    </li>
                                <?php } ?>

                                <?php if(getUserPerm('List of Unapproved Transfers','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_transfer_orders','', 'Unapproved');">
                                    <a class="nav-link ">
                                        <span class="title">List of Unapproved Transfers</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Approved Transfers','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_transfer_orders','', 'Approved');">
                                    <a class="nav-link ">
                                        <span class="title">List of Approved Transfers</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Supplied Transfers','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_transfer_orders','', 'Supplied');">
                                    <a class="nav-link ">
                                        <span class="title">List of Supplied Transfers</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Suppliers','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_of_suppliers');">
                                    <a class="nav-link ">
                                        <span class="title">List of Suppliers</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm('Lens Prices','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('list_of_lens_prices');">
                                    <a class="nav-link ">
                                        <span class="title">Lens Prices</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm('Promotional Sales','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                               <li class="nav-item  " onclick="getstep('promotional_sales');">
                                    <a class="nav-link ">
                                        <span class="title">Promotional Sales</span>
                                    </a>
                                </li>
                                <?php } ?>

                            </ul>
                        </li>
                        <?php } ?>
                       
                         <?php if(getUserPerm('Approvals','Main')=='yes' || $_SESSION['security']=='admin'){ ?>
                        <li class="nav-item  ">
                            <a href="javascript:;" class="nav-link nav-toggle">
                                <i class="fa fa-arrows-alt" style="color:"></i>
                                <span class="title">Approvals</span>
                                <span class="arrow"></span>
                            </a>
                            <ul class="sub-menu">
                               <?php if(getUserPerm('List of Unapproved Gratis','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('unapproved_gratis_patients');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Unapproved Gratis </span>
                                    </a>
                                </li>
                               <?php } ?>
                                <?php if(getUserPerm('List of Approved Gratis','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_approved_gratis');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Approved Gratis </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Unapproved Credit Sales','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('unapproved_credit_sales_patients');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Unapproved Credit Sales </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Branches','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('approved_credit_sales_patients');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Approved Credit Sales </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Branches','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_unapproved_discounts');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Unapproved Discounts </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Approved Discounts','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_approved_discounts');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Approved Discounts </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Unapproved Cancellations','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                 <li class="nav-item  " onclick="getstep('list_unapproved_cancellation_items');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Unapproved Cancellations </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Approved Cancellations','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                 <li class="nav-item  " onclick="getstep('list_approved_cancellation_items');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Approved Cancellations </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Unapproved Refunds','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                 <li class="nav-item  " onclick="getstep('list_unapproved_refunds');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Unapproved Refunds </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Approved Refunds','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                 <li class="nav-item  " onclick="getstep('list_approved_refunds');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Approved Refunds </span>
                                    </a>
                                </li>
                                <?php } ?>
                            </ul>
                        </li>
                         <?php } ?>
                                <?php } ?>
                        
                         <?php if(getUserPerm('Report Generation','Main')=='yes' || $_SESSION['security']=='admin'){ ?>
                        <li class="nav-item  ">
                            <a href="javascript:;" class="nav-link nav-toggle">
                                <i class="fa fa-bar-chart" style="color:"></i>
                                <span class="title">Report Generation</span>
                                <span class="arrow"></span>
                            </a>
                            <ul class="sub-menu">
                                <?php if(getUserPerm('Sales Report','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('sales_report_page');">
                                    <a class="nav-link ">
                                        <span class="title"> Sales Report </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Frames & Accessories Sold','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('frames_accessories_page');">
                                    <a class="nav-link ">
                                        <span class="title">Frames & Accessories Sold</span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm('General Sales Report','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('general_sales_report');">
                                    <a class="nav-link ">
                                        <span class="title">General Sales Report </span>
                                    </a>
                                </li>
                                <?php } ?>

                                <?php if(getUserPerm('Store Report','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <!-- <li class="nav-item  " onclick="getstep('store_reports_page');">
                                    <a class="nav-link ">
                                        <span class="title">Store Report </span>
                                    </a>
                                </li> -->
                                <?php } ?>
                                <li class="nav-item  " onclick="getstep('stock_reports_page');">
                                    <a class="nav-link ">
                                        <span class="title">Stock Report </span>
                                    </a>
                                </li>

                                <?php if(getUserPerm('Administrative Report','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('admin_report');">
                                    <a class="nav-link ">
                                        <span class="title">Admin  Report </span>
                                    </a>
                                </li>
                                <?php } ?>

                            </ul>
                        </li>
                        <?php } ?>
                        
                         <?php if(getUserPerm('Billing Office','Main')=='yes' || $_SESSION['security']=='admin'){ ?>
                        <li class="nav-item  ">
                            <a href="javascript:;" class="nav-link nav-toggle">
                                <i class="fa fa-dollar" style="color:"></i>
                                <span class="title">Billing Office</span>
                                <span class="arrow"></span>
                            </a>
                            <ul class="sub-menu">
                                <?php if(getUserPerm('List of Insurance Claims','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('claimsoffice_list_claims', 'insurance');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Insurance Bills </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Company Claims','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('claimsoffice_list_claims', 'company');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Company Bills </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Cash Bills','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('claimsoffice_list_claims', 'cash');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Cash Bills </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Staff Bills','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('claimsoffice_list_claims', 'staff');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Staff Bills </span>
                                    </a>
                                </li>
                                <?php } ?>
                                
                                <?php if(getUserPerm('Insurance Claims Summary','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('claimsoffice_list_claims_summary', 'insurance');">
                                    <a class="nav-link ">
                                        <span class="title"> Insurance Bills Summary </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Company Claims Summary','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('claimsoffice_list_claims_summary', 'company');">
                                    <a class="nav-link ">
                                        <span class="title"> Company Bills Summary</span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Cash Bills Summary','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('claimsoffice_list_claims_summary', 'cash');">
                                    <a class="nav-link ">
                                        <span class="title"> Cash Bills Summary </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('Staff Bills Summary','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('claimsoffice_list_claims_summary', 'staff');">
                                    <a class="nav-link ">
                                        <span class="title"> Staff Bills Summary </span>
                                    </a>
                                </li>
                                <?php } ?>

                            </ul>
                        </li>
                        <?php } ?>
                       
                        <?php if(getUserPerm('Admin Utilities','Main')=='yes' || $_SESSION['security']=='admin'){ ?>
                        <li class="nav-item  ">
                            <a href="javascript:;" class="nav-link nav-toggle">
                                <i class="fa fa-gears" style="color:"></i>
                                <span class="title"> Admin Utilities </span>
                                <span class="arrow"></span>
                            </a>
                            <ul class="sub-menu">
                                <?php if(getUserPerm('List of Branches','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_branches');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Branches </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Users','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_users');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Users </span>
                                    </a>
                                </li>
                                <?php } ?>
                                <?php if(getUserPerm('List of Users','Sub')=='yes' || $_SESSION['security']=='admin'){ ?>
                                <li class="nav-item  " onclick="getstep('list_of_companies');">
                                    <a class="nav-link ">
                                        <span class="title"> List of Companies </span>
                                    </a>
                                </li>
                                <?php } ?>
                            </ul>
                        </li>
                         <?php } ?>
                        
                            </ul>
                    <!-- END SIDEBAR MENU -->
                </div>
                <!-- END SIDEBAR -->
            </div>