<%@ language = "JavaScript" %>
<% /*
    $Revision$
    $Id$

    File:               wp_list.asp
    Description:        List of objects (Mobile version)
    Parameters:         ins_key (bv via QRC)
    Note:               CONCEPTUAL


*/ %>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/discx3d.inc" -->
<!-- #include file="./resultset_table.inc" -->
<!-- #include file="./mobile.inc" -->
<!-- #include file="./iface.inc" -->

<html>
<head>
<% FCLTMHeader.Generate({}); %>
</head>
<%
  var locatie_key = getQParamInt("locatie_key", user.alg_locatie_key({withcurrent:true})); // Locatie
  var gebouw_key = getQParamInt("gebouw_key", user.alg_gebouw_key({withcurrent:true})); // Gebouw, kan -1 zijn, dan niet gebruiken
  var verdieping_key = getQParamInt("verdieping_key", user.alg_verdieping_key({withcurrent:true}));

  var ins_key = getQParamInt("ins_key", -1);
  var ruimte_key = getQParamInt("ruimte_key", -1);

  var ins_key = getQParamInt("ins_key", "");

  var qrc = getQParamInt("qrc", 0) != 0;

%><body><%
    PAGE_START()
    HEADER({title: L("lcl_mobile_werkplekken"), back: false, home: !qrc});
    CONTENT_START();

    function fncolLink(oRs)
    {
      if (oRs("prs_werkplek_type").Value != 1) // geen flexplek
        return "";

      return "../pda/prs_claimwp.asp?noecho=0&wp_key=" + oRs("prs_werkplek_key").Value
    };

    function fncolHeader(oRs)
    {
        return safe.html(oRs("prs_werkplek_omschrijving").Value || "") + " "
                + (oRs("prs_werkplek_type").Value == 0 ? L("lcl_wptype_0") : L("lcl_wptype_1"));
    };

  var sql =   "SELECT   p.prs_werkplek_key, "
       + "         p.alg_ruimte_key, "
       + "         p.alg_verdieping_key, "
       + "         p.alg_gebouw_key, "
       + "         p.alg_locatie_key, "
       + "         p.alg_gebouw_code "
       + "         || '-' "
       + "         || p.alg_verdieping_code "
       + "         || '-' "
       + "         || p.alg_ruimte_nr samengesteld, "
       + "         p.alg_verdieping_code, "
       + "         p.alg_ruimte_nr, "
       + "         p.prs_werkplek_volgnr, "
       + "         p.prs_werkplek_omschrijving, "
       + "         CASE COALESCE (w.prs_werkplek_vastopp, -1) "
       + "            WHEN -1 "
       + "               THEN 'nee' "
       + "            ELSE 'ja' "
       + "         END decode_vastopp, "
       + "         p.prs_werkplek_opp, "
       + "         w.prs_werkplek_type, "  /* 0=vast, 1=flex, 2=tbd*/
       + "         p.prs_perslidwerkplek_bezetting, "
       + "         p.prs_afd_perslid_naam "
       + "    FROM prs_v_perslidwerkplek_gegevens p, "
       + "         alg_locatie l, "
       + "         prs_werkplek w "
       + "   WHERE p.alg_locatie_key = l.alg_locatie_key "
       + "     AND w.prs_werkplek_key = p.prs_werkplek_key "
       + "     AND w.prs_werkplek_virtueel = 0"
       + (gebouw_key > -1     ? " AND p.alg_gebouw_key = " + gebouw_key : "")
       + (verdieping_key > -1 ? " AND p.alg_verdieping_key = " + verdieping_key : "")
       + (ruimte_key > -1     ? " AND p.alg_ruimte_key = " + ruimte_key : "")
       + " ORDER BY prs_werkplek_omschrijving,prs_afd_perslid_naam";

    var rst = new ResultsetTable({sql: sql,
                                   linkColumn: fncolLink,
                                   headerColumn: fncolHeader,
                                   detailColumn: "prs_afd_perslid_naam",
                                   //asideColumn: fnAside,
                                   subheaderColumn: "samengesteld",
                                   ID: "wptable",
                                   showAll: true
                                  });

    var cnt = rst.processResultset();

    CONTENT_END();
    FOOTER();
    PAGE_END();
PDA_PAGE_END(); %>
	</body>
</html>
<% ASPPAGE_END(); %>
