293 lines
15 KiB
Plaintext
293 lines
15 KiB
Plaintext
<%@language = "javascript" %>
|
|
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: ins_bitsform.asp
|
|
Description: Invoeren van de bits waarden, afhankelijk van de controle en eenheid.
|
|
Parameters: srtcont_key (inspectiesoort)
|
|
eenheid (controle eenheid)
|
|
|
|
Context: Binnen ins_srtcontrolerecord.asp als gebruiker knopje/button 'Bits' drukt.
|
|
Note: Resultaat van een submit is een json object
|
|
|
|
*/
|
|
%>
|
|
<!-- #include file="../Shared/common.inc" -->
|
|
<!-- #include file="../Shared/iface.inc" -->
|
|
<!-- #include file="../Shared/selector.inc" -->
|
|
<!-- #include file="ins.inc" -->
|
|
|
|
<%
|
|
FCLTHeader.Requires({ plugins: ["jQuery", "suggest", "kenmerk"] });
|
|
|
|
var eenheid = getQParamInt("eenheid"); // Inspectie eenheid
|
|
var bits = getQParamInt("bits", 0); // Inspectie bits
|
|
%>
|
|
|
|
<html>
|
|
<head>
|
|
<% FCLTHeader.Generate(); %>
|
|
|
|
<script type="text/javascript">
|
|
//window.return_data = {};
|
|
window.return_data = { eenheid: <%=eenheid%>, bits: <%=bits > 0? bits : 0%>};
|
|
|
|
async function ins_submit()
|
|
{
|
|
if (!await validateForm("u2"))
|
|
return false;
|
|
|
|
// Bits waarde bepalen.
|
|
var bits = 0;
|
|
switch (<%=eenheid%>)
|
|
{
|
|
case 0:
|
|
case 1: if ($("#insInspNoHoli").prop('checked'))
|
|
bits = 128;
|
|
break;
|
|
case 2: bits = ($("#insInspZo").prop('checked')? 1 : 0) +
|
|
($("#insInspMa").prop('checked')? 2 : 0) +
|
|
($("#insInspDi").prop('checked')? 4 : 0) +
|
|
($("#insInspWo").prop('checked')? 8 : 0) +
|
|
($("#insInspDo").prop('checked')? 16 : 0) +
|
|
($("#insInspVr").prop('checked')? 32 : 0) +
|
|
($("#insInspZa").prop('checked')? 64 : 0) +
|
|
($("#insInspNoHoli").prop('checked')? 128 : 0);
|
|
break;
|
|
case 3: bits = parseInt($("#weekbits").val(), 10)
|
|
+ parseInt($("#dagbits").val(), 10)
|
|
+ ($("#insInspNoHoli").prop('checked')? 128 : 0);
|
|
break;
|
|
case 4: // wordt gebruikt in res_deelrecord en res_deelvoegtoe.
|
|
bits = ($("#insInspJan").prop('checked')? 1 : 0) +
|
|
($("#insInspFeb").prop('checked')? 2 : 0) +
|
|
($("#insInspMaa").prop('checked')? 4 : 0) +
|
|
($("#insInspApr").prop('checked')? 8 : 0) +
|
|
($("#insInspMei").prop('checked')? 16 : 0) +
|
|
($("#insInspJun").prop('checked')? 32 : 0) +
|
|
($("#insInspJul").prop('checked')? 64 : 0) +
|
|
($("#insInspAug").prop('checked')? 128 : 0) +
|
|
($("#insInspSep").prop('checked')? 256 : 0) +
|
|
($("#insInspOkt").prop('checked')? 512 : 0) +
|
|
($("#insInspNov").prop('checked')? 1024 : 0) +
|
|
($("#insInspDec").prop('checked')? 2048 : 0);
|
|
break;
|
|
case 5: // wordt gebruikt in res_deelrecord en res_deelvoegtoe.
|
|
bits = ($("#insInspZo").prop('checked')? 1 : 0) +
|
|
($("#insInspMa").prop('checked')? 2 : 0) +
|
|
($("#insInspDi").prop('checked')? 4 : 0) +
|
|
($("#insInspWo").prop('checked')? 8 : 0) +
|
|
($("#insInspDo").prop('checked')? 16 : 0) +
|
|
($("#insInspVr").prop('checked')? 32 : 0) +
|
|
($("#insInspZa").prop('checked')? 64 : 0);
|
|
break;
|
|
}
|
|
window.return_data.bits = bits;
|
|
|
|
FcltMgr.closeDetail(window, return_data);
|
|
}
|
|
|
|
function ins_cancel()
|
|
{
|
|
FcltMgr.closeDetail(window, { cancel: true } );
|
|
}
|
|
|
|
function onClickCbDay(pday)
|
|
{
|
|
if (<%=eenheid%> != 5)
|
|
{
|
|
// Minimaal 1 checkbox moet aangevinkt zijn. De laatste uit vinken kan niet.
|
|
if (!document.getElementById("insInspZo").checked &&
|
|
!document.getElementById("insInspMa").checked &&
|
|
!document.getElementById("insInspDi").checked &&
|
|
!document.getElementById("insInspWo").checked &&
|
|
!document.getElementById("insInspDo").checked &&
|
|
!document.getElementById("insInspVr").checked &&
|
|
!document.getElementById("insInspZa").checked)
|
|
$("#insInsp" + pday).prop('checked', true);
|
|
}
|
|
}
|
|
|
|
function onClickCbMnth(pmonth)
|
|
{
|
|
if (<%=eenheid%> != 5)
|
|
{
|
|
// Minimaal 1 checkbox moet aangevinkt zijn. De laatste uit vinken kan niet.
|
|
if (!document.getElementById("insInspJan").checked &&
|
|
!document.getElementById("insInspFeb").checked &&
|
|
!document.getElementById("insInspMaa").checked &&
|
|
!document.getElementById("insInspApr").checked &&
|
|
!document.getElementById("insInspMei").checked &&
|
|
!document.getElementById("insInspJun").checked &&
|
|
!document.getElementById("insInspJul").checked &&
|
|
!document.getElementById("insInspAug").checked &&
|
|
!document.getElementById("insInspSep").checked &&
|
|
!document.getElementById("insInspOkt").checked &&
|
|
!document.getElementById("insInspNov").checked &&
|
|
!document.getElementById("insInspDec").checked)
|
|
$("#insInsp" + pmonth).prop('checked', true);
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
|
|
<body class="fclt-modal" id="mod_insxcp">
|
|
<% MODAL_START(); %>
|
|
<form name="u2">
|
|
<% var bitsTitle = "";
|
|
var bitsIcon = "fa-calendar-day";
|
|
switch (eenheid)
|
|
{
|
|
case 0: bitsTitle = L("lcl_ins_controle_uurlijks");
|
|
bitsIcon = "fa-clock";
|
|
break;
|
|
case 1: bitsTitle = L("lcl_ins_controle_dagelijks");
|
|
break;
|
|
case 2: bitsTitle = L("lcl_ins_controle_wekelijks");
|
|
break;
|
|
case 3: bitsTitle = L("lcl_ins_controle_maandelijks");
|
|
break;
|
|
case 4: bitsTitle = L("lcl_ins_controle_jaarlijks");
|
|
break;
|
|
case 5: bitsTitle = L("lcl_ins_controle_wekelijks");
|
|
break;
|
|
}
|
|
MODAL_BLOCK_START("insBits", bitsTitle, { icon: bitsIcon })
|
|
%>
|
|
<input type="hidden" id="xcp_key" name="xcp_key" value="-1">
|
|
<%
|
|
if (eenheid == 2 || eenheid == 3 || eenheid == 4 || eenheid == 5)
|
|
{
|
|
if (eenheid == 2 || eenheid == 5)
|
|
{
|
|
if (eenheid == 2)
|
|
{ // Voor eenheid=2 moet er altijd minimaal 1 dag aangevinkt zijn. Voor eenheid=5 niet.
|
|
if ((bits & 127) == 0)
|
|
bits = 1;
|
|
}
|
|
%>
|
|
<tr class="trbits2">
|
|
<td class="label">
|
|
</td>
|
|
<td>
|
|
<input type="checkbox" class="fldInspZo" name="insInspZo" id="insInspZo" onClick="onClickCbDay('Zo')" value="1" <%=(bits & 1) == 1? "CHECKED" : ""%>><label for="insInspZo"><%=safe.html(calendar_names.days[0])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspMa" name="insInspMa" id="insInspMa" onClick="onClickCbDay('Ma')" value="1" <%=(bits & 2) == 2? "CHECKED" : ""%>><label for="insInspMa"><%=safe.html(calendar_names.days[1])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspDi" name="insInspDi" id="insInspDi" onClick="onClickCbDay('Di')" value="1" <%=(bits & 4) == 4? "CHECKED" : ""%>><label for="insInspDi"><%=safe.html(calendar_names.days[2])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspWo" name="insInspWo" id="insInspWo" onClick="onClickCbDay('Wo')" value="1" <%=(bits & 8) == 8? "CHECKED" : ""%>><label for="insInspWo"><%=safe.html(calendar_names.days[3])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspDo" name="insInspDo" id="insInspDo" onClick="onClickCbDay('Do')" value="1" <%=(bits & 16) == 16? "CHECKED" : ""%>><label for="insInspDo"><%=safe.html(calendar_names.days[4])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspVr" name="insInspVr" id="insInspVr" onClick="onClickCbDay('Vr')" value="1" <%=(bits & 32) == 32? "CHECKED" : ""%>><label for="insInspVr"><%=safe.html(calendar_names.days[5])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspZa" name="insInspZa" id="insInspZa" onClick="onClickCbDay('Za')" value="1" <%=(bits & 64) == 64? "CHECKED" : ""%>><label for="insInspZa"><%=safe.html(calendar_names.days[6])%></label>
|
|
</td>
|
|
</tr>
|
|
<% }
|
|
if (eenheid == 3)
|
|
{ %>
|
|
<tr class="trbits3">
|
|
<td>
|
|
</td>
|
|
<td>
|
|
<%
|
|
sql = "SELECT 256, " + safe.quoted_sql(L("lcl_ins_controle_eerste")) + ", 1 FROM DUAL"
|
|
+ " UNION SELECT 512, " + safe.quoted_sql(L("lcl_ins_controle_tweede")) + ", 2 FROM DUAL"
|
|
+ " UNION SELECT 768, " + safe.quoted_sql(L("lcl_ins_controle_derde")) + ", 3 FROM DUAL"
|
|
+ " UNION SELECT 1024, " + safe.quoted_sql(L("lcl_ins_controle_vierde")) + ", 4 FROM DUAL"
|
|
+ " UNION SELECT 1280, " + safe.quoted_sql(L("lcl_ins_controle_vijfde")) + ", 5 FROM DUAL"
|
|
+ " UNION SELECT 1536, " + safe.quoted_sql(L("lcl_ins_controle_eennalaatste")) + ", 6 FROM DUAL"
|
|
+ " UNION SELECT 1792, " + safe.quoted_sql(L("lcl_ins_controle_laatste")) + ", 7 FROM DUAL"
|
|
+ " ORDER BY 1";
|
|
FCLTselector("weekbits",
|
|
sql,
|
|
{ initKey: (bits & (256 + 512 + 1024)) > 0? (bits & (256 + 512 + 1024)) : 257, // Minimum waarde is eerste zondag van de maand (256 + 1 = 257)
|
|
required: false,
|
|
html: " width='100px'"
|
|
});
|
|
sql = "";
|
|
var initkey = 0;
|
|
for (var i = 0; i <= 6; i++)
|
|
{
|
|
sql += (i > 0? " UNION " : "") + "SELECT " + Math.pow(2, (i)) + ", " + safe.quoted_sql(calendar_names.days[i]) + " FROM DUAL";
|
|
if (initkey == 0 && (bits & Math.pow(2, (i))) == Math.pow(2, (i)))
|
|
initkey = Math.pow(2, (i));
|
|
}
|
|
FCLTselector("dagbits",
|
|
sql,
|
|
{ initKey: initkey > 0? initkey : 1,
|
|
required: false
|
|
});
|
|
%>
|
|
<%=L("lcl_ins_controle_period_ofthemonth")%></td>
|
|
</tr>
|
|
<% }
|
|
if (eenheid == 4)
|
|
{
|
|
if ((bits & 4095) == 0)
|
|
bits = 1;
|
|
%>
|
|
<tr class="trbits4">
|
|
<td>
|
|
</td>
|
|
<td>
|
|
<input type="checkbox" class="fldInspJan" name="insInspJan" id="insInspJan" onClick="onClickCbMnth('Jan')" value="1" <%=(bits & 1) == 1? "CHECKED" : ""%>><label for="insInspJan"><%=safe.html(calendar_names.months[0])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspFeb" name="insInspFeb" id="insInspFeb" onClick="onClickCbMnth('Feb')" value="1" <%=(bits & 2) == 2? "CHECKED" : ""%>><label for="insInspFeb"><%=safe.html(calendar_names.months[1])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspMaa" name="insInspMaa" id="insInspMaa" onClick="onClickCbMnth('Maa')" value="1" <%=(bits & 4) == 4? "CHECKED" : ""%>><label for="insInspMaa"><%=safe.html(calendar_names.months[2])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspApr" name="insInspApr" id="insInspApr" onClick="onClickCbMnth('Apr')" value="1" <%=(bits & 8) == 8? "CHECKED" : ""%>><label for="insInspApr"><%=safe.html(calendar_names.months[3])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspMei" name="insInspMei" id="insInspMei" onClick="onClickCbMnth('Mei')" value="1" <%=(bits & 16) == 16? "CHECKED" : ""%>><label for="insInspMei"><%=safe.html(calendar_names.months[4])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspJun" name="insInspJun" id="insInspJun" onClick="onClickCbMnth('Jun')" value="1" <%=(bits & 32) == 32? "CHECKED" : ""%>><label for="insInspJun"><%=safe.html(calendar_names.months[5])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspJul" name="insInspJul" id="insInspJul" onClick="onClickCbMnth('Jul')" value="1" <%=(bits & 64) == 64? "CHECKED" : ""%>><label for="insInspJul"><%=safe.html(calendar_names.months[6])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspAug" name="insInspAug" id="insInspAug" onClick="onClickCbMnth('Aug')" value="1" <%=(bits & 128) == 128? "CHECKED" : ""%>><label for="insInspAug"><%=safe.html(calendar_names.months[7])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspSep" name="insInspSep" id="insInspSep" onClick="onClickCbMnth('Sep')" value="1" <%=(bits & 256) == 256? "CHECKED" : ""%>><label for="insInspSep"><%=safe.html(calendar_names.months[8])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspOkt" name="insInspOkt" id="insInspOkt" onClick="onClickCbMnth('Okt')" value="1" <%=(bits & 512) == 512? "CHECKED" : ""%>><label for="insInspOkt"><%=safe.html(calendar_names.months[9])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspNov" name="insInspNov" id="insInspNov" onClick="onClickCbMnth('Nov')" value="1" <%=(bits & 1024) == 1024? "CHECKED" : ""%>><label for="insInspNov"><%=safe.html(calendar_names.months[10])%></label>
|
|
<br>
|
|
<input type="checkbox" class="fldInspDec" name="insInspDec" id="insInspDec" onClick="onClickCbMnth('Dec')" value="1" <%=(bits & 2048) == 2048? "CHECKED" : ""%>><label for="insInspDec"><%=safe.html(calendar_names.months[11])%></label>
|
|
<br>
|
|
<%
|
|
%>
|
|
</td>
|
|
</tr>
|
|
<% }
|
|
}
|
|
if (eenheid < 4)
|
|
{ %>
|
|
<tr class="trnotholiday">
|
|
<td class="label">
|
|
</td>
|
|
<td>
|
|
<input type="checkbox" class="fldInspNoHoli" name="insInspNoHoli" id="insInspNoHoli" value="1" <%=(bits & 128) == 128? "CHECKED" : ""%>><label for="insInspNoHoli"><%=L("lcl_ins_controle_notholiday")%></label>
|
|
</td>
|
|
</tr>
|
|
<% }
|
|
MODAL_BLOCK_END();
|
|
|
|
var buttons = [];
|
|
buttons.push({title: L("lcl_select"), icon: "fa-fclt-save", action:"ins_submit()", importance: 1})
|
|
buttons.push({title: L("lcl_cancel"), icon: "fa-fclt-cancel", action:"ins_cancel()", importance: 3})
|
|
SIMPLE_BLOCK_START();
|
|
CreateButtons(buttons);
|
|
SIMPLE_BLOCK_END();
|
|
IFACE.FORM_END();
|
|
%>
|
|
</form>
|
|
<% MODAL_END(); %>
|
|
</body>
|
|
</html>
|
|
<% ASPPAGE_END(); %>
|