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

$formname = 'Reminders Alert';
$ztit = $_SESSION["tit_" . $dbname];
$maindb = 'folwmain';
$trandb = 'folwtran';
$printfile = "";
$file = 'remdalert.php';
$trandbexist = 1;
$grid = '';
$keyfld = "vouchno";
$keycond = "";
$focusfield = "party";
$bseries = $_SESSION["user_series"];
$zroot = $_SESSION["zdir"];

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

$usertype = $_SESSION["usertype"];
$user = $_SESSION['username_' . $dbname];

//$count = $_POST["items"];
//if (isset($_POST["submit"])) {
//    $date = date("Y-m-d");
//
//    for ($i = 0; $i < $count; $i++) {
//
//
//        $vouchno = $_POST["vouchno_$i"];
//        $complete = $_POST["complete_$i"];
////        browse($complete);
//        if ($complete == '1') {
//            mysqli_query($conn, "UPDATE `$maindb` SET `autoflg` = '$complete' WHERE `vouchno`='$vouchno' ")or die(mysqli_error($conn));
//        }
//        print '<script type="text/javascript">';
//        print " top.window.location = 'menu.php?action=autoinwfab'";
//        print '</script>';
//    }
//}

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

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


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

    <form action='' method='POST'>
        <!-- Default box -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-body table-responsive" style="width:100%">
                        <h1>For Full Details Click on Voucher No.</h1>
<!--                        <div class="container" style="float:right;">
                            <input style="padding-right: 15px;float:right;width:17%;"  type='submit' id="update" name='submit' value='SAVE' class="btn btn-success">
                        </div>-->
                        <table id="example1" class="table-bordered" width="100%" style="padding-left: 2%;padding-right: 2%;">
                            <thead>
                                <tr style="" class="mySearchTr">
                                    <th style="width: 5%;text-align: center">Sr.</th>
                                    <th style="width: 5%;">Voucher</th>
                                    <th style="width: 10%;">Date</th>
                                    <th style="width: 20%;">Party Name</th>
                                    <th style="width: 10%;">Mobile 1</th>
                                    <th style="width: 10%;">Mobile 2</th>
                                    <th style="width: 10%;">Reminder Date</th>
                                </tr>
                            </thead>
                            <tbody class="mytable table-bordered">
                                <?php
                                $date = date("Y-m-d");
                                $srchresult = mysqli_query($conn, "SELECT a.*, date_format(a.`vouchdt`,'%d/%m/%Y') as mydt ,DATE_FORMAT(b.`remdate`,'%d-%m-%Y') as remdate FROM `$maindb` a ,$trandb b  WHERE a.`vouchno`= b.`vouchno`  AND b.remdate = '$date'") or die(mysqli_error($conn));

                                $ctr = 0;
                                $mctr = 0;
                                while ($row = mysqli_fetch_array($srchresult)) {
                                    $mctr++;

                                    echo "<tr class='' data-href='followup.php?mode=edit&vouchno=$row[vouchno]'>";
                                    Echo "<td style='text-align:center;' class=''><b>$mctr</b></td>";
                                    Echo "<td style='align:center;' class=''><b><a href='followup.php?mode=edit&vouchno=$row[vouchno]'><input type='text' style='color:blue;border:none;background-color:white;width:50px' name= 'vouchno_$ctr' value='$row[vouchno]' class='vouchno form-control' readonly></a></b></td>";
                                    Echo "<td  class=''><b>$row[mydt]</b></td>";
                                    Echo "<td class=''><b>$row[party]</b></td>";
                                    Echo "<td class=''><b>$row[mobile1]</b></td>";
                                    Echo "<td class=''><b>$row[mobile2]</b></td>";
                                    Echo "<td class=''><b>$row[remdate]</b></td>";
                                    echo "</tr>";
                                    $ctr++;
                                }
                                ?> 
                            </tbody> 
                        </table>

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

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

</body>
</html>
