<%@ language = "JavaScript" %>
<% /*
    $Revision$
    $Modtime: 0 $
    File:               res_infobord.asp
    Description:        A deeplink call to display information on the infobord
    Parameters:
        gebouw              gebouw: the code of the building. Optional parameter
    Context:
    Note:
*/ %>

<%
Response.Expires = 0;
Session("customerId") = 'DEMO';
Session("user_key") = 28421;
%>

<!-- #include file="../../../appl/Shared/common.inc" -->

<html>
  <head>
<%  // specific params needed to find the reservation which has to be deleted
    var refreshrate = getQParamInt("refreshrate", -1);
    var gebouw      = getQParam("gebouw", "leeg");

    // find the key of the building
    var alg_gebouw_key = -1;
    sql = "SELECT alg_gebouw_key"
        + " FROM alg_v_aanweziggebouw g"
        + " WHERE alg_gebouw_upper = UPPER(" + safe.quoted_sql(gebouw) + ")";
    oRs = Oracle.Execute(sql);
    if (!oRs.eof)
    {
      alg_gebouw_key = oRs(0).value;
    }

    // find the key of the usr_report
    var fac_usrrap_key = -1;
    sql = "SELECT fac_usrrap_key"
        + " FROM fac_usrrap ur"
        + " WHERE UPPER(fac_usrrap_view_name) = 'CURS_V_INFO_LOC_OVERZICHT'";
    oRs = Oracle.Execute(sql);
    if (!oRs.eof)
    {
      fac_usrrap_key = oRs(0).value;
    }

    var params = "";
    if (gebouw != "leeg")
      params += "&fclt_f_colname1=alg_gebouw_key&fclt_f_colvalue1=" + alg_gebouw_key;
%>
  </head>

  <body leftmargin=0 topmargin=0 onLoad="Loaded();">
    <script language="javascript">
      function Loaded()
      {
<%      if (fac_usrrap_key == -1 || (alg_gebouw_key == -1 && gebouw != "leeg"))
        { %>
          alert ("rapport of gebouw kan niet gevonden worden");
<%      }
        else
        { %>
          var s = "../../../appl/fac/fac_usrrap_infobord.asp?rap_key=<%=fac_usrrap_key%><%=params%>&refreshrate=<%=refreshrate%>";
          window.location.href = s;
<%      } %>
      }
    </script>
  </body>
</html>
