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

    File:           alg_show_verdieping.asp
    Status:
    Description:
    Parameters:

    Context:
    Note:

*/ %>
<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/iface.inc" -->
<!-- #include file="../Shared/selector.inc" -->
<!-- #include file="../Shared/plaatsselector.inc" -->
<!-- #include file="alg_flexkenmerk.inc" -->
<!-- #include file="alg.inc" -->

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

var flr_key  = getQParamInt("flr_key");
var onrgoedlvl = "V";
var this_alg = alg.func_enabled(flr_key, onrgoedlvl);
user.auth_required_or_abort(this_alg.readman || this_alg.readuse);

var sql = " SELECT * "
        + "   FROM alg_verdieping "
        + "  WHERE alg_verdieping_key = " + flr_key;
var oRs = Oracle.Execute(sql);
var flr_omschr = oRs("alg_verdieping_omschrijving").value;
var flr_volgnr = oRs("alg_verdieping_volgnr").value;
var flr_code   = oRs("alg_verdieping_code").value;
var flr_deleted = oRs("alg_verdieping_verwijder").value != null;
var dienstniveau = oRs("mld_dienstniveau_key").value;
oRs.Close();
%>

<html>
  <head>
<%  FCLTHeader.Generate(); %>
    <script type="text/javascript">
      function flr_change()
      {
        if (FcltMgr.startEdit(window))
          window.location.href = "alg_edit_verdieping.asp?flr_key=<%=flr_key%>&embedded=1"
      }

      function flr_delete()
      {
        if (confirm(L("lcl_alg_del_txt_verdieping")))
        {
          var data = { key: <%=flr_key%>,
                       level: "V"
                     };
          <% protectRequest.dataToken("data"); %>
          $.post("alg_delete.asp",
                 data,
                 FcltCallbackClose,
                 "json");
        }
      }
    </script>
  </head>

  <body id="showbody">
<%  var buttons = [];
    if (!flr_deleted)
    {
      if (this_alg.writeman || this_alg.writeuse)
        buttons.push({title: L("lcl_change"), action:"flr_change()", icon: "wijzigen.png" });
      if (this_alg.writeman) // ALGMAN nodig
        buttons.push({title: L("lcl_delete"), action:"flr_delete()", icon: "delete.png" });
    }

    IFRAMER_HEADER(L("lcl_alg_verdieping_frame"), buttons);
%>
    <div id="show">
<%    if (flr_deleted)
      {
%>      <div class="alg_deleted"><%=L("lcl_record_is_deleted")%></div><%
      }
%>
      <form name=u2 onSubmit="return false;">
<%      BLOCK_START("algLoc1", "&nbsp;");
        FCLTplaatsselector(-1, {
                            verdiepingkey: flr_key,
                            startlevel: 2, //locatie
                            eindlevel: 4, // Verdieping
                            readonly: true });

        ROFIELDTR("fld", L("lcl_estate_verdieping_man_code"), flr_code);
        ROFIELDTR("fld", L("lcl_estate_verdieping_man_volgnr"), flr_volgnr);
        if (dienstniveau)
        {
            sql  = "SELECT   mld_dienstniveau_key, "
                 + lcl.xsqla("mld_dienstniveau_omschr", "mld_dienstniveau_key")
                 + "    FROM mld_dienstniveau "
                 + "   WHERE mld_dienstniveau_key = " + dienstniveau;
            oRs = Oracle.Execute(sql);
            ROFIELDTR("fld", L("lcl_mld_dienst_niveau"), oRs("mld_dienstniveau_omschr").value);
            oRs.Close();
        }        
        BLOCK_END();
        
        BLOCK_START("algLoc2", "&nbsp;");
          var calcopp = alg.calc_algm2(flr_key, onrgoedlvl); 
          ROFIELDTR("fld", L("lcl_estate_ruimte_bruto_vloeropp") + L("lcl_estate_calc_vloeropp"), calcopp.oppbruto, {suppressEmpty: true});
          ROFIELDTR("fld", L("lcl_estate_ruimte_opp_alt1") + L("lcl_estate_calc_vloeropp"), calcopp.oppalt1, {suppressEmpty: true});
          ROFIELDTR("fld", L("lcl_estate_ruimte_opp_alt2") + L("lcl_estate_calc_vloeropp"), calcopp.oppalt2, {suppressEmpty: true}); 
        BLOCK_END();

        generateFlexKenmerkBlock ({
           onrgoed_key    : flr_key,
           onrgoed_niveau : onrgoedlvl,
           reado          : true,
           flexcolumns    : S("alg_flexcolumns"),
           this_alg       : this_alg
        });
%>
      </form>
    </div>
  </body>
</html>
