<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$zroot = $_SESSION["zdbroot"];

$zdb = $_SESSION["zdbyear_" . $dbname];
$zyear = right($zdb, 4);
$mfrdate = getzdates($zyear, 'S');
$mtodate = getzdates($zyear, 'E');

$formname = "Monthly Comparison";
$action = "monthcomprep_fr.php";
mysqli_select_db($conn, $zdb);

include("includes/linkshead.php");
?>
</head>

<body>
    <form method='POST' action="<?= $action; ?>">
        <div class="col-lg-5 col-md-12 col-sm-12 col-xs-12  pad">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><?php echo $formname; ?></h3>
                </div>
                <div class="panel-body">
                    

                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Month</label>
                        </div>
                        <div class="col-lg-3 col-md-4 col-sm-6 col-xs-6 pad">
                            <select class="form-control select2 month" name="month" required>
                                <option></option>
                                <?php
                                $gmon = mysqli_query($conn, "SELECT code,monname FROM $zroot.`month` ORDER BY code ") or die(mysqli_error($conn));
                                while ($smon = mysqli_fetch_array($gmon)) {
                                    echo "<option value='$smon[code]'>$smon[monname]</option>";
                                }
                                ?>
                            </select>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Year</label>
                        </div>
                        <div class="col-lg-3 col-md-4 col-sm-8 col-xs-8 pad">
                            <input type="number" id="year" name="year" class="form-control year" value="<?php echo date("Y"); ?>">
                        </div>
                    </div>

                </div>

                <div class="panel-footer text-center">
                    <?php include("includes/but_rep.php"); ?>

                    <script>
                        $("#sexcel").show();
                        $("#selectrep").change(function() {
                            if ($("#ex").is(":selected")) {
                                $("#sexcel").hide();
                            } else {
                                $("#sexcel").show();
                            }
                        });
                    </script>
                </div>
            </div>
        </div>
    </form>
    <?php include("includes/linksfoot.php"); ?>
</body>

</html>