DJIN#51899 omsteltijd per ruimte per opstelling geintroduceerd

svn path=/Website/trunk/; revision=41280
This commit is contained in:
2019-03-04 15:51:50 +00:00
parent cc936d5164
commit 33cfd3cf81
6 changed files with 114 additions and 11 deletions

View File

@@ -67,6 +67,14 @@ function model_res_ruimte_opstelling(fnparams)
"typ": "number",
"required": true
},
"setuptime": {
"dbs": "res_ruimte_opstel_tijd",
"label": L("res_ruimte_opstel_tijd"),
"typ": "float",
"trimZeros": true,
"defaultvalue": 0,
"required": true
},
"isdefault": {
"dbs": "res_ruimte_opstel_default",
"label": L("res_ruimte_opstel_default"),
@@ -87,6 +95,7 @@ function model_res_ruimte_opstelling(fnparams)
"bookingroom",
"bookingconfiguration",
"capacity",
"setuptime",
"isdefault"
]
};

View File

@@ -28,9 +28,10 @@ scaffolding(model_res_ruimte,
"description",
"bookingdiscipline",
"bookingconfigurations.bookingconfiguration",
"bookingconfigurations.capacity",
"bookingconfigurations.capacity",
"bookingconfigurations.setuptime",
"physicalrooms.ruimtekey"
]
]
},
"show": {
"js": ["./mgt_tools.js"],

View File

@@ -201,6 +201,7 @@ res = {
result.min_duur = oRs("res_ruimte_min_duur").Value;
}
sql = "SELECT res_ruimte_opstel_key"
+ " , res_ruimte_opstel_tijd"
+ " , res_ruimte_opstel_bezoekers"
+ " , res_ruimte_opstel_default"
+ " , ro.res_opstelling_key"
@@ -221,6 +222,7 @@ res = {
var rc = { ruimte_opstel_key: oRs("res_ruimte_opstel_key").Value,
opstelling_omschrijving: oRs("res_opstelling_omschrijving").Value,
opstelling_key: oRs("res_opstelling_key").Value,
opstel_tijd: oRs("res_ruimte_opstel_tijd").Value,
bezoekers: oRs("res_ruimte_opstel_bezoekers").Value,
verwijderd: oRs("res_ruimte_opstel_verwijder").Value != null }
if (oRs("res_ruimte_opstel_image").Value)
@@ -1309,6 +1311,7 @@ res = {
var sql = "SELECT DISTINCT fr.res_ruimte_key"
+ " , " + lcl.xsqla('rg.res_ruimte_nr', 'rg.res_ruimte_key')
+ " , rg.res_ruimte_volgnummer"
+ " , min_opstel_tijd"
+ " , bmin"
+ " , bmax"
+ " , alg_locatie_omschrijving"
@@ -1360,6 +1363,7 @@ res = {
sql = "WITH opstel_bez"
+ " AS (SELECT res_ruimte_key"
+ " , MIN (res_ruimte_opstel_tijd) min_opstel_tijd"
+ " , MIN (res_ruimte_opstel_bezoekers) bmin"
+ " , MAX (res_ruimte_opstel_bezoekers) bmax"
+ " FROM res_ruimte_opstelling"
@@ -1436,6 +1440,7 @@ res = {
{
var room = { res_ruimte_key: oRs("res_ruimte_key").Value,
res_ruimte_nr : oRs("res_ruimte_nr").Value,
opsteltijd : oRs("min_opstel_tijd").Value,
bMin : oRs("bMin").Value,
bMax : oRs("bMax").Value,
prepost_time : oRs("res_disc_params_preposttime").Value,
@@ -1508,6 +1513,8 @@ res = {
+ " , (SELECT count(1) FROM mld_melding mld_res"
+ " WHERE mld_res.res_rsv_ruimte_key = rv.res_rsv_ruimte_key) aantalM"
+ " , rsv_prepost.res_disc_params_preposttime"
+ " , ro.res_ruimte_opstel_key"
+ " , ro.res_ruimte_opstel_tijd"
+ " FROM res_v_aanwezigrsv_ruimte rv"
+ " , res_ruimte_opstelling ro"
+ " , res_activiteit ra"
@@ -1530,7 +1537,7 @@ res = {
? " AND ra.res_srtactiviteit_key = rsa.res_srtactiviteit_key"
: "")
+ (params.res_ruimte_key && !params.forSelectRoom
? " AND res_ruimte_key_1=" + params.res_ruimte_key
? " AND res_ruimte_key_1 = " + params.res_ruimte_key
: "")
+ " AND res_ruimte_key_1 IN (SELECT res_ruimte_key FROM (" + room_sql + "))"
+ " AND rsv_prepost.res_ruimte_key = res_ruimte_key_2"
@@ -1560,6 +1567,10 @@ res = {
res_tot : new Date(oRs("res_rsv_ruimte_tot").Value),
fo_status : oRs("res_status_fo_key").Value
};
if (oRs("res_ruimte_opstel_key").Value)
data.res_opstel_key = oRs("res_ruimte_opstel_key").Value;
if (oRs("res_ruimte_opstel_tijd").Value)
data.res_opstel_tijd = oRs("res_ruimte_opstel_tijd").Value;
if (oRs("res_disc_params_preposttime").Value)
data.rsv_preposttime = oRs("res_disc_params_preposttime").Value;
if (oRs("res_activiteit_posttime").Value)

View File

@@ -68,6 +68,79 @@ function set_will_fit(plan_rooms_info, plan_bezet_info, params)
return any_nofit;
}
// Converts plan_bezet_info[x].res_opstel_tijd into .pre_opstel_tijd and .post_opstel_tijd
// taking into account the "opstelling" of the previous and next reservations.
function addPrePostOpstelTijd(plan_rooms_info, plan_bezet_info, params)
{
var room;
var all_rsv;
var curr_rsv;
var this_rsv;
var prev_rsv;
var next_rsv;
var checkPrevNext;
for (var i_room in plan_rooms_info)
{
room = plan_rooms_info[i_room];
all_rsv = plan_bezet_info[room.res_ruimte_key];
if (all_rsv == null) continue;
// Efficiency check, het sorteren is veruit het zwaarst, dus voorkomen waar mogelijk.
checkPrevNext = false;
for (var x = 0; all_rsv != null && x < all_rsv.length; x++)
{
curr_rsv = all_rsv[x];
if ("res_opstel_tijd" in curr_rsv && curr_rsv.res_opstel_tijd > 0 && curr_rsv.fo_status != 3 &&
(!("prepost_time" in room) || curr_rsv.res_opstel_tijd > room.prepost_time) &&
(!("rsv_preposttime" in curr_rsv) || curr_rsv.res_opstel_tijd > curr_rsv.rsv_preposttime))
{
checkPrevNext = true;
break;
}
}
if (!checkPrevNext) continue;
all_rsv.sort(function(a, b) { return new Date(a.res_van) - new Date(b.res_van) });
for (var x = 0; all_rsv != null && x < all_rsv.length; x++)
{
this_rsv = all_rsv[x];
if (!("res_opstel_tijd" in this_rsv)) continue;
// Hier weegt de res_opstel_tijd toch niet mee
if (!this_rsv.res_opstel_tijd || this_rsv.fo_status == 3 ||
(room.prepost_time && this_rsv.res_opstel_tijd <= room.prepost_time) ||
(this_rsv.rsv_preposttime && this_rsv.res_opstel_tijd <= this_rsv.rsv_preposttime))
{
delete this_rsv.res_opstel_tijd;
continue;
}
prev_rsv = null;
next_rsv = null;
// Verschillende ruimtes hebben nooit dezelfde res_ruimte_opstelling_key
if (x > 0 && ("na_koppel" in this_rsv) == ("na_koppel" in all_rsv[x-1]))
prev_rsv = all_rsv[x-1];
if (x+1 < all_rsv.length && ("na_koppel" in this_rsv) == ("na_koppel" in all_rsv[x+1]))
next_rsv = all_rsv[x+1];
if (prev_rsv == null || !("res_opstel_key" in prev_rsv) || this_rsv.res_opstel_key != prev_rsv.res_opstel_key)
this_rsv.pre_opstel_tijd = this_rsv.res_opstel_tijd;
if (next_rsv == null || !("res_opstel_key" in next_rsv) || this_rsv.res_opstel_key != next_rsv.res_opstel_key)
this_rsv.post_opstel_tijd = this_rsv.res_opstel_tijd;
delete this_rsv.res_opstel_tijd;
}
}
}
// De echte planningblokjes van een regel
function make_plan_regel(room, ar, params, nr_days, hour_px)
{
@@ -128,7 +201,7 @@ function make_plan_regel(room, ar, params, nr_days, hour_px)
(params.contact_key != -1 && params.contact_key != contact_key) ||
(params.urole=='fe' && !user.isCollega(contact_key)))
{
not_available = true; // FE en niet een eigen reservering
not_available = true; // FE en niet een eigen reservering
}
if (ar[ci].extern) // uitzondering
@@ -207,16 +280,18 @@ function make_plan_regel(room, ar, params, nr_days, hour_px)
// Perhaps cleaning time, alleen optie en definitief
// this_post_time >= this_prepost_time (always)
var this_post_time = Math.max(this_prepost_time, (ar[ci].act_post_time || 0));
var this_pre_time = Math.max(this_prepost_time, (ar[ci].pre_opstel_tijd || 0));
var this_post_time = Math.max(this_prepost_time, (ar[ci].post_opstel_tijd || 0), (ar[ci].act_post_time || 0));
var preclean = 0;
var postclean = 0;
if (this_post_time && (ar[ci].fo_status == 1 || ar[ci].fo_status == 2))
if ((this_pre_time || this_post_time) && (ar[ci].fo_status == 1 || ar[ci].fo_status == 2))
{
theClass += " res_cleaning";
// maximaal kwartier 'doorschieten' links/rechts
preclean = Math.min(this_prepost_time, h_start - S("res_t1") + 0.25);
preclean = Math.min(this_pre_time, h_start - S("res_t1") + 0.25);
postclean = Math.min(this_post_time, S("res_t2") - h_end + 0.25);
if ( Math.round(hour_px * postclean - 1) > 0 )
@@ -325,6 +400,11 @@ __Log("start make_plan_room");
onmouse += " onmouseout=$('#timetip').hide();"
}
if (!params.forSelectRoom)
{
addPrePostOpstelTijd(plan_rooms_info, plan_bezet_info, params);
}
var xfunc = user.func_enabled2("CAD", { isOptional: true });
var cad_button = (xfunc && xfunc.canRead("WEB_CADUSE"));

View File

@@ -458,6 +458,7 @@ function scaffolding_list(model, scf_params)
generaltotal: field.generaltotal,
generalaverage: field.generalaverage,
decimals: field.decimals,
trimZeros: field.trimZeros,
secret: field.secret };
if (field.iscurrency)
coldata.datatype = "currency";
@@ -482,7 +483,7 @@ function scaffolding_list(model, scf_params)
rst.totalShow = fntotalShow;
}
if (field.typ == 'check' || field.typ == 'check0')
if (field.typ == "check" || field.typ == "check0")
{
coldata.content = fnfncolCheck(fld);
}

View File

@@ -1164,7 +1164,7 @@ function __rsMakeTableHeader(oRs, oRsFlexData, anyMultiActions)
}
if (inlineDetails)
{
html += "<th>"+L("lcl_inlinecolumnheader")+"</th>";
html += "<th>"+I("fa-plus-square-o fa-lg")+"</th>";
}
}
// ========= COLUMNS/THEADER =========
@@ -1713,6 +1713,7 @@ function Column(params)
this.hidden = params.hidden;
this.datatype = params.datatype;
this.decimals = params.decimals;
this.trimZeros = params.trimZeros;
this.total = params.total;
this.average = params.average;
this.amount = null; // Voor INTERN gebruik: is de integerwaarde van content, indien de kolomwaarden opgeteld moeten worden.
@@ -1758,7 +1759,7 @@ ResultsetTable.formatValue = function (val, params) //datatype, decimals)
else
return "&nbsp;";
}
// Vanuit API2 model
// Vanuit API2 model
if (typeof val == "object" && "name" in val)
{
val = val["name"];
@@ -1782,7 +1783,7 @@ ResultsetTable.formatValue = function (val, params) //datatype, decimals)
return val;
}
case "currency": return safe.curr(val);
case "float" : return safe.displayfloat(val, params.decimals);
case "float" : return safe.displayfloat(val, params.decimals, params.trimZeros);
case "number" : return val;
case "html" : return val;
}