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

$formname = 'Complaint';
$formname2 = 'Tenant Details';
$maindb = 'complaint';
//$trandb = 'memtran';
//$passdb = 'passmain';
$printfile = "complaint_print.php";
$file = 'complaint.php';
//$trandbexist = 0;
//$grid = '';
$keyfld = "vouchno";

$focusfield = "name";
//$mgrpcode = '010';
$usertype = $_SESSION["usertype_" . $dbname];

//$series = $_SESSION["society_" . $dbname];
$series = 1;


if (empty($series)) {
    browse("Invalid Society Credentials Forced Logout.");
    print '<script type="text/javascript">';
    print " top.window.location = 'index.php'";
    PRINT '</script>';
}

//$custcode = $_GET['custcode'];
//
//$cond = '';
//if (!empty($custcode)) {
//    $cond = "and accode = '$custcode' ";
//}
//$getcomp = mysqli_query($conn, "SELECT `cono`, `compname` FROM `society` WHERE `cono`='$series' ") or die(mysqli_error($conn));
//$comp = mysqli_fetch_array($getcomp);
//$compname = $comp['compname'];
$zroot = $_SESSION["zdbroot"];
//$keycond = " AND `grpcode`='010' and `series`='$series' $cond";   

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


include("includes/accode_generate.php");
include("includes/prev&next.php");


if (isset($_POST["submit"])) {

    $a = 1;
    $vouchno = $_POST["vouchno"];
    $mvouch = $qvouch;
    $complaintdt = $_POST["vouchdt"];
    $name = mysqli_real_escape_string($conn, $_POST["name"]);
    $flatno = $_POST["flatno"];
    $subject = $_POST["subject"];
    $descrip = $_POST["descrip"];
    $complby = $_POST["complby"];
    $recdby = $_POST["recdby"];
    $status = $_POST["status"];
    $status = $_POST["status"];
    $reason = $_POST["reason"];
    $completedt = $_POST["complete"];
    $verifyby = $_POST["verifyby"];


    $count = $_POST["items"];

    if ($name == "") {
        $a = 0;
        browse("Name Cannot Be Empty");
        if ($addflag == 1) {
            header("location:javascript://history.go(-1)");
        } else {
            header("refresh: ; $file?mode=last");
        }
    }

    if (isset($_POST["name"])) {
        $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE `name`= '$name'  AND vouchno != '$qvouch'") or die(mysqli_error($conn));
        if (mysqli_num_rows($result) > 0) {
            $a = 0;
            browse("Name Already Exist");
            header("refresh: 1; $file?mode=last");
        }
    }

    if (isset($_POST["flatno"])) {
        $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE `flatno`= '$flatno'  AND vouchno != '$qvouch'") or die(mysqli_error($conn));
        if (mysqli_num_rows($result) > 0) {
            $a = 0;
            browse("Flat No. Already Exist");
            header("refresh: 1; $file?mode=last");
        }
    }

    if ($a == 1) {
        mysqli_query($conn, "LOCK TABLES `$maindb` WRITE") or die(mysqli_error($conn));

        if ($addflag == 1) {

            $gen1 = mysqli_query($conn, "SELECT MAX($keyfld) AS maxcode FROM `$maindb` WHERE $keyfld !=''  LIMIT 0,1 ") or die(mysqli_error($conn));

            if (mysqli_num_rows($gen1) > 0) {
                $vvouch = mysqli_fetch_assoc($gen1);
                $qvouch = $vvouch["maxcode"] + 1;
            } else {
                $qvouch = '1';
            }
            $mvouch = $qvouch;
        }


        if ($addflag == 1) {

            //Member Only Active in Add Mode as per Fairoz
            mysqli_query($conn, "INSERT INTO `$maindb`(`vouchno`, `vouchdt`, `name`, `flatno`, `subject`, `descrip`, `complby`,
                                               `recdby`, `status`, `reason`, `complete`, `verifyby`)
                                        VALUES('$mvouch', '$complaintdt', '$name', '$flatno', '$subject', '$descrip', '$complby', '$recdby',
                                               '$status', '$reason' , '$completedt' , '$verifyby')") or die(mysqli_error($conn));

            insmess();
            $mvouch = $qvouch;
            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
        } else {
            $mvouch = $qvouch;
            mysqli_query($conn, "UPDATE `$maindb` SET `vouchdt`='$complaintdt', `name`='$name', `flatno`='$flatno', `subject`='$subject', `descrip`='$descrip',`complby`='$complby',
                        `recdby`='$recdby', `status`='$status', `reason`= '$reason', `complete`= '$completedt',verifyby='$verifyby' where vouchno = '$mvouch'") or die(mysqli_error($conn));




            updmess();
            header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
        }

        mysqli_query($conn, "UNLOCK TABLES");
    }
}
if ($addflag != 1) {

    $getvouch = '';
    if ($addflag == 0) {
        $getvouch = $_GET[$keyfld];
    } else {
        $getvouch = $qvouch;
    }

    $result = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE $keyfld='$getvouch'") or die(mysqli_error($conn));
    $get = mysqli_fetch_array($result);

    $getrecdby = mysqli_query($conn, "SELECT code,name FROM `comprecdby` WHERE code='$get[recdby]' order by name") or die(mysqli_error($conn));
    $fet = mysqli_fetch_array($getrecdby);

    $qryfl = mysqli_query($conn, "SELECT  name,block,wing,floor,area,unit,mobile FROM `accmast` where `flatno` ='$get[flatno]' and grpcode = '010' ") or die(mysqli_error($conn));
    $fetfl = mysqli_fetch_array($qryfl);
}

$senable = "";
$cenable = "";


if (isset($_GET["delete"])) {

    $result = mysqli_query($conn, "SELECT accode FROM `billmain` WHERE `accode`='$_GET[$keyfld]'  and `society` = '$series'") or die(mysqli_error($conn));
    $num = mysqli_num_rows($result);
    if ($num > 0) {
        browse('BILL GENERATED FOR THIS MEMBER');
        header("refresh: 1; $file?mode=last");
    } else {
        delete($zdb, "$maindb", "$keyfld", $_GET[$keyfld], "$file?mode=last");
//        delete($zdb, "$trandb", "$keyfld", $_GET[$keyfld], "$file?mode=last");

        mysqli_query($conn, "Delete From $zroot.`passmain`  WHERE `code` = '$_GET[$keyfld]' and usertype=3") or die(mysqli_error($conn));
    }
}

include("includes/linkshead.php");
?>
<script>
    $(document).ready(function () {
        $("body").on('blur keyup', '.cpass', checkPass);
        $("body").on('blur', '.cpass', checkReturn);
        $("body").on('keyup blur focus', '.amount', calmaint);
//        $("body").on('click', '.CMail', sendMail);
        $("body").on('blur', '#email', getUser);
        $("body").on('keyup change', '.prinamt,.latefee,.interest,.advance', calopenbal);
        $("body").off('click').on("click", '.remove', remove);
        $("body").on("change blur", '.maintype', chkrepeat);

        function chkrepeat() {
            var tr = $(this).closest('tr'),
                    maintype = tr.find('.mcode').val(),
                    srno = tr.find('.srno').val();
            $(".tbody").find('tr').each(function () {
                var row = $(this),
                        lmaintype = row.find('.mcode').val(),
                        loopsrno = row.find('.srno').val();

                if (lmaintype == maintype && loopsrno != srno) {
                    alert('MAINTENANCE CANNOT BE SAME !!!');
                    tr.find('.maintype').val('').trigger("change");
                    return false;
                }
            });
        }

        function calopenbal() {
            var prinamt = $(".prinamt").val(),
                    interest = $(".interest").val(),
                    advance = $(".advance").val(),
//                    latefee = $(".latefee").val(),
                    openbal = parseFloat(prinamt) + parseFloat(interest) - parseFloat(advance),
                    openamt = Math.abs(openbal);
            $(".openbal").val(openamt);

            if (latefee > 0) {
                $('.advance').attr("readonly", true);
                $('.advance').val(0);
            } else {
                $('.advance').removeAttr("readonly");
            }

            if (openbal > 0) {
                $('.dc').val('D');
            } else {
                $('.dc').val('C');
            }
        }

        function checkPass() {
            var pass = $(".password").val(),
                    cpass = $(".cpass").val();
            var check = "";
            if (pass != cpass) {
                var check = "<label class='label-control' style='color:red'>Password Not Matched</label>";
            } else {
                var check = "<label class='label-control' style='color:green'>Password Matched</label>";
            }

            $(".checkdiv").html(check);
        }

        function getUser() {
            var email = $("#email").val();

            $(".username").val(email);
        }

        function checkReturn() {
            var pass = $(".password").val(),
                    cpass = $(".cpass").val();
            if (pass != cpass) {
                alert("Password Did Not Match");
                $(".cpass").val("");
                $(".pass").val("");
            }
        }

        function calmaint() {
            var tr = $(this).closest("tr"),
                    val = 0;
            $(".amount").each(function () {
                if (!isNaN(this.value) && this.value.length != 0) {
                    val += parseFloat(this.value);
                }
            });
            $(".totalbill").val(val);
        }

        $('.CMail').click(function () {
            var user = $(".username").val(), pass = $(".password").val(), email = $("#email").val();
            $.post('customer_SendMail.php', {user: user, pass: pass, email: email}, function (data) {
                if (data == "success") {
                    alert("Username & Password Are Send To The Member");
                }
            });
        });

        $('#addnew').click(function () {
            AddRows();
        });

        function remove() {
            $(this).closest("tr").remove();
        }

        function AddRows() {
            var ctr = $('#items').val();

            var hide_check = "";
            if ($("#del_all").prop("checked")) {
                hide_check = 0;
            } else {
                hide_check = 1;
            }
            var detail = ".detailpart_" + ctr;
            var detail = ".fetchpart_" + ctr;
            $.post('member_add.php', {ctr: ctr, hide: hide_check}, function (data) {
                $(data).appendTo('.tbody');
                ctr++;
                $('#items').val(ctr);
                $(detail).select2();
            });
        }
    });

</script>
<style>
    .tab{
        border: 1px solid #6082BF;
        color: black;
        background-color:  white;
    }
</style>
<script src="MyScript/complaint_search.js" type="text/javascript"></script>
<script src="MyScript/complaint.js" type="text/javascript"></script>
</head>
<body>

    <form action='' method='POST'>
        <!-- Default box -->
        <div class="row">
            <div class="col-lg-6 pad">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title"><?php Echo $formname; ?></h3>
                        <div class="actions pull-right">
                            <!--<i class="fa fa-chevron-down"></i>-->
                            <!--<i class="fa fa-times"></i>-->
                        </div>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Voucher No.</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <input type="text" class="form-control form" name="vouchno" value="<?php Echo ($addflag != 1) ? $get["vouchno"] : "$qvouch"; ?>" readonly>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Complaint Date</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                <input type="date"  class="form-control form" name="vouchdt" value="<?php Echo ($addflag != 1) ? $get["vouchdt"] : date("Y-m-d"); ?>" >
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Flat No.</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <input type="text" class="form-control form flatno" name="flatno" value="<?php Echo ($addflag != 1) ? $get["flatno"] : ""; ?>" required>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Name</label>
                            </div>
                            <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 pad">
                                <input type="text" class="form-control text-uppercase form focusfield name" name="name" value="<?php Echo ($addflag != 1) ? $get["name"] : ""; ?>" required autofocus readonly>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Subject</label>
                            </div>
                            <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 pad">
                                <input type="text" class="form-control form" name="subject" value="<?php Echo ($addflag != 1) ? $get["subject"] : ""; ?>" required>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Description</label>
                            </div>
                            <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 pad">
                                <textarea class="form-control form" rows="4" cols="50" name="descrip" required autofocus> <?php Echo ($addflag != 1) ? $get["descrip"] : ""; ?> </textarea>

                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Complaint By</label>
                            </div>
                            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 pad">
                                <input type="text" class="form-control form" name="complby" value="<?php Echo ($addflag != 1) ? $get["complby"] : ""; ?>">
                            </div>
                        </div>
                        <hr style="border-top: 1px solid #B91646;width:101%;">
                        <div class="row">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Received By</label>
                            </div>
                            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 pad">
                                <select id="recdby" name="recdby" class="select2 form-control form recdby">
                                    <option value="<?php echo ($addflag != 1) ? $fet['code'] : " "; ?>"><?php echo ($addflag != 1) ? $fet['name'] : ""; ?></option>
                                    <?php
                                    $getstaff = mysqli_query($conn, "SELECT code,name FROM `comprecdby` where code !='' order by `name`") or die(mysqli_error($conn));
                                    while ($tstaff = mysqli_fetch_array($getstaff)) {
                                        echo "<option value=$tstaff[code]>$tstaff[name]</option>";
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Status</label>
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 pad">
                                <select id="status" name="status" class="select2 form-control form status">
                                    <option value=""></option>
                                    <option
                                    <?php
                                    if ($get['status'] == 'U') {
                                        echo "selected=selected";
                                    }
                                    ?> value='U'>Unattended</option>
                                    <option
                                    <?php
                                    if ($get['status'] == 'P') {
                                        echo "selected=selected";
                                    }
                                    ?> value='P'>Pending</option>
                                    <option
                                    <?php
                                    if ($get['status'] == 'C') {
                                        echo "selected=selected";
                                    }
                                    ?> value='C'>Completed</option>

                                </select>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Reason</label>
                            </div>
                            <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 pad">
                                <textarea class="form-control form" rows="4" cols="50" name="reason" required autofocus> <?php Echo ($addflag != 1) ? $get["reason"] : ""; ?> </textarea>
                            </div>
                        </div>
                        <div class="row complete2">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Complete Date</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                <input type="date"  class="form-control form complete" name="complete" value="<?php Echo ($addflag != 1) ? $get["complete"] : ""; ?>" >
                            </div>
                        </div>
                        <div class="row verifyby2">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Verified By</label>
                            </div>
                            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 pad">
                                <input type="text" class="form-control form verifyby" name="verifyby" value="<?php Echo ($addflag != 1) ? $get["verifyby"] : ""; ?>">
                            </div>
                        </div>

                    </div>
                    <div class="panel-footer">
                        <?php
                        if ($usertype != 3) {
                            include("includes/buttons.php");
                        }
                        ?>
                    </div>
                </div>
            </div>


            <div class="col-lg-6 pad">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title"><?php Echo $formname2; ?></h3>
                        <div class="actions pull-right">
                            <!--<i class="fa fa-chevron-down"></i>-->
                            <!--<i class="fa fa-times"></i>-->
                        </div>
                    </div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Phase</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <input type="text" class="form-control form block" name="block" value="<?php Echo ($addflag != 1) ? $fetfl["block"] : ""; ?>" readonly>
                            </div> 
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Building No.</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <input type="text"  class="form-control form wing" name="wing" value="<?php Echo ($addflag != 1) ? $fetfl["wing"] : ""; ?>" readonly>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Floor</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                                <input type="text" class="form-control form floor" name="floor" value="<?php Echo ($addflag != 1) ? $fetfl["floor"] : ""; ?>" readonly>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Area</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2  pad">
                                <input type="text" class="form-control form text-right area" name="area" value="<?php Echo ($addflag != 1) ? $fetfl["area"] : ""; ?>" readonly>
                            </div>
                        </div>
                        <div class="row">   
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Unit</label>
                            </div>
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <?php
                                if ($fetfl['unit'] == 'F') {
                                    $unit = 'Sq. Ft.';
                                    ?>
                                    <input type = "text" class = "form-control form  unit" name = "unit" value = "<?php Echo $unit; ?>" readonly>
                                <?php
                                } else { 
                                    $unit = 'Sq. Mtr.';
                                    ?>
                                    <input type = "text" class = "form-control form  unit" name = "unit" value = "<?php Echo $unit ; ?>" readonly>
                             <?php   }?>
                                
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 text-right pad">
                                <label class="label-control marg">Mobile</label>
                            </div>
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad">
                                <input type="text" class="form-control form  mobile" name="mobile" value="<?php Echo ($addflag != 1) ? $fetfl["mobile"] : ""; ?>" readonly>
                            </div>
                        </div>
                    </div>
                    <!--                    <div class="panel-footer">
                    <?php
                    if ($usertype != 3) {
                        include("includes/buttons.php");
                    }
                    ?>
                                        </div>-->
                </div>
            </div>

            <?php
//            if ($addflag != 1) {
//                $ctr = 0;
//                $gettran = mysqli_query($conn, "SELECT * FROM `$trandb` WHERE `accode` = '$qvouch' and `cono`='$series' ORDER BY `srno`")or die(mysqli_error($conn));
//                while ($tran = mysqli_fetch_array($gettran)) {
//                    $getmain = mysqli_query($conn, "SELECT * FROM `accmast` where `type`='I' and `series`='$series' and `accode`='$tran[maintype]'") or die(mysqli_error($conn));
//                    $gmain = mysqli_fetch_array($getmain);
//
//                    Echo "<tr>";
//                    Echo "<td><i class='fa fa-close form remove' style='display:none;'></i></td>";
//                    Echo "<td><input type='text' class='form-control form numeric srno' name='srno_$ctr' value='$tran[srno]'></td>";
//                    Echo "<td><input type='text' class='form-control form  maintype' name='maintype_$ctr' value='$gmain[name]' readonly>
//                                             <input type='hidden' class='form-control form mcode' name='mcode_$ctr' value='$tran[maintype]' >    
//                                             </td>";
//                    Echo "<td><input type='text' class='form-control form text-right numeric amount' name='amount_$ctr' value='$tran[amount]'></td>";
//                    Echo "</tr>";
//                    $ctr++;
//                }
//            } else {
//                $getrec = mysqli_query($conn, "SELECT * FROM $zroot.`soctran` where `cono`='$series' order by srno") or die(mysqli_error($conn));
//                $mctr = 1;
//                $pctr = 0;
//                while ($get = mysqli_fetch_array($getrec)) {
//                    $gtmatt = mysqli_query($conn, "SELECT accode,name FROM `accmast` where `type`='I' and `series`='$series' and `accode` = '$get[maintype]' ")or die(mysqli_error($conn));
//                    $matt = mysqli_fetch_array($gtmatt);
//                    Echo "<tr>";
//                    Echo "<td><i class='fa fa-close form remove'></i></td>";
//                    Echo "<td><input type='text' class='form-control form numeric srno' name='srno_$pctr' value='$mctr'></td>";
//                    Echo "<td><input type='text' class='form-control form  maintype' name='maintype_$pctr' value='$matt[name]' readonly>
//                                            <input type='hidden' class='form-control form mcode' name='mcode_$pctr' value='$get[maintype]'>
//                                              </td>";
//                    Echo "<td><input type='text' class='form-control form numeric text-right amount' name='amount_$pctr' value='0'></td>";
//                    Echo "</tr>";
//                    $mctr++;
//                    $pctr++;
//                }
//            }
//            
            ?>

        </div>


    </form>
    <div class="modal fade bs-example-modal-lg searchModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel">Search <? Echo $formname; ?></h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-2">
                            <select class="form-control sfield">
                                <option value="1">Flat No.</option>
                                <option value="2">Complaint Date</option>
                                <option value="3">Name</option>
                                <option value="4">Subject</option>
                                <option value="5">Complaint By</option>
                                <option value="6">Received By</option>
                                <option value="7">Status</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control soperator">
                                <option value="">Type of Search</option>
                                <option value="%">Like</option>
                                <option value="=">Exactly</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control sortBy">
                                <option value="">Sort By</option>
                                <option value="1">Flat No.</option>
                                <option value="2">Complaint Date</option>
                                <option value="3">Name</option>
                                <option value="4">Subject</option>
                                <option value="5">Complaint By</option>
                                <option value="6">Received By</option>
                                <option value="7">Status</option>
                            </select> 
                        </div>
                        <div class="col-lg-2">
                            <select class="form-control orderAs">
                                <option value="desc">Desc</option>
                                <option value="asc">Asc</option>
                            </select>
                        </div>
                        <div class="col-lg-2">
                            <input type="text" value="" class="form-control ssearch" placeholder="Search Here">
                        </div>
                        <div class="col-lg-2">
                            <input type="button" style="color: white; background-color:#B91646;" class="btn btn-primary sload" value="Search" >
                        </div>
                    </div>
                    <div class="col-lg-12 sloader text-center"> 
                        <!--<img src="images/search.gif" alt="loading">-->       
                    </div>
                    <div class="col-lg-12 snoRecord text-center">
                        <h3>NO RECORDS FOUND</h3>
                    </div>
                    <div class="table-responsive" style="max-height: 400px;overflow: auto;">
                        <table id="" class="table table-striped table-condensed table-bordered" width="100%">
                            <thead>
                                <tr style="background-color:#B91646;">
                                    <th style="color: white;" width="6%">Flat No.</th>
                                    <th style="color: white;" width="15%">Complaint Date</th>
                                    <th style="color: white;" width="30%">Name</th>
                                    <th style="color: white;" width="15%">Subject</th>
                                    <th style="color: white;" width="15%">Complaint By</th>
                                    <th style="color: white;" width="15%">Received By</th>
                                    <th style="color: white;" width="10%">Status</th>
                                    <th style="color: white;" width="8%">Action</th>

                                </tr>
                            </thead>
                            <tbody class="sTbody">
                            </tbody>
                        </table>
                    </div>
                    <div class="row">
                        <div class="col-xs-12 text-right search-action-bar">
                            <input type="button"  class="btn btn-primary sprev" style="color: white; background-color:#B91646;" value="Previous">
                            <input type="button"  class="btn btn-primary snext" style="color: white; background-color:#B91646;" value="Next">
                        </div>
                    </div>

                </div>
                <div class="modal-footer"></div>
            </div>
        </div>
    </div>
<?php include("includes/linksfoot.php"); ?>
</body>
</html>
