<%@ LANGUAGE = JavaScript %>
<% /*
     $Revision$
     $Id$

    File:        kpn_search.asp
    Status:      95%

    Description:   Toont zoekvelden voor lijst van kostenplaatsen
    Parameters:
    Context:       Vanuit menu
    Note:
*/ %>

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

<%
FCLTHeader.Requires({ plugins:["jQuery"],
                      js: []
                    });

  var prs_key    = getQParamInt("prs_key", -1);
  var authparams = user.checkAutorisation("WEB_FINMSU", true);
%>
<html>
  <head>
<%  FCLTHeader.Generate(); %>
  </head>
  <body id="searchbody">
    <div id="search">
      <form name="u2" target="workFrame" action="kpn_search_list.asp" method="get">
<%    BLOCK_START("searchtable", L("lcl_filterblok"));%>
          <tr>
            <td class="label"><label for="descr"><%=L("lcl_prs_descr")%>:</label></td>
            <td><input type="text" class="fldsrch" name="descr"></td>
          </tr>
          <tr>
            <td class="label"><label for="descr"><%=L("lcl_prs_dept_name")%>:</label></td>
            <td><input type="text" class="fldsrch" name="name"></td>
          </tr>
               <% sql =  "SELECT DISTINCT p.prs_perslid_key"
                      + "              , " + S("prs_pers_string")
                      + "            FROM prs_kostenplaats pk"
                      + "               , prs_perslid p"
                      + "           WHERE pk.prs_perslid_key = p.prs_perslid_key"
                      + "              AND prs_kostenplaats_verwijder IS NULL"
                      + (!(authparams && authparams.ALGreadlevel)
                        ? "           AND pk.prs_perslid_key = " + user_key
                        : "")
                      + " UNION "
                      + "SELECT DISTINCT p.prs_perslid_key"
                      + "              , " + S("prs_pers_string")
                      + "           FROM prs_kostenplaats pk"
                      + "              , prs_kostenplaatsgrp pkg"
                      + "              , prs_perslid p"
                      + "          WHERE pk.prs_perslid_key = p.prs_perslid_key"
                      + "            AND prs_kostenplaats_verwijder IS NULL"
                      + "            AND pk.prs_kostenplaatsgrp_key = pkg.prs_kostenplaatsgrp_key"
                      + (!(authparams && authparams.ALGreadlevel)
                        ? "          AND pkg.prs_perslid_key = " + user_key
                        : "")
                      + "       ORDER BY 2"

                  FCLTselector("budgeth", sql,
                    {  label: L("lcl_prs_budgethouder"),
                       emptyOption: "",
                       whenEmpty: L("lcl_search_generic"),
                       selectjustone: !(authparams && authparams.ALGreadlevel)
                    });
                  sql =  "SELECT prs_kostenplaatsgrp_key"
                      + "      , prs_kostenplaatsgrp_oms"
                      + "   FROM prs_kostenplaatsgrp"
                      + " ORDER BY 2 ";

                  FCLTselector("kstplgr", sql,
                    {  label: L("lcl_prs_kostenpl_group"),
                       emptyOption: "",
                       whenEmpty: L("lcl_search_generic")
                    });
                %>
<%    BLOCK_END();
  var buttons =  [ {title: L("lcl_search"), action:"document.forms.u2.submit();", id:"bSearch" }];
  CreateButtons(buttons, { entersubmit: true });
%>
      </form>
    </div>
    <div id="result">
      <iframe width="100%" height="100%"
              src="../Shared/empty.asp"
              name="workFrame" id="workFrame"
              onload='FcltMgr.iframeLoaded(this)'
              frameborder="0" scrolling="no">
      </iframe>
    </div>
  </body>
</html>
