HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/web/secure/csl/bam/admin/reports.asp
<%Option Explicit%>

<%
Session("MenuName") = "Reports"
Session("MenuLink") = "reports.asp"
%>
<!--#include virtual="bam1/dbfunctions.asp"-->
<!--#include virtual="bam1/commonutils.asp"-->
<!--#include file="apputils.asp"-->
<!--#include file="editutils.asp"-->
<!--#include file="reputils.asp"-->

<%


If (Request.QueryString("rep") = "" Or Request.QueryString("cmd") <> "rep") And (Request.QueryString("rep") <> "2" Or Request.QueryString("cmd2") <> "") Then
%>
<!--#include file="heading.asp"-->
<%
Else
%>
<html>
<head>
<title>BAM Accommodation Administration</title>
<link rel="stylesheet" type="text/css" href="styles.css?v=2">
<meta http-equiv="Pragma" content="no-cache">
<style type="text/css">
<!--
.title {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: medium; font-style: normal; font-weight: bold; color: #8f0000}
P.page {page-break-after: always}
-->
</style>


<STYLE TYPE="text/css">
STRONG
{
    COLOR: #000000;
    FONT-FAMILY: Verdana, Arial;
    FONT-SIZE: 8pt
}
</STYLE>

</head>

<body leftmargin="10" bgcolor="#FFFFFF" topmargin="10" onload=uSetFocus()>
<%
End If
%>

<!--#include file="authenticate.asp"-->

<%

If gbAuthenticated Then

Dim gbIncludeDateValidation
gbIncludeDateValidation = False

Dim strSQL, strSearchValue, strValue2, strHeading, strReportTitle, strReportTitle2
Dim strSearchField, i

Dim strReportNo
strReportNo = Request.QueryString("rep")

Const MAXLOOKUPS = 4

' used 4 in following because CONST MAXLOOKUPS doesn't work
Dim asLKLookup(4), asLKType(4), asLKFieldName(4), asLKTableName(4), asLKDisplayFieldName(4), asLKPrompt(4), asLKBlank(4)

Dim strReportSQL, strReportType

Dim LLKValue, LLKDisplayValue ' (SS,7/12/14)


'Response.Write("#"+ strProductID + "#")

' default values
strReportTitle = ""
strReportTitle2 = ""
strValue2 = ""

' --- MAIN MENU ---
If strCommand = "" and strReportNo = "" Then
%>
<br><br>
<Strong><font size="4">Reports</font></Strong>
<table class="menu">

<%
' open settings database
OpenQuery("SELECT * FROM Reports ORDER BY ReportNo")
Do While Not EndOfQuery
  ' (SS,23/10/15) only allow report 3 (Bookings with Credit Card Details) if Admin user
  If IsAdmin Or GetQueryValue("ReportNo") <> 3 Then  
%>
<tr><td>&nbsp;</td></tr><tr><td>&nbsp;<%=GetQueryValue("ReportNo")%>.&nbsp;</td>
<td nowrap><a href="reports.asp?cmd=acc&rep=<%=GetQueryValue("ReportNo")%>"><%=GetQueryValue("ReportName")%></a></td></tr>
<%
  End If
NextQueryRecord
Loop
CloseQuery
%>
</table>
<%
End If



' --- GET REPORT DETAILS FROM SETTINGS DATABASE ---
If strReportNo <> "" Then
  OpenQuery("SELECT * FROM Reports WHERE ReportNo=" + strReportNo)

  strReportTitle = GetQueryValue("ReportName")
  strReportType = GetQueryValue("ReportType")
  asLKLookup(1) = GetQueryValue("Lookup1")
  asLKLookup(2) = GetQueryValue("Lookup2")
  asLKLookup(3) = GetQueryValue("Lookup3")
  asLKLookup(4) = GetQueryValue("Lookup4")
  strReportSQL = GetQueryValue("SQL")

  CloseQuery

  OpenQuery("SELECT * FROM Lookups")

  For i = 1 To MAXLOOKUPS
    If asLKLookup(i) <> "" And FindRecord("LookupID", asLKLookup(i)) Then
      asLKType(i) = GetQueryValue("Type")
      asLKFieldName(i) = GetQueryValue("FieldName")
      asLKTableName(i) = GetQueryValue("TableName")
      asLKDisplayFieldName(i) = GetQueryValue("DisplayFieldName") ' (SS,7/12/14)
      asLKPrompt(i) = GetQueryValue("Prompt")
      asLKBlank(i) = GetQueryValue("AllowBlank")
    Else
      asLKType(i) = ""
      asLKFieldName(i) = ""
      asLKTableName(i) = ""
      asLKDisplayFieldName(i) = ""
      asLKPrompt(i) = ""
      asLKBlank(i) = False
    End If
  Next
  
  CloseQuery ' (29/11/14)

End If
' --- END OF GET REPORT DETAILS FROM SETTINGS DATABASE ---



' --- ACCEPT CRITERIA FROM USER (if at least one input required) ---
If strCommand = "acc" And asLKFieldName(1) <> "" Then
'Response.Write("<br>*** Debug Info ***<br>" + strReportSQL + "<br>****************")
%>

<P><Strong><font size="3">Report - <%=strReportTitle%></font></Strong></P>
<form name="report" action="reports.asp?cmd=rep&rep=<%=strReportNo%>" method="post">
<table border="0" cellpadding="0" cellspacing="0" class="title">
<%
  gsFocusForm = "report"
  gsFocusField = asLKFieldName(1)
  For i = 1 to MAXLOOKUPS
  	If asLKLookup(i) <> "" Then
      Response.Write("<tr>")
      Response.Write("<td nowrap Height=30>" + asLKPrompt(i) + ":&nbsp;</td>")
      Response.Write("<td nowrap>")
      If asLKType(i) = "L" Then
        Response.Write("<select name=""" + asLKFieldName(i) + """>" & vbCrLf)
        If asLKBlank(i) Then
          Response.Write "<option></option>" & vbCrLf
        End If
        OpenQuery("SELECT * FROM " + asLKTableName(i))
        Do While Not EndOfQuery
          LLKValue = GetQueryValue(asLKFieldName(i))
          ' (SS,6/12/14) if no separate display field then use the main field, else use the display field
          If asLKDisplayFieldName(i) = "" Then
            LLKDisplayValue = LLKValue
          Else
            LLKDisplayValue = NB(GetQueryValue(asLKDisplayFieldName(i))) 
          End If        
          
          ' (SS,7/12/14) added value LLKValue to allow different value to be displayed to the one assigned
          Response.Write("<option value=""" & LLKValue & """>")
          Response.Write(LLKDisplayValue & "</option>" & vbCrLf)
                    
          NextQueryRecord
        Loop
        CloseQuery
        Response.Write("</select>" & vbCrLf)
      ElseIf asLKType(i) = "D" Then  ' date type
        Response.Write("<input type=""text"" name=""" + asLKFieldName(i) + """ size=""15"" onblur=""convert_date(" + asLKFieldName(i) + ")"">")
        gbIncludeDateValidation = True
      Else
        Response.Write("<input type=""text"" name=""" + asLKFieldName(i) + """ size=""15"">")
      End If
      Response.Write("</td></tr>")
    End If
  Next

%>
</table>
<br>
<input type="submit" name="cmd" value="Report">
</form>
<%
Else ' run the report by setting strCommand to "rep"
  strCommand = "rep"
End If ' If strCommand = "acc"
' --- END OF ACCEPT CRITERIA FROM USER ---



' --- ACTUAL REPORT ---
If strCommand = "rep" Then

  Dim strStartDate, strEndDate, sSQL, LAbortReport

  LAbortReport = False

  ' replace tokens with values from form
  strReportTitle2 = ""
  For i = 1 to MAXLOOKUPS
    If asLKLookup(i) <> "" Then
      strReportSQL = ReplaceStr(strReportSQL, "#" + asLKLookup(i) + "#", CleanSQLStr(Request.Form(asLKFieldName(i)))) ' (SS,5/12/14) added CleanSQLStr
      If strReportTitle2 <> "" then strReportTitle2 = strReportTitle2 + ",&nbsp;&nbsp;"
      strReportTitle2 = strReportTitle2 + asLKPrompt(i) + ": " + Request.Form(asLKFieldName(i))
    End If
  Next

  If strReportTitle = "Hotel Guest Listing" Then
    ReportHotelGuestListing
  ' (SS,23/10/15) added IsAdmin so only admin user can see this report
  ElseIf strReportTitle = "Bookings with Credit Card Details" And IsAdmin Then
  	ReportBookingsWithCreditCardDetails
  ElseIf strReportTitle = "Guest Listing for All Hotels" Then
  	ReportGuestListingForAllHotels "", False ' (SS,8/2/16) added False not cancelled
  ' (SS,8/2/16) added following for show only cancelled bookings   
  ElseIf strReportTitle = "Cancelled Bookings" Then
  	ReportGuestListingForAllHotels "", True
  End If

End If
' --- END OF ACTUAL REPORT ---


End If 'If gbAuthenticated Then
%>
<!--#include file="footing.asp"-->