" . getLngt("Bitte kontrollieren Sie noch einmal die Eingabe.");
if ($trackingID == "") :
$out = getLngt("Bitte geben Sie Ihre Sendungsnummer ein.");
else :
// Get the array for formatting the database-values for the output according to the defined type
$outputFormatField = defineOutputFormats();
$tmpArray = getTrackingdataByID($trackingID);
$objType = $tmpArray[0];
$trackingArray = $tmpArray[1];
$trackingArrayLen = count($trackingArray);
$atLeastOneTourArticleDoesExist = false;
if ($trackingArray[0]["trat_id"] != "") :
$atLeastOneTourArticleDoesExist = true;
endif;
if ($debug) :
print_r($trackingArray); echo "
";
echo "objType = " . $objType . "
";
echo "atLeastOneTourArticleDoesExist = " . ($atLeastOneTourArticleDoesExist ? "Yes" : "No") . "
";
echo "languageSelected = " . $languageSelected . "
";
echo "languageDBUpdateMode = " . $languageDBUpdateMode . "
";
endif;
if ($trackingArrayLen > 0) :
// LAYOUT DATA
$currentHqId = $trackingArray[0]["hq_id"];
if ($currentHqId == "") : $currentHqId = "0"; endif;
$jbCscIdPayer = $trackingArray[0]["csc_id_payer"];
if ($jbCscIdPayer > 0) :
$jbCsIdPayer = getFieldValueFromId("costcenter","csc_id",$jbCscIdPayer,"cs_id");
if ($jbCsIdPayer > 0) :
$jbCsBlurMarkupTimePayer = getFieldValueFromId("customer","cs_id",$jbCsIdPayer,"cs_blur_markup_time");
if ($jbCsBlurMarkupTimePayer == "") : $jbCsBlurMarkupTimePayer = 0; endif;
$jbCmpIdPayer = getFieldValueFromId("customer","cs_id",$jbCsIdPayer,"cmp_id");
$jbCmpCompPayer = getFieldValueFromId("company","cmp_id",$jbCmpIdPayer,"cmp_comp");
endif;
endif;
$parLogoFile = getParameterValue("0", "IMG_LOGO_NAME_EMAIL", $currentHqId, "0");
$parLogoHeight = getParameterValue("0", "IMG_LOGO_HEIGHT", $currentHqId, "0");
$parLogoWidth = getParameterValue("0", "IMG_LOGO_WIDTH", $currentHqId, "0");
$parCssBackground = getParameterValue("0", "IMG_LOGO_BGCOL_EMAIL", $currentHqId, "0");
if ($parLogoFile != "") :
$imgLogoFile = $parLogoFile;
$imgLogoHeight = $parLogoHeight;
$imgLogoWidth = $parLogoWidth;
endif;
if ($parCssBackground != "") :
$imgCssBackground = $parCssBackground;
endif;
if ($debug) :
echo "imgLogoFile = " . $imgLogoFile . "
";
echo "imgLogoHeight = " . $imgLogoHeight . "
";
echo "imgLogoWidth = " . $imgLogoWidth . "
";
echo "imgCssBackground = " . $imgCssBackground . "
";
endif;
// HEADER
if ($objType == "tracking_jb" || $objType == "track_jb") :
$mapViewLink = "[" . getLngt("Karte") . "]";
$historyOut .= "
\n";
$historyOut .= " | \n";
$historyOut .= " " . getLngt("Auftrag") . ": " . $trackingArray[0]["jb_id"] . "" . " " . $mapViewLink . "\n";
$historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
$historyOut .= "\n";
$historyOut .= " \n";
$historyOut .= " " . getLngt("Station") . " \n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . getLngt("Status") . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . getLngt("Erledigungszeit") . "\n";
$historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
/*
$historyOut .= "\n";
$historyOut .= " | \n";
$historyOut .= " " . getLngt("Station") . "\n";
$historyOut .= " | \n";
// $historyOut .= " \n";
// $historyOut .= " " . getLngt("Artikel") . "\n";
// $historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . getLngt("Erledigungszeit") . "\n";
$historyOut .= " | \n";
// $historyOut .= " \n";
// $historyOut .= " " . getLngt("Ereignis") . "\n";
// $historyOut .= " | \n";
// $historyOut .= " \n";
// $historyOut .= " " . getLngt("Bemerkung") . "\n";
// $historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
*/
elseif ($objType == "tracking_tr" || $objType == "track_tr") :
$currAddress = $trackingArray[0]["ad_street"] . " " . $trackingArray[0]["tr_hsno"] . " in " . $trackingArray[0]["ad_zipcode"] . " " . $trackingArray[0]["ad_city"];
$trComp = $trackingArray[0]["tr_comp"];
// ETA
$etaOut = "";
if ($trackingArray[0]["tr_status"] == "1") :
$etaOut = getLngt("Ihre Sendung wurde geliefert.");
else :
$etaOffset = get_tour_duration($trackingArray[0]["tr_id"]);
$roundToXMinutes = 5;
// $etaOffset = -1;
// echo $etaOffset . "
";
if (is_numeric($etaOffset)) :
if ($etaOffset != -1) :
// ETA
$currUnixTimestamp = time();
if ($roundToXMinutes != "" && is_numeric($roundToXMinutes) && $roundToXMinutes > 1) :
$eta = (floor(($currUnixTimestamp + $etaOffset) / 60) - (floor(($currUnixTimestamp + $etaOffset) / 60) % $roundToXMinutes)) * 60; // Full x minutes (e.g. 5)
else :
$eta = floor(($currUnixTimestamp + $etaOffset) / 60) * 60; // Full minute
endif;
$etaTime = date("H:i", $eta);
if ($jbCsBlurMarkupTimePayer > 0) :
// Time window
$etaTimeLowerRange = date("H:i", $eta - ($jbCsBlurMarkupTimePayer * 60));
$etaTimeUpperRange = date("H:i", $eta + ($jbCsBlurMarkupTimePayer * 60));
$etaOut .= getLngt("Ihre Sendung von") . " " . $jbCmpCompPayer . " " . getLngt("wird voraussichtlich zwischen") . "
";
$etaOut .= "" . $etaTimeLowerRange . " " . getLngt("Uhr") . " " . getLngt("und") . " " . $etaTimeUpperRange . " " . getLngt("Uhr") . "
";
$etaOut .= getLngt("bei") . " " . $trComp . " " . "
";
$etaOut .= "" . $currAddress . "
";
$etaOut .= getLngt("eintreffen") . "." . "
";
else :
$etaOut .= getLngt("Ihre Sendung von") . " " . $jbCmpCompPayer . " " . getLngt("wird voraussichtlich um ca.") . "
";
$etaOut .= "" . $etaTime . " " . getLngt("Uhr") . "
";
$etaOut .= getLngt("bei") . " " . $trComp . " " . "
";
$etaOut .= "" . $currAddress . "
";
$etaOut .= getLngt("eintreffen") . "." . "
";
endif;
else :
// $etaOut = getLngt("Derzeit steht technisch leider keine zeitliche Einschätzung bereit.");
$hqAdmin = getFieldValueFromId("headquarters","hq_id",$currentHqId,"hq_admin");
$hqUsrId = getFieldValueFromId("employee","emp_id",$hqAdmin,"usr_id");
$hqUsrPhone = getFieldValueFromId("user","usr_id",$hqUsrId,"usr_phone");
$etaOut .= getLngt("Ihre Sendung von") . " " . $jbCmpCompPayer . "
";
$etaOut .= getLngt("an") . " " . $trComp . " " . "
";
$etaOut .= "" . $currAddress . "
";
$etaOut .= getLngt("Dieser Service steht aus technischen Gründen") . "
";
$etaOut .= getLngt("momentan leider nicht zur Verfügung") . "." . "
";
$etaOut .= getLngt("Bitte probieren sie es etwas später noch einmal") . "
";
$etaOut .= getLngt("oder wenden sie sich telefonisch an") . ":" . "
";
$etaOut .= "" . $hqUsrPhone . "
";
endif;
endif;
endif;
$classTrStatus = "f12bp1_red";
if ($trackingArray[0]["tr_status"] == "1") :
$classTrStatus = "f12bp1_darkgreen";
endif;
/*
$historyOut .= "\n";
$historyOut .= " | \n";
// $historyOut .= " " . $currAddress . "\n";
$historyOut .= " " . $currAddress . "\n";
$historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
*/
$historyOut .= " |
\n";
if ($etaOut != "") :
$historyOut .= "\n";
$historyOut .= " | \n";
// $historyOut .= " " . $etaOut . "\n";
$historyOut .= " " . $etaOut . "\n";
$historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
$historyOut .= " |
\n";
endif;
if ($atLeastOneTourArticleDoesExist) :
$historyOut .= "\n";
$historyOut .= " | \n";
$historyOut .= " " . getLngt("Artikel") . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . getLngt("Ereigniszeit") . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . getLngt("Ereignis") . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . getLngt("Bemerkung") . "\n";
$historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
endif;
elseif ($objType == "tracking_trat" || $objType == "track_trat") :
if ($trackingArray[0]["trat_serialno"] != "") :
$historyOut .= "\n";
$historyOut .= " | \n";
$historyOut .= " " . "Sendung" . ": " . $trackingArray[0]["trat_serialno"] . "\n";
$historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
endif;
$historyOut .= "\n";
$historyOut .= " | \n";
$historyOut .= " " . getLngt("Ereigniszeit") . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . getLngt("Ereignis") . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . getLngt("Bemerkung") . "\n";
$historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
endif;
// BODY
$remAddress = "";
$remTratSerialno = "";
for ($i = 0; $i < $trackingArrayLen; $i++) :
$currAddress = $trackingArray[$i]["ad_street"] . " " . $trackingArray[$i]["tr_hsno"] . "
" . $trackingArray[$i]["ad_zipcode"] . " " . $trackingArray[$i]["ad_city"];
if ($currAddress == $remAddress) :
$currAddress = "";
else :
$remAddress = $currAddress;
endif;
$currTratSerialno = $trackingArray[$i]["trat_serialno"];
if ($currTratSerialno == $remTratSerialno) :
$currTratSerialno = "";
else :
$remTratSerialno = $currTratSerialno;
endif;
if ($objType == "tracking_jb" || $objType == "track_jb") :
$classTrStatus = "f10np1_red";
if ($trackingArray[$i]["tr_status"] == "1") :
$classTrStatus = "f10np1_darkgreen";
endif;
$historyOut .= "\n";
$historyOut .= " \n";
$historyOut .= " " . ($i + 1) . ". " . getLngt("Station") . " \n";
$historyOut .= $currAddress;
$historyOut .= " \n";
$historyOut .= " | \n";
$historyOut .= " \n";
if ($trackingArray[$i]["tr_status"] == "1") :
$historyOut .= " " . getLngt("erledigt") . "\n";
else :
$historyOut .= " " . getLngt("offen") . "\n";
endif;
$historyOut .= " | \n";
$historyOut .= " \n";
if ($trackingArray[$i]["tr_status"] == "1") :
$historyOut .= " " . formatOutput($trackingArray[$i]["tr_finishtime"],$outputFormatField["tr_finishtime"]) . "\n";
endif;
$historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
/*
if (false && $trackingArray[$i]["trat_serialno"] != "") :
$historyOut .= "\n";
$historyOut .= " | \n";
$historyOut .= " " . $currAddress . "\n";
$historyOut .= " | \n";
// $historyOut .= " \n";
// $historyOut .= " " . $currTratSerialno . "\n";
// $historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . formatOutput($trackingArray[$i]["tr_finishtime"],$outputFormatField["tr_finishtime"]) . "\n";
$historyOut .= " | \n";
// $historyOut .= " \n";
// $historyOut .= " " . $trackingArray[$i]["mt_value"] . "\n";
// $historyOut .= " | \n";
// $historyOut .= " \n";
// $historyOut .= " " . $trackingArray[$i]["tratp_remark"] . "\n";
// $historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
endif;
*/
elseif ($objType == "tracking_tr" || $objType == "track_tr") :
// Check there is at least one tour article
if ($atLeastOneTourArticleDoesExist) :
if ($trackingArray[$i]["trat_serialno"] != "") :
$historyOut .= "\n";
$historyOut .= " | \n";
$historyOut .= " " . $currTratSerialno . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . formatOutput($trackingArray[$i]["tratp_createtime"],$outputFormatField["tratp_createtime"]) . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . $trackingArray[$i]["mt_value"] . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . $trackingArray[$i]["tratp_remark"] . "\n";
$historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
endif;
endif;
elseif ($objType == "tracking_trat" || $objType == "track_trat") :
$historyOut .= "\n";
$historyOut .= " | \n";
$historyOut .= " " . formatOutput($trackingArray[$i]["tratp_createtime"],$outputFormatField["tratp_createtime"]) . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . $trackingArray[$i]["tratp_state"] . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . $trackingArray[$i]["tratp_remark"] . "\n";
$historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
endif;
/*
$historyOut .= "\n";
$historyOut .= " | \n";
$historyOut .= " " . formatOutput($trackingArray[$i]["tratp_createtime"],$outputFormatField["tratp_createtime"]) . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . $trackingArray[$i]["mt_value"] . "\n";
$historyOut .= " | \n";
$historyOut .= " \n";
$historyOut .= " " . $trackingArray[$i]["tratp_state"] . "\n";
$historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
*/
endfor;
// ---------------------------------
// Get contractor (seller) data (e.g. Amazon) of the carrier (e.g. Stadtbote) for visualisation for the end customer
// Get process of all events of the tracking ID
/*
$sqlquery = "SELECT cmp.cmp_comp, cmp.cmp_comp2, hq.hq_name, cmp2.cmp_comp AS cmp2_comp,"
. " cmp2.cmp_comp2 AS cmp2_comp2, cmp2.cmp_logo AS cmp2_logo, cmp2.cmp_logo_width AS cmp2_logo_width, cmp2.cmp_logo_height AS cmp2_logo_height"
. " FROM phoenix.job AS jb, phoenix.costcenter AS csc, phoenix.customer AS cs, phoenix.company AS cmp, phoenix.headquarters AS hq, phoenix.company AS cmp2"
. " WHERE jb.jb_id = '" . $objId . "' AND"
. " jb.csc_id_payer = csc.csc_id AND"
. " csc.cs_id = cs.cs_id AND"
. " cs.cmp_id = cmp.cmp_id AND"
. " cs.hq_id = hq.hq_id AND"
. " hq.cmp_id = cmp2.cmp_id";
$result = $db_conn->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
while ($row = $result->fetchRow()):
// $cmpOut .= $row["cmp_comp"] . " " . $row["cmp_comp2"] . "
\n";
$cmpOut .= "\n";
$cmpOut .= " \n";
$cmpOut .= " " . $row["cmp_comp"] . " " . $row["cmp_comp2"] . "\n";
$cmpOut .= " | \n";
$cmpOut .= "
\n";
$cmpOut .= " |
\n";
$row["hq_name"] $row["cmp2_logo"] $row["cmp2_logo_width"] $row["cmp2_logo_height"]
$cmp2Out .= "\n";
$cmp2Out .= " \n";
$cmp2Out .= " " . $row["cmp2_comp"] . " " . $row["cmp2_comp2"] . "\n";
$cmp2Out .= " | \n";
$cmp2Out .= "
\n";
$cmp2Out .= " |
\n";
endwhile;
$result->free();
*/
endif;
endif;
?>