<%@language = "javascript" %>
<%
/*  $Revision$
    Modtime: 06-10-2009 $

    File:           prs_show_contactpersoon.asp
    Status:         60%
    Description:
    Parameters:     cps_key (required)

    Context:
*/ %>
<!--#include file="../Shared/common.inc" -->
<!--#include file="../Shared/iface.inc" -->
<!--#include file="../Shared/persoonselector.inc" -->
<!--#include file="prs_flexkenmerk.inc" -->

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

  var cps_key  = getQParamInt("cps_key");
  var autfunction = 'WEB_RELUSE';
  var authparams = user.checkAutorisation(autfunction);

   sql = "SELECT c.prs_contactpersoon_key, "
       + "       c.prs_bedrijf_key, "
       + "       prs_bedrijf_naam, "
       + "       prs_contactpersoon_aanhef, "
       + "       prs_contactpersoon_voorletters, "
       + "       prs_contactpersoon_naam, "
       + "       prs_contactpersoon_voornaam, "
       + "       prs_contactpersoon_tussenv, "
       + "       prs_contactpersoon_functie, "
       + "       prs_contactpersoon_titel, "
       + "       prs_contactpersoon_telefoon_1, "
       + "       prs_contactpersoon_telefoon_2, "
       + "       prs_contactpersoon_fax, "
       + "       prs_contactpersoon_email, "
       + "       prs_contactpersoon_opmerking, "
       + "       prs_contactpersoon_uurloon, "
       + "       c.prs_perslid_key, "
       + "       c.prs_contactpersoon_verwijder"
       + "  FROM prs_contactpersoon c, "
       + "       prs_bedrijf b "
       + " WHERE b.prs_bedrijf_key = c.prs_bedrijf_key AND prs_contactpersoon_key = " + cps_key

    oRs = Oracle.Execute(sql);

      var prs_bdrkey = oRs("prs_bedrijf_key").value;
      var prs_bdrnm  = oRs("prs_bedrijf_naam").value;
      var prs_aanh   = oRs("prs_contactpersoon_aanhef").value;
      var prs_voorl  = oRs("prs_contactpersoon_voorletters").value;
      var prs_naam   = oRs("prs_contactpersoon_naam").value;
      var prs_vrnaam = oRs("prs_contactpersoon_voornaam").value;
      var prs_tsnvgs = oRs("prs_contactpersoon_tussenv").value;
      var prs_func   = oRs("prs_contactpersoon_functie").value;
      var prs_titel  = oRs("prs_contactpersoon_titel").value;
      var prs_tel1   = oRs("prs_contactpersoon_telefoon_1").value;
      var prs_tel2   = oRs("prs_contactpersoon_telefoon_2").value;
      var prs_fax    = oRs("prs_contactpersoon_fax").value;
      var prs_email  = oRs("prs_contactpersoon_email").value;
      var prs_opm    = oRs("prs_contactpersoon_opmerking").value;
      var prs_loon   = oRs("prs_contactpersoon_uurloon").value;
      var prs_prskey = oRs("prs_perslid_key").value;
      var prs_verwijder = oRs("prs_contactpersoon_verwijder").value;

    oRs.Close();
%>
<html>
<head>
<%
   FCLTHeader.Generate();
   // var xfunc = user.func_enabled("*", null, null, cps_key); TODO: kritisch naar kijken, moet dit voor contactpersonen?
%>
<script  type="text/javascript">
    function cps_change()
    {
        if (FcltMgr.startEdit(window))
            window.location.href = "prs_edit_contactpersoon.asp?cps_key=<%=cps_key%>"
    }
    function cps_delete()
    {
        if (confirm(L("lcl_prs_del_txt_contactpers")))
        {
            var data = { key: <%=cps_key%>
                       , level: "C"
                       };
            <% protectRequest.dataToken("data"); %>
            $.post("prs_delete.asp",
                   data,
                   FcltCallbackClose,
                   "json");
        }
    }
    function cps_locations()
    {
        var url = "../prs/prscontactlocs.asp?ckey=<%=cps_key%>";
        FcltMgr.openModalDetail(url, "<%=L("lcl_prs_companies_dienst_locs")%>");
    }
</script>
</head>

<body id="showbody">
<%
  var buttons = [];

  if (authparams.ALGwritelevel < 9 && prs_verwijder == null)
  {
    buttons =  [ {title: L("lcl_change"), action:"cps_change()", icon: "wijzigen.png" },
                 {title: L("lcl_delete"), action:"cps_delete()", icon: "delete.png" },
                 {title: L("lcl_prs_companies_dienst_locs"), action: "cps_locations()", icon: "house.png"}];
  }
IFRAMER_HEADER(L("lcl_prs_contactpersoon_frame"), buttons);
if (prs_verwijder != null)
{
%>      <div class="prs_deleted"><%=L("lcl_record_is_deleted")%></div><%
}
%>
<div id="show">
<form name=u2>
<%
BLOCK_START("prsPerslid", L("lcl_prs_basisblok"));
 var params = { infoPointer: { Url: "appl/prs/prs_bedrijf.asp?bedrijf_key=" + prs_bdrkey,
                          Title: prs_bdrnm }};

    ROFIELDTR("fld", L("lcl_prs_companies_name"), prs_bdrnm, params);
    FCLTpersoonselector("prs_prskey",
                        "prs_prskey",
                        { label: L("lcl_person"),
                          perslidKey: prs_prskey,
                          filtercode: "",
                          whenEmpty: L("lcl_search_generic"),
                          moreinfo: true,
                          info: 'PRS',
                          readonly: true,
                          suppressEmpty: true
                        });
    ROFIELDTR("fld", L("lcl_prs_companies_contact_naam"), prs_naam, {suppressEmpty:true});
    ROFIELDTR("fldshort", L("lcl_prs_companies_contact_tussenv"), prs_tsnvgs, {suppressEmpty:true});
    ROFIELDTR("fldshort", L("lcl_prs_companies_contact_voorl"), prs_voorl, {suppressEmpty:true});
    ROFIELDTR("fld", L("lcl_prs_companies_contact_voorn"), prs_vrnaam, {suppressEmpty:true});
    ROFIELDTR("fld", L("lcl_prs_companies_contact_aanhef"), prs_aanh, {suppressEmpty:true});
    ROFIELDTR("fldshort", L("lcl_prs_companies_contact_titel"), prs_titel, {suppressEmpty:true});
    ROFIELDTR("fld", L("lcl_prs_companies_contact_functie"), prs_func, {suppressEmpty:true});
    ROFIELDTR("fld", L("lcl_prs_companies_contact_tel1"), prs_tel1, {suppressEmpty:true});
    ROFIELDTR("fld", L("lcl_prs_companies_contact_tel2"), prs_tel2, {suppressEmpty:true});
    ROFIELDTR("fld", L("lcl_prs_companies_contact_fax1"), prs_fax, {suppressEmpty:true});
    AFIELDTR('fldmailto details', L("lcl_prs_companies_contact_email"), "mailto:" + prs_email, prs_email, { suppressEmpty: true });
    ROTEXTAREATR("fldtxt", L("lcl_prs_companies_contact_opm"), prs_opm, {id: "prs_opm", suppressEmpty: true});
    ROFIELDTR("fldshort", L("lcl_prs_companies_uurloon"), prs_loon, {suppressEmpty: true});
BLOCK_END();
BLOCK_START("prsFlex"+(S("prs_flexcolumns")!=1?"2":""), L("lcl_prs_flexblok"));
  generateFlexKenmerkCode ({
     link_key   : cps_key,
     niveau     : "C",
     reado      : true,
     flexcolumns: S("prs_flexcolumns")
});

BLOCK_END();
%>
</form>
</div>
</body>
</html>
