<?php
include("config.php");
if (!loggedin()) {
    header("Location: login.php");
    exit();
}if (($_SESSION['reports'] != '1')) {
    header("Location: error.php");
    exit();
}
?>


<!DOCTYPE html>
<html>
    <?php include("include/heads.php"); ?>	
    <body class="fixed-left">
        <div id="wrapper">
            <!-- Top Bar Start -->
            <?php include("include/topbar.php"); ?>
            <!-- Top Bar End -->

            <!-- Left Sidebar Start -->
            <?php include("include/leftsidebar.php"); ?>
            <!-- Left Sidebar End -->

            <!-- Start right Content here -->

            <div class="deleteData"></div>

            <div class="content-page">
                <!-- Start content -->
                <div class="content">
                    <div class="container">

                        <!-- Page-Title -->
                        <div class="row">
                            <div class="col-sm-12">
                                <h4 class="page-title"> Financial report </h4>
                                <ol class="breadcrumb">
                                    <li><a href="financial_report.php">Report Financial</a></li>
                                    <li class="active">View   Financial report
                                    </li>
                                </ol>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-lg-12">
                                <div class="card-box">
                                    <h4 class="m-t-0 header-title"><b>Search</b></h4>
                                    <p class="text-muted font-13 m-b-30"></p>  
                                    <form method="get" action="print_selected_financial_report.php" enctype="multipart/form-data" target="_blank" data-parsley-validate>
                                        <div class="form-group">
                                            <label for="select_report">Choos Report *</label>
                                            <select class="form-control select2me" name="report" id="select_report" required parsley-trigger="change">
                                                <option value='daily'>Daily</option>
                                                <option value='week'>Week</option>
                                                <option value='month'>Month</option>

                                            </select>					
                                        </div>	
                                        <?php
                                        if ($_SESSION['user_type'] == 1) {
                                            ?>
                                            <div class="col-md-3">
                                                <label class="control-label">  Branch</label>
                                                <select  class="form-control branche_id select2me" name="branche_id" id="branche_id">
                                                    <option value=''>All </option>
                                                    <?php
                                                    $query = $con->query("SELECT * FROM `branches` ORDER BY `id` ASC");
                                                    while ($row = mysqli_fetch_assoc($query)) {
                                                        $branche_id = $row['id'];
                                                        $name = $row['name'];
                                                        echo " <option value = '{$branche_id}'>{$name}</option>";
                                                    }
                                                    ?>
                                                </select>
                                            </div>
                                        <?php } ?>
                                        <div class='clearfix'></div>

                                        <div class="form-group text-left" style="margin-top:60px;width:100%;clear:both;">
                                            <button class="btn btn-primary waves-effect waves-light" type="submit" name="submit">Search</button>
                                        </div>

                                        <br /><br /><br /><br />

                                    </form>	
                                </div>
                            </div>
                        </div>

                    </div>			
                </div>
                <?php include("include/footer_text.php"); ?>

            </div>			
            <!-- End Right content here -->

            <!-- Right Sidebar -->
            <div class="side-bar right-bar nicescroll">
                <?php include("include/rightbar.php"); ?>
            </div>
            <!-- /Right-bar -->
        </div>
        <!-- END wrapper -->
        <?php include("include/footer.php"); ?>	

        <script type="text/javascript">
            $('.date-picker').datepicker();
            $('.select2me').select2({
                placeholder: "Select",
                width: 'auto',
                allowClear: true
            });
        </script>

        <script>
            $(document).ready(function () {
                $("#cssmenu ul>li").removeClass("active");
                $("#item10").addClass("active");
            });
        </script>
    </body>
</html>