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

    File:           fac_show_adres.asp)
    Description:    edit detailed information of an adres

    Parameters:     adr_key

    Context:
    Note:

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

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

var autfunction = "WEB_ALGMSU";
  var authparams = user.checkAutorisation(autfunction);

var adr_key = getQParamInt("adr_key");
var alg_loc_key = -1;

var sql,oRs;
if (adr_key > -1)
{
 sql = "SELECT mld_adres_contactpers_bureau, "
     + "       mld_adres_telefoon, "
     + "       mld_adres_fax, "
     + "       mld_adres_naam, "
     + "       mld_adres_bezoek_adres, "
     + "       mld_adres_bezoek_postcode, "
     + "       mld_adres_bezoek_plaats, "
     + "       mld_adres_bezoek_land, "
     + "       mld_adres_post_adres, "
     + "       mld_adres_gebouw_ruimte, "
     + "       mld_adres_post_postcode, "
     + "       mld_adres_post_plaats, "
     + "       mld_adres_post_land, "
     + "       mld_adres_contactpersoon, "
     + "       mld_adres_contactpers_telefoon, "
     + "       mld_adres_contactpers_fax, "
     + "       mld_adres_factuuradres, "
     + "       mld_adres_opdrachtadres, "
     + "       mld_adres_afleveradres, "
     + "       alg_locatie_key "
     + "  FROM mld_adres "
     + " WHERE mld_adres_key = " + adr_key;

oRs=Oracle.Execute(sql);

  var mld_adr_cnt_bur   = oRs("mld_adres_contactpers_bureau").Value;
  var mld_adr_tel       = oRs("mld_adres_telefoon").Value;
  var mld_adr_fax       = oRs("mld_adres_fax").Value;
  var mld_adr_nm        = oRs("mld_adres_naam").Value;
  var mld_adr_bez_adr   = oRs("mld_adres_bezoek_adres").Value;
  var mld_adr_bez_pcd   = oRs("mld_adres_bezoek_postcode").value;
  var mld_adr_bez_pla   = oRs("mld_adres_bezoek_plaats").Value;
  var mld_adr_bez_lnd   = oRs("mld_adres_bezoek_land").Value;
  var mld_adr_pst_adr   = oRs("mld_adres_post_adres").Value;
  var mld_adr_geb_rui   = oRs("mld_adres_gebouw_ruimte").value;
  var mld_adr_pst_pcd   = oRs("mld_adres_post_postcode").Value;
  var mld_adr_pst_pla   = oRs("mld_adres_post_plaats").Value;
  var mld_adr_pst_lnd   = oRs("mld_adres_post_land").Value;
  var mld_adr_cnt_prs   = oRs("mld_adres_contactpersoon").Value;
  var mld_adr_cnt_tel   = oRs("mld_adres_contactpers_telefoon").Value;
  var mld_adr_cnt_fax   = oRs("mld_adres_contactpers_fax").Value;
  var mld_adr_fac_adr   = oRs("mld_adres_factuuradres").Value;
  var mld_adr_opd_adr   = oRs("mld_adres_opdrachtadres").Value;
  var mld_adr_afl_adr   = oRs("mld_adres_afleveradres").Value;
  var alg_loc_key       = oRs("alg_locatie_key").Value;

oRs.close();

oRs = Oracle.Execute(sql);
}
%>

<html>
<head>
<%
   FCLTHeader.Generate();
%>
<script type="text/javascript">
    function fac_submit()
    {
        document.activeElement.blur(); // trigger laatste onChanges
        if (!validateForm("u2"))
            return false;
        document.forms.u2.submit();
    }

    function fac_cancel()
    {
        FcltMgr.closeDetail(window, { cancel: true } );
    }
</script>

</head>
<body id="editbody">
<%
  var buttons =  [ {title: L("lcl_submit"), action:"fac_submit()", icon: "opslaan.png" },
                   {title: L("lcl_cancel"), action:"fac_cancel()", icon: "undo.png" }];

  IFRAMER_HEADER(L("lcl_adres_frame_algemeen"), buttons);
%>
<div id="edit">
<form name="u2"
      action="fac_edit_adres_save.asp?adr_key=<%=adr_key%>"
      method="post"
      target="hidFrameSubmit"
      onSubmit="job_submit();">
<%
BLOCK_START("facAlg", L("lcl_fac_adres_nawblock"));
  FCLTplaatsselector( authparams.ALGreadlevel,{ locatiekey: alg_loc_key,
                        startlevel: 2,
                        eindlevel: 2,
                        readonly: false,
                        whenEmpty: L("lcl_search_generic")
                      });

  RWFIELDTR("mld_adr_nm",           "fld",          L("lcl_prs_address_naam"),   mld_adr_nm, {maxlength: 60, required: true});
  RWFIELDTR("mld_adr_geb_rui",      "fld",          L("lcl_prs_address_gebouw_ruimte"),   mld_adr_geb_rui, {maxlength: 30});
  RWFIELDTR("mld_adr_bez_adr",      "fld",          L("lcl_prs_address_bezoek_adres"),   mld_adr_bez_adr, {maxlength: 50});
  RWFIELDTR("mld_adr_bez_pcd",      "fld",          L("lcl_prs_address_bezoek_postcode"),   mld_adr_bez_pcd, {maxlength: 12});
  RWFIELDTR("mld_adr_bez_pla",      "fld",          L("lcl_prs_address_bezoek_plaats"),   mld_adr_bez_pla, {maxlength: 30});
  RWFIELDTR("mld_adr_bez_lnd",      "fld",          L("lcl_prs_address_bezoek_land"),   mld_adr_bez_lnd, {maxlength: 30});
  RWFIELDTR("mld_adr_tel",          "fld",          L("lcl_prs_address_phone"),   mld_adr_tel, {maxlength: 15});
  RWFIELDTR("mld_adr_fax",          "fld",          L("lcl_prs_address_fax"),   mld_adr_fax, {maxlength: 15});
  %>
  <tr>
    <td class="label"><label><%=L("lcl_prs_address_factuuradres")%>:</label></td>
    <td><% CHECKBOX("fldalgbez", "mld_adr_fac_adr", mld_adr_fac_adr==1) %></td>
  </tr>
  <tr>
    <td class="label"><label><%=L("lcl_prs_address_opdrachtadres")%>:</label></td>
    <td><% CHECKBOX("fldalgbez", "mld_adr_opd_adr", mld_adr_opd_adr==1) %></td>
  </tr>
  <tr>
    <td class="label"><label><%=L("lcl_prs_address_afleveradres")%>:</label></td>
    <td><% CHECKBOX("fldalgbez", "mld_adr_afl_adr", mld_adr_afl_adr==1) %></td>
  </tr>
  <%
BLOCK_END();

BLOCK_START("facBez", L("lcl_fac_adres_postblock"));
  RWFIELDTR("mld_adr_pst_adr",  "fld",          L("lcl_prs_address_post_adres"),   mld_adr_pst_adr, {maxlength: 50});
  RWFIELDTR("mld_adr_pst_pcd",  "fld",          L("lcl_prs_address_post_postcode"),   mld_adr_pst_pcd, {maxlength: 12});
  RWFIELDTR("mld_adr_pst_pla",  "fld",          L("lcl_prs_address_post_plaats"),   mld_adr_pst_pla, {maxlength: 30});
  RWFIELDTR("mld_adr_pst_lnd",  "fld",          L("lcl_prs_address_post_land"),   mld_adr_pst_lnd, {maxlength: 30});
BLOCK_END();

BLOCK_START("facCnt", L("lcl_prs_bedrijf_contactblock"));
  RWFIELDTR("mld_adr_cnt_prs",  "fld",          L("lcl_prs_address_contact_person"),   mld_adr_cnt_prs, {maxlength: 30});
  RWFIELDTR("mld_adr_cnt_tel",  "fld",          L("lcl_prs_address_contact_telefoon"),   mld_adr_cnt_tel, {maxlength: 15});
  RWFIELDTR("mld_adr_cnt_fax",  "fld",          L("lcl_prs_address_contact_fax"),   mld_adr_cnt_fax, {maxlength: 15});
  RWFIELDTR("mld_adr_cnt_bur",  "fld",          L("lcl_prs_address_contact_bureau"),   mld_adr_cnt_bur, {maxlength: 20});
BLOCK_END();
IFACE.FORM_END();
%>
</form>
<iframe src="../Shared/empty.html" name="hidFrameSubmit" style="display:none"></iframe>
</div>
</body>
</html>
