<%@ language = "JavaScript" %> <% /* $Revision$ $Id$ File: fac_list.asp Description: Toont verplichtingen etc van user, Mobile version Parameters: - Context: Note: Dit is altijd Mijn Lijst */ %> <% var showall = getQParamInt("showall", 1) == 1; var urole = "fe"; var qrc = getQParamInt("qrc", 0) != 0; var subject = L("lcl_mobile_lopendezaken"); // TODO: Je denkt status.getresfostatustext(), maar res.inc hebben we sowieso al nodig function res_getfostatustext (p){ return res.getfostatustext(p); } function fncolLink(oRs, processParams) { var module = oRs.Fields("xmlnode").Value; if (module == "reservering" && processParams && processParams.disc_key) { var orghome = HTTP.urlzelf() + "/appl/pda/facilitor.asp"; var url = "../res/res_goto_extern.asp?res_disc_key=" + processParams.disc_key + "&deepurl=" + safe.url(oRs.Fields("deepurl").Value + "&orghome=" + orghome); } else // Gewoon intern var url = fncolLinkKey(module, oRs.Fields("item_key").Value); return url; }; // Ook te gebruiken met key=-1 voor nieuwe function fncolLinkKey(module, key) { var nurl = ""; switch (module) { case "melding": nurl = "../pda/melding.asp?mld_key=" + key; break; case "reservering": nurl = "../pda/reservering.asp?rsv_ruimte_key=" + key; break; case "bestelling": nurl = "../pda/bestelling.asp?bes_key=" + key; break; case "afspraak": nurl = "../pda/afspraak.asp?afs_key=" + key; break; } return nurl; }; function fncolHeader(oRs) { var module = oRs.Fields("xmlnode").Value; var txt= "??"; switch (module) { case "melding": txt = L("lcl_complain"); break; case "reservering": txt = L("lcl_reservation"); break; case "bestelling": txt = L("lcl_bes_bestelling"); break; case "afspraak": txt = L("lcl_vis_appointment"); break; } txt = oRs.Fields("item").Value; return safe.html(txt); }; %>
<% FCLTMHeader.Generate() %>
<% var xfunc = user.func_enabled("*", null, null, user_key); var modules = []; if (xfunc.canRead("WEB_MLDUSE")) modules.push({ xmlnode: 'melding', groupName: L("lcl_mobile_meldingen"), fnStatus: function (oRs) { return status.getmldstatustext(oRs.Fields("mld_melding_status").Value); }, fnSubheader: function (oRs) { return "
" + toDateTimeString(oRs.Fields("datum").Value, false, false, true) + "
" + (oRs.Fields("mld_melding_omschrijving").Value? "
" +safe.html(shorttxt(oRs.Fields("mld_melding_omschrijving").Value, S("rs_mobile_maxchar")))+"
" : ""); }, sql: "SELECT isd.ins_srtdiscipline_prefix || TO_CHAR (m.mld_melding_key) item, " + " m.mld_melding_key item_key, " + " 'melding' xmlnode, " + " m.mld_melding_einddatum datum, " + (S("mld_selector_mode") == 0 ? " " + lcl.xsql('id.ins_discipline_omschrijving', 'id.ins_discipline_key') + " detail, " : " " + lcl.xsql('sm.mld_stdmelding_omschrijving', 'sm.mld_stdmelding_key') + " detail, ") + " m.mld_melding_omschrijving, " + " m.mld_melding_status " + " FROM mld_melding m" + " , ins_srtdiscipline isd" + " , ins_tab_discipline id" + " , mld_stdmelding sm" + " , mld_statuses st" + " WHERE id.ins_srtdiscipline_key = isd.ins_srtdiscipline_key " + " AND sm.mld_ins_discipline_key = id.ins_discipline_key" + " AND m.mld_stdmelding_key = sm.mld_stdmelding_key" + " AND m.fac_activiteit_key IS NULL " + " AND (m.mld_workflowstep_key IS NULL OR mld_melding_start_key = mld_melding_key) " + " AND m.mld_melding_status IN (0, 2, 3, 4, 7) " + " AND st.mld_statuses_key = m.mld_melding_status " + " AND m.prs_perslid_key = " + user_key }); if (xfunc.canRead("WEB_BESUSE")) modules.push({ xmlnode: 'bestelling', groupName: L("lcl_FE_ordering"), fnStatus: function (oRs) { return status.getbesbestellingstatustext(oRs.Fields("bes_bestelling_status").Value); }, fnSubheader: function (oRs) { return "
" + toDateTimeString(oRs.Fields("bes_bestelling_leverdatum").Value, false, false, true) + "
"; }, sql: "SELECT TO_CHAR (bes_bestelling_key) item, " + " bes_bestelling_key item_key, " + " 'bestelling' xmlnode, " + " b.bes_bestelling_leverdatum, " + " (SELECT MIN (" + lcl.xsql('ins_discipline_omschrijving', 'ins_discipline_key') + ") " + " FROM bes_discipline " + " WHERE ins_discipline_key IN " + " (SELECT ins_discipline_key " + " FROM bes_srtgroep sg, bes_srtdeel sd, bes_bestelling_item bi " + " WHERE sd.bes_srtgroep_key = sg.bes_srtgroep_key " + " AND bi.bes_srtdeel_key = sd.bes_srtdeel_key " + " AND bi.bes_bestelling_key = b.bes_bestelling_key)) " + " detail, " + " b.bes_bestelling_status" + " FROM bes_bestelling b " + " WHERE b.bes_bestelling_status IN (5, 4, 3, 2) AND b.fac_activiteit_key IS NULL " + " AND (b.prs_perslid_key_voor = " + user_key + " OR b.prs_perslid_key = " + user_key + ")" }); if (xfunc.canRead("WEB_RESUSE")) modules.push({ xmlnode: 'reservering', groupName: L("lcl_mobile_reserveringen"), fnStatus: function (oRs) { return res_getfostatustext(oRs.Fields("status_key").Value); }, fnSubheader: function (oRs) { return "
" + toDateTimeString(oRs.Fields("datum").Value, false, false, true) + "
"; }, sql: "SELECT * FROM (" + "SELECT TO_CHAR (rr.res_reservering_key) || '/' || rr.res_rsv_ruimte_volgnr item, " + " rr.res_rsv_ruimte_key item_key, " + " 'reservering' xmlnode, " + " rr.res_rsv_ruimte_van datum, " + " COALESCE (rr.res_rsv_ruimte_omschrijving, (SELECT "+ lcl.xsql('ra.res_activiteit_omschrijving', 'res_activiteit_key') + " FROM res_activiteit ra " + " WHERE res_activiteit_key = rr.res_activiteit_key)) detail, " + " DECODE (res_rsv_ruimte_dirtlevel, 0, rr.res_status_fo_key, -1) status_key" + " FROM res_v_aanwezigrsv_ruimte rr " + " WHERE rr.res_status_bo_key IN (4, 3, 2, 7) " + " AND rr.res_rsv_ruimte_van >= TRUNC(SYSDATE) " + " AND (rr.res_rsv_ruimte_contact_key = " + user_key + " OR rr.res_rsv_ruimte_host_key = " + user_key + ")" + "UNION " // dirtlevel van de onderliggenden bepalen? + "SELECT TO_CHAR (rr.res_reservering_key) || '/' || rr.res_rsv_ruimte_volgnr, " + " rr.res_rsv_ruimte_key, " + " 'reservering', " + " rr.res_rsv_ruimte_van, " + " COALESCE (rr.res_rsv_ruimte_omschrijving, (SELECT "+ lcl.xsql('ra.res_activiteit_omschrijving', 'res_activiteit_key') + " FROM res_activiteit ra " + " WHERE res_activiteit_key = rr.res_activiteit_key)), " + " DECODE (res_rsv_ruimte_dirtlevel + res_rsv_deel_dirtlevel, 0, rr.res_status_fo_key, -1) " + " FROM res_v_aanwezigrsv_ruimte rr, res_v_aanwezigrsv_deel dd " + " WHERE rr.res_status_bo_key IS NULL AND dd.res_rsv_ruimte_key = rr.res_rsv_ruimte_key " + " AND rr.res_rsv_ruimte_van >= TRUNC(SYSDATE) " + " AND (rr.res_rsv_ruimte_contact_key = " + user_key + " OR rr.res_rsv_ruimte_host_key = " + user_key + ")" + "UNION " // dirtlevel van de onderliggenden bepalen? + "SELECT TO_CHAR (rr.res_reservering_key) || '/' || rr.res_rsv_ruimte_volgnr, " + " rr.res_rsv_ruimte_key, " + " 'reservering', " + " rr.res_rsv_ruimte_van, " + " COALESCE (rr.res_rsv_ruimte_omschrijving, (SELECT "+ lcl.xsql('ra.res_activiteit_omschrijving', 'res_activiteit_key') + " FROM res_activiteit ra " + " WHERE res_activiteit_key = rr.res_activiteit_key)), " + " DECODE (res_rsv_ruimte_dirtlevel + res_rsv_artikel_dirtlevel, 0, rr.res_status_fo_key, -1) " + " FROM res_v_aanwezigrsv_ruimte rr, res_v_aanwezigrsv_artikel dd " + " WHERE rr.res_status_bo_key IS NULL AND dd.res_rsv_ruimte_key = rr.res_rsv_ruimte_key " + " AND rr.res_rsv_ruimte_van >= TRUNC(SYSDATE) " + " AND (rr.res_rsv_ruimte_contact_key = " + user_key + " OR rr.res_rsv_ruimte_host_key = " + user_key + ")" + " ) ORDER by datum" }); if (xfunc.canRead("WEB_BEZUSE")) modules.push({ xmlnode: 'afspraak', groupName: L("lcl_mobile_bezoek"), fnStatus: function (oRs) { return oRs.Fields("done").Value == 2 ? fac.localstring('lcl_vis_inside_st') : ''; }, fnSubheader: function (oRs) { return "
" + toDateTimeString(oRs.Fields("datum").Value, false, false, true) + "
"; }, sql: "SELECT b.bez_afspraak_naam " + " || (CASE WHEN bez_afspraak_bedrijf IS NOT NULL THEN ' (' || bez_afspraak_bedrijf || ')' END) detail, " + " b.bez_afspraak_key item_key, " + " 'afspraak' xmlnode, " + " a.bez_afspraak_datum datum, " + " TO_CHAR (b.bez_afspraak_key) not_item, " + " TO_CHAR (b.bez_afspraak_key) item, " + " (CASE WHEN bez_bezoekers_done IS NOT NULL THEN 2 ELSE 1 END) done " + " FROM bez_bezoekers b, bez_afspraak a " + " WHERE b.bez_afspraak_key = a.bez_afspraak_key AND bez_bezoekers_out IS NULL " + " AND a.bez_afspraak_datum >= TRUNC(SYSDATE) " + " AND (a.bez_afspraak_contact_key = " + user_key + " OR a.bez_afspraak_host_key = " + user_key + ")" + " ORDER by bez_afspraak_datum" }); PAGE_START(); HEADER({title: subject, back:!qrc, home: !qrc, datatheme: jQFrontEndTheme }); CONTENT_START({datatheme: jQFrontEndTheme}); %>
<% for (module in modules) { var oRs = Oracle.Execute("SELECT COUNT(*) FROM ("+modules[module].sql+")"); // beetje bot maar het zijn toch heel snelle queries? var cnt = oRs(0).Value; oRs.Close(); var remotes = []; // Externe reserveringen er vast bijzoeken if (modules[module].xmlnode == "reservering") { var autfunction = "WEB_RESUSE"; var sql = res.getremotes_sql(autfunction); var oRs = Oracle.Execute(sql); // Als je hier weet dat er intern niks was zou je deze externe opties initieel opengeklapt willen? while( !oRs.eof ) { var url = oRs.Fields("res_disc_params_remoteurl").Value + "&API=RESINFO"; var xparams = { request: "user_lopend_info", prs_externId: customerId + "_" + String(user_key), mobile: true } var json = HTTP.getJSON(url, { data: xparams }); if (!json) { __DoLog("user_lopend_info is onverwacht geen Array bij opvragen van:", "#FF0000"); __DoLog(xparams); } else { var user_lopend_info = json.user_lopend_info; if (user_lopend_info.length) { remotes.push({disc_desc: oRs.Fields("ins_discipline_omschrijving").Value, disc_key: oRs.Fields("ins_discipline_key").Value, user_lopend_info: user_lopend_info }); cnt += user_lopend_info.length; } } oRs.MoveNext(); } oRs.close(); } // Om dit helemaal volgens de regels te doen (en de bubble te kunnen gebruiken) // moet dit in een list worden gevat volgens mij %>

## <%=modules[module].groupName %><%=cnt%>

<% // Toevoegen in deze versie alleen voor meldingen en afspraken // En omdat de huidige plaats wordt gebruikt moet die ook bekend zijn if (CurrentPosition && ( (xfunc.canWrite("WEB_MLDUSE") && modules[module].xmlnode == "melding") || (xfunc.canWrite("WEB_BEZUSE") && modules[module].xmlnode == "afspraak") || (xfunc.canWrite("WEB_RESUSE") && modules[module].xmlnode == "reservering") )) { BUTTON (L("lcl_add"), {linkid:fncolLinkKey(modules[module].xmlnode, -1), dataicon: "plus", dataajax: 'false'}); } var rst = new ResultsetTable({sql: modules[module].sql, keyColumn: "item_key", linkColumn: fncolLink, headerColumn: fncolHeader, detailColumn: "detail", asideColumn: modules[module].fnStatus, subheaderColumn: modules[module].fnSubheader || "datum", ID: "factable", showAll: true, noSearch: true }); var cnt = rst.processResultset(); if (modules[module].xmlnode == "reservering") // Externe reserveringen er bij slepen { for (var i in remotes) { %>
<%= L("lcl_res_extern_prefix") + Server.HTMLencode(remotes[i].disc_desc)%>
<% rst.buttons = []; rst.sql = null; rst.ID = "factable2"; rst.dataset = remotes[i].user_lopend_info; var cnt = rst.processResultset({ disc_key: remotes[i].disc_key }); %>
<% } } %>
<% } %>
<% CONTENT_END(); // Nu nog mijn recente berichten van max 2 dagen terug. De rest is vast irrelevant maar zoek die // desnoods zelf maar via menu-optie message_list. var sqlm = "SELECT m.web_user_mess_dsc" + ", sn.fac_srtnotificatie_url" + ", COALESCE(m.web_user_mess_action_params, ' ') web_user_mess_action_params" + ", m.web_user_mess_action_status" + ", m.web_user_mess_action_datum" + ", m.web_user_message_key" + ", web_user_mess_prioriteit" + ", sn.fac_srtnotificatie_xmlnode" + " FROM web_user_messages m, fac_srtnotificatie sn" + " WHERE (m.prs_perslid_key_receiver = " + user_key + " OR m.prs_perslid_key_receiver IS NULL) " // General messages + " AND sn.fac_srtnotificatie_key(+)=m.fac_srtnotificatie_key" + " AND TRUNC(m.web_user_mess_action_datum) > TRUNC(SYSDATE) - " + 2 + " ORDER BY m.web_user_mess_action_datum DESC, m.web_user_message_key DESC"; function fncolLinkM(oRs) { var action; if (oRs("fac_srtnotificatie_url").Value != null ) { action = "../../default.asp?u=" + oRs("fac_srtnotificatie_xmlnode").Value + "&k=" + oRs("web_user_mess_action_params").Value; action = action.replace(/\#/g, "&"); } return action; }; function fnUrgentieM(oRs) { var displ = ""; switch (oRs("web_user_mess_prioriteit").value) { case 1: displ = L("lcl_mld_urg_hoog1"); break; case 2: displ = ""; break; case 3: displ = L("lcl_mld_urg_laag1"); break; } return displ; } CONTENT_START(); var rst = new ResultsetTable({sql: sqlm, keyColumn: "web_user_message_key", linkColumn: fncolLinkM, headerColumn: "web_user_mess_dsc", detailColumn: "web_user_mess_action_datum", asideColumn: fnUrgentieM, ID: "messagestable", noSearch: true, showAll: true }); var cnt = rst.processResultset(); CONTENT_END(); FOOTER({datatheme: jQFrontEndTheme}); PAGE_END(); %>