<!-- Report Viewer Modal -->
    <div class="modal fade" id="reportViewerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog modal-sm">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="reportViewerModalTitle">Report Viewer</h4>
          </div>
          <div class="modal-body">
            <div class="form-group">
              <label for="reportViewerSelectReport">Select Report:</label>
              <select class="form-control" name="reportViewerSelectReport" id="reportViewerSelectReport">
                <option value="-1">-- SELECT A REPORT --</option>
                
                <?php
                  $query = "SELECT * FROM REPORT_HEAD ORDER BY ReportName";
                  $result = mysqli_query($con, $query);
                  while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
                    ?>
                      <option value="<?= $row['ReportID'] ?>"><?= $row['ReportName'] ?></option>
                    <?php
                  }
                 ?>
              </select>
            </div>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            <button type="button" id="goViewReportButton" class="btn btn-primary">Go</button>
          </div>
        </div>
      </div>
      <script type="text/javascript">
        $('#goViewReportButton').on("click", function(){
          if($('#reportViewerSelectReport').val() == "-1"){
            alert("Please select a report");
            return false;
          }else{
            window.location = "mod.php?p=report&a=view&id=" + $('#reportViewerSelectReport').val();
          }
        });
      </script>
    </div>
    <!-- Report Viewer Modal End -->
