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

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

$file = "multienvp.php";

$formname = "Multiple Envelope";
$action = "multienvp_select.php";
mysqli_select_db($conn, $zdb);

include("includes/linkshead.php");
?>
<script src="MyScript/school.js" type="text/javascript"></script>
<script src="MyScript/multienvp.js" type="text/javascript"></script>
</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 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-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Center</label>
                        </div>
                        <div class="col-lg-6 col-md-6 col-sm-8 col-xs-8 pad">
                            <select class="form-control select2 center" name="center" >
                                <option></option>
                                <?php
                                $gcentr = mysqli_query($conn, "SELECT centcode, name FROM `center` order by name") or die(mysqli_error($conn));
                                while ($centr = mysqli_fetch_array($gcentr)) {
                                    $centrcode = $centr['centcode'];
                                    $center = $centr['name'];
                                    echo"<option value='$centrcode'>$center</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">Medium</label>
                        </div>
                        <div class="col-lg-4 col-md-6 col-sm-8 col-xs-8 pad">
                            <select class="form-control select2 medium" name="medmcode" >
                                <option></option>
                                <?php
                                $gmedm = mysqli_query($conn, "SELECT * FROM `medium` order by name") or die(mysqli_error($conn));
                                while ($smedm = mysqli_fetch_array($gmedm)) {
                                    $medmcode = $smedm['code'];
                                    $medium = $smedm['name'];
                                    echo"<option value = '$medmcode'>$medium</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">Exam</label>
                        </div>
                        <div class="col-lg-4 col-md-6 col-sm-8 col-xs-8 pad">
                            <select class="form-control select2 exam" name="exam" >
                                <option></option>
                                <?php
                                $gexam = mysqli_query($conn, "SELECT `code`,`name` FROM `exam` order by name")or die(mysqli_error($conn));
                                while ($dexam = mysqli_fetch_array($gexam)) {
                                    $examcode = $dexam['code'];
                                    $exam = $dexam['name'];
                                    Echo "<option value='$examcode'>$exam</option>";
                                }
                                ?>
                            </select>
                        </div>
                    </div>
                    <div class="row" style="padding-bottom:3px;padding-top:3px;">
                        <div class="col-lg-3 col-md-4 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control">City</label>
                        </div>
                        <div class="col-lg-4 col-md-6 col-sm-8 col-xs-8" style="padding-left: 0px">
                            <input type="text" class="form-control city" name="city">
                        </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">Order By</label>
                        </div>
                        <div class="col-lg-2 col-md-6 col-sm-8 col-xs-8 pad">
                            <select class="form-control select2 orderby" name="orderby" >
                                <option value="custcode">Code</option>
                                <option value="name">Name</option>
                            </select>
                        </div>
                    </div>

                </div>
                <div class="panel-footer text-center">
                    <div style="overflow: auto; ">
                        <table class="table-condensed" style="margin: 0 auto;">
                            <tr>
                                <td class=" buttonform tooltip-bottom" id="ssubmit" style="display: <? Echo $savedisabled ?>" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="View">
                                    <button type="button" class="btn btn-pad btn-square btn-info" name='view' id="view" data-toggle="modal" data-target="#schlmodal">
                                        <!--<button id='view' type='submit' formtarget="_blank" name='view' class="btn btn-pad btn-square" style="background-color:#05B2EA;">-->
                                        <i class="fa fa-television" style="color:#ffffff"></i>
                                    </button>
                                </td>
                                <td class=" buttonform tooltip-bottom" id="scancel" style="display: <? Echo $canceldisabled ?>" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Close">
                                    <button id='cancel' type="reset" class="btn btn-pad btn-square " style="background-color:red;" onClick="window.location.href = '<?= 'default.php' ?>'">
                                        <i class="fa fa-power-off" style="color:#ffffff"></i>
                                    </button>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <form action="multienvp_select.php"  target="_blank" method='POST'>
        <div class="modal fade" id="schlmodal"  role="dialog" aria-labelledby="myLargeModalLabel" >
            <div class="modal-dialog modal-lg" style="margin-top: 5%;">
                <div class="modal-content">
                    <div class="modal-header">
                        <button class="close" data-dismiss="modal"><span>&times;</span></button>
                        <div class="row">
                            <div class="col-lg-2 text-right padi">
                                <label class="label-control">Search By Code</label>
                            </div>
                            <div class="col-lg-2 padi" >
                                <input type='text' style="" name='search' class="form-control tsearch">    
                            </div>
                        </div>
                    </div>
                    <div class="modal-body">
                        <div class="col-lg-12 iloader text-center">
                            <img src="images/g2a_spinner.gif" alt="loading">       
                        </div>
                        <div class="table-responsive" style="height: 300px;">
                            <div class="mydata mytable"></div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <div><input type="submit" class="btn btn-info proeed" value="Proceed"></div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <?php include("includes/linksfoot.php"); ?>
</body>
</html>