<%@ language = "JavaScript" %> <% Server.ScriptTimeout=6000; %> <% /* $Revision$ $Id$ File: fac_anonimize_list.asp Description: Toont van elke module het aantal te anonimeren records. Parameters: module: filtert het resultaat (BEZ, PRS etc) Context: Requires: WEB_PRSSYS autorisatie Note: */ %> <% var showall = getQParamInt("showall", 0) == 1; var outputmode = getQParamInt("outputmode", 0); var startdatum = new Date(1); // Periode van (Startdatum is dan 1970. Bij doorgeven verwacht getFParamDate "startdatum > 0", daarom 1) var einddatum = getQParamDate("einddatum"); // Perdiode tot var autfunction = "WEB_PRSSYS"; var authparams = user.checkAutorisation(autfunction); FCLTHeader.Requires({ plugins: ["jQuery"] }) %>
<% FCLTHeader.Generate({outputmode: outputmode}) %>
<% var sql; var sqln = []; // Tijdelijk uitschakelen van het anonimiseren van BES i.v.m. trage onderstaande query die ook in de ANO package wordt gebruikt. // Sinds 05-02-2025 actief. sql = "SELECT 'BES' module" + " , " + safe.quoted_sql(L("lcl_bes_bestellingen")) + " onderdeel" + " , COUNT(b.bes_bestelling_key) aantal" + " FROM bes_bestelling b" + " WHERE (SELECT MAX(ft.fac_tracking_datum)" + " FROM fac_tracking ft" + " WHERE ft.fac_tracking_refkey = b.bes_bestelling_key" + " AND ft.fac_srtnotificatie_key IN (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_xmlnode = 'bestelling'" //+ " AND fac_srtnotificatie_code != 'BESANO'" // Vervangen door "fac_srtnotificatie_key != key" hieronder. Blijkt veel sneller te zijn. + " AND fac_srtnotificatie_key != (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_code = 'BESANO')" + " )) BETWEEN " + startdatum.beginToSQL() + " AND " + einddatum.endToSQL() + " AND b.bes_bestelling_status IN (1, 6, 7, 8)" + " AND NOT EXISTS (SELECT ft.fac_tracking_key" + " FROM fac_tracking ft" + " WHERE ft.fac_tracking_refkey = b.bes_bestelling_key" + " AND ft.fac_srtnotificatie_key = (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_code = 'BESANO'))"; sqln.push(sql); sql = "SELECT 'BEZ' module" + " , " + safe.quoted_sql(L("lcl_bez_appointments")) + " onderdeel" + " , COUNT(bez_afspraak_key) aantal" + " FROM bez_afspraak" + " WHERE bez_afspraak_datum BETWEEN " + startdatum.beginToSQL() + " AND " + einddatum.endToSQL() + " AND NOT EXISTS" + " (SELECT ft.fac_tracking_key" + " FROM fac_tracking ft" + " WHERE ft.fac_tracking_refkey = bez_afspraak_key" + " AND ft.fac_srtnotificatie_key = (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_code = 'BEZANO'))"; sqln.push(sql); sql = "SELECT 'FIN' module" + " , " + safe.quoted_sql(L("lcl_fin_invoices")) + " onderdeel" + " , COUNT(f.fin_factuur_key) aantal" + " FROM fin_factuur f" + " WHERE (SELECT MAX(ft.fac_tracking_datum)" + " FROM fac_tracking ft" + " WHERE ft.fac_tracking_refkey = f.fin_factuur_key" + " AND ft.fac_srtnotificatie_key IN (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_xmlnode = 'factuur'" + " AND fac_srtnotificatie_key != (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_code = 'FINANO')" + " )) BETWEEN " + startdatum.beginToSQL() + " AND " + einddatum.endToSQL() + " AND f.fin_factuur_statuses_key IN (1, 7)" + " AND NOT EXISTS" + " (SELECT ft.fac_tracking_key" + " FROM fac_tracking ft" + " WHERE ft.fac_tracking_refkey = f.fin_factuur_key" + " AND ft.fac_srtnotificatie_key = (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_code = 'FINANO'))"; sqln.push(sql); // Tijdelijk uitschakelen van het anonimiseren van MLD i.v.m. trage onderstaande query die ook in de ANO package wordt gebruikt. // Sinds 21-03-2019 actief. sql = "SELECT 'MLD' module" + " , " + safe.quoted_sql(L("lcl_mld_meldingen")) + " onderdeel" + " , COUNT(m.mld_melding_key) aantal" + " FROM mld_melding m" + " WHERE (SELECT MAX(ft.fac_tracking_datum)" + " FROM fac_tracking ft" + " WHERE ft.fac_tracking_refkey = m.mld_melding_key" + " AND ft.fac_srtnotificatie_key IN (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_xmlnode = 'melding'" //+ " AND fac_srtnotificatie_code != 'MLDANO'" // Vervangen door "fac_srtnotificatie_key != key" hieronder. Blijkt veel sneller te zijn. + " AND fac_srtnotificatie_key != (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_code = 'MLDANO')" + " )) BETWEEN " + startdatum.beginToSQL() + " AND " + einddatum.endToSQL() + " AND m.mld_melding_status IN (1, 6)" + " AND NOT EXISTS (SELECT ft.fac_tracking_key" + " FROM fac_tracking ft" + " WHERE ft.fac_tracking_refkey = m.mld_melding_key" + " AND ft.fac_srtnotificatie_key = (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_code = 'MLDANO'))"; sqln.push(sql); sql = "SELECT 'PRS' module" + " , " + safe.quoted_sql(L("lcl_prs_persons")) + " onderdeel" + " , COUNT(p.prs_perslid_key) aantal" + " FROM prs_perslid p" + " WHERE p.prs_perslid_verwijder IS NOT NULL" + " AND p.prs_perslid_verwijder BETWEEN " + startdatum.beginToSQL() + " AND " + einddatum.endToSQL() + " AND NOT EXISTS (SELECT ft.fac_tracking_key" + " FROM fac_tracking ft" + " WHERE ft.fac_tracking_refkey = p.prs_perslid_key" + " AND ft.fac_srtnotificatie_key = (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_code = 'PRSANO'))"; sqln.push(sql); sql = "SELECT 'RES' module" + " , " + safe.quoted_sql(L("lcl_res_reservation")) + " onderdeel" + " , COUNT(r.res_rsv_ruimte_key) aantal" + " FROM res_rsv_ruimte r" + " WHERE (SELECT MAX(ft.fac_tracking_datum)" + " FROM fac_tracking ft" + " WHERE ft.fac_tracking_refkey = r.res_rsv_ruimte_key" + " AND ft.fac_srtnotificatie_key IN (SELECT nk.fac_srtnotificatie_key" + " FROM fac_srtnotificatie nk" + " WHERE nk.fac_srtnotificatie_xmlnode = 'reservering'" + " AND nk.fac_srtnotificatie_key != (SELECT nc.fac_srtnotificatie_key" + " FROM fac_srtnotificatie nc" + " WHERE nc.fac_srtnotificatie_code = 'RESANO'" + " )" + " )" + " ) BETWEEN " + startdatum.beginToSQL() + " AND " + einddatum.endToSQL() + " AND ( r.res_status_bo_key IN (5,6)" + " OR r.res_rsv_ruimte_verwijder IS NOT NULL" + " )" + " AND NOT EXISTS (SELECT ft.fac_tracking_key" + " FROM fac_tracking ft" + " WHERE ft.fac_tracking_refkey = r.res_rsv_ruimte_key" + " AND ft.fac_srtnotificatie_key = (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_code = 'RESANO'))"; sqln.push(sql); var currentWeekDay = new Date().getDay(); var lessDays = currentWeekDay == 0 ? 6 : currentWeekDay - 1; var startdatumweek = new Date(new Date().getTime() - (1000 * 60 * 60 * 24 * lessDays)); sql = "SELECT module" + " , onderdeel" + " , aantal" + " , (SELECT COUNT(ft.fac_tracking_key)" + " FROM fac_tracking ft" + " WHERE ft.fac_tracking_datum BETWEEN " + startdatumweek.beginToSQL() + " AND " + new Date().endToSQL() + " AND ft.fac_srtnotificatie_key = (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_code = (module || 'ANO'))) anonimized_thisweek" + " , (SELECT COUNT(ft.fac_tracking_key)" + " FROM fac_tracking ft" + " WHERE ft.fac_srtnotificatie_key = (SELECT fac_srtnotificatie_key" + " FROM fac_srtnotificatie" + " WHERE fac_srtnotificatie_code = (module || 'ANO'))) anonimized_total" + " FROM (" + sqln.join(" UNION ") + ")"; function fncolaantal(oRs) { return oRs("aantal").Value != null? oRs("aantal").Value : 0; } var rst = new ResultsetTable({ sql: sql, keyColumn: "module", ID: "memorizetable", title : L("lcl_fac_anonymize"), showAll: showall, outputmode: outputmode }); rst.addColumn(new Column({caption: L("lcl_fac_module"), content: "module"})); rst.addColumn(new Column({caption: L("lcl_fac_component"), content: "onderdeel"})); rst.addColumn(new Column({caption: L("lcl_fac_toanonymize"), content: fncolaantal, datatype: "number"})); rst.addColumn(new Column({caption: L("lcl_fac_anonymized"), content: "anonimized_total", datatype: "number"})); rst.addColumn(new Column({caption: L("lcl_fac_thisweek"), content: "anonimized_thisweek", datatype: "number"})); rst.addAction({action: "mld_anonymize", caption: L("mgt_kenmerk_systeem_ano"), multi: true, multiOnce: true}); var cnt = rst.processResultset(); %>
<% ASPPAGE_END(); %>