FSN#36056: Filtermogelijkheid op afwijkende periodieke acties.

svn path=/Website/trunk/; revision=29025
This commit is contained in:
Maykel Geerdink
2016-04-19 12:17:40 +00:00
parent d2d0e3d07d
commit 862185afbd
4 changed files with 124 additions and 18 deletions

View File

@@ -259,6 +259,7 @@ var authparams = user.checkAutorisation("WEB_INSUSE");
+ " , di.ins_srtcontrole_type"
+ " , -1 ins_deelsrtcontrole_status"
+ " , COALESCE(xcp.ins_srtcontroledl_xcp_eind, di.ins_srtcontrole_eind) inspectie_eind"
+ " , NULL ins_controlemode_success"
+ " FROM defined_inspect di"
+ " , ins_srtcontroledl_xcp xcp"
+ " WHERE di.ins_srtcontrole_key = xcp.ins_srtcontrole_key(+)"
@@ -313,15 +314,18 @@ var authparams = user.checkAutorisation("WEB_INSUSE");
+ " , di.ins_srtcontrole_type"
+ " , idsc.ins_deelsrtcontrole_status"
+ " , COALESCE(xcp.ins_srtcontroledl_xcp_eind, di.ins_srtcontrole_eind) inspectie_eind"
+ " , cm.ins_controlemode_success ins_controlemode_success"
+ " FROM defined_inspect di"
+ " , ins_srtcontroledl_xcp xcp"
+ " , ins_deelsrtcontrole idsc"
+ " , prs_perslid p"
+ " , ins_controlemode cm"
+ " WHERE di.ins_srtcontrole_key = xcp.ins_srtcontrole_key(+)"
+ " AND di.ins_deel_key = xcp.ins_deel_key(+)"
+ " AND idsc.ins_srtcontrole_key = di.ins_srtcontrole_key"
+ " AND idsc.ins_deel_key = di.ins_deel_key"
+ " AND idsc.prs_perslid_key = p.prs_perslid_key(+)"
+ " AND idsc.ins_controlemode_key = cm.ins_controlemode_key(+)"
+ " AND di.ins_deel_key = " + ins_key
// Gedaande inspectie altijd tonen.
+ " )"
@@ -400,6 +404,21 @@ var authparams = user.checkAutorisation("WEB_INSUSE");
return toDateString(controledatum); // Alleen datum tonen.
}
function fnCMSuccess(oRs)
{
var CMSuccess = oRs("ins_controlemode_success").Value;
if (CMSuccess != null && CMSuccess == 1)
var dttxt = '<img id="cms' + oRs("ins_deel_key").Value + '"'
+ ' src="../Pictures/res_ok.gif" class="ilbutton"'
+ ' style="cursor:pointer"'
+ '>';
else
var dttxt = "";
return "<span style='white-space: nowrap'>"+dttxt+"</span>";
}
function fnVolgende(oRs)
{
if (oRs("seq").Value == 2)
@@ -513,6 +532,7 @@ var authparams = user.checkAutorisation("WEB_INSUSE");
rst.addColumn(new Column({caption: L("lcl_ins_srtcontrole_type"), content: fnSrtControleType}));
rst.addColumn(new Column({caption: L("lcl_ins_controle_plandate"), content: fnVolgende}));
rst.addColumn(new Column({caption: L("lcl_ins_controle_datum"), content: fnControleDatum}));
rst.addColumn(new Column({caption: L("ins_controlemode_success"), content: fnCMSuccess}));
rst.addColumn(new Column({caption: L("lcl_ins_controle_srt"), content: "ins_srtcontrole_omschrijving"}));
rst.addColumn(new Column({caption: L("lcl_ins_kosten") + "&nbsp;(" + L("lcl_valutasign") + ")", content: fnKosten, datatype: "currency"}));
rst.addColumn(new Column({caption: L("lcl_ins_controle_opm"), content: "ins_deelsrtcontrole_opmerking"}));

View File

@@ -51,6 +51,8 @@
insObjIncl search also for objects wich is a part from another object
insLentOut search for objects wich are lent out
insAvail search for objects wich are available
insSuccessY search for inspections which are a success
insSuccessN search for inspections which are not a success
fgraph search for objects for a fgraph search
Context: - INS/ins_search.asp (Search action from bes_search.asp form)
- FGraph (<cust>_Report.asp)
@@ -124,6 +126,8 @@ function ins_list (pautfunction, params)
var expObjIncl = params.expObjIncl;
var insLentOut = params.insLentOut;
var insAvail = params.insAvail;
var insSuccessY = params.insSuccessY;
var insSuccessN = params.insSuccessN;
var embedded = params.embedded;
var tiny = params.tiny || parent_key || koppel_key;
var srtcontrole = params.srtcontrole;
@@ -530,6 +534,7 @@ function ins_list (pautfunction, params)
+ " , ins_deelsrtcontrole_status"
+ " , ins_deelsrtcontrole_key"
+ " , ins_deelsrtcontrole_plandatum"
+ " , ins_controlemode_success"
+ " FROM (WITH defined_inspect" // gedefinieerde inspecties
+ " AS (SELECT *"
+ " FROM ins_deel id"
@@ -566,11 +571,22 @@ function ins_list (pautfunction, params)
+ " , NULL ins_deelsrtcontrole_key"
+ " , (SELECT idsc.ins_deelsrtcontrole_plandatum"
+ " FROM ins_deelsrtcontrole idsc"
+ " WHERE idsc.ins_deelsrtcontrole_key = (SELECT MAX(idsc2.ins_deelsrtcontrole_key)"
+ " FROM ins_deelsrtcontrole idsc2"
+ " WHERE idsc2.ins_deel_key = di.ins_deel_key"
+ " AND idsc2.ins_srtcontrole_key = di.ins_srtcontrole_key))"
+ " ins_deelsrtcontrole_plandatum"
+ " WHERE idsc.ins_deelsrtcontrole_key = (SELECT MAX(idsc2.ins_deelsrtcontrole_key)"
+ " FROM ins_deelsrtcontrole idsc2"
+ " WHERE idsc2.ins_deel_key = di.ins_deel_key"
+ " AND idsc2.ins_srtcontrole_key = di.ins_srtcontrole_key))"
+ " ins_deelsrtcontrole_plandatum"
// Er moet naar de laatste UITGEVOERDE (afgeronde(6)) inspecte gegeven worden om te bepalen of de laatste inspecte een SUCCESS was.
+ " , (SELECT cm.ins_controlemode_success"
+ " FROM ins_deelsrtcontrole idsc"
+ " , ins_controlemode cm"
+ " WHERE idsc.ins_controlemode_key = cm.ins_controlemode_key"
+ " AND idsc.ins_deelsrtcontrole_key = (SELECT MAX (idsc2.ins_deelsrtcontrole_key)"
+ " FROM ins_deelsrtcontrole idsc2"
+ " WHERE idsc2.ins_deel_key = di.ins_deel_key"
+ " AND idsc2.ins_srtcontrole_key = di.ins_srtcontrole_key"
+ " AND idsc2.ins_deelsrtcontrole_status = 6))"
+ " ins_controlemode_success"
+ " FROM defined_inspect di"
+ " , ins_srtcontroledl_xcp xcp"
+ " WHERE di.ins_srtcontrole_key = xcp.ins_srtcontrole_key(+)"
@@ -580,6 +596,17 @@ function ins_list (pautfunction, params)
+ " WHERE idsc.ins_srtcontrole_key = di.ins_srtcontrole_key"
+ " AND idsc.ins_deelsrtcontrole_status IN (5, 6)"
+ " AND idsc.ins_deel_key = di.ins_deel_key)"
+ (insSuccessY && insSuccessN
? ""
: " AND (SELECT cm.ins_controlemode_success"
+ " FROM ins_deelsrtcontrole idsc"
+ " , ins_controlemode cm"
+ " WHERE idsc.ins_controlemode_key = cm.ins_controlemode_key"
+ " AND idsc.ins_deelsrtcontrole_key = (SELECT MAX (idsc2.ins_deelsrtcontrole_key)"
+ " FROM ins_deelsrtcontrole idsc2"
+ " WHERE idsc2.ins_deel_key = di.ins_deel_key"
+ " AND idsc2.ins_srtcontrole_key = di.ins_srtcontrole_key"
+ " AND idsc2.ins_deelsrtcontrole_status = 6))" + (insSuccessY? " = 1" : " IS NULL"))
+ " ORDER BY inspectie_date)"
: (params.inspSoon || (!params.inspSoon && !params.inspBusy && !params.inspClosed)
? " SELECT 1 rn" // inspecties die nog nooit zijn uitgevoerd/ingepland. Er is nog geen ins_deelsrtcontrole regel aanwezig en dus ook geen plandatum/respijtdatum.
@@ -601,6 +628,7 @@ function ins_list (pautfunction, params)
+ " , -1 ins_deelsrtcontrole_status"
+ " , NULL ins_deelsrtcontrole_key"
+ " , NULL ins_deelsrtcontrole_plandatum"
+ " , NULL ins_controlemode_success"
+ " FROM defined_inspect di"
+ " , ins_srtcontroledl_xcp xcp"
+ " WHERE di.ins_srtcontrole_key = xcp.ins_srtcontrole_key(+)"
@@ -608,8 +636,9 @@ function ins_list (pautfunction, params)
+ " AND (di.ins_deel_key, di.ins_srtcontrole_key) NOT IN"
+ " (SELECT ins_deel_key, ins_srtcontrole_key"
+ " FROM ins_deelsrtcontrole)"
+ " UNION ALL" // Inspecties die al eens zijn uitgevoerd of inspecties die voor het eerst zijn ingepland(0) of gestart(2) maar nog geen uitgevoerde/afgemelde(6) inspectie hebben.
+ " UNION ALL"
: "")
// Inspecties die al eens zijn uitgevoerd of inspecties die voor het eerst zijn ingepland(0) of gestart(2) maar nog geen uitgevoerde/afgemelde(6) inspectie hebben.
+ " SELECT RANK ()" // Volgnummertje toekennen
+ " OVER ("
+ " PARTITION BY di.ins_deel_key, idsc.ins_srtcontrole_key" // Soort van group-by
@@ -643,11 +672,14 @@ function ins_list (pautfunction, params)
+ " , idsc.ins_deelsrtcontrole_status"
+ " , idsc.ins_deelsrtcontrole_key"
+ " , CASE WHEN idsc.ins_deelsrtcontrole_status IN (0, 2) THEN idsc.ins_deelsrtcontrole_plandatum ELSE NULL END ins_deelsrtcontrole_plandatum"
+ " , NULL ins_controlemode_success"
+ " FROM ins_deelsrtcontrole idsc"
+ " , defined_inspect di"
+ " , ins_srtcontroledl_xcp xcp"
+ " , ins_controlemode cm"
+ " WHERE di.ins_srtcontrole_key = xcp.ins_srtcontrole_key(+)"
+ " AND di.ins_deel_key = xcp.ins_deel_key(+)"
+ " AND idsc.ins_controlemode_key = cm.ins_controlemode_key(+)"
+ " AND idsc.ins_srtcontrole_key = di.ins_srtcontrole_key"
+ " AND idsc.ins_deel_key = di.ins_deel_key"
+ " ORDER BY inspectie_next)")
@@ -666,7 +698,8 @@ function ins_list (pautfunction, params)
+ " , ispn.ins_srtcontrole_type"
+ " , ispn.ins_deelsrtcontrole_status"
+ " , ispn.ins_deelsrtcontrole_key"
+ " , ispn.ins_deelsrtcontrole_plandatum";
+ " , ispn.ins_deelsrtcontrole_plandatum"
+ " , ispn.ins_controlemode_success";
sqlInspectie_from = ", (" + sqlNext + ") ispn"
@@ -1627,19 +1660,34 @@ function ins_list (pautfunction, params)
function fnPlandatum(oRs)
{
var vervallen = (oRs("inspectie_eind").Value != null && new Date(oRs("inspectie_eind").Value).getTime() < new Date().midnight());
if (vervallen) return L("lcl_ins_controle_vervallen");
var vervallen = (oRs("inspectie_eind").Value != null && new Date(oRs("inspectie_eind").Value).getTime() < new Date().midnight());
if (vervallen) return L("lcl_ins_controle_vervallen");
var plandatum = oRs("ins_deelsrtcontrole_plandatum").Value;
var plandatum = oRs("ins_deelsrtcontrole_plandatum").Value;
var inspectie_eenheid = oRs("inspectie_eenheid").Value;
if (inspectie_eenheid == 0)
var dttxt = toDateTimeString(plandatum);
else
var dttxt = toDateString(plandatum);
var inspectie_eenheid = oRs("inspectie_eenheid").Value;
if (inspectie_eenheid == 0)
var dttxt = toDateTimeString(plandatum);
else
var dttxt = toDateString(plandatum);
return "<span style='white-space: nowrap'>"+dttxt+"</span>";
}
return "<span style='white-space: nowrap'>"+dttxt+"</span>";
}
function fnCMSuccess(oRs)
{
var CMSuccess = oRs("ins_controlemode_success").Value;
if (CMSuccess != null && CMSuccess == 1)
var dttxt = '<img id="cms' + oRs("ins_deel_key").Value + '"'
+ ' src="../Pictures/res_ok.gif" class="ilbutton"'
+ ' style="cursor:pointer"'
+ '>';
else
var dttxt = "";
return "<span style='white-space: nowrap'>"+dttxt+"</span>";
}
function fnSrtControleType(oRs)
{
@@ -1755,6 +1803,7 @@ function ins_list (pautfunction, params)
{
rst.addColumn(new Column({caption: (params.inspDone? L("lcl_ins_controle_datum") : L("lcl_ins_controle_next")), content: fnInspectie}));
rst.addColumn(new Column({caption: L("lcl_ins_controle_plandate"), content: fnPlandatum}));
rst.addColumn(new Column({caption: L("ins_controlemode_success"), content: fnCMSuccess}));
rst.addColumn(new Column({caption: L("lcl_ins_controle_srt"), content: "ins_srtcontrole_omschrijving"}));
rst.addColumn(new Column({caption: L("lcl_ins_controle_groep"), content: "groepoms"}));
}

View File

@@ -154,6 +154,11 @@ var authparams = user.checkAutorisation(autfunction);
$("#insLSF").show();
}
}
function onClickSuccess()
{
if (!document.getElementById("insSuccessY").checked && !document.getElementById("insSuccessN").checked)
document.getElementById("insSuccessY").checked = true;
}
<% if (xd.enabled()) { %>
function xdclicked()
{
@@ -362,6 +367,7 @@ var authparams = user.checkAutorisation(autfunction);
</td>
</tr>
<% } %>
</table>
</td><!-- end column 1 -->
@@ -577,6 +583,33 @@ var authparams = user.checkAutorisation(autfunction);
</div>
</td>
</tr>
<% if (insInspect) // Ook inspectiezoekvelden
{ %>
<tr class="primsearch donetime" style="display:none">
<td class="label">
<label><%=L("ins_controlemode_success")%>:&nbsp;</label>
</td>
<td>
<input type=hidden name="inspect" value="1">
<table>
<tr class="insD">
<td>
<input type="checkbox" class="fldcheck" name="insSuccessY" id="insSuccessY" value="1" checked onClick="onClickSuccess()">
</td>
<td>
<label for="insSuccessY"><%=L("lcl_Yes")%></label>
</td>
<td>
<input type="checkbox" class="fldcheck" name="insSuccessN" id="insSuccessN" value="1" checked onClick="onClickSuccess()">
</td>
<td>
<label for="insSuccessN"><%=L("lcl_No")%></label>
</td>
</tr>
</table>
</td>
</tr>
<% } %>
<% } %>
</table>
</td><!-- end column 2-->

View File

@@ -66,6 +66,8 @@ var expObjIncl = getQParamInt("expObjIncl", 0) == 1; // Ook vervallen objecten
var insLentOut = getQParamInt("insLentOut", 0) == 1; // Uitgegeven
var insAvail = getQParamInt("insAvail", 0) == 1; // Beschikbaar
var insSuccessY = getQParamInt("insSuccessY", 0) == 1; // Succes Ja.
var insSuccessN = getQParamInt("insSuccessN", 0) == 1; // Succes Nee.
var insInspect = getQParamInt("inspect", 0) == 1;
var inspDone = getQParamInt("insInspDone", 0) == 1;
@@ -140,7 +142,9 @@ ins_list ( autfunction,
insObjIncl: insObjIncl,
expObjIncl: expObjIncl,
insLentOut: insLentOut,
insAvail: insAvail
insAvail: insAvail,
insSuccessY: insSuccessY,
insSuccessN: insSuccessN
}
);
%>