<%@ LANGUAGE="JavaScript" %> <% /* $Revision$ $Id$ File: deelwerk_list.asp Description: Overzichtslijst urenverantwoording voor haltemedewerkers voor een specifieke week Parameters: Context: Note: */ %> <% FCLTHeader.Set({root: "../../../appl/"}); %> <% var mld_disc_stoppingplace = 1001; // discipine key stopping-places FCLTHeader.Requires({ js: ["../../../Cust/CONN/deelwerk/deelwerk_list.js"], css: ["./deelwerk.css"], lcl: ["MLD"] }); var urole = getQParamSafe("urole", "fe"); var fronto = urole == "fo"; var backo = urole == "bo"; var minfo = urole == "mi"; var frontend = (!fronto & !backo & !minfo); var autfunction = "WEB_INSUSE"; // alleen plaats (PRS) afhankelijk en niet organisatie (ALG) afhankelijk var authparams = user.checkAutorisation(autfunction, true); var OBJUSE_read = (authparams.ALGreadlevel < 9); var OBJUSE_write = (authparams.ALGwritelevel < 9); user.auth_required_or_abort(OBJUSE_read || OBJUSE_write); var reado = true; if (OBJUSE_write) reado = false; var outputmode = getQParamInt("outputmode", 0); var showall = getQParamInt("showall", 0) == 1; var print = (outputmode == 1); var excel = (outputmode == 2); var prs_key = getQParamInt('prs_key', -1); if (prs_key == -1) prs_key = user_key; sql = "SELECT " + S("prs_pers_string") + " FROM prs_v_aanwezigperslid p" + " WHERE p.prs_perslid_key = " + prs_key; oRs = Oracle.Execute(sql); var person_naam = ""; if (!oRs.eof) person_naam = oRs(0).value; var d = new Date(); //today's date var startday = getQParamInt("startday", d.getTime()); var weekdate = new Date(startday); var weeknr = getWeeknumber(weekdate); var jaar = weekdate.getYear(); var firstDow = YWDtoDate(jaar, weeknr, 1); // Eerste dag var fDow = new Date(firstDow); var lDow = new Date(fDow); lDow = new Date(lDow.setDate(fDow.getDate() + 6)); %>
<% FCLTHeader.Generate({ outputmode: outputmode }); if (excel) { Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader ("content-disposition", "inline; filename=dynamic.xls"); } %>
<% sql = "SELECT dw.mld_deelwerk_key" + ", dw.mld_deelwerk_datum" + ", o.alg_plaatsaanduiding" + ", id.ins_deel_key" + ", id.ins_deel_omschrijving" + ", COALESCE(dw.mld_deelwerk_duur, 0) mld_deelwerk_duur" + ", ud1.fac_usrdata_omschr activiteit" + ", ud2.fac_usrdata_omschr werkgever" + ", COALESCE(dw.mld_deelwerk_km, 0) mld_deelwerk_km" + ", dw.mld_deelwerk_opmerking" + " FROM mld_deelwerk dw" + ", ins_deel id" + ", ins_v_alg_overzicht o" + ", fac_usrdata ud1" + ", fac_usrdata ud2" + " WHERE dw.ins_deel_key = id.ins_deel_key" + " AND id.ins_alg_locatie_key = o.alg_locatie_key" + " AND id.ins_deel_verwijder IS NULL" + " AND id.ins_deel_module = 'INS'" + " AND id.ins_deel_parent_key IS NULL" + " AND o.alg_onroerendgoed_keys = id.ins_alg_ruimte_key" + " AND o.alg_onroerendgoed_type = id.ins_alg_ruimte_type" + " AND id.ins_alg_ruimte_type IN ('T')" + " AND o.alg_locatie_key = id.ins_alg_locatie_key" + " AND id.ins_discipline_key = " + mld_disc_stoppingplace + " AND dw.fac_usrdata_key_activiteit = ud1.fac_usrdata_key" + " AND dw.fac_usrdata_key_opdrachtgever = ud2.fac_usrdata_key" + " AND dw.mld_deelwerk_datum BETWEEN " + fDow.beginToSQL() + " AND " + lDow.endToSQL() + " AND dw.prs_perslid_key = " + prs_key + " ORDER BY 2"; /********************************** * Callback functies ResultsetTable *********************************/ function fnrowActionEnabler(oRs) { var eEdit = true; var eDelete = true; var data = { eEdit: eEdit, eDelete: eDelete }; return data; } function fnspentTime(oRs) { var totalminutes = parseInt(oRs("mld_deelwerk_duur").value, 10); var nrhours = Math.floor(totalminutes / 60); var nrminutes = ((totalminutes % 60) < 10? "0" : "") + (totalminutes % 60); var spendtime = nrhours + ":" + nrminutes; return spendtime; } function fnmateriaal(oRs) { var materialstring = ""; sql = "SELECT dwm.fac_usrdata_key_materiaal" + ", dwm.mld_deelwerkmateriaal_aantal" + ", fud.fac_usrdata_omschr" + " FROM mld_deelwerkmateriaal dwm" + ", fac_usrdata fud" + " WHERE dwm.fac_usrdata_key_materiaal = fud.fac_usrdata_key" + " AND dwm.mld_deelwerk_key = " + oRs("mld_deelwerk_key").value + " ORDER BY fud.fac_usrdata_omschr"; oRsM = Oracle.Execute(sql); while (!oRsM.eof) { if (oRsM("mld_deelwerkmateriaal_aantal").value > 0) { materialstring = materialstring + (materialstring == "" ? "" : ",
") + oRsM("mld_deelwerkmateriaal_aantal").value + ' x ' + oRsM("fac_usrdata_omschr").value; } oRsM.moveNext(); } return materialstring; } /************************************** * End callback functies ResultsetTable *************************************/ var rst = new ResultsetTable({keyColumn: "mld_deelwerk_key", ID: "deelwerktable", rowActionEnabler: fnrowActionEnabler, sql: sql, outputmode: outputmode, title: L("lcl_mld_splace_hourrows"), showAll: showall }); // Kolommen rst.addColumn(new Column({caption: L("lcl_mld_day"), content: "mld_deelwerk_datum", datatype: "date"})); rst.addColumn(new Column({caption: L("lcl_mld_place"), content: "alg_plaatsaanduiding"})); rst.addColumn(new Column({caption: L("lcl_mld_stoppingplace"), content: "ins_deel_omschrijving"})); rst.addColumn(new Column({caption: L("lcl_mld_time_spent"), content: fnspentTime})); // TODO: Omzetten in uu:mm rst.addColumn(new Column({caption: L("lcl_activity"), content: "activiteit"})); rst.addColumn(new Column({caption: L("lcl_mld_principal"), content: "werkgever"})); rst.addColumn(new Column({caption: L("lcl_mld_km"), content: "mld_deelwerk_km", datatype: "integer"})); rst.addColumn(new Column({caption: L("lcl_mld_opm"), content: "mld_deelwerk_opmerking"})); rst.addColumn(new Column({caption: L("lcl_mld_material"), content: fnmateriaal})); // Acties rst.addAction({action: "dwEdit", caption: L("lcl_delete"), enabler: "eEdit", isDefault: true}); rst.addAction({action: "dwDelete", caption: L("lcl_delete"), enabler: "eDelete"/*, multi: true*/}); var count = rst.processResultset(); %>