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

$maindb = 'visamain';
$trandb = 'visatran';
$formname = "Mofa List";
$action = "mofalist_fr.php";
$file = "mofalist.php";

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$zyear = right($zdb, 4);

// $mfrdate = getzdates($zyear, 'S');
// $mtodate = getzdates($zyear, 'E');
$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);

$current_date = date("Y-m-d");

// First day of the month.
$mfrdate =  date('Y-m-01', strtotime($current_date));

// Last day of the month.
$mtodate =  date('Y-m-t', strtotime($current_date));

// browse($mfrdate);
// browse($mtodate);

include("includes/linkshead.php");
?>
<script src="MyScript/item.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 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="control-label marg">Mofa From</label>
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-8 col-xs-8 pad">
                                <input type="date" size="80" name="frmdate" value="<?php echo "$mfrdate"; ?>" required class="form-control"/>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="control-label marg">Mofa To</label>
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-8 col-xs-8 pad">
                                <input type="date" size="80" name="todate" value="<?php echo "$mtodate"; ?>" required class="form-control"/>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                <label class="control-label marg">Visa Type</label>
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-8 col-xs-8 pad">
                                <select id="cmbtype" name="visatype" class="form-control select2">
                                    <option></option>   
                                    <option value="W">Work</option>
                                    <option value="F">Family</option>
                                    <option value="R">Residency</option>
                                    <option value="V">Visit</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="control-label marg">Agent </label>
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-8 col-xs-8 pad">
                                <select id="cmbtype" name="agent" class="form-control select2">
                                    <option></option>   
                                    <?php
                                    $atype = mysqli_query($conn, "SELECT `broker` FROM `visamain` group by broker order by broker") or die(mysqli_error($conn));
                                    while ($getatype = mysqli_fetch_array($atype)) {
                                        echo "<option value='$getatype[broker]'>$getatype[broker]</option>";
                                    }
                                    ?>   
                                </select>
                            </div>
                        </div>
                        <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-1 col-xs-1 text-right pad">
                            <label class="label-control marg">Place</label>
                        </div>
                        <div class="col-lg-4 col-md-4 col-sm-2 col-xs-2 pad">
                            <select name="sector" class="form-control select2 sector" >
                                <option value="<?php Echo ($addflag != 1) ? $get["sector"] : "MUMBAI"; ?>"><?php Echo ($addflag != 1) ? $get["sector"] : "MUMBAI"; ?></option>
                                <option value="MUMBAI">MUMBAI</option>
                                <option value="New DELHI">NEW DELHI</option>

                            </select>
                        </div>
                        </div>
                    </div>
                    <div class="panel-footer">
                        <?php include("includes/but_rep.php"); ?>
                        <script>
                            $("#subpdf").hide();
//                                $("#excel").hide();
                        </script>
                    </div>
                    <!--</div>-->
                </div>
            </div>
        </div>
    </div>
</form>
<?php include("includes/linksfoot.php"); ?>
</body>
</html>
