<%@ language = "JavaScript" %> <% /* $Revision$ $Id$ Description: Statistics mbt vastgoed en harde faciliteiten Is als een soort actueel jaaroverzicht van de assets Gaat er van uitdat er "netjes" geconfigureerd is, en anders is dit een incentive om dat te doen. Werkt dan ook als een soort verify. Je komt bijvoorbeeld te specifieke groeperingen constateren bij de srtgebouw en srtruimte Is onafhankelijk van organsatie(structuur), het zijn zuiver harde, fysieke assets Uitzondering voor de reserveerare zaken, die dubbelen met het fysieke maar geven een beeld van de dienstverlening. Kan ongetwijfeld nog uitgebreid worden en eigenlijk nog een paar verse lcl's */ %> <% FCLTHeader.Requires({ plugins:["jQuery"], js: ["jquery-ui.js"] }); %>
<% FCLTHeader.Generate(); var autfunction = "WEB_PRSSYS"; // of later WEB_ALGMSU? var authparams = user.checkAutorisation(autfunction); facts = new Array; function add2facts (oRs) { while (!oRs.eof) { facts.push({id: oRs("id").value, lbl: oRs("lbl").value, cnt: oRs("val").value, det: oRs("det").value}) oRs.moveNext(); } } %>
<% SUBFRAME_START(); // Gebouwen var sql = "SELECT 1 id, "+safe.quoted_sql(L('frm_alggebouwframe'))+" lbl, COUNT (*) val, SUM (alg_gebouw_bruto_vloeropp) det" + " FROM alg_gebouw " + " WHERE alg_gebouw_verwijder IS NULL " + " AND (alg_gebouw_vervaldatum IS NULL OR alg_gebouw_vervaldatum > SYSDATE)"; var oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = " SELECT 1 id, '> '||" + lcl.xsql ('s.alg_srtgebouw_omschrijving', 's.alg_srtgebouw_key') + " lbl, COUNT (*) val, SUM (g.alg_gebouw_bruto_vloeropp) det " + " FROM alg_gebouw g, alg_srtgebouw s " + " WHERE s.alg_srtgebouw_key(+) = g.alg_srtgebouw_key " + " AND g.alg_gebouw_verwijder IS NULL " + " AND (alg_gebouw_vervaldatum IS NULL OR alg_gebouw_vervaldatum > SYSDATE) " + "GROUP BY s.alg_srtgebouw_omschrijving " + "ORDER BY 3 desc, 2 "; oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = "SELECT 1 id, "+safe.quoted_sql(L('lcl_alg_fmstats_nrloc'))+" lbl, COUNT (*) val, '' det" + " FROM (SELECT DISTINCT alg_locatie_plaats " + " FROM alg_locatie l " + " WHERE l.alg_locatie_verwijder IS NULL " + " AND (alg_locatie_vervaldatum IS NULL OR alg_locatie_vervaldatum > SYSDATE)" + " AND EXISTS (SELECT '' FROM alg_gebouw g WHERE g.alg_locatie_key = l.alg_locatie_key" + " AND g.alg_gebouw_verwijder IS NULL " + " AND (alg_gebouw_vervaldatum IS NULL OR alg_gebouw_vervaldatum > SYSDATE)))"; oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); // Terreinen sql = "SELECT 2 id, "+safe.quoted_sql(L('frm_algterreinframe'))+" lbl, COUNT (*) val, SUM (alg_terreinsector_oppervlak) det" + " FROM alg_terreinsector " + " WHERE alg_terreinsector_verwijder IS NULL " + " AND (alg_terreinsector_vervaldatum IS NULL OR alg_terreinsector_vervaldatum > SYSDATE)"; oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = " SELECT 2 id, '> '||" + lcl.xsql ('s.alg_srtterreinsec_omschrijving', 's.alg_srtterreinsector_key') + " lbl, COUNT (*) val, SUM (t.alg_terreinsector_oppervlak) det " + " FROM alg_terreinsector t, alg_srtterreinsector s " + " WHERE s.alg_srtterreinsector_key(+) = t.alg_srtterreinsector_key " + " AND t.alg_terreinsector_verwijder IS NULL " + " AND (alg_terreinsector_vervaldatum IS NULL OR alg_terreinsector_vervaldatum > SYSDATE) " + "GROUP BY s.alg_srtterreinsec_omschrijving " + "ORDER BY 3 desc, 2 "; oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = "SELECT 2 id, "+safe.quoted_sql(L('lcl_alg_fmstats_nrloc'))+" lbl, COUNT (*) val, '' det" + " FROM (SELECT DISTINCT alg_locatie_plaats " + " FROM alg_locatie l " + " WHERE l.alg_locatie_verwijder IS NULL " + " AND (alg_locatie_vervaldatum IS NULL OR alg_locatie_vervaldatum > SYSDATE)" + " AND EXISTS (SELECT '' FROM alg_terreinsector g WHERE g.alg_locatie_key = l.alg_locatie_key" + " AND g.alg_terreinsector_verwijder IS NULL " + " AND (alg_terreinsector_vervaldatum IS NULL OR alg_terreinsector_vervaldatum > SYSDATE)))"; oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); // Ruimtes sql = "SELECT 3 id, "+safe.quoted_sql(L('frm_algruimteframe'))+" lbl, COUNT (*) val, SUM (alg_ruimte_bruto_vloeropp) det " + " FROM alg_ruimte " + " WHERE alg_ruimte_verwijder IS NULL"; oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = " SELECT 3 id, '> '||" + lcl.xsql ('s.alg_srtruimte_omschrijving', 's.alg_srtruimte_key') + " lbl, COUNT (*) val, SUM (r.alg_ruimte_bruto_vloeropp) det " + " FROM alg_ruimte r, alg_srtruimte s " + " WHERE s.alg_srtruimte_key(+) = r.alg_srtruimte_key " + " AND r.alg_ruimte_verwijder IS NULL " + "GROUP BY s.alg_srtruimte_omschrijving " + "ORDER BY 3 desc, 2 "; oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); // Niet reserveerbare assets sql0 = "SELECT {0} id, " // 1 query voor beide + " '{2}' lbl, " + " COUNT (*) val, " + " '' det " + " FROM ins_deel i, ins_srtdeel sd " + " WHERE i.ins_deel_verwijder IS NULL " + " AND i.ins_srtdeel_key = sd.ins_srtdeel_key" + " AND sd.ins_srtdeel_verwijder IS NULL " + " AND (i.ins_deel_vervaldatum IS NULL OR i.ins_deel_vervaldatum > SYSDATE) " + " AND sd.ins_srtdeel_sensortype {1}" // 1 query voor beide + " AND NOT EXISTS " + " (SELECT '' " + " FROM res_deel r " + " WHERE res_deel_verwijder IS NULL " + " AND (res_deel_vervaldatum IS NULL OR res_deel_vervaldatum > SYSDATE) " + " AND r.res_ins_deel_key = i.ins_deel_key) "; sql1 = "SELECT {0} id, '> ' || ins_discipline_omschrijving lbl, COUNT (*) val, '' det " + " FROM ins_deel i, ins_discipline rd, ins_srtdeel sd " + " WHERE i.ins_discipline_key = rd.ins_discipline_key " + " AND i.ins_deel_verwijder IS NULL " + " AND sd.ins_srtdeel_verwijder IS NULL " + " AND i.ins_srtdeel_key = sd.ins_srtdeel_key" + " AND sd.ins_srtdeel_sensortype {1}" + " AND ins_discipline_verwijder IS NULL " + " AND (i.ins_deel_vervaldatum IS NULL OR i.ins_deel_vervaldatum > SYSDATE) " + " AND NOT EXISTS " + " (SELECT '' " + " FROM res_deel r " + " WHERE res_deel_verwijder IS NULL " + " AND (res_deel_vervaldatum IS NULL OR res_deel_vervaldatum > SYSDATE) " + " AND r.res_ins_deel_key = i.ins_deel_key) " + "GROUP BY ins_discipline_omschrijving " + "ORDER BY 3 DESC, 2 "; sql = sql0.format(4, '= 0', L('lcl_alg_fmstats_assets')); oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = sql1.format(4, '= 0'); oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = sql0.format(5, '<> 0', L('lcl_alg_fmstats_sensors')); oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = sql1.format(5, '<> 0'); oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); // Reserveerbare ruimtes (reken maar na :-)) sql = "SELECT 6 id," + " 'Reserveerbare ruimtes' lbl," + " COUNT (*) val," + " SUM (r.alg_ruimte_bruto_vloeropp) det" + " FROM alg_ruimte r" + " WHERE r.alg_ruimte_verwijder IS NULL" + " AND r.alg_ruimte_key IN (SELECT alg_ruimte_key" + " FROM res_alg_ruimte rag, res_ruimte rr" + " WHERE res_alg_ruimte_verwijder IS NULL" + " AND rr.res_ruimte_key = rag.res_ruimte_key" + " AND (rr.res_ruimte_startdatum IS NULL OR rr.res_ruimte_startdatum <= SYSDATE)" + " AND (rr.res_ruimte_vervaldatum IS NULL OR rr.res_ruimte_vervaldatum > SYSDATE)" + " )" + " ORDER BY 3 DESC, 2"; oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = "SELECT 6 id," + " '> ' || ins_discipline_omschrijving lbl," + " COUNT (*) val," + " SUM (r.alg_ruimte_bruto_vloeropp) det" + " FROM alg_ruimte r," + " res_ruimte rr," + " res_discipline rd," + " res_alg_ruimte rag" + " WHERE rr.res_discipline_key = rd.ins_discipline_key" + " AND r.alg_ruimte_verwijder IS NULL" + " AND rd.ins_discipline_verwijder IS NULL" + " AND rag.res_ruimte_key = rr.res_ruimte_key" + " AND rag.alg_ruimte_key = r.alg_ruimte_key" + " AND rag.res_alg_ruimte_verwijder IS NULL" + " AND rr.res_ruimte_verwijder IS NULL" + " AND (rr.res_ruimte_startdatum IS NULL OR rr.res_ruimte_startdatum <= SYSDATE)" + " AND (rr.res_ruimte_vervaldatum IS NULL OR rr.res_ruimte_vervaldatum > SYSDATE)" + " GROUP BY ins_discipline_omschrijving" + " ORDER BY 3 DESC, 2"; oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); //Reserveerbare faciliteiten var sql0 = "SELECT {0} id, '{2}' lbl, COUNT (*) val, '' det " + " FROM ins_deel i " + " WHERE i.ins_deel_verwijder IS NULL " + " AND EXISTS " + " (SELECT ins_deel_key " + " FROM res_deel r, res_discipline rd " + " WHERE res_deel_verwijder IS NULL " + " AND r.res_discipline_key = rd.ins_discipline_key " + " AND ins_discipline_min_level = {1} " + " AND (res_deel_vervaldatum IS NULL OR res_deel_vervaldatum > SYSDATE) " + " AND r.res_ins_deel_key = i.ins_deel_key) "; // ins_discipline_min_level /* 1; Reserveerbaar object; 2; Verbruiksartikel; 3; Ruimte 4; Personenresource; 5; Werkplek;*/ var sql1 = "SELECT {0} id, '> ' || ins_discipline_omschrijving lbl, COUNT (*) val, '' det " + " FROM res_deel rr, res_discipline rd " + " WHERE rr.res_discipline_key = rd.ins_discipline_key " + " AND rr.res_deel_verwijder IS NULL " + " AND ins_discipline_min_level = {1} " + " AND ins_discipline_verwijder IS NULL " + " AND (rr.res_deel_vervaldatum IS NULL OR rr.res_deel_vervaldatum > SYSDATE) " + "GROUP BY ins_discipline_omschrijving " + "ORDER BY 3 DESC, 2 "; sql = sql0.format(7, '1', L('lcl_res_objcat')); oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = sql1.format(7, '1'); oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = sql0.format(8, '4', L('lcl_res_persons')); oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = sql1.format(8, '4'); oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = sql0.format(9, '5', L('lcl_res_wpcat')); oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = sql1.format(9, '5'); oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); // Werkplekken sql = " SELECT 10 id, "+safe.quoted_sql(L('frm_wplistframe'))+" lbl, COUNT (*) val, '' det " + " FROM prs_werkplek wp, " + " alg_ruimte r, " + " alg_verdieping v, " + " alg_gebouw g, " + " alg_locatie l " + " WHERE prs_werkplek_virtueel = 0 " + " AND r.alg_ruimte_key = wp.prs_alg_ruimte_key " + " AND r.alg_verdieping_key = v.alg_verdieping_key " + " AND v.alg_gebouw_key = g.alg_gebouw_key " + " AND g.alg_locatie_key = l.alg_locatie_key " + " AND g.alg_gebouw_verwijder IS NULL " + " AND v.alg_verdieping_verwijder IS NULL " + " AND r.alg_ruimte_verwijder IS NULL " + " AND (alg_gebouw_vervaldatum IS NULL OR alg_gebouw_vervaldatum > SYSDATE) "; oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); sql = " SELECT 10 id, '> ' || l.alg_locatie_plaats lbl, COUNT (*) val, '' det" + " FROM prs_werkplek wp, " + " alg_ruimte r, " + " alg_verdieping v, " + " alg_gebouw g, " + " alg_locatie l " + " WHERE prs_werkplek_virtueel = 0 " + " AND r.alg_ruimte_key = wp.prs_alg_ruimte_key " + " AND r.alg_verdieping_key = v.alg_verdieping_key " + " AND v.alg_gebouw_key = g.alg_gebouw_key " + " AND g.alg_locatie_key = l.alg_locatie_key " + " AND g.alg_gebouw_verwijder IS NULL " + " AND v.alg_verdieping_verwijder IS NULL " + " AND r.alg_ruimte_verwijder IS NULL " + " AND (alg_gebouw_vervaldatum IS NULL OR alg_gebouw_vervaldatum > SYSDATE) " + "GROUP BY l.alg_locatie_plaats " + "ORDER BY 3 DESC, 2 "; oRs = Oracle.Execute(sql); add2facts (oRs); oRs.Close(); var buttons = []; IFRAMER_HEADER(L("lcl_alg_fmstats")+" / "+L("lcl_estate_ruimte_bruto_vloeropp"), buttons); %> <% var i = 0; var currid = 1; // Luiheid en eenmaligheid is de reden om dit niet met een loopje te doen, verschillen alleen in icon en presentatie van det(ails). // Zou ze best collapsible willen, maar dat werkt alleen nog maar voor flexkenmerkblokken; ingeklapt kan wel, maar dan kun je niet meer uitklappen. BLOCK_START("fm1", facts[i].lbl+" "+safe.showFloat(facts[i].cnt,0) + " / " + safe.showFloat(facts[i].det||'-',0)+ " m2", {icon: "fa-building"}); i+=1; for (i=i; i<facts.length; i++) { if (facts[i].id && facts[i].id != currid) { currid += 1; break; } ROFIELDTR("fld", facts[i].lbl, safe.showFloat(facts[i].cnt,0) + (facts[i].det ? (" / " + safe.showFloat(facts[i].det||'-',0) + " m2") : "")); } BLOCK_END(); BLOCK_START("fm2", facts[i].lbl+" "+safe.showFloat(facts[i].cnt,0) + " / " + safe.showFloat(facts[i].det||'-',0)+ " m2", {icon: "fa-layer-group"}); i+=1; for (i=i; i<facts.length; i++) { if (facts[i].id && facts[i].id != currid) { currid += 1; break; } ROFIELDTR("fld", facts[i].lbl, safe.showFloat(facts[i].cnt,0) + (facts[i].det ? (" / " + safe.showFloat(facts[i].det||'-',0) + " m2") : "")); } BLOCK_END(); BLOCK_START("fm3", facts[i].lbl+" "+safe.showFloat(facts[i].cnt,0) + " / " + safe.showFloat(facts[i].det||'-',0)+ " m2", {icon: "fa-map-marker-alt"}); i+=1; for (i=i; i<facts.length; i++) { if (facts[i].id && facts[i].id != currid) { currid += 1; break; } ROFIELDTR("fld", facts[i].lbl, safe.showFloat(facts[i].cnt,0) + (facts[i].det ? (" / " + safe.showFloat(facts[i].det||'-',0) + " m2") : "")); } BLOCK_END(); BLOCK_START("fm4", facts[i].lbl+" "+safe.showFloat(facts[i].cnt,0), {icon: "fa-cubes"}); i+=1; for (i=i; i<facts.length; i++) { if (facts[i].id && facts[i].id != currid) { currid += 1; break; } ROFIELDTR("fld", facts[i].lbl, safe.showFloat(facts[i].cnt,0) ); } BLOCK_END(); BLOCK_START("fm5", facts[i].lbl+" "+safe.showFloat(facts[i].cnt,0), {icon: "fa-sensor"}); i+=1; for (i=i; i<facts.length; i++) { if (facts[i].id && facts[i].id != currid) { currid += 1; break; } ROFIELDTR("fld", facts[i].lbl, safe.showFloat(facts[i].cnt,0) ); } BLOCK_END(); BLOCK_START("fm6", facts[i].lbl+" "+safe.showFloat(facts[i].cnt,0) + " / " + safe.showFloat(facts[i].det||'-',0)+ " m2", {icon: "fa-users"}); i+=1; for (i=i; i<facts.length; i++) { if (facts[i].id && facts[i].id != currid) { currid += 1; break; } ROFIELDTR("fld", facts[i].lbl, safe.showFloat(facts[i].cnt,0) + (facts[i].det ? (" / " + safe.showFloat(facts[i].det||'-',0) + " m2") : "")); } BLOCK_END(); BLOCK_START("fm7", facts[i].lbl+" "+safe.showFloat(facts[i].cnt,0), {icon: "fa-projector"}); i+=1; for (i=i; i<facts.length; i++) { if (facts[i].id && facts[i].id != currid) { currid += 1; break; } ROFIELDTR("fld", facts[i].lbl, safe.showFloat(facts[i].cnt,0) ); } BLOCK_END(); BLOCK_START("fm8", facts[i].lbl+" "+safe.showFloat(facts[i].cnt,0), {icon: "fa-user"}); i+=1; for (i=i; i<facts.length; i++) { if (facts[i].id && facts[i].id != currid) { currid += 1; break; } ROFIELDTR("fld", facts[i].lbl, safe.showFloat(facts[i].cnt,0) ); } BLOCK_END(); BLOCK_START("fm9", facts[i].lbl+" "+safe.showFloat(facts[i].cnt,0), {icon: "fa-desktop"}); i+=1; for (i=i; i<facts.length; i++) { if (facts[i].id && facts[i].id != currid) { currid += 1; break; } ROFIELDTR("fld", facts[i].lbl, safe.showFloat(facts[i].cnt,0) ); } BLOCK_END(); BLOCK_START("fm10", facts[i].lbl+" "+safe.showFloat(facts[i].cnt,0), {icon: "fa-chair-office"}); i+=1; for (i=i; i<facts.length; i++) { if (facts[i].id && facts[i].id != currid) { currid += 1; break; } ROFIELDTR("fld", facts[i].lbl, safe.showFloat(facts[i].cnt,0) ); } BLOCK_END(); %> <% SUBFRAME_END(); %>
<% ASPPAGE_END(); %>