<%@language = "javascript" %> <% /* $Revision$ $Id$ File: mld_kenmerk_search_list.asp (vroeger FacmgtVB/mld_kenmerkgrid.asp) Description: Vangt de parameters van mld_kenmerk_search op en verwerkt die tot een lijst Parameters: Context: Vanuit mld_kenmerk_search.asp Note: */ %> <% var searchtext = getQParam("searchtext", null); var srtdisc_key = getQParamInt("srtdisc_key", -1); var disc_key = getQParamInt("disc_key", -1); var stdm_key = getQParamInt("stdm", -1); var kenmerktype = getQParam("kenmerktype", null); var kenmerk_niveau = getQParam("niveau", null); var outputmode = getQParamInt("outputmode", 0); // 0 = screen, 1 = print, 2 = excel etc var showall = getQParamInt("showall", 0) == 1; var authparams = user.checkAutorisation("WEB_MLDMGT"); %>
<% FCLTHeader.Generate({outputmode: outputmode}); %>
<% if (stdm_key>0) { var sql = "SELECT ins_discipline_key," + " m2.ins_srtdiscipline_key" + " FROM mld_stdmelding md, mld_discipline m2" + " WHERE md.mld_ins_discipline_key = m2.ins_discipline_key" + " AND mld_stdmelding_key = " + stdm_key; var oRs = Oracle.Execute(sql); var dkey = oRs("ins_discipline_key").Value; var skey = oRs("ins_srtdiscipline_key").Value; } if (disc_key>0) { var sql = "SELECT m2.ins_srtdiscipline_key" + " FROM mld_discipline m2" + " WHERE m2.ins_discipline_key = " + disc_key; var oRs = Oracle.Execute(sql); var skey = oRs("ins_srtdiscipline_key").Value; } var sql = "SELECT mkm.mld_kenmerk_key," + " mkm.mld_kenmerk_niveau," + " mkm.mld_kenmerk_verplicht," + " mkm.mld_kenmerk_verplicht_status," + " mld_kenmerk_volgnummer," + " mld_kenmerk_groep," + " mld_srtkenmerk_omschrijving," + " mld_srtkenmerk_kenmerktype," + " mkm.mld_srtkenmerk_key," + " aantal," + " aantal365," + " (SELECT ins_srtdiscipline_omschrijving" // JGL: Ik houd niet van al deze inline selects maar anders + " FROM ins_srtdiscipline isd" // krijgen we meer outer-joins dan Oracle leuk vindt + " WHERE isd.ins_srtdiscipline_key = s.ins_srtdiscipline_key)" + " ins_srtdiscipline_omschrijving," + " (SELECT ins_srtdiscipline_prefix" + " FROM ins_srtdiscipline isd" + " WHERE isd.ins_srtdiscipline_key = s.ins_srtdiscipline_key)" + " ins_srtdiscipline_prefix," + " (SELECT ins_discipline_omschrijving" + " FROM mld_discipline md" + " WHERE md.ins_discipline_key = s.ins_discipline_key)" + " ins_discipline_omschrijving," + " (SELECT mld_stdmelding_omschrijving" + " FROM mld_stdmelding msm" + " WHERE msm.mld_stdmelding_key = s.mld_stdmelding_key)" + " mld_stdmelding_omschrijving" + " FROM mld_kenmerk mkm," + " mld_srtkenmerk msk," + " (SELECT 'S' mld_kenmerk_niveau," + " mld_stdmelding_key ref_mld_stdmelding_key," + " mld_stdmelding_key," + " ins_discipline_key," + " m2.ins_srtdiscipline_key" + " FROM mld_stdmelding md, mld_discipline m2" + " WHERE md.mld_ins_discipline_key = m2.ins_discipline_key" + " UNION ALL" + " SELECT 'D' mld_kenmerk_niveau," + " ins_discipline_key ref_mld_stdmelding_key," + " NULL mld_stdmelding_key," + " ins_discipline_key ins_discipline_key," + " ins_srtdiscipline_key" + " FROM mld_discipline m2" + " UNION ALL" + " SELECT 'T' mld_kenmerk_niveau," + " ins_srtdiscipline_key ref_mld_stdmelding_key," + " NULL mld_stdmelding_key," + " NULL ins_discipline_key," + " ins_srtdiscipline_key" + " FROM ins_srtdiscipline m2) s," + " (SELECT mld_kenmerk_key, count(*) aantal" + " FROM mld_kenmerkmelding" + " GROUP BY mld_kenmerk_key) nn," + " (SELECT mld_kenmerk_key, count(*) aantal365" + " FROM mld_kenmerkmelding" + " WHERE mld_kenmerkmelding_aanmaak > SYSDATE - 365" + " GROUP BY mld_kenmerk_key) nn365" + " WHERE mkm.mld_kenmerk_verwijder IS NULL" + " AND mkm.mld_stdmelding_key = ref_mld_stdmelding_key" + " AND mkm.mld_kenmerk_niveau = s.mld_kenmerk_niveau" + " AND mkm.mld_srtkenmerk_key = msk.mld_srtkenmerk_key" + " AND mkm.mld_kenmerk_key = nn.mld_kenmerk_key(+)" + " AND mkm.mld_kenmerk_key = nn365.mld_kenmerk_key(+)" + (srtdisc_key>0?" AND s.ins_srtdiscipline_key = " + srtdisc_key:"") + (disc_key>0?" AND (s.ins_discipline_key = " + disc_key + " OR ('T' = mkm.mld_kenmerk_niveau" + " AND s.ins_srtdiscipline_key = "+skey+"))":"") + (stdm_key>0?" AND (s.mld_stdmelding_key = " + stdm_key + " OR ('D' = mkm.mld_kenmerk_niveau" + " AND s.ins_discipline_key = "+dkey+")" + " OR ('T' = mkm.mld_kenmerk_niveau" + " AND s.ins_srtdiscipline_key = "+skey+"))":"") + (searchtext?" AND UPPER(mld_srtkenmerk_omschrijving) LIKE " + safe.quoted_sql_wild(searchtext + "%") :"") + (kenmerktype!="-1"?" AND mld_srtkenmerk_kenmerktype = " + safe.quoted_sql(kenmerktype) :"") + (kenmerk_niveau!="-1"?" AND mkm.mld_kenmerk_niveau = " + safe.quoted_sql(kenmerk_niveau) :"") + " ORDER BY ins_srtdiscipline_omschrijving," + " ins_discipline_omschrijving NULLS FIRST," + " mld_stdmelding_omschrijving NULLS FIRST," + " mld_kenmerk_volgnummer" function fnNiveau(oRs) { return { "S": L("lcl_complain"), "D": L("lcl_mld_vakgroep"), "T": L("lcl_mld_vakgroeptype") }[oRs("mld_kenmerk_niveau").Value]; } function fnKenmerkType(oRs) { return kenmerk.types[oRs("mld_srtkenmerk_kenmerktype").Value]; } function fnAantal(oRs) { var tp = oRs("mld_srtkenmerk_kenmerktype").Value; if (tp == "M" || tp == "L" || tp == "Q") return "" + L("lcl_not_available") + ""; return oRs("aantal").Value || 0; } function fnAantal365(oRs) { var tp = oRs("mld_srtkenmerk_kenmerktype").Value; if (tp == "M" || tp == "L" || tp == "Q") return "" + L("lcl_not_available") + ""; return oRs("aantal365").Value || 0; } function fnSoort(oRs) { return '' + safe.html(oRs("mld_srtkenmerk_omschrijving").Value) + ""; } function fnVerplicht(oRs) { var txt = []; var plicht = oRs("mld_kenmerk_verplicht").Value; var statusplicht = oRs("mld_kenmerk_verplicht_status").Value; if (plicht == 1) txt.push(L("lcl_mld_altijd_verplicht")); else if (plicht == 2) txt.push(L("lcl_mld_groepsverplichting")); if (statusplicht == 1) txt.push(L("lcl_mld_afgewezen")); else if (statusplicht == 5) txt.push(L("lcl_mld_afgemeld")); else if (statusplicht != null) txt.push("ONBEKEND" + statusplicht) return txt.join("\n"); } function fnGroep(oRs) { var groep = oRs("mld_kenmerk_groep").Value; if (!groep) return ""; return L("lcl_mld_kenmerk_groep") + " " + groep; } buttons = {}; //if (canAdd) { var addurl = "appl/mld/mld_kenmerk.asp?mode=edit" + "&niveau=" + (stdm_key > 0? "S" : safe.url(kenmerk_niveau)); addurl += buildTransitParam(["srtdisc_key", "disc_key", "stdm"]); buttons = [{ icon: "plus.png", title: L("lcl_add"), action: "FcltMgr.openDetail('" + addurl + "', '" + L("lcl_add") + "', {callback: FcltMgr.reload })" }] } var rst = new ResultsetTable({ sql: sql, keyColumn: "mld_kenmerk_key", ID: "mldkenmerktable", showAll: showall, outputmode: outputmode, title: L("lcl_mld_kenmerken"), buttons: buttons }); rst.addColumn(new Column({caption: "Key", content: "mld_kenmerk_key"})); rst.addColumn(new Column({caption: L("lcl_mld_vakgroeptype"), content: "ins_srtdiscipline_omschrijving"})); //rst.addColumn(new Column({caption: "ins_srtdiscipline_prefix", content: "ins_srtdiscipline_prefix"})); rst.addColumn(new Column({caption: L("lcl_mld_vakgroep"), content: "ins_discipline_omschrijving"})); rst.addColumn(new Column({caption: L("lcl_complain"), content: "mld_stdmelding_omschrijving"})); rst.addColumn(new Column({caption: L("lcl_mld_kenmerk_volgnummer"), content: "mld_kenmerk_volgnummer"})); rst.addColumn(new Column({caption: L("lcl_mld_kenmerk_groep"), content: fnGroep})); rst.addColumn(new Column({caption: L("lcl_mld_kenmerk_verplicht"), content: fnVerplicht})); rst.addColumn(new Column({caption: L("lcl_mld_srtkenmerk_omschrijving"), content: fnSoort})); rst.addColumn(new Column({caption: L("lcl_mld_srtkenmerk_kenmerktype"), content: fnKenmerkType})); rst.addColumn(new Column({caption: L("lcl_mld_kenmerk_niveau"), content: fnNiveau})); rst.addColumn(new Column({caption: L("lcl_mld_kenmerk_count"), content: fnAantal})); //rst.addColumn(new Column({caption: "L("lcl_aantal") jaar", content: fnAantal365})); rst.addAction({ action: "mkm_edit", caption: L("lcl_edit"), isDefault: true}); var cnt = rst.processResultset(); %>