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

$maindb = 'visamain';
$trandb = 'visatran';
$formname = "Submission List";
$action = "submission_fr.php";
$file = "submission_sc.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">Submission 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">Submission 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="place" class="form-control select2 place" >
                                    <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 class="row">

                            <div class="col-lg-3 col-md-3 col-sm-1 col-xs-1 text-right pad">
                                <label class="label-control marg">Stamp Type</label>
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-2 col-xs-2 pad">
                                <select name="stamptype" class="form-control select2 stamptype" >
                                    <option value="">All</option>
                                    <option value="1">Stamp</option>
                                    <option value="2">No Stamp</option>

                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="panel-footer">
                    <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="View2">
                <button id='view2' type='submit' formtarget="_blank" name='view2' class="btn btn-pad btn-square" style="background-color:#7b2624; ">
                    <i class="fa fa-television" style="color:#ffffff"></i>
                </button>
            </td>
            <td class=" buttonform tooltip-bottom" id="sspdf" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Pdf">
                <button id='subpdf' type='submit' name='subpdf' formtarget="_blank" name='pdf' class="btn btn-pad btn-square" style="background-color:white;border: 1px solid red">
                    <i class="fa fa-file-pdf-o" style="color:red; font-size: 15px;"></i>
                </button>
            </td>
            <td class=" buttonform tooltip-bottom" id="ssubmit" style="display: <? Echo $savedisabled ?>" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Excel">
                <button id='excel' type='submit' name='excel' class="btn btn-pad btn-square" style="background-color:#34a853; ">
                    <i class="fa fa-file-excel-o" style="color:#ffffff;" title="Excel"></i>
                </button>
            </td>
            <td class=" buttonform tooltip-bottom" id="ssubmit" style="display: <? Echo $savedisabled ?>" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="View">
                <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="ssubmit" style="display: <? Echo $savedisabled ?>" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="View Chart">
                <button id='graph' type='submit' formtarget="_blank" name='graph' class="btn btn-pad btn-square" style="background-color:red; ">
                    <i class="fa fa-download" 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.parent.location.href='menu.php'">-->
                <button id='cancel' type="reset" class="btn btn-pad btn-square " style="background-color:red;" onclick="window.parent.location.href='menu.php'">
                    <i class="fa fa-power-off" style="color:#ffffff"></i>
                </button>
            </td>
        </tr>
    </table>
</div>
                        <script>
                            $("#subpdf").hide();
//                                $("#excel").hide();
                        </script>
                    </div>
                    <!--</div>-->
                </div>
            </div>
        </div>
    </div>
</form>
<?php include("includes/linksfoot.php"); ?>
</body>
</html>
