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

$zdb = $_SESSION["zdbyear_" . $dbname];


$zroot = $_SESSION["zdbroot"];
$formname = "Monthly Sale Summary";
$action = "salesumm_fr.php";
mysqli_select_db($conn, $zdb);

include("includes/linkshead.php");
?>
</head>
<body>
    <form method='POST' action="<?= $action; ?>">
        <!-- Default box -->
        <div class="col-lg-6 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" style="font-size: 18px">Year</label>
                        </div>
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <select class="form-control select2 yearno" name="yearno">
                                <?php
                                $date = date("Y-m-d");

                                $getyr1 = mysqli_query($conn, "Select * from $zroot.yeartab where yearname = year('$date') ");
                                $fetyr1 = mysqli_fetch_array($getyr1);
                                echo "<option value='$fetyr1[yearname]'>$fetyr1[yearname]</option>";
                                $getyear = mysqli_query($conn, "Select * from $zroot.yeartab order by yearname");
                                while ($fetyear = mysqli_fetch_array($getyear)) {
                                    echo "<option value='$fetyear[yearname]'>$fetyear[yearname]</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">From Month</label>
                        </div>
                        <div class="col-lg-3 col-md-4 col-sm-6 col-xs-6 pad">
                            <select class="form-control select2 marg" name="mono">
                                <!--default value-->
                                <?php
                                $getmnt1 = mysqli_query($conn, "Select * from $zroot.month where moncode = month('$date') ");
                                $fetmnth1 = mysqli_fetch_array($getmnt1);
                                echo "<option value='$fetmnth1[moncode]'>$fetmnth1[moncode] - $fetmnth1[monname]</option>";
                                $getmnt = mysqli_query($conn, "Select * from $zroot.month order by moncode");
                                while ($fetmnth = mysqli_fetch_array($getmnt)) {
                                    echo "<option value='$fetmnth[moncode]'> $fetmnth[moncode] - $fetmnth[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">To Month</label>
                        </div>
                        <div class="col-lg-3 col-md-4 col-sm-6 col-xs-6 pad">
                            <select class="form-control select2 marg" name="tomono">
                                <?php
                                $date2 = date("Y-m-d");

                                $getmnt2 = mysqli_query($conn, "Select * from $zroot.month where moncode = month('$date2') ");
                                $fetmnth2 = mysqli_fetch_array($getmnt2);
                                echo "<option value='$fetmnth2[moncode]'>$fetmnth2[moncode] - $fetmnth2[monname]</option>";
                                $getmntn = mysqli_query($conn, "Select * from $zroot.month order by moncode");
                                while ($fetmnthn = mysqli_fetch_array($getmntn)) {
                                    echo "<option value='$fetmnthn[moncode]'> $fetmnthn[moncode] - $fetmnthn[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">Scope</label>
                        </div>
                        <div class="col-lg-3 col-md-4 col-sm-6 col-xs-6 pad">
                            <select class="form-control select2 scope" name="scope">
                                <option value="A">All</option>   

                                <option value="O">Looloo</option>
                                <option value="L">Khojati</option>
                            </select>
                        </div>
                    </div>-->

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