\n";
$currRowStr .= " | " . decodeSpecialChars($row["ati_serialno"]) . " | \n";
$currRowStr .= " " . $dataSU[28] . " | \n";
$currRowStr .= " " . ($dataSU[25] != "" ? "*" : "") . ($dataSU[30] != "" ? $deactivationText : "") . " | \n";
$currRowStr .= " " . $row["stk_name"] . " " . $row["ati_data_01"] . " | \n";
$currRowStr .= " " . "" . " | \n";
// Preselection of the tour number
$currRowStr .= " \n";
$currRowStr .= " \n";
$currRowStr .= " | \n";
$currRowStr .= " " . $dataSU[19] . " | \n";
$currRowStr .= " " . $row["ad_zipcode"] . " | \n";
$currRowStr .= " " . $dataSU[2] . " | \n";
$currRowStr .= " " . $dataSU[3] . " | \n";
if ($displayColumnData) :
$ptBgCol = "";
if ($dataSU[5] != "" && $dataSU[5] >= $f_tv[$atId][3]) :
$ptBgCol = "background-color:" . $colArray["yellow"] . ";";
endif;
if ($dataSU[5] != "" && $dataSU[5] >= $f_tv[$atId][4]) :
$ptBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$tmpChecked = in_array($row["ati_serialno"], $f_su_cb_chkbx_00);
if ($tmpChecked) :
$tourSumArray[$dataSU[21]] += $dataSU[5]; // Init sum of checked cash box values
$tourWeightArray[$dataSU[21]] += ($dataSU[5] / $cbWeightFactors[0]); // Init weight of checked cash box values
endif;
$tmpChkBx = "";
$dataSU[5] = convertATIdataFields($dataSU[5], "4");
$currRowStr .= " " . $dataSU[5] . " " . $tmpChkBx . " | \n";
else :
$currRowStr .= " | \n";
endif;
if ($displayColumnData) :
$ptBgCol = "";
if ($dataSU[6] != "" && $dataSU[6] >= $f_tv[$atId][1]) :
$ptBgCol = "background-color:" . $colArray["yellow"] . ";";
endif;
if ($dataSU[6] != "" && $dataSU[6] >= $f_tv[$atId][2]) :
$ptBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$tmpChecked = in_array($row["ati_serialno"], $f_su_cb_chkbx_01);
if ($tmpChecked) :
$tourSumArray[$dataSU[21]] += $dataSU[6]; // Init sum of checked cash box values
$tourWeightArray[$dataSU[21]] += ($dataSU[6] / $cbWeightFactors[1]); // Init weight of checked cash box values
endif;
$tmpChkBx = "";
$dataSU[6] = convertATIdataFields($dataSU[6], "5");
$currRowStr .= " " . $dataSU[6] . " " . $tmpChkBx . " | \n";
else :
$currRowStr .= " | \n";
endif;
if ($displayColumnData) :
$ptBgCol = "";
if ($dataSU[7] != "" && $f_tv[$atId][8] != 0 && $dataSU[7] <= $f_tv[$atId][8]) :
$ptBgCol = "background-color:" . $colArray["yellow"] . ";";
endif;
if ($dataSU[7] != "" && $f_tv[$atId][5] != 0 && $dataSU[7] <= $f_tv[$atId][5]) :
$ptBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$tmpChecked = in_array($row["ati_serialno"], $f_su_cb_chkbx_02);
if ($tmpChecked) :
// $tourSumArray[$dataSU[21]] += $dataSU[7]; // Init sum of checked cash box values
// $tourWeightArray[$dataSU[21]] += ($dataSU[7] / $cbWeightFactors[2]); // Init weight of checked cash box values
endif;
$tmpChkBx = "";
$dataSU[7] = convertATIdataFields($dataSU[7], "6");
$currRowStr .= " " . $dataSU[7] . " " . $tmpChkBx . " | \n";
else :
$currRowStr .= " | \n";
endif;
if ($displayColumnData) :
$ptBgCol = "";
if ($dataSU[8] != "" && $f_tv[$atId][9] != 0 && $dataSU[8] <= $f_tv[$atId][9]) :
$ptBgCol = "background-color:" . $colArray["yellow"] . ";";
endif;
if ($dataSU[8] != "" && $f_tv[$atId][6] != 0 && $dataSU[8] <= $f_tv[$atId][6]) :
$ptBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$tmpChecked = in_array($row["ati_serialno"], $f_su_cb_chkbx_03);
if ($tmpChecked) :
// $tourSumArray[$dataSU[21]] += $dataSU[8]; // Init sum of checked cash box values
// $tourWeightArray[$dataSU[21]] += ($dataSU[8] / $cbWeightFactors[3]); // Init weight of checked cash box values
endif;
$tmpChkBx = "";
$dataSU[8] = convertATIdataFields($dataSU[8], "7");
$currRowStr .= " " . $dataSU[8] . " " . $tmpChkBx . " | \n";
else :
$currRowStr .= " | \n";
endif;
if ($displayColumnData) :
// SPECIAL TREATMENT REGARDING article type ($atId) in column "Dispenser" [ex "H3"]
if (in_array($atId, $atIdsDispenser)) :
$ptBgCol = "";
if ($dataSU[9] != "" && $f_tv[$atId][10] != 0 && $dataSU[9] <= $f_tv[$atId][10]) :
$ptBgCol = "background-color:" . $colArray["yellow"] . ";";
endif;
if ($dataSU[9] != "" && $f_tv[$atId][7] != 0 && $dataSU[9] <= $f_tv[$atId][7]) :
$ptBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$tmpChecked = in_array($row["ati_serialno"], $f_su_cb_chkbx_04);
if ($tmpChecked) :
// $tourSumArray[$dataSU[21]] += $dataSU[9]; // Init sum of checked cash box values
// $tourWeightArray[$dataSU[21]] += ($dataSU[9] / $cbWeightFactors[4]); // Init weight of checked cash box values
endif;
$tmpChkBx = "";
$dataSU[9] = convertATIdataFields($dataSU[9], "8");
$currRowStr .= " " . $dataSU[9] . " " . $tmpChkBx . " | \n";
else :
$currRowStr .= " | \n";
endif;
else :
$currRowStr .= " | \n";
endif;
if ($displayColumnData) :
$dataSU[4] = convertATIdataFields($dataSU[4], "3");
$ptStyle = "";
if ($dataSU[4] != $currentDateUI) :
$ptStyle .= "color:" . $colArray["red"] . ";";
endif;
$currRowStr .= " " . $dataSU[4] . " | \n";
else :
$currRowStr .= " | \n";
endif;
// Messages of service units
$tmpChecked = in_array($row["ati_serialno"], $f_su_atm_chkbx);
$tmpChkBx = $dataSU[17];
if ($dataSU[17] != "" && $dataSU[17] != " ") :
$tmpChkBx .= " " . "";
endif;
$currRowStr .= " " . $tmpChkBx . " | \n";
// Major probabilities regarding to the service intervals
/*
$ptBgCol = "";
if ($dataSU[18] != "" && $dataSU[18] >= $probability_tv_red) :
$ptBgCol = "background-color:" . $colArray["red"] . ";";
endif;
if ($dataSU[18] != "" && $dataSU[18] >= $probability_tv_yellow) :
$ptBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$currRowStr .= " " . $dataSU[18] . " % | \n";
*/
// Prio states according to the messages
/*
$ptBgCol = "";
if ($data_16_a != "" && $data_16_b != "" && $data_16_a > 0 && $data_16_b > 0 && $data_16_a <= $data_16_b) :
$ptBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$currRowStr .= " " . $data_16_b . " [" . $data_16_a . "] | \n";
*/
$currRowStr .= "
\n";
$outEventStatesArray[] = $currRowStr;
endif;
endif;
// Generate optimization array
if ($mode == "0" || $mode == "2") :
if ($f_act == "optimizePT" && $ptChecked == "checked") :
// $suRoutePlanningArray[$f_su_tour_no[$row["ati_serialno"]]][] = array($row["ati_serialno"], $row["ati_data_03"], $row["ati_data_02"]);
$suRoutePlanningArray[$f_su_tour_no[$row["ati_serialno"]]][] = array($row["ati_serialno"], $row["ati_data_23"], $row["ati_data_22"]);
endif;
endif;
// Aggregate service unit data of all service units
if ($mode == "3") :
if (!isset($dataAllSU) || $dataAllSU == "") :
$dataAllSU = array();
endif;
$dataAllSU[$row["ati_serialno"]] = $dataSU;
// $dataAllSU[$row["ati_serialno"]]["state"]["suIsCriticalPermanently"] = ($suIsCriticalPermanently ? "1" : "0");
$dataAllSU[$row["ati_serialno"]]["state"]["suIsCritical"] = ($suIsCritical ? "1" : "0");
$dataAllSU[$row["ati_serialno"]]["state"]["suIsCriticalByIncreaseValue"] = ($suIsCriticalByIncreaseValue ? "1" : "0");
$dataAllSU[$row["ati_serialno"]]["state"]["suIsSemiCritical"] = ($suIsSemiCritical ? "1" : "0");
$dataAllSU[$row["ati_serialno"]]["state"]["suHasCriticalMsg"] = ($suHasCriticalMsg ? "1" : "0");
$dataAllSU[$row["ati_serialno"]]["dom"]["tour"]["id"] = "f_su_tour_no[" . $row["ati_serialno"] . "]";
$dataAllSU[$row["ati_serialno"]]["dom"]["tour"]["state"] = $dataSU[21];
$dataAllSU[$row["ati_serialno"]]["dom"]["su"]["id"] = "f_su_chkbx_" . $row["ati_serialno"];
$dataAllSU[$row["ati_serialno"]]["dom"]["su"]["state"] = $ptChecked;
$dataAllSU[$row["ati_serialno"]]["dom"]["atm"]["id"] = "f_su_atm_chkbx_" . $row["ati_serialno"];
$dataAllSU[$row["ati_serialno"]]["dom"]["atm"]["val"] = $dataSU[17];
$dataAllSU[$row["ati_serialno"]]["dom"]["atm"]["state"] = (in_array($row["ati_serialno"], $f_su_atm_chkbx) ? "checked" : "");
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_00"]["id"] = "f_su_cb_chkbx_00_" . $row["ati_serialno"];
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_00"]["val"] = $dataSU[5];
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_00"]["state"] = (in_array($row["ati_serialno"], $f_su_cb_chkbx_00) ? "checked" : "");
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_01"]["id"] = "f_su_cb_chkbx_01_" . $row["ati_serialno"];
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_01"]["val"] = $dataSU[6];
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_01"]["state"] = (in_array($row["ati_serialno"], $f_su_cb_chkbx_01) ? "checked" : "");
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_02"]["id"] = "f_su_cb_chkbx_02_" . $row["ati_serialno"];
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_02"]["val"] = $dataSU[7];
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_02"]["state"] = (in_array($row["ati_serialno"], $f_su_cb_chkbx_02) ? "checked" : "");
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_03"]["id"] = "f_su_cb_chkbx_03_" . $row["ati_serialno"];
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_03"]["val"] = $dataSU[8];
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_03"]["state"] = (in_array($row["ati_serialno"], $f_su_cb_chkbx_03) ? "checked" : "");
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_04"]["id"] = "f_su_cb_chkbx_04_" . $row["ati_serialno"];
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_04"]["val"] = $dataSU[9];
$dataAllSU[$row["ati_serialno"]]["dom"]["cb_04"]["state"] = (in_array($row["ati_serialno"], $f_su_cb_chkbx_04) ? "checked" : "");
endif;
endwhile;
$result->free();
if ($mode == "3") :
return $dataAllSU;
endif;
endif;
}
function getServiceUnits () {
global $hq_id, $rootStockSU;
$dataAllSU = array();
// Get root stock where all service units belong to
$rootStockSU = getParameterValue("0", "SU_STK_ROOT", $hq_id);
if ($rootStockSU != "" && is_numeric($rootStockSU)) :
$dataAllSU = getPersistentStates("3");
endif;
return $dataAllSU;
}
// Get the list of service jobs
function getServiceJoblist () {
global $db, $PHP_SELF;
global $f_act, $hq_id, $rootStockSU, $numOfRowsJB, $f_jb_orderByCol, $f_jb_sort_sequence, $outJobArray, $f_search;
global $f_jb_filter_1, $f_jb_filter_2, $f_jb_filter_3;
global $fromDateRange_jb, $toDateRange_jb;
global $colArray;
$fieldClause = "jb.jb_id, jb.jb_status, jb.jb_ordertime, jb.cr_sid, jb.jb_taketime, jb.jb_finishtime, jb.emp_id, jb.jb_invtext, "
. "tr.tr_sort, tr.tr_comp, tr.tr_commission_no, tr.tr_remark, tr.tr_status, tr.tr_finishtime, "
. "ad.ad_id, ad.ad_street, tr.tr_hsno, ad.ad_zipcode, ad.ad_city, ad.ad_country";
$fromClause = "job AS jb, courier AS cr, tour AS tr, address AS ad";
$whereClause = "jb.cr_id = cr.cr_id AND jb.jb_id = tr.jb_id AND tr.ad_id = ad.ad_id AND "
. "jb.jb_ordertime >= '" . $fromDateRange_jb . "' AND jb.jb_ordertime <= '" . $toDateRange_jb . "' AND "
. "(ISNULL(jb.jb_storno) OR (jb.jb_storno = '0')) ";
if ($f_jb_filter_1 == "1") :
$whereClause .= " AND jb.jb_status != '2'";
elseif ($f_jb_filter_1 == "2") :
$whereClause .= " AND jb.jb_status = '2'";
endif;
if ($f_jb_filter_2 != "") :
$whereClause .= " AND tr.tr_commission_no = '" . $f_jb_filter_2 . "'";
endif;
if ($f_jb_filter_3 != "") :
$fromClause .= " LEFT JOIN stock AS stk ON ad.ad_id = stk.ad_id";
$whereClause .= " AND stk.stk_name = '" . $f_jb_filter_3 . "'";
endif;
if ($f_search != "") :
$whereClause = " (jb.cr_sid LIKE '%" . $f_search . "%' OR jb.jb_invtext LIKE '%" . $f_search . "%' OR tr.tr_comp LIKE '%" . $f_search . "%' OR"
. " tr.tr_commission_no LIKE '%" . $f_search . "%' OR tr.tr_remark LIKE '%" . $f_search . "%' OR"
. " ad.ad_street LIKE '%" . $f_search . "%' OR tr.tr_hsno LIKE '%" . $f_search . "%' OR"
. " ad.ad_zipcode LIKE '%" . $f_search . "%' OR ad.ad_city LIKE '%" . $f_search . "%') ";
endif;
// Sort sequence of the service jobs
$orderByClause = "";
$sortseq = "";
if ($f_jb_sort_sequence == "1") : $sortseq = " DESC"; endif; // ASC or DESC
$orderByColArray = array("jb.jb_id" . $sortseq . ",tr.tr_sort" . $sortseq,
"jb.cr_sid" . $sortseq . ",jb.jb_id" . $sortseq,
"tr.tr_sort" . $sortseq,
"tr.tr_finishtime" . $sortseq,
"tr.tr_commission_no" . $sortseq,
"ad.ad_street" . $sortseq . ",ad.ad_zipcode" . $sortseq,
"ad.ad_zipcode" . $sortseq . ",ad.ad_street" . $sortseq,
"jb.jb_ordertime" . $sortseq,
"jb.jb_taketime" . $sortseq,
"jb.jb_finishtime" . $sortseq,
"tr.tr_remark" . $sortseq);
if ($f_jb_orderByCol == "") : $f_jb_orderByCol = "0"; endif; // Contains the number of the current column to be sorted
$orderByClause = $orderByColArray[$f_jb_orderByCol];
$sqlStmt = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
// echo $sqlStmt . "\n";
// Major probability
$logBgCol = "background-color:" . $colArray["green"] . ";";
if ($probabilityToNextServiceMax >= $probability_tv_yellow) :
$logBgCol = "background-color:" . $colArray["yellow"] . ";";
endif;
if ($probabilityToNextServiceMax >= $probability_tv_red) :
$logBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$currRowStr .= " | " . getLngt("Gesamtservicewahrscheinlichkeit nur auf Basis der Serviceintervalle:") . " " . $probabilityToNextServiceMax . " % | \n";
// Probability in "$probabilityToNextService_05"
$logBgCol = "background-color:" . $colArray["green"] . ";";
if ($probabilityToNextService_05 >= $probability_tv_yellow) :
$logBgCol = "background-color:" . $colArray["yellow"] . ";";
endif;
if ($probabilityToNextService_05 >= $probability_tv_red) :
$logBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$currRowStr .= " " . $probabilityToNextService_05 . " % | \n";
// Probability in "$probabilityToNextService_06"
$logBgCol = "background-color:" . $colArray["green"] . ";";
if ($probabilityToNextService_06 >= $probability_tv_yellow) :
$logBgCol = "background-color:" . $colArray["yellow"] . ";";
endif;
if ($probabilityToNextService_06 >= $probability_tv_red) :
$logBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$currRowStr .= " " . $probabilityToNextService_06 . " % | \n";
// Probability in "$probabilityToNextService_07"
$logBgCol = "background-color:" . $colArray["green"] . ";";
if ($probabilityToNextService_07 >= $probability_tv_yellow) :
$logBgCol = "background-color:" . $colArray["yellow"] . ";";
endif;
if ($probabilityToNextService_07 >= $probability_tv_red) :
$logBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$currRowStr .= " " . $probabilityToNextService_07 . " % | \n";
// Probability in "$probabilityToNextService_08"
$logBgCol = "background-color:" . $colArray["green"] . ";";
if ($probabilityToNextService_08 >= $probability_tv_yellow) :
$logBgCol = "background-color:" . $colArray["yellow"] . ";";
endif;
if ($probabilityToNextService_08 >= $probability_tv_red) :
$logBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$currRowStr .= " " . $probabilityToNextService_08 . " % | \n";
// Probability in "$probabilityToNextService_09"
$logBgCol = "background-color:" . $colArray["green"] . ";";
if ($probabilityToNextService_09 >= $probability_tv_yellow) :
$logBgCol = "background-color:" . $colArray["yellow"] . ";";
endif;
if ($probabilityToNextService_09 >= $probability_tv_red) :
$logBgCol = "background-color:" . $colArray["red"] . ";";
endif;
$currRowStr .= " " . $probabilityToNextService_09 . " % | \n";
$currRowStr .= "
\n";
if ($logDisplayRow) :
$outLogArray[] = $currRowStr;
endif;
endif;
if ($retMode == "1") :
return $averageAmountArray;
elseif ($retMode == "2") :
return array($probabilityToNextServiceMax, $averageAmountArray);
else :
return $probabilityToNextServiceMax;
endif;
endif;
endif;
}
// Get log data
function getLogData ($whereClause = "", $orderByClause = "") {
global $db, $PHP_SELF;
global $hq_id, $rootStockSU, $numOfRowsLOG, $f_search, $f_log_sort_sequence, $f_log_orderByCol, $outLogArray, $f_log_filter_1;
global $f_tv, $colArray;
$fieldClause = "log.log_createtime, log.hq_id, log.jb_id, log.usr_id, log.cr_id, log.cr_sid, log.cs_id, log.at_id, log.stk_id, log.id_01, log.logo_description";
$fromClause = "phoenix_log.log AS log";
// if ($whereClause != "") : $whereClause = "log.logo_id = '1000' AND " . $whereClause; endif;
// Sort sequence of the log data
$sortseq = "";
if ($f_log_sort_sequence == "1") : $sortseq = " DESC"; endif; // ASC or DESC
$orderByColArray = array("log.log_createtime" . $sortseq);
if ($f_log_orderByCol == "") : $f_log_orderByCol = "0"; endif; // Contains the number of the current column to be sorted
$orderByClause = $orderByColArray[$f_log_orderByCol];
$sqlStmt = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
// echo $sqlStmt . "\n";
$retString .= "\n";
$retString .= "| " . getLngt("Lfd") . " | \n";
$retString .= " " . getLngt("Barcode") . " | \n";
$retString .= " " . getLngt("Betrag") . " | \n";
$retString .= " " . getLngt("Bemerkung") . " | \n";
// $retString .= " " . getLngt("Status") . " | \n";
$retString .= "
\n";
// Split content to get the barcodes of the current selected article type
// E.g.: "0=Q1,Q2,Q3|1=Q1,Q2,Q3,Q4,Q5|2=Q1..." => x(0) = Q1,Q2,Q3, x(1) = Q1,Q2,Q3,Q4,Q5, ...
// [=> 0=Q1,Q2,Q3 => Service "0" (= Lieferung) is mapped to the barcodes]
/*
$f_barcode_array = getKeyValueArrayFromString($gdcContentBarcodes);
$f_barcode_string = $f_barcode_array[$atId]; // Take the barcodes (array)
$f_amount_array = getKeyValueArrayFromString($gdcContentAmounts);
$f_amount_string = $f_amount_array[$atId]; // Take the amounts (array)
$f_remark_array = getKeyValueArrayFromString($gdcContentRemarks);
$f_remark_string = $f_remark_array[$atId]; // Take the remarks (array)
$f_status_array = getKeyValueArrayFromString($gdcContentStatus);
$f_status_string = $f_status_array[$atId]; // Take the status (array)
*/
// if ($f_barcode_string != "") :
if ($gdcContentBarcodesLen > 0) :
/*
$f_barcode_array = spliti(",", $f_barcode_string);
$f_barcode_array_len = count($f_barcode_array);
$f_amount_array = spliti(",", $f_amount_string);
$f_remark_array = spliti(",", $f_remark_string);
$f_status_array = spliti(",", $f_status_string);
*/
$f_barcode_array = $gdcContentBarcodes;
$f_barcode_array_len = count($f_barcode_array);
$f_amount_array = $gdcContentAmounts;
$f_remark_array = $gdcContentRemarks;
$f_status_array = $gdcContentStatus;
if ($f_barcode_array_len > 0) :
for ($i = 0; $i < $f_barcode_array_len; $i++) :
$retString .= "\n";
$retString .= "| " . ($i + 1) . ". | ";
$retString .= "";
$retString .= " ";
$retString .= " | ";
$retString .= "";
$retString .= " ";
$retString .= " | ";
$retString .= "";
/*
$retString .= "";
*/
$retString .= " ";
$retString .= " | ";
/*
$retString .= "";
$retString .= " ";
$retString .= " | ";
*/
$retString .= "
\n";
endfor;
endif;
endif;
/*
if ($i == "") : $i = 1; else : $i++; endif;
$retString .= "\n";
$retString .= "| " . $i . ". | \n";
$retString .= "\n";
$retString .= " ";
$retString .= " | \n";
$retString .= "";
$retString .= "";
$retString .= " ";
$retString .= " |
\n";
*/
$retString .= "
\n";
endif;
else :
$retArray = array($gdcContentBarcodes, $gdcContentAmounts, $gdcContentRemarks, $gdcContentStatus);
endif;
endif;
if ($mode == "0") :
return $retArray;
elseif ($mode == "1") :
return $retArray;
elseif ($mode == "2") :
return $retString;
else :
return $retArray;
endif;
}
// Init global parameters for ILLT
function illtInitGlobals () {
global $globalParUseRelatedCustomer, $csId, $adId, $dataSU, $f_tv, $outGlobalStateArray, $hours, $hourTimeUnits, $rootStockSU, $criticalMessageArray;
global $maxNumOfTours, $maxNumOfAtiDataFields, $suGroupId, $cbGroupId, $suAtIdArray, $suAtIdArrayLen, $suStockIdParentDefault, $cbStockIdParentDefault;
global $suServiceAndWayTimeDefault, $f_su_admin_ati_data_24, $suServiceIsCriticalByDefaultVehicleOnly, $suServiceIsCriticalByStateSemiCriticalAndDefaultVehicle;
global $selYear, $selMonth, $selDay;
// Check for mode of system usage
$globalParUseRelatedCustomer = getParameterValue("0", "GLOBAL_USE_RELATED_CUSTOMER", "0");
// Get customer regarding placement of jobs into FDS
$csId = getParameterValue("0", "FDS_CUSTOMER_DEFAULT", "0");
$adId = getParameterValue("0", "FDS_ADDRESS_DEFAULT", "0");
// SERVICE UNIT data fields
$dataSU = array();
// Init array for threshold values
$f_tv = array();
// Global state array
$outGlobalStateArray = array();
// Hours per day
// $hours = getParameterValue("0", "DISPOSITION_HOURS", $hq_id);
// if ($hours == "" || !is_numeric($hours)) :
$hours = getParameterValue("0", "DISPOSITION_HOURS", "0");
if ($hours == "" || !is_numeric($hours)) :
$hours = 23;
endif;
// endif;
// Time units of a hour (e.g. 12 units per 5 minutes <=> 6 units per 10 minutes <=> one hour)
// $hourTimeUnits = getParameterValue("0", "DISPOSITION_HOUR_TIME_UNITS", $hq_id);
// if ($hourTimeUnits == "" || !is_numeric($hourTimeUnits)) :
$hourTimeUnits = getParameterValue("0", "DISPOSITION_HOUR_TIME_UNITS", "0");
if ($hourTimeUnits == "" || !is_numeric($hourTimeUnits)) :
$hourTimeUnits = 6;
endif;
// endif;
// Get root stock where all service units belong to
$rootStockSU = getParameterValue("0", "SU_STK_ROOT", $hq_id);
// Get vector of all message codes being critical
$criticalMessageArray = getColVectorFromDB2ArrayByClause("phoenix.articlemessage", "atm_code", "atm_critical = '1'", "", "atm_code", "1");
$maxNumOfTours = getParameterValue("0", "MAX_NUM_OF_SU_TOURS", $hq_id);
if ($maxNumOfTours == "" || !is_numeric($maxNumOfTours)) :
$maxNumOfTours = "4";
endif;
// Number of data fields in "articleitem" (ati_data_01, ati_data_02, ...)
$maxNumOfAtiDataFields = getParameterValue("0", "MAX_NUM_OF_ATI_DATA_FIELDS", $hq_id);
if ($maxNumOfAtiDataFields == "" || !is_numeric($maxNumOfAtiDataFields)) :
$maxNumOfAtiDataFields = "30";
endif;
// Get GROUP numbers for items
// Ticket machine (here "service unit" ("su"))
$suGroupId = getParameterValue("0", "SU_TICKET_MACHINE_GROUP_ID", $hq_id);
if ($suGroupId == "") : $suGroupId = "1"; endif;
// "Cash box" ("cb")
$cbGroupId = getParameterValue("0", "SU_CASH_BOX_GROUP_ID", $hq_id);
if ($cbGroupId == "") : $cbGroupId = "2"; endif;
// Get vector of article(type) IDs ("at_id") of service units
// $suAtIdArray = getColVectorFromDB2ArrayByClause("phoenix.article", "at_id", "at_group = '," . $suGroupId . ",'", "", "at_id");
$suAtIdString = getParameterValue("0", "SU_AT_TYPES_FOR_TV", $hq_id);
$suAtIdArray = explode(",", $suAtIdString);
$suAtIdArrayLen = count($suAtIdArray);
// Get new threshold values by frontend
for ($a = 0; $a < $suAtIdArrayLen; $a++) :
$atId = $suAtIdArray[$a];
for ($t = 0; $t < $maxNumOfAtiDataFields; $t++) :
getSecHttpVars("1",array("f_tv_" . $atId . "_" . pad(($t + 1),2)));
$f_tv[$atId][($t + 1)] = ${("f_tv_" . $atId . "_" . pad(($t + 1),2))};
endfor;
endfor;
// There could be defined a special stock being parent stock for all service unit (article item) stocks.
// Otherwise every service unit will be associated to a special root stock (!!!!)
$suStockIdParentDefault = getParameterValue("0", "SERVICEUNIT_STOCK_PARENT_ID", $hq_id);
if ($suStockIdParentDefault == "" || !is_numeric($suStockIdParentDefault)) :
$suStockIdParentDefault = getParameterValue("0", "SERVICEUNIT_STOCK_PARENT_ID", "0");
if ($suStockIdParentDefault == "" || !is_numeric($suStockIdParentDefault)) :
$suStockIdParentDefault = "0";
endif;
endif;
// There could be defined a special stock being parent stock for all service unit (article item) stocks.
// Otherwise every service unit will be associated to a special root stock (!!!!)
$cbStockIdParentDefault = getParameterValue("0", "CASHBOX_STOCK_PARENT_ID", $hq_id);
if ($cbStockIdParentDefault == "" || !is_numeric($cbStockIdParentDefault)) :
$cbStockIdParentDefault = getParameterValue("0", "CASHBOX_STOCK_PARENT_ID", "0");
if ($cbStockIdParentDefault == "" || !is_numeric($cbStockIdParentDefault)) :
$cbStockIdParentDefault = "0";
endif;
endif;
// Service time default value
$suServiceAndWayTimeDefault = getParameterValue("0", "SERVICEUNIT_TIME_DEFAULT", $hq_id);
if ($suServiceAndWayTimeDefault == "" || !is_numeric($suServiceAndWayTimeDefault)) :
$suServiceAndWayTimeDefault = getParameterValue("0", "SERVICEUNIT_TIME_DEFAULT", "0");
if ($suServiceAndWayTimeDefault == "" || !is_numeric($suServiceAndWayTimeDefault)) :
$suServiceAndWayTimeDefault = 10;
endif;
endif;
if ($f_su_admin_ati_data_24 == "") :
$f_su_admin_ati_data_24 = $suServiceAndWayTimeDefault;
endif;
// Check for activation of critical behaviour by default vehicle ONLY
$suServiceIsCriticalByDefaultVehicleOnly = getParameterValue("0", "SERVICEUNIT_CRITICAL_BY_VEHICLE_ONLY", $hq_id);
if ($suServiceIsCriticalByDefaultVehicleOnly == "") :
$suServiceIsCriticalByDefaultVehicleOnly = getParameterValue("0", "SERVICEUNIT_CRITICAL_BY_VEHICLE_ONLY", "0");
endif;
// Check for activation of critical behaviour if state is semi critical AND default vehicle is set
$suServiceIsCriticalByStateSemiCriticalAndDefaultVehicle = getParameterValue("0", "SERVICEUNIT_CRITICAL_ADDED_BY_VEHICLE", $hq_id);
if ($suServiceIsCriticalByStateSemiCriticalAndDefaultVehicle == "") :
$suServiceIsCriticalByStateSemiCriticalAndDefaultVehicle = getParameterValue("0", "SERVICEUNIT_CRITICAL_ADDED_BY_VEHICLE", "0");
endif;
// Get global threshold values
$thresholdValuesArray = getThresholdValues($suAtIdArray);
$predictionDays = 0;
if ($selYear == "") : $selYear = date("Y"); endif;
if ($selMonth == "") : $selMonth = date("m"); endif;
if ($selDay == "") : $selDay = date("d"); endif;
}
?>