<%@ LANGUAGE = JavaScript %>
<%  Server.ScriptTimeout=6000; %>
<% /*
     $Revision$
     $Id$

    File:               verwerken_form.asp
    Description:        Laat een willekeurig bestand verwerken
    Parameters:
        import_key      Importe key
    Context:            Vanuit imp_list
    Note:               Na verwerken sluiten we onzelf

*/
%>

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

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

var import_key = getQParamInt("import_key"); // Import key

// Heb ik rechten om te verwerken
var this_imp = imp.func_enabled_import(import_key);
user.auth_required_or_abort(this_imp.canWrite);

var sql = "SELECT fac_import_filenaam"
        + "     , fac_import_datum_gelezen"
        + "  FROM fac_import"
        + " WHERE fac_import_key = " + import_key;
var oRs = Oracle.Execute(sql);
var filename = oRs("fac_import_filenaam").Value;
var gelezen = new Date(oRs("fac_import_datum_gelezen"));
oRs.Close();
%>

<html>
  <head>
<%  FCLTHeader.Generate(); %>
    <script>
      function doSubmit()
      {
        document.getElementById("vraag_verwerken").innerHTML = L("lcl_imp_inf_process") + "<br>" + L("lcl_imp_please_wait");
        var data = { import_key: <%=import_key%>
                   };
        <% protectRequest.dataToken("data"); %>
        $.post("imp_verwerken.asp",
              data,
              FcltCallbackClose,
              "json");
        return true;
      }
      function doCancel()
      {
        FcltMgr.closeDetail(window, { cancel: true })
      }
    </script>
  </head>

  <body id="editbody">
    <form name="processForm" id="processForm">
<%    BLOCK_START("fileupload", L("lcl_imp_verwerk") + " " + L("lcl_imp_file").toLowerCase());%>
      <tr>
        <td id="vraag_verwerken">
          <%=L("lcl_imp_sure_process_data")%>
          <br><%=L("lcl_imp_file_name") + ": " + safe.html(filename)%>
          <br><%=L("lcl_imp_date_readin") + ": " + toDateTimeString(gelezen)%>
          <br>&nbsp;
        </td>
      </tr>
<%    BLOCK_END();
      var buttons = [];
      buttons.push({id: "doupload", title: L("lcl_imp_verwerk"), action: "doSubmit()", singlepress: true});
      buttons.push({id: "docancel", title: L("lcl_cancel"), action: "doCancel()"});
      CreateButtons(buttons);
IFACE.FORM_END();
%>
    </form>
  </body>
</html>
