<%@language = "javascript" %> <% /* $Revision$ $Id$ File: contract.asp Description: Bekijk/wijzig contract (Mobile version) Parameters: cnt_key voor bestaand contract Nog niet helemaal uitgekristalliseerd hoe de stdm geselecteerd en gefilterd kan worden, handigst Note: */ %> <% FCLTHeader.Requires({plugins: ["suggest"]}); var cnt_key = getQParamInt("cnt_key", -1); var qrc = getQParamInt("qrc", 0) != 0; if (cnt_key > -1) { // BESTAAND CONTRACT var this_cnt = cnt.func_enabled_contract(cnt_key, cnt_info); // Wat heb ik zoal aan rechten op dit contract? user.auth_required_or_abort(this_cnt.canReadAny); var cnt_info = cnt.cnt_contract_info(cnt_key); // nog heel beperkt } var subject = L("lcl_cnt_contract") + " " + cnt_info.nummer_intern+ (cnt_info.versie == null || cnt_info.versie == ""? "" : "." + cnt_info.versie); %>
<% FCLTMHeader.Generate({title: subject }); %>
<% PAGE_START({id: "page-1-" + cnt_key}); HEADER({title: (cnt_key > -1 ? subject : "") , back: !qrc, home: !qrc, datatheme: jQFrontEndTheme}); CONTENT_START(); ROFIELD ("fldoms", L("lcl_cnt_descr"), cnt_info.discipline_omschrijving +"/"+ cnt_info.omschrijving); ROFIELD ("fldpers", L("lcl_cnt_manager"), cnt_info.perslid_naam_beh); ROFIELD ("fldcntnr", L("lcl_cnt_contractnr"), cnt_info.nummer, {suppressEmpty: true}); if (cnt_info.mantel_key != null) { ROFIELD ("fldcontract", L("lcl_cnt_mantel"), cnt_info.mantelcontractnummer); } ROFIELD ("fldtxt", L("lcl_cnt_document"), cnt_info.document, {suppressEmpty: true}); ROFIELD("fldtxt", L("lcl_remark"), cnt_info.opmerking, {suppressEmpty: true}); if (cnt_info.srtcontract_type == S("cnt_srttype_rental")) { ROFIELD ("fld", L("lcl_cnt_mutatie_huurder"), cnt_info.bedrijf_naam, {suppressEmpty: true}); ROFIELD ("flddep", L("lcl_cnt_afdeling"), cnt_info.afdeling_naam, {suppressEmpty: true}); } else ROFIELD ("fld", L("lcl_cnt_company"), cnt_info.bedrijf_naam); ROFIELD ("flddate", L("lcl_cnt_looptijd"), toDateString(cnt_info.looptijd_van)+ " " +L("lcl_tot")+" "+ toDateString(cnt_info.looptijd_tot)); var fin_collapse = !this_cnt.canGoedkeur1 && !this_cnt.canGoedkeur2 && !this_cnt.canGoedkeur3 && !this_cnt.canGoedkeur4 && !this_cnt.canGoedkeur5 && !this_cnt.canReject; BLOCK_START({collapsed: fin_collapse, title: L("lcl_cnt_fin_data")}); ROFIELD ("fld", L("lcl_cnt_kostenplaats"), cnt_info.kostenplaats_naam); ROFIELD ("fld", L("lcl_cnt_contract_sum")+ " " + S("currency_pref"), safe.curr(cnt_info.kosten), {datatype:"currency", suppressEmpty: true}); ROFIELD ("fld", L("lcl_cnt_period_sum")+ " " + S("currency_pref"), safe.curr(cnt_info.termijnkosten), {suppressEmpty: true, datatype:"currency"}); ROFIELD ("fldshort", L("lcl_hour_rate")+ " " + S("currency_pref"), safe.curr(cnt_info.uurloon), {suppressEmpty: true, datatype:"currency"}); ROFIELD ("fldshort", L("lcl_cnt_discount"), cnt_info.korting, {suppressEmpty: true, datatype:"float"}); BLOCK_END(); BLOCK_START({collapsed: (cnt_key > 0), title: L("lcl_cnt_flexblok")}); generateFlexKenmerkCode ({cnt_key: cnt_key, prs_key: user_key, reado: true, flexcolumns : 1 }); BLOCK_END() // De eventuelse scope // Contractscope // Deze alleen als er mogelijke scope is: type niet 4 (generiek) of 6 (mantel) var cnt_typecontract = -1; var sql = "SELECT dp.cnt_srtcontract_type " + " FROM cnt_contract c, cnt_disc_params dp " + " WHERE c.ins_discipline_key = dp.cnt_ins_discipline_key " + " AND cnt_contract_key =" + cnt_key ; var oRs = Oracle.Execute( sql ); if(!oRs.eof){ cnt_typecontract = oRs("cnt_srtcontract_type").Value; } oRs.close(); if (cnt_typecontract != 4 && cnt_typecontract != 6) { var aantal = 0; var totaal = 0; sql = "SELECT COUNT (cnt_contract_plaats_key) aantal" + " , SUM(COALESCE(cnt_contract_plaats_gewicht, 0)) totaal" + " FROM cnt_contract_plaats" + " WHERE cnt_contract_key = " + cnt_key; oRs = Oracle.Execute(sql); // Altijd resultaat aantal = oRs("aantal").Value; totaal = oRs("totaal").Value; var kosten = 0; sql = "SELECT cnt_contract_kosten FROM cnt_contract WHERE cnt_contract_key = " + cnt_key; oRs = Oracle.Execute(sql); if (!oRs.eof) { kosten = oRs(0).Value; } sql = ""; var scopetext = ""; switch (cnt_typecontract) { // resultaatkolommen code, scope, gewicht, type case 1: // Onderhoud op objecten sql = "SELECT 0 code" + " , " + lcl.xsql('S.ins_srtdeel_omschrijving','S.ins_srtdeel_key') + " scope" + " , null gewicht" + " , 'S' type " + " , cnt_contract_object_key object_key" + " FROM cnt_contract_object, ins_srtdeel S " + " WHERE cnt_ins_deel_key IS NULL" + " AND cnt_ins_srtdeel_key = S.ins_srtdeel_key" + " AND cnt_contract_object_verwijder IS NULL" + " AND cnt_contract_key = " + cnt_key + " UNION ALL" + " SELECT 1 code" + " , COALESCE( (SELECT l.alg_locatie_omschrijving || ': ' || D.alg_plaatsaanduiding || ' ' || ins_deel_omschrijving || ' (' || " + lcl.xsql('D.ins_srtdeel_omschrijving','D.ins_srtdeel_key') + " || ')'" + " FROM ins_v_deel_gegevens D, alg_locatie l" + " WHERE cnt_ins_deel_key = D.ins_deel_key" + " AND l.alg_locatie_key =D.alg_locatie_key )," + " COALESCE(( SELECT pf.prs_perslid_naam_full || ' ' || ins_deel_omschrijving || ' (' || " + lcl.xsql('SD.ins_srtdeel_omschrijving','SD.ins_srtdeel_key') + " || ')'" + " FROM ins_deel D, ins_srtdeel SD, prs_v_perslid_fullnames pf " + " WHERE cnt_ins_deel_key = D.ins_deel_key" + " AND SD.ins_srtdeel_key = D.ins_srtdeel_key" + " AND pf.prs_perslid_key = D.ins_alg_ruimte_key" + " AND D.ins_alg_ruimte_type = 'P')," + " COALESCE(( SELECT " + S("prs_dep_string") + " || ' ' ||ins_deel_omschrijving || ' (' ||" + lcl.xsql('SD.ins_srtdeel_omschrijving','SD.ins_srtdeel_key') + " || ')'" + " FROM ins_deel D, ins_srtdeel SD, prs_v_aanwezigafdeling d" + " WHERE cnt_ins_deel_key = D.ins_deel_key" + " AND SD.ins_srtdeel_key = D.ins_srtdeel_key" + " AND d.prs_afdeling_key = D.ins_alg_ruimte_key" + " AND D.ins_alg_ruimte_type = 'A'), 'onb'))) scope" + " , null gewicht" + " , 'D' type" + " , cnt_contract_object_key object_key" + " FROM cnt_contract_object" + " WHERE cnt_ins_deel_key IS NOT NULL" + " AND cnt_contract_object_verwijder IS NULL" + " AND cnt_contract_key = " + cnt_key + " ORDER BY 3"; scopetext = L("lcl_cnt_objects"); break; case 2: // Huur van ruimte of terreinsector: deze werden eigenlijk niet direct als scope getoond geloof ik sql = " SELECT NULL code" + ", plaatsaanduiding scope" + ", NULL gewicht" + ", type type" + ", totaal_opp" + ", alg_onrgoed_key plaats_key" + " FROM" + " (SELECT rm.alg_ruimte_aanduiding plaatsaanduiding" + ", co.alg_onrgoed_key" + ", (SELECT fac.safe_to_number(alg_onrgoedkenmerk_waarde)" + " FROM alg_onrgoedkenmerk" + " WHERE alg_onrgoed_key = co.alg_onrgoed_key" + " AND alg_kenmerk_key = " + S("alg_ruimte_comm_opp_key") + ") totaal_opp" + ", 'R' type" + " FROM alg_v_ruimte_gegevens rm" + ", cnt_contract_onrgoed co" + ", alg_srtruimte sr" + " WHERE co.alg_onrgoed_niveau = 'R'" + " AND co.alg_onrgoed_key = rm.ALG_RUIMTE_KEY" + " AND sr.alg_srtruimte_key = co.alg_srtonrgoed_key" + " AND co.cnt_mld_melding_key IS NULL" + " AND co.cnt_contract_key = " + cnt_key + "" + " UNION" + " SELECT lc.alg_locatie_code || ' - ' || alg_terreinsector_omschrijving plaatsaanduiding" + ", co.alg_onrgoed_key" + ", (SELECT fac.safe_to_number(alg_onrgoedkenmerk_waarde) from alg_onrgoedkenmerk" + " WHERE alg_onrgoed_key = co.alg_onrgoed_key" + " AND alg_kenmerk_key = " + S("alg_terrein_comm_opp_key") + ") totaal_opp" + ", 'T' type" + " FROM alg_terreinsector tr" + ", cnt_contract_onrgoed co" + ", alg_srtterreinsector sr" + ", alg_locatie lc" + " WHERE co.alg_onrgoed_niveau = 'T'" + " AND co.alg_onrgoed_key = tr.alg_terreinsector_key" + " AND sr.alg_srtterreinsector_key = co.alg_srtonrgoed_key" + " AND lc.alg_locatie_key = tr.alg_locatie_key" + " AND co.cnt_mld_melding_key IS NULL" + " AND co.cnt_contract_key = " + cnt_key + "" + " UNION" + " SELECT " + safe.quoted_sql(L("lcl_location")) + " plaatsaanduiding" + ", co.alg_onrgoed_key" + ", null totaal_opp" + ", 'L' type" + " FROM alg_locatie lc" + ", cnt_contract_onrgoed co" + ", alg_srtruimte sr" + " WHERE co.alg_onrgoed_niveau = 'L'" + " AND co.alg_onrgoed_key = lc.alg_locatie_key" + " AND sr.alg_srtruimte_key = co.alg_srtonrgoed_key" + " AND co.cnt_mld_melding_key IS NULL" + " AND co.cnt_contract_key = " + cnt_key + ")"; break; case 3: // onderhoud op objectsoorten en/of plaats case 5: // onderhoud op plaats if (cnt_typecontract == 3) { sql = "SELECT ins_srtdeel_code code" + " , " + lcl.xsql('sd.ins_srtdeel_omschrijving','SD.ins_srtdeel_key') + " scope" + " , null gewicht" + " , 'S' type" + " , -1 plaats_key" + " FROM cnt_contract_object co" + " , ins_srtdeel sd" + " WHERE co.cnt_ins_srtdeel_key = sd.ins_srtdeel_key" + " AND co.cnt_contract_object_verwijder IS NULL" + " AND sd.ins_srtdeel_verwijder IS NULL" + " AND cnt_contract_key = " + cnt_key + " UNION ALL "; } sql += "SELECT cnt_alg_plaats_code" + " , l.alg_locatie_omschrijving || ' (' || l.alg_locatie_code || ')' scope" + " , cnt_contract_plaats_gewicht gewicht" + " , cnt_alg_plaats_code type" + " , cnt_contract_plaats_key plaats_key" + " FROM cnt_contract_plaats" + " , alg_locatie l" + " WHERE cnt_alg_plaats_key = l.alg_locatie_key" + " AND cnt_alg_plaats_code = 'L'" + " AND cnt_contract_plaats_verwijder IS NULL" + " AND cnt_contract_key = " + cnt_key + " UNION " + "SELECT cnt_alg_plaats_code" + " , l.alg_locatie_omschrijving || ' (' || l.alg_locatie_code || '): " + L("lcl_building") + " ' || g.alg_gebouw_omschrijving scope" + " , cnt_contract_plaats_gewicht gewicht, cnt_alg_plaats_code type" + " , cnt_contract_plaats_key plaats_key" + " FROM cnt_contract_plaats, alg_locatie l" + " , alg_gebouw g " + " WHERE cnt_alg_plaats_code = 'G'" + " AND cnt_alg_plaats_key=g.alg_gebouw_key" + " AND g.alg_locatie_key=l.alg_locatie_key" + " AND cnt_contract_plaats_verwijder IS NULL" + " AND cnt_contract_key = " + cnt_key + " UNION " + "SELECT cnt_alg_plaats_code" + " , l.alg_locatie_omschrijving || ' (' || l.alg_locatie_code || '): " + L("lcl_terra") + " ' || t.alg_terreinsector_omschrijving scope" + " , cnt_contract_plaats_gewicht gewicht" + " , cnt_alg_plaats_code type" + " , cnt_contract_plaats_key plaats_key" + " FROM cnt_contract_plaats" + " , alg_locatie l" + " , alg_terreinsector t" + " WHERE cnt_alg_plaats_code = 'T'" + " AND cnt_alg_plaats_key=t.alg_terreinsector_key" + " AND t.alg_locatie_key=l.alg_locatie_key" + " AND cnt_contract_plaats_verwijder IS NULL" + " AND cnt_contract_key = " + cnt_key + " ORDER BY 4,2"; scopetext = L("lcl_cnt_locations"); break; } function fncolLink(oRs) { var nurl = ""; return nurl; }; function fnGewicht(oRs) { var result = ""; if (aantal > 0 && totaal != 0) result = (kosten * oRs("gewicht").Value / totaal); return safe.curr(result); } function fnTotaal_opp(oRs) { if (!oRs("totaal_opp").Value) return L("lcl_cnt_unknown"); return safe.displayfloat(oRs("totaal_opp").Value); } BLOCK_START({collapsed: true, title: L("lcl_cnt_frame_scope")}); var rst = new ResultsetTable({sql: sql, keyColumn: (cnt_typecontract == 1? "object_key" : "plaats_key"), linkColumn: fncolLink, groupColumn: "scope", headerColumn: "scope", detailColumn: "", //"type", //asideColumn: fnAside, subheaderColumn: (cnt_typecontract == 2? fnTotaal_opp : fnGewicht), ID: "scopetable", noSearch: true, showAll: true }); var cnt = rst.processResultset(); BLOCK_END() } CONTROLGROUP_START() // Buttons if (cnt_key > -1) { if (this_cnt.canGoedkeur1 || this_cnt.canGoedkeur2 || this_cnt.canGoedkeur3 || this_cnt.canGoedkeur4 || this_cnt.canGoedkeur5) BUTTON(L("lcl_goedkeur"), {click: "cnt_goedkeur()", dataicon: "check"}); if (this_cnt.canReject) BUTTON(L("lcl_reject"), {click: "cnt_reject()", dataicon: "delete"}); if (this_cnt.canClose) { BUTTON(L("lcl_close"), {click: "cnt_close()", dataicon: "check"}); } trackinglines = mobile.hastrackingpage('contract', cnt_key); if (trackinglines > 0) { BUTTON(L("lcl_history"), {linkid: "#cnt-2-" + cnt_key, dataicon: "bullets", transition: "pop", datarel: "dialog"}); } } else trackinglines = 0; CONTROLGROUP_END() CONTENT_END(); FOOTER(); PAGE_END() if (trackinglines > 0) { PAGE_START({id: "cnt-2-" + cnt_key}) mobile.trackingpage('contract', cnt_key, subject); PAGE_END(); } %>