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

    File:         bes_show_srtprod.asp
    Description:  Details van een artikel
    Parameters:   srtprod_key

    Context:
    Note:

*/ %>

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

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

var srtprod_key  = getQParamInt("srtprod_key");

var authparams = user.checkAutorisation("WEB_BESMSU");

sql = "SELECT bes_srtprod_omschrijving,"
    + "       bes_srtprod_btw,"
    + "       bes_srtprod_eenheid,"
    + "       bes_srtprod_nr,"
    + "       prs_bedrijf_key,"
    + "       bes_srtprod_vervaldatum ,"
    + "       bes_srtprod_image,"
    + "       bes_srtprod_veelvoud,"
    + "       bes_srtprod_opmerking,"
    + "       bes_grootheid_getal,"
    + "       bes_srtprod_verwijder,"
    + "       bes_srtgroep_omschrijving,"
    + "       ins_discipline_omschrijving,"
    + "       bes_grootheid_naam"
    + "  FROM bes_srtprod d, bes_srtgroep g, ins_tab_discipline disc, bes_grootheid bg"
    + " WHERE g.ins_discipline_key = disc.ins_discipline_key"
    + "   AND d.bes_srtgroep_key = g.bes_srtgroep_key"
    + "   AND d.bes_grootheid_key = bg.bes_grootheid_key(+)"
    + "   AND d.bes_srtprod_key = " + srtprod_key

oRs = Oracle.Execute(sql);

var art = { srtprod_key: srtprod_key,
            srtgroep_oms: oRs("bes_srtgroep_omschrijving").Value,
            disc_oms: oRs("ins_discipline_omschrijving").Value,
            omschrijving: oRs("bes_srtprod_omschrijving").Value,
            btw: oRs("bes_srtprod_btw").Value,
            eenheid: oRs("bes_srtprod_eenheid").Value,
            grootheid_naam: oRs("bes_grootheid_naam").Value,
            grootheid_getal: oRs("bes_grootheid_getal").Value,
            nr: oRs("bes_srtprod_nr").Value,
            bedrijf_key: oRs("prs_bedrijf_key").Value,
            vervaldatum : oRs("bes_srtprod_vervaldatum").Value,
            image: oRs("bes_srtprod_image").Value,
            veelvoud: oRs("bes_srtprod_veelvoud").Value,
            opmerking: oRs("bes_srtprod_opmerking").Value,
            verwijder: oRs("bes_srtprod_verwijder").Value
        }

oRs.Close();
%>

<html>
  <head>
<%  FCLTHeader.Generate(); %>
    <script  type="text/javascript" >
      function bes_change()
      {
          if (FcltMgr.startEdit(window))
              window.location.href = "bes_edit_srtprod.asp?srtprod_key=<%=srtprod_key%>"
      }
      function bes_delete()
      {
         var srtprod_key = <%=srtprod_key%>;
         if (confirm(L("lcl_bes_del_srtprod")))
         {
           var data = { bes_srtprod_key: <%=srtprod_key%>
                      };
           <% protectRequest.dataToken("data"); %>
           $.post("bes_srtprod_delete.asp",
                  data,
                  FcltCallbackClose,
                  "json");
         }
      }
    </script>
  </head>
  <body id="showbody">
<%  var buttons = [];

    if (art.verwijder == null)
    {
      var buttons =  [ {title: L("lcl_change"), action:"bes_change()", icon: "wijzigen.png" },
                       {title: L("lcl_delete"), action:"bes_delete()", icon: "delete.png" } ];
    }
    IFRAMER_HEADER(L("lcl_bes_srtprod_frame"), buttons);
%>
    <div id="show">
<%    if (art.verwijder != null)
      {
%>      <div class="prs_deleted"><%=L("lcl_record_is_deleted")%></div><%
      }
%>
      <form name="u2" onSubmit="return false;">
<%      BLOCK_START("besArtikel", L("lcl_bes_srtprodblok"));

        ROFIELDTR("fld", L("lcl_bes_srtdeel_nr"), art.nr);
        ROFIELDTR("fld", L("lcl_bes_srtdeel_oms"), art.omschrijving);
        ROFIELDTR("fld", L("lcl_bes_discipline"), art.disc_oms);
        ROFIELDTR("fld", L("lcl_bes_srtgroup"), art.srtgroep_oms);
        ROFIELDTR("fld", L("lcl_bes_unity"), art.eenheid);
        ROFIELDTR("fld", L("lcl_bes_grootheidnorm"), art.grootheid_getal);
        ROFIELDTR("fld", L("lcl_bes_grootheid"), art.grootheid_naam);
        ROFIELDTR("fld", L("lcl_bes_image"), art.image, {suppressEmpty: true});

        BLOCK_END();

        BLOCK_START("besArtikelBestel", L("lcl_bes_srtdeelbestelblok"));
        FCLTbedrijfselector("lev_key", // supplier
                           "sg_lev",
                          { companyKey: art.bedrijf_key,
                            label: L("lcl_bes_producer"),
                            readonly: true,
                            suppressEmpty: true,
                            moreinfo: true
                          });

        ROFIELDTR("flddate", L("lcl_bes_vervaldatum"), toDateString(art.vervaldatum));
        ROFIELDTR("fldshort", L("lcl_bes_veelvoud"), art.veelvoud, {suppressEmpty: true});
        ROFIELDTR("fldshort", L("lcl_btw_percentage"), art.btw, {suppressEmpty: true});
        ROTEXTAREATR("fld", L("lcl_bes_opmerking"), art.opmerking, {suppressEmpty: true});
        BLOCK_END();
%>
      </form>
    </div>
  </body>
</html>
