";
endif;
$pageTitel = getLngt("Sendungsverfolgung");
// *********************
// TEST INSERT INTO "metaobject"
// insertMetaobjectTrackingItem($moIdRefDB, $objType, $objId, $moValueTrId, $moValueTratSerialno = "")
// $tmpArr = insertMetaobjectTrackingItem("2", "track_tr", "1812157", "3712779", "");
// $tmpArr = insertMetaobjectTrackingItem("2", "track", "1812157", "1812157", "1042209022");
// $tmpArr = insertMetaobjectTrackingItem("2", "track_jb", "1812157", "", "1812157");
// *********************
// TEST SENDING TRACKING MAIL
// $tmpArr = sendTrackingHTMLMail("mv@assecutor.de", "e36bac56d55c8ea4afee7aa50ef9fd1c");
// print_r($tmpArr); die();
// *********************
// Get header image from database
// $imgFilename = ...
if ($imgFilename == "") : $imgFilename = "assecutor.png"; endif;
$trOut = "";
$csEndOut = "";
$cmpOut = "";
$cmp2Out = "";
$historyOut = "";
$out = getLngt("Ihre Sendung konnte unter der angegebenen Nummer nicht aufgefunden werden.") . "
" . 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);
if ($debug) : print_r($trackingArray); echo "\n
"; endif;
if ($trackingArrayLen > 0) :
// 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("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";
elseif ($objType == "tracking_tr" || $objType == "track_tr") :
$currAddress = $trackingArray[0]["ad_street"] . " " . $trackingArray[0]["tr_hsno"] . " - " . $trackingArray[0]["ad_zipcode"] . " " . $trackingArray[0]["ad_city"];
$classCurrAddress = "f12bp1_red";
if ($trackingArray[0]["tr_state"] == "1") :
$classCurrAddress = "f12bp1_darkgreen";
endif;
$historyOut .= "\n";
$historyOut .= " | \n";
$historyOut .= " " . $currAddress . "\n";
$historyOut .= " | \n";
$historyOut .= "
\n";
$historyOut .= " |
\n";
$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";
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") :
$classCurrAddress = "f10np1_red";
if ($trackingArray[$i]["tr_state"] == "1") :
$classCurrAddress = "f10np1_darkgreen";
endif;
if ($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]["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;
elseif ($objType == "tracking_tr" || $objType == "track_tr") :
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;
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->fetch_assoc()):
// $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;
?>