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

$formname = "Complaint Print";
$action = "complaint_print_fr.php";

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);

$date = date("Y-m-d");
$newdate = date("Y-m-d", strtotime ( '-1 month' , strtotime ( $date ) )) ;


include("includes/linkshead.php");
?>
<script src="MyScript/complaint.js" type="text/javascript"></script>
</head>
<body>
    <form method='POST' action="<?= $action; ?>">
        <!-- Default box -->
        <div>
            <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-4 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                <label class="label-control marg">Complaint Date - From</label>
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 pad">
                                <input type="date" class="form-control complfrdt" name="complfrdt" value="<?php Echo $newdate ?>" >
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                <label class="label-control marg" style="margin-right: 10%">Complaint Date - To</label>
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 pad">
                                <input type="date" class="form-control compltodt" name="compltodt" value="<?php Echo date("Y-m-d") ?>">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                <label class="label-control marg">Flat No</label>
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 pad">
                                <input type="text" class="form-control flatno" name="flatno">
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                <label class="label-control marg">Name</label>
                            </div>
                            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 pad">
                                <select id="name" name="name" class="select2 form-control name">
                                    <option value=""</option>
                                    <?php
                                    $getstaff = mysqli_query($conn, "SELECT vouchno,name FROM `complaint` where vouchno !='' order by `name`") or die(mysqli_error($conn));
                                    while ($tstaff = mysqli_fetch_array($getstaff)) {
                                        echo "<option value=$tstaff[vouchno]>$tstaff[name]</option>";
                                    }
//                                    
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                <label class="label-control marg">Subject</label>
                            </div>
                            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 pad">
                                <input type="text" class="form-control subject" name="subject" >
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 text-right pad">
                                <label class="label-control marg">Status</label>
                            </div>
                            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 pad">
                                <select id="status" name="status" class="select2 form-control status">
                                    <option value="">All</option>
                                    <option value="U">Unattended</option>
                                    <option value="P">Pending</option>
                                    <option value="C">Completed</option>
                                </select>
                            </div>
                        </div>
                        <br>
                    </div>
                    <div class="panel-footer">
                        <?php include("includes/but_rep.php") ?>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <?php include("includes/linksfoot.php"); ?>
</body>
</html>
