307 lines
14 KiB
Plaintext
307 lines
14 KiB
Plaintext
<%@ LANGUAGE="JavaScript" %>
|
|
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: CNT/cnt_contract_scope.asp
|
|
Description: Afhankelijk van het type contract wordt hier gepresenteerd de bijbehorende scope
|
|
cnt_srtcontract_type Scope
|
|
[1] Onderhoud/Maintenance Objecten
|
|
[3] Ondersteuning/Support Plaats (locatie, gebouw, verdieping, ruimte, terrein) en/of objecten
|
|
[4] Algemeen/Generic Geen
|
|
[5] Leverancier/Supplier Plaats (locatie, gebouw, verdieping, ruimte, terrein)
|
|
[6] Mantel/Master Geen
|
|
Parameters: cnt_key Contract key
|
|
Context:
|
|
Note:
|
|
*/
|
|
%>
|
|
|
|
<!-- #include file="../Shared/common.inc" -->
|
|
<!-- #include file="../Shared/iface.inc" -->
|
|
<!-- #include file="../Shared/resultset_table_v2.inc" -->
|
|
<!-- #include file="cnt.inc" -->
|
|
|
|
<%
|
|
var cnt_key = getQParamInt("cnt_key");
|
|
var this_cnt = cnt.func_enabled_contract(cnt_key); // Wat heb ik zoal aan rechten op dit contract?
|
|
user.auth_required_or_abort(this_cnt.canReadAny);
|
|
|
|
var showall = getQParamInt("showall", 0) == 1;
|
|
var outputmode = getQParamInt("outputmode", 0);
|
|
%>
|
|
<html>
|
|
<head>
|
|
<% FCLTHeader.Generate({outputmode: outputmode}); %>
|
|
<script type="text/javascript">
|
|
function cnt_scopechange()
|
|
{
|
|
if (FcltMgr.startEdit(window))
|
|
window.location.href = "cnt_edit_scope.asp?cnt_key=<%=cnt_key%>&embedded=1";
|
|
}
|
|
|
|
function gotoScope(row)
|
|
{
|
|
var rowKey = row.getAttribute("ROWKEY");
|
|
var rowData = JSON.parse(row.getAttribute("ROWDATA"));
|
|
var url;
|
|
switch (rowData.scopeType)
|
|
{
|
|
case 'G' : url = "appl/alg/alg_gebouw.asp?key="+rowKey ; break;
|
|
case 'V' : url = "appl/alg/alg_verdieping.asp?key="+rowKey ; break;
|
|
case 'R' : url = "appl/alg/alg_ruimte.asp?key="+rowKey ; break;
|
|
case 'L' : url = "appl/alg/alg_locatie.asp?key="+rowKey ; break;
|
|
case 'T' : url = "appl/alg/alg_terreinsector.asp?ter_key="+rowKey ; break;
|
|
case 'D' : url= "appl/ins/ins_deel.asp?urole=bo&ins_key="+rowKey; break;
|
|
case 'S' : url = "appl/ins/ins_srtdeel.asp?urole=bo&srtdeel_key="+rowKey ; break;
|
|
}
|
|
FcltMgr.openDetail(url, "");
|
|
}
|
|
</script>
|
|
</head>
|
|
<body id="listbody">
|
|
<%
|
|
var cnt_typecontract = -1;
|
|
var sql = "SELECT c.ins_discipline_key"
|
|
+ " , c.cnt_contract_nummer"
|
|
+ " , 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();
|
|
|
|
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;
|
|
oRs.Close();
|
|
|
|
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("cnt_contract_kosten").value;
|
|
}
|
|
oRs.Close();
|
|
|
|
sql = "";
|
|
switch (cnt_typecontract)
|
|
{
|
|
// resultaatkolommen code, scope, gewicht, type, key
|
|
case 1: // Onderhoud op objecten
|
|
sql = "SELECT 0 code"
|
|
+ " , " + lcl.xsql('S.ins_srtdeel_omschrijving','S.ins_srtdeel_key') + " scope"
|
|
+ " , null gewicht"
|
|
+ " , 'S' type "
|
|
+ " , s.ins_srtdeel_key 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_ins_deel_key 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";
|
|
break;
|
|
case 2: // DEPRECATED
|
|
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"
|
|
+ " , co.cnt_ins_srtdeel_key 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 ";
|
|
}
|
|
// Checken of deze presentatie consistent is met de overige plaatsaanduidingen bv bij ins
|
|
sql += "SELECT cnt_alg_plaats_code"
|
|
+ " , l.alg_locatie_code || ' (' || l.alg_locatie_omschrijving || ')' scope"
|
|
+ " , cnt_contract_plaats_gewicht gewicht"
|
|
+ " , cnt_alg_plaats_code type"
|
|
+ " , cnt_alg_plaats_key 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_code ||'-'||v.alg_plaatsaanduiding || DECODE(v.alg_plaatsomschrijving, '','' , ' (' || v.alg_plaatsomschrijving || ')')"
|
|
+ " , cnt_contract_plaats_gewicht gewicht, cnt_alg_plaats_code type"
|
|
+ " , cnt_alg_plaats_key key"
|
|
+ " FROM cnt_contract_plaats, alg_locatie l"
|
|
+ " , alg_v_allonrgoed_gegevens v"
|
|
+ " WHERE cnt_alg_plaats_code = 'G'"
|
|
+ " AND v.alg_type = 'G'"
|
|
+ " AND cnt_alg_plaats_key=v.alg_gebouw_key"
|
|
+ " AND v.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_code ||'-'||v.alg_plaatsaanduiding || DECODE(v.alg_plaatsomschrijving, '','' , ' (' || v.alg_plaatsomschrijving || ')')"
|
|
+ " , cnt_contract_plaats_gewicht gewicht, cnt_alg_plaats_code type"
|
|
+ " , cnt_alg_plaats_key key"
|
|
+ " FROM cnt_contract_plaats, alg_locatie l"
|
|
+ " , alg_v_allonrgoed_gegevens v"
|
|
+ " WHERE cnt_alg_plaats_code = 'V'"
|
|
+ " AND v.alg_type = 'V'"
|
|
+ " AND cnt_alg_plaats_key=v.alg_verdieping_key"
|
|
+ " AND v.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_code ||'-'||v.alg_plaatsaanduiding || DECODE(v.alg_plaatsomschrijving, '','' , ' (' || v.alg_plaatsomschrijving || ')')"
|
|
+ " , cnt_contract_plaats_gewicht gewicht, cnt_alg_plaats_code type"
|
|
+ " , cnt_alg_plaats_key key"
|
|
+ " FROM cnt_contract_plaats, alg_locatie l"
|
|
+ " , alg_v_allonrgoed_gegevens v"
|
|
+ " WHERE cnt_alg_plaats_code = 'R'"
|
|
+ " AND v.alg_type = 'R'"
|
|
+ " AND cnt_alg_plaats_key=v.alg_ruimte_key"
|
|
+ " AND v.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_code ||'-'||v.alg_plaatsaanduiding || DECODE(v.alg_plaatsomschrijving, '','' , ' (' || v.alg_plaatsomschrijving || ')')"
|
|
+ " , cnt_contract_plaats_gewicht gewicht"
|
|
+ " , cnt_alg_plaats_code type"
|
|
+ " , cnt_alg_plaats_key key"
|
|
+ " FROM cnt_contract_plaats, alg_locatie l"
|
|
+ " , alg_v_allonrgoed_gegevens v"
|
|
+ " WHERE cnt_alg_plaats_code = 'T'"
|
|
+ " AND v.alg_type = 'T'"
|
|
+ " AND cnt_alg_plaats_key=v.alg_terreinsector_key"
|
|
+ " AND v.alg_locatie_key=l.alg_locatie_key"
|
|
+ " AND cnt_contract_plaats_verwijder IS NULL"
|
|
+ " AND cnt_contract_key = " + cnt_key
|
|
+ " ORDER BY 2,4";
|
|
break;
|
|
case 4: // scopeloos
|
|
case 6: // mantelcontract
|
|
sql = "SELECT 'x' code, 'x' scope, 'x' gewicht, 'x' type, -1 key FROM DUAL WHERE 1=0";
|
|
break;
|
|
}
|
|
|
|
function fnrowData(oRs)
|
|
{
|
|
var scopeType = oRs("type").Value;
|
|
var data = {scopeType: scopeType};
|
|
return JSON.stringify(data);
|
|
}
|
|
|
|
function fnScopetype(oRs)
|
|
{
|
|
var result = "";
|
|
switch (oRs("type").value)
|
|
{
|
|
case "G" : result = L("lcl_building"); break;
|
|
case "V" : result = L("lcl_floor"); break;
|
|
case "R" : result = L("lcl_room"); break;
|
|
case "L" : result = L("lcl_location"); break;
|
|
case "T" : result = L("lcl_terra"); break;
|
|
case "D" : result = L("lcl_obj_inf_name"); break;
|
|
case "S" : result = L("lcl_obj_sort"); break;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
function fnSubtabicon(oRs)
|
|
{
|
|
if (oRs == null || oRs.eof)
|
|
return { icon: "fa-exclamation-triangle", color: "#FFBF00" }
|
|
else
|
|
return null;
|
|
}
|
|
|
|
var buttons = [];
|
|
if (this_cnt.canChange)
|
|
{
|
|
buttons.push({title: L("lcl_change"), icon: "fa-fclt-edit", action: "cnt_scopechange()" });
|
|
}
|
|
|
|
var rst = new ResultsetTable({ sql: sql,
|
|
keyColumn: "key",
|
|
ID: "cntscopetable",
|
|
title: L("lcl_cnt_frame_scope"),
|
|
showAll: showall,
|
|
outputmode: outputmode,
|
|
rowData: fnrowData,
|
|
buttons: buttons,
|
|
subtabicon: fnSubtabicon
|
|
});
|
|
|
|
rst.addColumn(new Column({ caption: L("lcl_cnt_scope_title"), content: fnScopetype }));
|
|
rst.addColumn(new Column({ caption: L("lcl_plaatsgegevens"), content: "scope", hasActions: true }));
|
|
if (cnt_typecontract != 1)
|
|
rst.addColumn(new Column({ caption: L("lcl_cnt_verdeling"), content: fnGewicht, datatype: "currency" }));
|
|
rst.addAction({ action: "gotoScope", caption: L("lcl_details"), isDefault: true });
|
|
|
|
var cnt = rst.processResultset();
|
|
%>
|
|
</body>
|
|
</html>
|
|
<% ASPPAGE_END(); %>
|