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

    File:               imp_search_rap.asp
    Description:        Filterscherm voor overzicht importrapportages
    Parameters:
       import_key       Import key
    Context:            Aangeroepen vanuit importfunctie overzicht
    Note:
*/
%>

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

<%
// "jquery-ui.js" als js toevoegen. Bij de meeste xxx_search.asp bestanden gebeurd dit al automatisch door de "kenmerk" plugin. Anders o.a. $.dialog() onbekend bij acties in overzicht
FCLTHeader.Requires({ plugins:["jQuery"],
                      js: ["jquery-ui.js"]
                    });

var import_key = getQParamInt("import_key"); // Importfunctiekey

var sql  = "SELECT fac_import_app_code, fac_import_app_oms, fac_import_datum_gelezen, fac_import_datum_verwerkt, fac_import_filenaam"
         + ", (SELECT " + S("prs_pers_string")
         + "     FROM prs_perslid p"
         + "    WHERE p.prs_perslid_key = i.prs_perslid_key) uitvoerder"
         + " FROM fac_import_app ia"
         + "    , fac_import i"
         + " WHERE ia.fac_import_app_key = i.fac_import_app_key"
         + "   AND i.fac_import_key = " + import_key;
var oRs = Oracle.Execute(sql);
var importcode = oRs("fac_import_app_code").value;
var import_app_oms = oRs("fac_import_app_oms").value;
var import_datum_gelezen = oRs("fac_import_datum_gelezen").value;
var import_datum_verwerkt = oRs("fac_import_datum_verwerkt").value;
var import_filenaam = oRs("fac_import_filenaam").value;
var import_uitvoerder = oRs("uitvoerder").value;

// Heb ik rechten om rapportage te zien
var this_imp = imp.func_enabled_import(import_key);
user.auth_required_or_abort(this_imp.canReadAny);
%>

<html>
  <head>
<%  FCLTHeader.Generate() %>
    <script type="text/javascript">
      $(function () // We doen autostart
        {
            $('#rapfilter_str>option').prop('selected','true');
            imp_submit();
        });
      function imp_submit()
      {
        document.forms.u2.submit();
      }
    </script>
  </head>

  <body id="searchbody">
    <div id="search">
      <form name="u2" target="workFrame" action="imp_search_list_rap.asp" method="get">
        <input type="hidden" name="import_key" value="<%=import_key%>">
<%    BLOCK_START("searchtable", L("lcl_filterblok"));%>
        <tr>
          <td class="searchkolom1"><!-- start column 1 -->
            <table><!-- x rijen, 2 kolommen: label + veld -->
<%          ROFIELDTR("fld", L("lcl_imp_app_code"), importcode);
            ROFIELDTR("fld", L("lcl_imp_app_oms"), import_app_oms);
            ROFIELDTR("fld", L("lcl_imp_date_readin"), toDateTimeString(import_datum_gelezen));
            ROFIELDTR("fld", L("lcl_imp_file_name"), import_filenaam);
            ROFIELDTR("fld", L("lcl_imp_date_processed"), toDateTimeString(import_datum_verwerkt));
            ROFIELDTR("fld", L("lcl_imp_import_by"), import_uitvoerder);

            <!-- Filter rapportage -->
            sql = "SELECT 'I', " + safe.qL("lcl_imp_rap_i") + ", 1 FROM DUAL"
                + " UNION SELECT 'E', " + safe.qL("lcl_imp_rap_e") + ", 2 FROM DUAL"
                + " UNION SELECT 'S', " + safe.qL("lcl_imp_rap_s") + ", 3 FROM DUAL"
                + " UNION SELECT 'W', " + safe.qL("lcl_imp_rap_w") + ", 4 FROM DUAL"
                + " ORDER BY 3";
            FCLTselector("rapfilter_str",
                         sql,
                         { label: L("lcl_imp_rap_berichten"),
                           trclass:"primsearch",
                           multi: true,
                           size: 4
                         });

            RWFIELDTR("searchtext", "fld", L("lcl_search_diff_fields"), "");
            %>
            </table>
          </td><!-- end column 1 -->

          <!-- Second column -->
          <td valign=top>
            <table>
            </table>
          </td><!-- end column 2-->
        </tr>
<%    BLOCK_END();
      buttons = [{ title: L("lcl_search"), action: "imp_submit()" }];
      CreateButtons(buttons);
%>
      </form>
    </div> <!-- search -->

    <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>
