all headquarters) $f_hq_id_ext_len = 0; if ($userTypeName == "hq") : // Extended field needed for global parameters $f_hq_id_ext = getColVectorFromDB2Array("mandatorheadquarters","md_id",$md_id,"hq_id"); array_unshift($f_hq_id_ext, 0); $f_hq_id_ext_len = count($f_hq_id_ext); endif; // Special rights $empHasGeneralAccessToHeadquartersAdministration = authCheckEmployeeRights($emp_id, "47"); // General access to headquarters administration $empHasAccessregardingHeadquartersManager = authCheckEmployeeRights($emp_id, "32"); // Headquarters manager $empHasAccessToModifyPDALocatingState = authCheckEmployeeRights($emp_id, "9"); // VPA locating $empHasAccessToHeadquarters = authCheckEmployeeRights($emp_id, "10"); // Access to all headquarters $empHasAccessToEditBwvHotlineNumbers = authCheckEmployeeRights($emp_id, "45"); // BWV hotline // Current timestamp $currentTime = getDateTime("0"); // Get the emp_id of the root admin, e.g. setting new passwords of employees $empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName); // For output only $styleDivWidth01 = "190px"; // Container for parameterizing lists if ($f_act != "") : // Change GLOBAL parameters (for headquarter) if ($f_act == "setGlobPar") : if ($empHasGeneralAccessToHeadquartersAdministration) : $tmpLogStr = ""; for ($f = 1; $f < $f_hq_id_ext_len; $f++) : getSecHttpVars("1",array("hq_data_cmp_comp_" . $f_hq_id_ext[$f], "hq_data_cmp_comp2_" . $f_hq_id_ext[$f], "hq_data_cmp_comp3_" . $f_hq_id_ext[$f], "hq_data_cmp_comp4_" . $f_hq_id_ext[$f], "hq_data_ad_street_" . $f_hq_id_ext[$f], "hq_data_cmp_hsno_" . $f_hq_id_ext[$f], "hq_data_ad_zipcode_" . $f_hq_id_ext[$f], "hq_data_ad_city_" . $f_hq_id_ext[$f])); $cmpComp = trim(${("hq_data_cmp_comp_" . $f_hq_id_ext[$f])}); $cmpComp2 = trim(${("hq_data_cmp_comp2_" . $f_hq_id_ext[$f])}); $cmpComp3 = trim(${("hq_data_cmp_comp3_" . $f_hq_id_ext[$f])}); $cmpComp4 = trim(${("hq_data_cmp_comp4_" . $f_hq_id_ext[$f])}); $adStreet = trim(${("hq_data_ad_street_" . $f_hq_id_ext[$f])}); $cmpHsno = trim(${("hq_data_cmp_hsno_" . $f_hq_id_ext[$f])}); $adZipcode = trim(${("hq_data_ad_zipcode_" . $f_hq_id_ext[$f])}); $adCity = trim(${("hq_data_ad_city_" . $f_hq_id_ext[$f])}); $hqCmpId = getFieldValueFromId("headquarters","hq_id", $f_hq_id_ext[$f],"cmp_id"); if ($hqCmpId != "" && is_numeric($hqCmpId) && $hqCmpId > 0) : updateStmt("company", "cmp_id", $hqCmpId, array("cmp_comp", $cmpComp, "cmp_comp2", $cmpComp2, "cmp_comp3", $cmpComp3, "cmp_comp4", $cmpComp4, "cmp_hsno", $cmpHsno)); $hqAdId = getFieldValueFromId("company","cmp_id", $hqCmpId,"ad_id"); if ($hqAdId != "" && is_numeric($hqAdId) && $hqAdId > 0) : updateStmt("address", "ad_id", $hqAdId, array("ad_street", $adStreet, "ad_zipcode", $adZipcode, "ad_city", $adCity)); else : insertStmt("address", array("ad_street", $adStreet, "ad_zipcode", $adZipcode, "ad_city", $adCity)); $adIdNew = getLastInsertID(); updateStmt("company", "cmp_id", $hqCmpId, array("ad_id", $adIdNew)); endif; endif; if ($tmpLogStr != "") : $tmpLogStr .= "|"; endif; $tmpLogStr .= $f . "=" . $hqCmpId . ";" . $hqAdId . ";" . $cmpComp . ";" . $cmpComp2 . ";" . $cmpComp3 . ";" . $cmpComp4 . ";" . $adStreet . ";" . $cmpHsno . ";" . $adZipcode . ";" . $adCity; endfor; // Write logdata into log database writeToLogDB("199",$hq_id,"",$usr_id,"","","","" . $tmpLogStr,"","",""); endif; if ($empHasGeneralAccessToHeadquartersAdministration && $empHasAccessToModifyPDALocatingState) : /* // Store value to enable/disable the PDA locating if (is_numeric($par_locatingByPDA)) : if (existsEntry("parameter",array("par_key","LOCATING_PDA_ENABLED","emp_id","0","hq_id",$hq_id))) : updateStmt("parameter", "emp_id", "0", array("par_value", $par_locatingByPDA), " par_key = 'LOCATING_PDA_ENABLED' AND hq_id = '" . $hq_id . "'"); else: insertStmt("parameter", array("par_key", "LOCATING_PDA_ENABLED", "emp_id", "0", "par_value", $par_locatingByPDA, "hq_id", $hq_id, "md_id", $md_id)); endif; else : $statusMessage = getLngt("Der Status konnte nicht geändert werden."); endif; // Store interval for the PDA locating if ($par_locatingFromHrs == "" || !is_numeric($par_locatingFromHrs)) : $par_locatingFromHrs = "0"; endif; if ($par_locatingFromMin == "" || !is_numeric($par_locatingFromMin)) : $par_locatingFromMin = "0"; endif; if ($par_locatingToHrs == "" || !is_numeric($par_locatingToHrs)) : $par_locatingToHrs = "23"; endif; if ($par_locatingToMin == "" || !is_numeric($par_locatingToMin)) : $par_locatingToMin = "59"; endif; // Check for from-time <= to-time if ($par_locatingToHrs < $par_locatingFromHrs || ($par_locatingToHrs == $par_locatingFromHrs && $par_locatingToMin < $par_locatingFromMin)) : $statusMessage = getLngt("Die obere Intervallgrenze für die VPA-Ortung ist kleiner als die untere. Bitte neu eingeben!"); else : if (existsEntry("parameter",array("par_key","LOCATING_PDA_INTERVAL","emp_id","0","hq_id",$hq_id))) : updateStmt("parameter", "emp_id", "0", array("par_value", $par_locatingFromHrs . "," . $par_locatingFromMin . "," . $par_locatingToHrs . "," . $par_locatingToMin), " par_key = 'LOCATING_PDA_INTERVAL' AND hq_id = '" . $hq_id . "'"); else: insertStmt("parameter", array("par_key", "LOCATING_PDA_INTERVAL", "emp_id", "0", "par_value", $par_locatingFromHrs . "," . $par_locatingFromMin . "," . $par_locatingToHrs . "," . $par_locatingToMin, "hq_id", $hq_id, "md_id", $md_id)); endif; endif; // Write logdata into log database writeToLogDB("194",$hq_id,"",$usr_id,"","","","LOC_GLOB_PAR_STATE=" . $par_locatingByPDA . "|LOC_GLOB_PAR_INTERVAL=" . $par_locatingFromHrs . "," . $par_locatingFromMin . "," . $par_locatingToHrs . "," . $par_locatingToMin,"","",""); */ endif; if ($empHasGeneralAccessToHeadquartersAdministration && $empHasAccessToEditBwvHotlineNumbers) : $tmpLogStr = ""; for ($f = 0; $f < $f_hq_id_ext_len; $f++) : // BWV-Hotline getSecHttpVars("1",array("par_BWV_phone_" . $f_hq_id_ext[$f])); $par_BWV_phone = ${("par_BWV_phone_" . $f_hq_id_ext[$f])}; if (existsEntry("parameter",array("par_key","BWV_PHONE_NO","emp_id","0","hq_id",$f_hq_id_ext[$f]))) : updateStmt("parameter", "emp_id", "0", array("par_value", $par_BWV_phone), " par_key = 'BWV_PHONE_NO' AND hq_id = '" . $f_hq_id_ext[$f] . "'"); else: insertStmt("parameter", array("par_key", "BWV_PHONE_NO", "emp_id", "0", "par_value", $par_BWV_phone, "hq_id", $f_hq_id_ext[$f], "md_id", $md_id)); endif; if ($tmpLogStr != "") : $tmpLogStr .= "|"; endif; $tmpLogStr .= $f . "=" . $par_BWV_phone; // GLN getSecHttpVars("1",array("par_GLN_" . $f_hq_id_ext[$f])); $par_GLN = ${("par_GLN_" . $f_hq_id_ext[$f])}; if ($f == 0) : if (existsEntry("parameter",array("par_key","GLN_HQ_ALL","emp_id","0","hq_id",$f_hq_id_ext[$f]))) : updateStmt("parameter", "emp_id", "0", array("par_value", $par_GLN), " par_key = 'GLN_HQ_ALL' AND hq_id = '" . $f_hq_id_ext[$f] . "'"); else: insertStmt("parameter", array("par_key", "GLN_HQ_ALL", "emp_id", "0", "par_value", $par_GLN, "hq_id", $f_hq_id_ext[$f], "md_id", $md_id)); endif; else : updateStmt("headquarters", "hq_id", $f_hq_id_ext[$f], array("hq_gln", $par_GLN), ""); endif; if ($tmpLogStr != "") : $tmpLogStr .= "|"; endif; $tmpLogStr .= "," . $par_GLN; // DUNS getSecHttpVars("1",array("par_DUNS_" . $f_hq_id_ext[$f])); $par_DUNS = ${("par_DUNS_" . $f_hq_id_ext[$f])}; if ($f == 0) : if (existsEntry("parameter",array("par_key","DUNS_HQ_ALL","emp_id","0","hq_id",$f_hq_id_ext[$f]))) : updateStmt("parameter", "emp_id", "0", array("par_value", $par_DUNS), " par_key = 'DUNS_HQ_ALL' AND hq_id = '" . $f_hq_id_ext[$f] . "'"); else: insertStmt("parameter", array("par_key", "DUNS_HQ_ALL", "emp_id", "0", "par_value", $par_DUNS, "hq_id", $f_hq_id_ext[$f], "md_id", $md_id)); endif; else : updateStmt("headquarters", "hq_id", $f_hq_id_ext[$f], array("hq_duns", $par_DUNS), ""); endif; if ($tmpLogStr != "") : $tmpLogStr .= "|"; endif; $tmpLogStr .= "," . $par_DUNS; endfor; // Write logdata into log database writeToLogDB("196",$hq_id,"",$usr_id,"","","","" . $tmpLogStr,"","",""); endif; endif; endif; // Button for setting GLOBAL PARAMETERS $buttonGlobalSettings = defineButtonType10(getLngt("Speichern"), "action_save_globs", "finishPage('" . ec("setGlobPar") . "');", "140", "left"); $outHqAddress = ""; $outHotlineBWV = ""; $outGLN = ""; $outDUNS = ""; $outVHT = ""; $outLocatingVPA = ""; if ($userTypeName == "hq") : // Headquarters master data (address, etc.) if ($empHasGeneralAccessToHeadquartersAdministration || $empHasAccessToHeadquarters) : $outHqAddress .= ""; for ($f = 1; $f < $f_hq_id_ext_len; $f++) : $hqCmpId = getFieldValueFromId("headquarters","hq_id", $f_hq_id_ext[$f],"cmp_id"); $hqCmpFields = getFieldsValueFromId("company", "cmp_id", $hqCmpId, array("cmp_comp","cmp_comp2","cmp_comp3","cmp_comp4","ad_id","cmp_hsno")); $cmpAdId = $hqCmpFields[4]; $hqAdFields = getFieldsValueFromId("address", "ad_id", $cmpAdId, array("ad_street","ad_zipcode","ad_city","ad_country")); $outHqAddress .= "
" . getLngt("Niederlassung") . " " . $hqNameArr[$f_hq_id_ext[$f]] . "
"; if (($empHasGeneralAccessToHeadquartersAdministration || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin))) : $outHqAddress .= "
"; $outHqAddress .= "" . " "; $outHqAddress .= "" . ""; $outHqAddress .= "
"; $outHqAddress .= "" . " "; $outHqAddress .= "" . ""; $outHqAddress .= "
"; $outHqAddress .= "" . " "; $outHqAddress .= "" . ""; $outHqAddress .= "
"; $outHqAddress .= "" . " "; $outHqAddress .= "" . " "; $outHqAddress .= "
"; else : $outHqAddress .= "
"; $outHqAddress .= $hqCmpFields[0] . " " . $hqCmpFields[1]; $outHqAddress .= "
"; $outHqAddress .= $hqCmpFields[2] . " " . $hqCmpFields[3]; $outHqAddress .= "
"; $outHqAddress .= $hqAdFields[0] . " " . $hqCmpFields[5]; $outHqAddress .= "
"; $outHqAddress .= $hqAdFields[1] . " " . $hqAdFields[2]; $outHqAddress .= "
"; endif; $outHqAddress .= "

\n"; endfor; endif; // VPA locating if ($empHasAccessToModifyPDALocatingState) : /* // Get current state of locating mode $locatingByPDA = getParameterValue("0", "LOCATING_PDA_ENABLED"); // Get hq value from table "parameter" if ($locatingByPDA == "" || !is_numeric($locatingByPDA) || !($locatingByPDA == "0" || $locatingByPDA == "1")) : $locatingByPDA = LOCATING_PDA_ENABLED; if (!is_numeric($locatingByPDA) || !($locatingByPDA == "0" || $locatingByPDA == "1")) : $locatingByPDA = "1"; // Enable per default endif; endif; // Get interval of locating mode if mode is activated $intervalStatus = array(); $locatingInterval = getParameterValue("0", "LOCATING_PDA_INTERVAL"); // Get corresponding interval if ($locatingInterval == "") : $locatingInterval = LOCATING_PDA_INTERVAL; endif; if ($locatingInterval != "") : $intervalStatus = explode(",",$locatingInterval); endif; // for ($f = 0; $f < $f_hq_id_ext_len; $f++) : $outLocatingVPA .= "
" . getLngt("VPA-Ortung:") . "
\n" . "


\n"; $outLocatingVPA .= "
" . getLngt("Intervall bei
Aktivierung:") . "
\n" . "
" . " : " . "" . "  (" . getLngt("von") . ")" . "
\n" . "
 
\n" . "
" . " : " . "" . "  (" . getLngt("bis") . ")" . "

" . "
\n"; */ endif; // BWV-Hotline, GLN, DUNS if ($empHasAccessToEditBwvHotlineNumbers) : $par_GLN_HQ_ALL = getParameterValue("0", "GLN_HQ_ALL", "0"); $par_DUNS_HQ_ALL = getParameterValue("0", "DUNS_HQ_ALL", "0"); for ($f = 0; $f < $f_hq_id_ext_len; $f++) : // BWV-Hotline $par_BWV_phone = getParameterValue("0", "BWV_PHONE_NO", (string) $f_hq_id_ext[$f]); $outHotlineBWV .= "
" . ($f_hq_id_ext[$f] == "0" ? getLngt("BWV-Hotline bundesweit:") : getLngt("BWV-Hotline") . " " . $hqNameArr[$f_hq_id_ext[$f]]) . "
"; if (($empHasGeneralAccessToHeadquartersAdministration || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin)) && authCheckEmployeeRights($emp_id, "45")) : $outHotlineBWV .= ""; else : $outHotlineBWV .= $par_BWV_phone; endif; $outHotlineBWV .= "

\n"; // GLN $hq_gln = ""; if ($f > 0) : $hq_gln = getFieldValueFromId("headquarters","hq_id", $f_hq_id_ext[$f],"hq_gln"); endif; $outGLN .= "
" . ($f_hq_id_ext[$f] == "0" ? getLngt("GLN bundesweit:") : getLngt("GLN") . " " . $hqNameArr[$f_hq_id_ext[$f]]) . "
"; if (($empHasGeneralAccessToHeadquartersAdministration || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin)) && authCheckEmployeeRights($emp_id, "45")) : if ($f == 0) : $outGLN .= ""; else : $outGLN .= ""; endif; else : if ($f == 0) : $outGLN .= $par_GLN_HQ_ALL; else : $outGLN .= $hq_gln; endif; endif; $outGLN .= "

\n"; // DUNS $hq_duns = ""; if ($f > 0) : $hq_duns = getFieldValueFromId("headquarters","hq_id", $f_hq_id_ext[$f],"hq_duns"); endif; $outDUNS .= "
" . ($f_hq_id_ext[$f] == "0" ? getLngt("DUNS bundesweit:") : getLngt("DUNS") . " " . $hqNameArr[$f_hq_id_ext[$f]]) . "
"; if (($empHasGeneralAccessToHeadquartersAdministration || ($empIdRootAdmin != "" && $emp_id == $empIdRootAdmin)) && authCheckEmployeeRights($emp_id, "45")) : if ($f == 0) : $outDUNS .= ""; else : $outDUNS .= ""; endif; else : if ($f == 0) : $outDUNS .= $par_DUNS_HQ_ALL; else : $outDUNS .= $hq_duns; endif; endif; $outDUNS .= "

\n"; endfor; endif; // Vehicle classes (output only) if (true) : $sqlquery = "SELECT hq.hq_mnemonic, cr.hq_id, crvh.vht_id, mt.mt_value, COUNT(*) AS num" . " FROM couriervehicle AS crvh, courier AS cr, metatype AS mt, headquarters AS hq, mandatorheadquarters AS md" . " WHERE crvh.cr_id = cr.cr_id AND cr.hq_id = hq.hq_id AND md.hq_id = hq.hq_id AND" . " crvh.vht_id = mt.mt_sort AND mt.mt_type = 'vehicletype'" . " GROUP BY cr.hq_id, crvh.vht_id" . " ORDER BY hq.hq_mnemonic, crvh.vht_id"; // echo $sqlquery . "
"; $result = $db->dbQ($sqlquery); $remHqId = 0; while ($row = $result->fetch_assoc()): $hqId = $row["hq_id"]; $hqMnemonic = $row["hq_mnemonic"]; $vhtName = $row["mt_value"]; $numOfVehiclesPerClass = $row["num"]; if ($remHqId == 0) : $remHqId = $hqId; $outVHT .= "
" . getLngt("Niederlassung") . " " . $hqMnemonic . ""; endif; if ($remHqId != $hqId) : $remHqId = $hqId; $outVHT .= "

\n"; $outVHT .= "
" . getLngt("Niederlassung") . " " . $hqMnemonic . ""; endif; $outVHT .= "
" . getLngt($vhtName) . "" . " " . "" . $numOfVehiclesPerClass . "
"; endwhile; $outVHT .= "

\n"; $result->free(); endif; endif; ?> <?php echo $pageTitel ?> <?php echo $usr_account ?>