1. Import
This commit is contained in:
35
html/tracking/sendReq.php
Normal file
35
html/tracking/sendReq.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
function pad($strValue = "", $lengthOf = 0, $specialChar = "0", $appendMode = "left") {
|
||||
if ($lengthOf == 0 || ($appendMode != "left" && $appendMode != "right")) :
|
||||
return trim($strValue);
|
||||
endif;
|
||||
|
||||
$len = strlen($strValue);
|
||||
for ($i = $len; $i < $lengthOf; $i++) :
|
||||
if ($appendMode == "left") :
|
||||
$strValue = $specialChar . $strValue;
|
||||
else :
|
||||
$strValue = $strValue . $specialChar;
|
||||
endif;
|
||||
endfor;
|
||||
return $strValue;
|
||||
}
|
||||
|
||||
$trackingUserID = "stbx";
|
||||
$trackingPassword = "cagtmv2924";
|
||||
|
||||
|
||||
$req = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
||||
$req .= "<AmazonTrackingRequest xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"AmazonTrackingRequest.xsd\">";
|
||||
$req .= "<Validation><UserID>" . $trackingUserID . "</UserID><Password>" . $trackingPassword . "</Password></Validation><APIVersion>3.1</APIVersion>";
|
||||
for ($i = 1; $i <= 2; $i++) :
|
||||
$testID = "test" . pad($i, 4, "0");
|
||||
$req .= "<TrackingNumber>" . $testID . "</TrackingNumber>";
|
||||
endfor;
|
||||
$req .= "</AmazonTrackingRequest>";
|
||||
|
||||
$req = urlencode($req);
|
||||
|
||||
header("Location: tracking_amazon.php?trackingReq=" . $req);
|
||||
?>
|
||||
685
html/tracking/tracking.php
Normal file
685
html/tracking/tracking.php
Normal file
@@ -0,0 +1,685 @@
|
||||
<?php
|
||||
/*=======================================================================
|
||||
*
|
||||
* tracking.php
|
||||
*
|
||||
* Autor: Marc Vollmann
|
||||
*
|
||||
=======================================================================*/
|
||||
|
||||
|
||||
include_once ("../include/mcglobal.inc.php");
|
||||
include_once ("../include/inc_job.inc.php");
|
||||
|
||||
// Check HTTP-Parameters
|
||||
getSecHttpVars("1",array("f_act", "trackingID", "selectedLanguage"));
|
||||
|
||||
|
||||
$trackingID = trim($trackingID);
|
||||
|
||||
// Write logdata into log file
|
||||
if ($trackingID != "") :
|
||||
$currentTime = getDateTime("0");
|
||||
writeToFile("../log/tracking.log", $currentTime . " : " . $trackingID);
|
||||
endif;
|
||||
|
||||
if ($selectedLanguage == "" || !is_numeric($selectedLanguage)) : $selectedLanguage = $languageSelected; endif;
|
||||
$languageSelected = $selectedLanguage;
|
||||
|
||||
getLanguage(__FILE__);
|
||||
getCurrentScript(__FILE__);
|
||||
|
||||
|
||||
$pageTitel = getLngt("Sendungsverfolgung");
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Event messages
|
||||
$eventMsgArray["EVENT_101"] = getLngt("Sendung hat Versandzentrum verlassen."); // Electronic Manifest transmitted to the carrier and the carrier’s truck has departed seller facility
|
||||
$eventMsgArray["EVENT_102"] = getLngt("Sendung wurde vom Transporteur übernommen."); // Origin scan which confirms possession by the carrier
|
||||
|
||||
//$eventMsgArray["EVENT_201"] = getLngt("Ankunft der Sendung im zentralen Hub."); // Arrived at any of the carrier facilities
|
||||
$eventMsgArray["EVENT_201"] = getLngt("Ankunft der Sendung im Verteilzentrum."); // Arrived at any of the carrier facilities
|
||||
$eventMsgArray["EVENT_202"] = getLngt("Ausgang der Sendung aus dem zentralen Hub."); // Departed any of the carrier facilities
|
||||
|
||||
// $eventMsgArray["EVENT_203"] = "Arrived at destination country"; // Arrived at the destination country
|
||||
// $eventMsgArray["EVENT_204"] = "Initiated customs clearance process"; // Customs has started to clear the package
|
||||
// $eventMsgArray["EVENT_205"] = "Completed customs clearance process"; // Customs has cleared the package
|
||||
// $eventMsgArray["EVENT_206"] = "In transit to pickup location"; // Package is in transit to pickup location
|
||||
// $eventMsgArray["EVENT_207"] = "Problem resolved and shipment is in transit"; // Resolution of exception scan and package is in transit again
|
||||
// $eventMsgArray["EVENT_208"] = "Your selected store is closed for delivery and your shipment has been rerouted to a nearby store. The carrier will provide more information about the new store"; // Customer pick-up location is closed and the package was rerouted to a nearby pick-up location
|
||||
|
||||
$eventMsgArray["EVENT_300"] = getLngt("NOT DISPLAYED"); // Tendered to alternate carrier, line haul complete
|
||||
$eventMsgArray["EVENT_301"] = getLngt("Sendung zugestellt."); // Delivered to the customer directly
|
||||
$eventMsgArray["EVENT_302"] = getLngt("Zustellung läuft."); // On the last leg of delivery to the customer
|
||||
$eventMsgArray["EVENT_304"] = getLngt("Vergeblicher Zustellversuch."); // Carrier attempted delivery, but unable to deliver to customer
|
||||
$eventMsgArray["EVENT_306"] = getLngt("Kontaktaufnahme"); // Carrier has contacted the customer to arrange delivery of the package
|
||||
$eventMsgArray["EVENT_307"] = getLngt("Neuer Auslieferungstermin vereinbart"); // Carrier has scheduled delivery of the package with the customer
|
||||
//$eventMsgArray["EVENT_308"] = getLngt("Sendung ist verfügbar für Abholung"); // Package is available for pickup from pickup location
|
||||
$eventMsgArray["EVENT_308"] = getLngt("Sendung steht zur Abholung bereit."); // Package is available for pickup from pickup location
|
||||
$eventMsgArray["EVENT_309"] = getLngt("Rücksendung der Ware"); // Package was delivered back to seller’s facility
|
||||
// $eventMsgArray["EVENT_310"] = "Tendered to local postal carrier for final delivery"; // Local postal carrier will perform final delivery to the customer. If assigned a new tracking id, carrier name and tracking id should be provided.
|
||||
// $eventMsgArray["EVENT_311"] = "Tendered to local postal carrier for final delivery and no proof of delivery will be provided"; // Local postal carrier will perform final delivery to the customer but they will not scan the package as delivered (international use).
|
||||
$eventMsgArray["EVENT_320"] = getLngt("Kunde hat abgeholt.");
|
||||
$eventMsgArray["EVENT_328"] = getLngt("Zustellung auf den nächsten Werktag verschoben."); // "Shipment addressed to a company that is closed on weekends. Shipment will be deliverd on the next working day"; // Business closed. The goods/consignements/equipment could not be delivered/collected as the business was closed
|
||||
|
||||
$eventMsgArray["EVENT_401"] = getLngt("Falsche Adresse"); // Destination address does not exist or is incorrect
|
||||
// $eventMsgArray["EVENT_402"] = "Customs clearance delay"; // Any situation which causes a delay clearing customs
|
||||
$eventMsgArray["EVENT_403"] = getLngt("Empfänger verzogen"); // Consignee no longer lives at the delivery address and left no forwarding address
|
||||
$eventMsgArray["EVENT_404"] = getLngt("Verzögerung der Auslieferung"); // This represents a definite delay in delivery and will trigger correspondences to the customer to notify them of the delay
|
||||
$eventMsgArray["EVENT_405"] = getLngt("Ware beschädigt"); // Carrier damaged the package
|
||||
$eventMsgArray["EVENT_406"] = getLngt("Sendung wird zurückgehalten"); // The package is being held by the carrier
|
||||
$eventMsgArray["EVENT_407"] = getLngt("Sendung nicht angenommen"); // Consignee refused to accept package
|
||||
$eventMsgArray["EVENT_408"] = getLngt("Verkäufer hat die Sendung zurückgerufen"); // Seller has requested the package to be returned to sellers facility
|
||||
// $eventMsgArray["EVENT_409"] = "Lost by carrier"; // Carrier lost the package
|
||||
$eventMsgArray["EVENT_411"] = "Auf der Packliste avisierte Sendung wurde vom Versender nicht mitgeliefert."; // Carrier received electronic or paper manifest, but the shipment has not been picked up
|
||||
$eventMsgArray["EVENT_412"] = "Sendung steht nicht auf der Packliste/Übergabe an falschen Transportservice."; // Carrier received the package, but not the electronic/paper manifest. This is sent only when the shipment cannot move until the problem is resolved
|
||||
// $eventMsgArray["EVENT_413"] = "Customer refused shipment due to customs charges"; // Customer has refused shipment due to customs duties, taxes and fees charges.
|
||||
// $eventMsgArray["EVENT_414"] = "Possible delay in delivery due to arrival at incorrect carrier facility"; // Package was mis-sorted and delivery maybe delayed
|
||||
// $eventMsgArray["EVENT_415"] = "Received from prior carrier"; // Carrier has received the package from the previous carrier
|
||||
$eventMsgArray["EVENT_416"] = getLngt("Nicht auslieferbar"); // Package could not be delivered, and seller has instructed the carrier to destroy the package or follow alternate instructions
|
||||
// $eventMsgArray["EVENT_418"] = "Returning to seller due to incorrect address"; // Unable to complete delivery due to incorrect address and the shipment is being returned to the seller
|
||||
// $eventMsgArray["EVENT_419"] = "Returning to seller because customer refused delivery"; // Customer refused delivery and the shipment is being returned to the seller
|
||||
// $eventMsgArray["EVENT_420"] = "Delay in delivery due to weather or natural disaster"; // Shipment delivery is delayed because of weather or natural disaster
|
||||
// $eventMsgArray["EVENT_421"] = "Unable to forward shipment to different address"; // Forwarding attempt failed
|
||||
// $eventMsgArray["EVENT_422"] = "Shipment forwarded to a different delivery address"; // Carrier has forwarded the package to an address
|
||||
// $eventMsgArray["EVENT_423"] = "Shipment damaged and will not be delivered"; // Carrier has identified the package as damaged, will not complete the delivery, and will dispose of the package
|
||||
// $eventMsgArray["EVENT_424"] = "Held for payment"; // Delivery of the package cannot be completed until payment is received by Carrier
|
||||
// $eventMsgArray["EVENT_425"] = "Possible delay in delivery due to extra carrier processing"; // There is possible delay in delivery because the carrier had to perform extra processing outside of the norm
|
||||
// $eventMsgArray["EVENT_426"] = "Confiscated or seized by an official government authority"; // The package will not be delivered nor returned due to being seized by an official government authority
|
||||
// $eventMsgArray["EVENT_427"] = "Held by carrier – seller input required"; // The package is being held by the carrier because they require additional information from seller
|
||||
// $eventMsgArray["EVENT_428"] = "Address issue corrected by carrier but delivery could be delayed."; // The carrier was able to correct the customer’s address without any input from customer or seller
|
||||
$eventMsgArray["EVENT_451"] = getLngt("Nach Ablauf der Lagerfrist zurückgeschickt.");
|
||||
|
||||
$eventMsgArray["EVENT_901"] = getLngt("Sendungsbarcode gelesen"); // Internal Assecutor event
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Error messages
|
||||
$errMsgArray["ERROR_101"] = "INVALID TRACKING NUMBER"; // Request contains an invalid tracking number
|
||||
$errMsgArray["ERROR_102"] = "NO TRACKING INFO FOUND"; // No data exists in the carrier’s system for the given tracking number
|
||||
|
||||
$errMsgArray["ERROR_201"] = "INVALID USERID/PASSWORD"; // Request contains an invalid user ID or password
|
||||
$errMsgArray["ERROR_202"] = "INVALID API VERSION"; // Request contains an incompatible API version
|
||||
$errMsgArray["ERROR_203"] = "XML DOCUMENT NOT WELL FORMED"; // Request is not a well-formed XML document
|
||||
$errMsgArray["ERROR_204"] = "XML DOCUMENT NOT VALID"; // Request is not a valid XML document
|
||||
|
||||
$errMsgArray["ERROR_301"] = "TRACKING SERVICE NOT AVAILABLE"; // Generic error code to handle any situation
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Delivery location codes
|
||||
$deliveryLocCodes["AS_INSTRUCTED"] = getLngt("Anweisungsgemäß"); // Package was delivered as per instructions
|
||||
$deliveryLocCodes["CARPORT"] = getLngt("Carport"); // Package was left inside a carport
|
||||
$deliveryLocCodes["CUSTOMER_PICKUP"] = getLngt("Picked up by customer"); // Package was picked up by customer
|
||||
$deliveryLocCodes["DECK"] = getLngt("Deck"); // Package was left on an outside deck
|
||||
$deliveryLocCodes["DOCK"] = getLngt("Shipping dock"); // Package was left on dock
|
||||
$deliveryLocCodes["FRONT_DESK"] = getLngt("Front desk"); // Package was left at front desk
|
||||
$deliveryLocCodes["FRONT_DOOR"] = getLngt("Front door"); // Package was left in or near the front door
|
||||
$deliveryLocCodes["GARAGE"] = getLngt("Garage"); // Package was left in or near the garage door
|
||||
$deliveryLocCodes["GUARD"] = getLngt("Guard"); // Package was handed to a security guard
|
||||
$deliveryLocCodes["MAILBOX"] = getLngt("Mailbox"); // Package was left inside the residence’s mailbox
|
||||
$deliveryLocCodes["MAIL_ROOM"] = getLngt("Mail room"); // Package was left in mail room
|
||||
$deliveryLocCodes["MAIL_SLOT"] = getLngt("Mail slot"); // Package was left in mail slot
|
||||
$deliveryLocCodes["MC_BOY"] = getLngt("Delivered to male child"); // Package was handed directly to a male child.
|
||||
$deliveryLocCodes["MC_GIRL"] = getLngt("Delivered to female child"); // Package was handed directly to a female child.
|
||||
$deliveryLocCodes["MC_MAN"] = getLngt("Delivered to male adult"); // Package was handed directly to a man
|
||||
$deliveryLocCodes["MC_WOMAN"] = getLngt("Delivered to female adult"); // Package was handed directly to a woman
|
||||
$deliveryLocCodes["NEIGHBOR"] = getLngt("Left with neighbor"); // Package was handed directly to a neighbor
|
||||
$deliveryLocCodes["OUTBUILDING"] = getLngt("Outbuilding"); // Package was left in an outbuilding
|
||||
$deliveryLocCodes["PATIO"] = getLngt("Patio"); // Package was left on an outside patio
|
||||
$deliveryLocCodes["PORCH"] = getLngt("Porch"); // Package was left on an outside porch
|
||||
$deliveryLocCodes["REAR_DOOR"] = getLngt("Rear door"); // Package was in or near the rear door
|
||||
$deliveryLocCodes["RECEIVER"] = getLngt("Resident"); // Package was handed to resident
|
||||
$deliveryLocCodes["RECEPTIONIST"] = getLngt("Receptionist"); // Package was handed to a receptionist
|
||||
$deliveryLocCodes["SECURE_LOCATION"] = getLngt("Secure location"); // Package was left in a secure location
|
||||
$deliveryLocCodes["SIDE_DOOR"] = getLngt("Side door"); // Package was left at side door
|
||||
|
||||
// Pickup location codes
|
||||
$pickupLocCodes["CARRIER_FACILITY"] = getLngt("Available for pickup at carrier facility"); // Package can be picked up from carrier’s hub
|
||||
$pickupLocCodes["CONVENIENCE_STORE"] = getLngt("Available for pickup at local convenience store"); // Package can be picked up at a local store
|
||||
$pickupLocCodes["LOCAL_POST_OFFICE"] = getLngt("Available for pickup at your local post office"); // Package can be picked up at local post office
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
$trOut = "";
|
||||
$csEndOut = "";
|
||||
$cmpOut = "";
|
||||
$cmp2Out = "";
|
||||
$tratpOut = "";
|
||||
|
||||
$out = getLngt("Ihre Sendung konnte unter der angegebenen Nummer nicht aufgefunden werden.") . "<br>" . getLngt("Bitte kontrollieren Sie noch einmal die Eingabe.");
|
||||
if ($trackingID == "") :
|
||||
$out = getLngt("Bitte geben Sie Ihre Sendungsnummer ein.");
|
||||
endif;
|
||||
|
||||
if ($trackingID != "") :
|
||||
|
||||
// Get the array for formatting the database-values for the output according to the defined type
|
||||
$outputFormatField = defineOutputFormats();
|
||||
|
||||
// Get connection to meta object instance
|
||||
$dbMetaObjConn = getConnectionToMetaDB();
|
||||
|
||||
// Check existence of the hash value
|
||||
if (existsEntry("meta_object.metaobject", array("mo_hash",$trackingID), $dbMetaObjConn)) :
|
||||
|
||||
$moId = getFieldValueFromId("meta_object.metaobject", "mo_hash", $trackingID, "mo_id", $dbMetaObjConn);
|
||||
$moIdRefDB = getFieldValueFromId("meta_object.metaobject", "mo_id", $moId, "mo_id_ref_db", $dbMetaObjConn);
|
||||
$objType = getFieldValueFromId("meta_object.metaobject", "mo_id", $moId, "mo_obj_type", $dbMetaObjConn);
|
||||
$objId = getFieldValueFromId("meta_object.metaobject", "mo_id", $moId, "mo_obj_id", $dbMetaObjConn);
|
||||
$moValue = getFieldValueFromId("meta_object.metaobject", "mo_id", $moId, "mo_value", $dbMetaObjConn);
|
||||
|
||||
if ($moId != "" && $moId > "0") :
|
||||
|
||||
// Get database instance
|
||||
$dbInst = getFieldValueFromId("meta_object.metaobject", "mo_id", $moIdRefDB, "mo_value", $dbMetaObjConn);
|
||||
|
||||
if ($dbInst != "") :
|
||||
|
||||
// Get database connection
|
||||
$db_conn = getDbConnectionSpecial($dbInst, $dbname, $dblogin, $dbpassword);
|
||||
|
||||
if (substr($objType, 0, 5) == "track") : // Could be "track", "track_tour", "track_job", ...
|
||||
|
||||
// Charset
|
||||
$result = $db_conn->query("SET NAMES LATIN1");
|
||||
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
|
||||
|
||||
|
||||
// *** STATION TRACKING ***
|
||||
|
||||
if ($objType == "track_tour") :
|
||||
|
||||
$jobData = array();
|
||||
$trId = $objId;
|
||||
$jbId = getOneStmt("SELECT tr.jb_id FROM tour AS tr WHERE tr.tr_id = '" . $objId . "'", "jb_id", $db_conn);
|
||||
|
||||
getDBData("job", $jbId, $db_conn);
|
||||
if ($jobData != "" && is_array($jobData)) :
|
||||
print_r($jobData);
|
||||
$jobDataLen = count($jobData);
|
||||
endif;
|
||||
die();
|
||||
|
||||
// ........................
|
||||
|
||||
|
||||
// Get tracking data
|
||||
$sqlquery = "SELECT trat.trat_id, trat.jb_id, trat.tr_sort, trat.trat_state, trat.trat_remark,"
|
||||
. " tratp.tratp_type, tratp.tratp_state, tratp.tratp_remark, tratp.tratp_createtime,"
|
||||
. " tr.tr_signname, tr.tr_hsno,"
|
||||
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
|
||||
. " FROM phoenix.tour AS tr, phoenix.tourarticle AS trat, phoenix.tourarticleprocess AS tratp, phoenix.address AS ad"
|
||||
. " WHERE tr.tr_id = '" . $objId . "' AND"
|
||||
. " trat.jb_id = tr.jb_id AND"
|
||||
. " trat.tr_sort = tr.tr_sort AND"
|
||||
. " trat.trat_id = tratp.trat_id AND"
|
||||
. " tr.ad_id = ad.ad_id"
|
||||
. " ORDER BY tratp.tratp_createtime";
|
||||
|
||||
$result = $db_conn->query($sqlquery);
|
||||
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
|
||||
|
||||
while ($row = $result->fetchRow()):
|
||||
|
||||
$tratpOut .= "<tr>\n";
|
||||
$tratpOut .= " <td width=\"50%\" align=\"left\">\n";
|
||||
$tratpOut .= " <span class=\"f10np1\">" . $eventMsgArray["EVENT_" . $row["tratp_type"]] . "</span>\n";
|
||||
$tratpOut .= " </td>\n";
|
||||
$tratpOut .= " <td width=\"20%\" align=\"left\">\n";
|
||||
if ($row["tratp_state"] >= "1") :
|
||||
$tratpOut .= " <span class=\"f10np1_green\">" . getLngt("erledigt") . "</span>\n";
|
||||
else :
|
||||
$tratpOut .= " <span class=\"f10np1_red\">" . getLngt("offen") . "</span>\n";
|
||||
endif;
|
||||
$tratpOut .= " </td>\n";
|
||||
$tratpOut .= " <td width=\"30%\" align=\"left\">\n";
|
||||
$tratpOut .= " <span class=\"f10np1\">" . formatOutput($row["tratp_createtime"],$outputFormatField["tratp_createtime"]) . "</span>\n";
|
||||
$tratpOut .= " </td>\n";
|
||||
$tratpOut .= "</tr>\n";
|
||||
$tratpOut .= "<tr><td class=\"spacer05\"></td></tr>\n";
|
||||
endwhile;
|
||||
$result->free();
|
||||
|
||||
// -------------------------------------
|
||||
|
||||
// Get delivery address and data of the end customer
|
||||
$sqlquery = "SELECT trat.jb_id, trat.tr_sort,"
|
||||
. " tr.tr_signname, tr.tr_hsno, tr.tr_person,"
|
||||
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
|
||||
. " FROM phoenix.tourarticle AS trat, phoenix.tour AS tr, phoenix.address AS ad"
|
||||
. " WHERE trat.trat_serialno = '" . $moValue . "' AND"
|
||||
. " trat.jb_id = tr.jb_id AND"
|
||||
. " trat.tr_sort = tr.tr_sort AND"
|
||||
. " tr.ad_id = ad.ad_id"
|
||||
. " ORDER BY trat.jb_id, trat.tr_sort";
|
||||
|
||||
$result = $db_conn->query($sqlquery);
|
||||
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
|
||||
|
||||
// The last row is the youngest order with the corresponding station no.
|
||||
while ($row = $result->fetchRow()):
|
||||
|
||||
$jbIdOfDelivery = $row["jb_id"];
|
||||
$trSortOfDelivery = $row["tr_sort"];
|
||||
$adStreetOfDelivery = $row["ad_street"];
|
||||
$trHsnoOfDelivery = $row["tr_hsno"];
|
||||
$adZipcodeOfDelivery = $row["ad_zipcode"];
|
||||
$adCityOfDelivery = $row["ad_city"];
|
||||
$adCountryOfDelivery = $row["ad_country"];
|
||||
$trPersonOfDelivery = $row["tr_person"];
|
||||
endwhile;
|
||||
$result->free();
|
||||
|
||||
if ($jbIdOfDelivery != "") :
|
||||
if ($trPersonOfDelivery != "") :
|
||||
$csEndOut .= $trPersonOfDelivery . "<br>\n";
|
||||
endif;
|
||||
$csEndOut .= $adStreetOfDelivery . " " . $trHsnoOfDelivery . "<br>\n";
|
||||
$csEndOut .= $adZipcodeOfDelivery . " " . $adCityOfDelivery . "\n";
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
// *** PACKAGE TRACKING (by barcode) ***
|
||||
|
||||
if ($objType == "track") :
|
||||
|
||||
// Get tracking data
|
||||
$sqlquery = "SELECT trat.trat_id, trat.jb_id, trat.tr_sort, trat.trat_state, trat.trat_remark,"
|
||||
. " tratp.tratp_type, tratp.tratp_state, tratp.tratp_remark, tratp.tratp_createtime,"
|
||||
. " tr.tr_signname, tr.tr_hsno,"
|
||||
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
|
||||
. " FROM phoenix.tourarticle AS trat, phoenix.tourarticleprocess AS tratp, phoenix.tour AS tr, phoenix.address AS ad"
|
||||
. " WHERE trat.trat_serialno = '" . $moValue . "' AND"
|
||||
. " trat.trat_id = tratp.trat_id AND"
|
||||
. " trat.jb_id = tr.jb_id AND"
|
||||
. " trat.tr_sort = tr.tr_sort AND"
|
||||
. " tr.ad_id = ad.ad_id"
|
||||
. " ORDER BY tratp.tratp_createtime";
|
||||
|
||||
$result = $db_conn->query($sqlquery);
|
||||
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
|
||||
|
||||
while ($row = $result->fetchRow()):
|
||||
|
||||
$tratpOut .= "<tr>\n";
|
||||
$tratpOut .= " <td width=\"50%\" align=\"left\">\n";
|
||||
$tratpOut .= " <span class=\"f10np1\">" . $eventMsgArray["EVENT_" . $row["tratp_type"]] . "</span>\n";
|
||||
$tratpOut .= " </td>\n";
|
||||
$tratpOut .= " <td width=\"20%\" align=\"left\">\n";
|
||||
if ($row["tratp_state"] >= "1") :
|
||||
$tratpOut .= " <span class=\"f10np1_green\">" . getLngt("erledigt") . "</span>\n";
|
||||
else :
|
||||
$tratpOut .= " <span class=\"f10np1_red\">" . getLngt("offen") . "</span>\n";
|
||||
endif;
|
||||
$tratpOut .= " </td>\n";
|
||||
$tratpOut .= " <td width=\"30%\" align=\"left\">\n";
|
||||
$tratpOut .= " <span class=\"f10np1\">" . formatOutput($row["tratp_createtime"],$outputFormatField["tratp_createtime"]) . "</span>\n";
|
||||
$tratpOut .= " </td>\n";
|
||||
$tratpOut .= "</tr>\n";
|
||||
$tratpOut .= "<tr><td class=\"spacer05\"></td></tr>\n";
|
||||
endwhile;
|
||||
$result->free();
|
||||
|
||||
// -------------------------------------
|
||||
|
||||
// Get delivery address and data of the end customer
|
||||
$sqlquery = "SELECT trat.jb_id, trat.tr_sort,"
|
||||
. " tr.tr_signname, tr.tr_hsno, tr.tr_person,"
|
||||
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
|
||||
. " FROM phoenix.tourarticle AS trat, phoenix.tour AS tr, phoenix.address AS ad"
|
||||
. " WHERE trat.trat_serialno = '" . $moValue . "' AND"
|
||||
. " trat.jb_id = tr.jb_id AND"
|
||||
. " trat.tr_sort = tr.tr_sort AND"
|
||||
. " tr.ad_id = ad.ad_id"
|
||||
. " ORDER BY trat.jb_id, trat.tr_sort";
|
||||
|
||||
$result = $db_conn->query($sqlquery);
|
||||
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
|
||||
|
||||
// The last row is the youngest order with the corresponding station no.
|
||||
while ($row = $result->fetchRow()):
|
||||
|
||||
$jbIdOfDelivery = $row["jb_id"];
|
||||
$trSortOfDelivery = $row["tr_sort"];
|
||||
$adStreetOfDelivery = $row["ad_street"];
|
||||
$trHsnoOfDelivery = $row["tr_hsno"];
|
||||
$adZipcodeOfDelivery = $row["ad_zipcode"];
|
||||
$adCityOfDelivery = $row["ad_city"];
|
||||
$adCountryOfDelivery = $row["ad_country"];
|
||||
$trPersonOfDelivery = $row["tr_person"];
|
||||
endwhile;
|
||||
$result->free();
|
||||
|
||||
if ($jbIdOfDelivery != "") :
|
||||
if ($trPersonOfDelivery != "") :
|
||||
$csEndOut .= $trPersonOfDelivery . "<br>\n";
|
||||
endif;
|
||||
$csEndOut .= $adStreetOfDelivery . " " . $trHsnoOfDelivery . "<br>\n";
|
||||
$csEndOut .= $adZipcodeOfDelivery . " " . $adCityOfDelivery . "\n";
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
// *** JOB TRACKING ***
|
||||
|
||||
if ($objType == "track_job") :
|
||||
|
||||
// Get stations delivered before current requested station requested by end customer
|
||||
$sqlquery = "SELECT tr.tr_sort, tr.tr_status, tr.tr_finishtime, tr.tr_hsno,"
|
||||
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
|
||||
. " FROM phoenix.tour AS tr, phoenix.address AS ad"
|
||||
. " WHERE tr.jb_id = '" . $objId . "' AND"
|
||||
. " tr.ad_id = ad.ad_id"
|
||||
. " ORDER BY tr.tr_sort";
|
||||
|
||||
$result = $db_conn->query($sqlquery);
|
||||
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
|
||||
|
||||
while ($row = $result->fetchRow()):
|
||||
$trOut .= "<tr>\n";
|
||||
$trOut .= " <td width=\"50%\" align=\"left\">\n";
|
||||
$trOut .= " <span class=\"f10np1\">" . $row["tr_sort"] . ". " . getLngt("Station") . "<br>\n";
|
||||
$trOut .= $row["ad_street"] . " " . $row["tr_hsno"] . "<br>\n";
|
||||
$trOut .= $row["ad_zipcode"] . " " . $row["ad_city"] . "\n";
|
||||
$trOut .= " </span>\n";
|
||||
$trOut .= " </td>\n";
|
||||
$trOut .= " <td width=\"20%\" align=\"left\">\n";
|
||||
if ($row["tr_status"] == "1") :
|
||||
$trOut .= " <span class=\"f10np1_green\">" . getLngt("erledigt") . "</span>\n";
|
||||
else :
|
||||
$trOut .= " <span class=\"f10np1_red\">" . getLngt("offen") . "</span>\n";
|
||||
endif;
|
||||
$trOut .= " </td>\n";
|
||||
$trOut .= " <td width=\"30%\" align=\"left\">\n";
|
||||
if ($row["tr_status"] == "1") :
|
||||
$trOut .= " <span class=\"f10np1\">" . formatOutput($row["tr_finishtime"],$outputFormatField["tr_finishtime"]) . "</span>\n";
|
||||
endif;
|
||||
$trOut .= " </td>\n";
|
||||
$trOut .= "</tr>\n";
|
||||
$trOut .= "<tr><td class=\"spacer05\"></td></tr>\n";
|
||||
endwhile;
|
||||
$result->free();
|
||||
endif;
|
||||
|
||||
|
||||
// ---------------------------------
|
||||
|
||||
// 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"] . "<br>\n";
|
||||
|
||||
/*
|
||||
$cmpOut .= "<tr>\n";
|
||||
$cmpOut .= " <td align=\"left\">\n";
|
||||
$cmpOut .= " <span class=\"f12bp1\">" . $row["cmp_comp"] . "<br>" . $row["cmp_comp2"] . "</span>\n";
|
||||
$cmpOut .= " </td>\n";
|
||||
$cmpOut .= "</tr>\n";
|
||||
$cmpOut .= "<tr><td class=\"spacer15\"></td></tr>\n";
|
||||
*/
|
||||
|
||||
/*
|
||||
$row["hq_name"] $row["cmp2_logo"] $row["cmp2_logo_width"] $row["cmp2_logo_height"]
|
||||
|
||||
$cmp2Out .= "<tr>\n";
|
||||
$cmp2Out .= " <td align=\"center\">\n";
|
||||
$cmp2Out .= " <span class=\"f12bp1\">" . $row["cmp2_comp"] . "<br>" . $row["cmp2_comp2"] . "</span>\n";
|
||||
$cmp2Out .= " </td>\n";
|
||||
$cmp2Out .= "</tr>\n";
|
||||
$cmp2Out .= "<tr><td class=\"spacer15\"></td></tr>\n";
|
||||
*/
|
||||
endwhile;
|
||||
$result->free();
|
||||
|
||||
else :
|
||||
// Write logdata into log database
|
||||
// writeToLogDB("97",$hqId,"","","","",$objId,"STATUS=OBJTYPE_NOT_FOUND|IP=" . $currentClientIP . "|MO_ID" . $moId);
|
||||
endif;
|
||||
|
||||
else :
|
||||
// database not specified in metaobject row
|
||||
// writeToLogDB("97","","","","","","","STATUS=DB_NOT_SPECIFIED|IP=" . $currentClientIP . "|MO_ID" . $moId);
|
||||
endif;
|
||||
else :
|
||||
// HASH nicht gefunden um Zuordnung herzustellen
|
||||
endif;
|
||||
endif;
|
||||
else :
|
||||
// Write logdata into log database
|
||||
// writeToLogDB("97","","","","","","","STATUS=EMPTY_OPCODE|IP=" . $currentClientIP . "|MO_ID" . $moId);
|
||||
endif;
|
||||
?>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset="ISO-8859-1">
|
||||
|
||||
<title><?php echo $pageTitel ?></title>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
|
||||
.mcTable { border:0px; width:650px; background:#CDD9FD; }
|
||||
|
||||
.mcTable2 { border:0px; width:610px; background:#CDD9FD; }
|
||||
|
||||
.spacer05 { height:5px; background:#CDD9FD;}
|
||||
.spacer15 { height:15px; background:#CDD9FD;}
|
||||
.spacer25 { height:25px; background:#CDD9FD;}
|
||||
|
||||
.f10np1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: normal; padding: 1px; color: #000000;}
|
||||
.f10bp1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold; padding: 1px; color: #000000;}
|
||||
.f10np1_green { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: normal; padding: 1px; color: #00BB00;}
|
||||
.f10np1_red { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: normal; padding: 1px; color: #FF0000;}
|
||||
.f10np1_blue { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: normal; padding: 1px; color: #1b12b9;}
|
||||
.f12np1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; font-weight: normal; padding: 1px; color: #000000;}
|
||||
.f12bp1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; font-weight: bold; padding: 1px; color: #000000;}
|
||||
.f12np1_blue { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; font-weight: normal; padding: 1px; color: #1b12b9;}
|
||||
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
|
||||
function finishTrackingPage() {
|
||||
document.forms[0].submit();
|
||||
}
|
||||
|
||||
function selectLanguage(lng) {
|
||||
document.forms[0].selectedLanguage.value = lng;
|
||||
finishTrackingPage();
|
||||
}
|
||||
|
||||
-->
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<form action="tracking.php" method="post">
|
||||
|
||||
<input type="hidden" name="f_act" value="">
|
||||
<input type="hidden" name="trackingID" value="<?php echo $trackingID ?>">
|
||||
<input type="hidden" name="selectedLanguage" value="<?php echo ec($selectedLanguage) ?>">
|
||||
|
||||
<center>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:650px;" align="center">
|
||||
<img src="../images/external/trck_header.jpg" border="0" height="167" width="640">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer05"></td></tr></table>
|
||||
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:305px;" align="left">
|
||||
<span class="f10np1"><a href="javascript:selectLanguage('0');"><?php echo getLngt("[Deutsch]") ?></a></span>
|
||||
<span class="f10np1"><a href="javascript:selectLanguage('1');"><?php echo getLngt("[English]") ?></a></span>
|
||||
</td>
|
||||
<td style="width:305px;" align="right">
|
||||
<!-- <span class="f10np1"><a href="javascript:finishTrackingPage();"><?php echo getLngt("[Anfrage senden]") ?></a></span> -->
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:610px;" align="left">
|
||||
<span class="f12np1_blue"><?php echo getLngt("Sendungsnummer") ?>:</span>
|
||||
<input class="f12np1" type="text" name="trackingID" value="<?php echo $trackingID ?>">
|
||||
<span class="f10np1"><a href="javascript:finishTrackingPage();"><?php echo getLngt("[Anfrage senden]") ?></a></span>
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
|
||||
<?php if ($csEndOut != "") : ?>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:610px;" align="left">
|
||||
<span class="f10np1_blue"><?php echo getLngt("Lieferadresse:") ?></span><br>
|
||||
<span class="f10np1"><?php echo $csEndOut ?></span>
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($cmpOut != "") : ?>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:610px;" align="left">
|
||||
<span class="f10np1_blue"><?php echo getLngt("Lieferant:") ?></span><br>
|
||||
<span class="f10np1"><?php echo $cmpOut ?></span>
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($tratpOut == "" && $trOut == "") : ?>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:610px;" align="center">
|
||||
<span class="f10np1_red"><?php echo $out ?></span>
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($tratpOut != "") : ?>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:610px;" align="center">
|
||||
<table class="mcTable2">
|
||||
<tr>
|
||||
<td width="50%" align="left">
|
||||
<span class="f10bp1"><?php echo getLngt("Ereignis") ?></span>
|
||||
</td>
|
||||
<td width="20%" align="left">
|
||||
<span class="f10bp1"><?php echo getLngt("Status") ?></span>
|
||||
</td>
|
||||
<td width="30%" align="left">
|
||||
<span class="f10bp1"><?php echo getLngt("Zeitpunkt") ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="spacer05" colspan="3"></td></tr>
|
||||
<?php echo $tratpOut ?>
|
||||
</table>
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($trOut != "") : ?>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:610px;" align="center">
|
||||
<table class="mcTable2">
|
||||
<tr>
|
||||
<td width="50%" align="left">
|
||||
<span class="f10bp1"><?php echo getLngt("Auslieferungsstationen") ?></span>
|
||||
</td>
|
||||
<td width="20%" align="left">
|
||||
<span class="f10bp1"><?php echo getLngt("Status") ?></span>
|
||||
</td>
|
||||
<td width="30%" align="left">
|
||||
<span class="f10bp1"><?php echo getLngt("Zeitpunkt") ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class=\"spacer05\"></td></tr>
|
||||
<?php echo $trOut ?>
|
||||
</table>
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer15"></td></tr></table>
|
||||
<?php endif; ?>
|
||||
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:650px;" align="center">
|
||||
<img src="../images/external/assecutor.png" border="0" height="51" width="640">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
680
html/tracking/tracking_ADSG.php
Normal file
680
html/tracking/tracking_ADSG.php
Normal file
@@ -0,0 +1,680 @@
|
||||
<?php
|
||||
/*=======================================================================
|
||||
*
|
||||
* tracking_ADSG.php
|
||||
*
|
||||
* Autor: Marc Vollmann
|
||||
*
|
||||
=======================================================================*/
|
||||
|
||||
|
||||
include_once ("../include/mcglobal.inc.php");
|
||||
include_once ("../include/inc_job.inc.php");
|
||||
include_once ("../include/inc_tracking.inc.php");
|
||||
include_once ("../locating/xServer.inc.php");
|
||||
|
||||
// Check HTTP-Parameters
|
||||
getSecHttpVars("1",array("f_act", "trackingID", "selectedLanguage"));
|
||||
|
||||
|
||||
$trackingID = trim($trackingID);
|
||||
|
||||
// Write logdata into log file
|
||||
if ($trackingID != "") :
|
||||
$currentTime = getDateTime("0");
|
||||
writeToFile("../log/tracking.log", $currentTime . " : " . $trackingID);
|
||||
endif;
|
||||
|
||||
if ($selectedLanguage == "" || !is_numeric($selectedLanguage)) : $selectedLanguage = $languageSelected; endif;
|
||||
$languageSelected = $selectedLanguage;
|
||||
|
||||
getLanguage(__FILE__);
|
||||
getCurrentScript(__FILE__);
|
||||
|
||||
$debug = false;
|
||||
|
||||
$pageTitel = getLngt("Sendungsverfolgung");
|
||||
|
||||
// Init header image
|
||||
$imgLogoFile = "assecutor.png";
|
||||
$imgLogoHeight = "233";
|
||||
$imgLogoWidth = "543";
|
||||
$imgCssBackground = "#CDD9FD";
|
||||
|
||||
$trOut = "";
|
||||
$csEndOut = "";
|
||||
$cmpOut = "";
|
||||
$cmp2Out = "";
|
||||
$historyOut = "";
|
||||
|
||||
$out = getLngt("Ihre Sendung konnte unter der angegebenen Nummer nicht aufgefunden werden.") . "<br>" . 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 "<br><br>";
|
||||
echo "objType = " . $objType . "<br>";
|
||||
echo "atLeastOneTourArticleDoesExist = " . ($atLeastOneTourArticleDoesExist ? "Yes" : "No") . "<br>";
|
||||
echo "languageSelected = " . $languageSelected . "<br>";
|
||||
echo "languageDBUpdateMode = " . $languageDBUpdateMode . "<br>";
|
||||
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 . "<br>";
|
||||
echo "imgLogoHeight = " . $imgLogoHeight . "<br>";
|
||||
echo "imgLogoWidth = " . $imgLogoWidth . "<br>";
|
||||
echo "imgCssBackground = " . $imgCssBackground . "<br>";
|
||||
endif;
|
||||
|
||||
|
||||
// HEADER
|
||||
if ($objType == "tracking_jb" || $objType == "track_jb") :
|
||||
|
||||
$mapViewLink = "[<a href=\"../locating/map.php?jb_id=" . $trackingArray[0]["jb_id"] . "&tracking=" . $trackingID . "\" target=\"_blank\">" . getLngt("Karte") . "</a>]";
|
||||
|
||||
$historyOut .= "<tr>\n";
|
||||
$historyOut .= " <td align=\"center\" colspan=\"5\">\n";
|
||||
$historyOut .= " <span class=\"f12bp1_darkgreen\">" . getLngt("Auftrag") . ": " . $trackingArray[0]["jb_id"] . "</span>" . " " . $mapViewLink . "\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer25\"></td></tr>\n";
|
||||
|
||||
$historyOut .= "<tr>\n";
|
||||
$historyOut .= " <td width=\"50%\" align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"f10bp1\">" . getLngt("Station") . "</span><br>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td width=\"20%\" align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"f10bp1\">" . getLngt("Status") . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td width=\"30%\" align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"f10bp1\">" . getLngt("Erledigungszeit") . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer05\"></td></tr>\n";
|
||||
|
||||
/*
|
||||
$historyOut .= "<tr>\n";
|
||||
$historyOut .= " <td align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"f10bp1\">" . getLngt("Station") . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
// $historyOut .= " <td align=\"center\">\n";
|
||||
// $historyOut .= " <span class=\"f10bp1\">" . getLngt("Artikel") . "</span>\n";
|
||||
// $historyOut .= " </td>\n";
|
||||
$historyOut .= " <td align=\"center\">\n";
|
||||
$historyOut .= " <span class=\"f10bp1\">" . getLngt("Erledigungszeit") . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
// $historyOut .= " <td align=\"center\">\n";
|
||||
// $historyOut .= " <span class=\"f10bp1\">" . getLngt("Ereignis") . "</span>\n";
|
||||
// $historyOut .= " </td>\n";
|
||||
// $historyOut .= " <td align=\"left\">\n";
|
||||
// $historyOut .= " <span class=\"f10bp1\">" . getLngt("Bemerkung") . "</span>\n";
|
||||
// $historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer05\"></td></tr>\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 . "<br><br>";
|
||||
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") . "<br><br>";
|
||||
$etaOut .= "<span class=\"f12bp1_blue\">" . $etaTimeLowerRange . " " . getLngt("Uhr") . " " . getLngt("und") . " " . $etaTimeUpperRange . " " . getLngt("Uhr") . "</span><br><br>";
|
||||
$etaOut .= getLngt("bei") . " " . $trComp . " " . "<br><br>";
|
||||
$etaOut .= "<b>" . $currAddress . " </b><br><br>";
|
||||
$etaOut .= getLngt("eintreffen") . "." . "<br><br>";
|
||||
else :
|
||||
|
||||
$etaOut .= getLngt("Ihre Sendung von") . " " . $jbCmpCompPayer . " " . getLngt("wird voraussichtlich um ca.") . "<br><br>";
|
||||
$etaOut .= "<span class=\"f12bp1_blue\">" . $etaTime . " " . getLngt("Uhr") . "</span><br><br>";
|
||||
$etaOut .= getLngt("bei") . " " . $trComp . " " . "<br><br>";
|
||||
$etaOut .= "<b>" . $currAddress . " </b><br><br>";
|
||||
$etaOut .= getLngt("eintreffen") . "." . "<br><br>";
|
||||
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 . "<br><br>";
|
||||
$etaOut .= getLngt("an") . " " . $trComp . " " . "<br><br>";
|
||||
$etaOut .= "<b>" . $currAddress . " </b><br><br><br><br>";
|
||||
$etaOut .= getLngt("Dieser Service steht aus technischen Gründen") . "<br><br>";
|
||||
$etaOut .= getLngt("momentan leider nicht zur Verfügung") . "." . "<br><br>";
|
||||
$etaOut .= getLngt("Bitte probieren sie es etwas später noch einmal") . "<br><br>";
|
||||
$etaOut .= getLngt("oder wenden sie sich telefonisch an") . ":" . "<br><br><br>";
|
||||
$etaOut .= "<span class=\"f12bp1_blue\">" . $hqUsrPhone . "</span><br><br>";
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
$classTrStatus = "f12bp1_red";
|
||||
if ($trackingArray[0]["tr_status"] == "1") :
|
||||
$classTrStatus = "f12bp1_darkgreen";
|
||||
endif;
|
||||
|
||||
/*
|
||||
$historyOut .= "<tr>\n";
|
||||
$historyOut .= " <td align=\"center\" colspan=\"4\">\n";
|
||||
// $historyOut .= " <span class=\"" . $classTrStatus . "\">" . $currAddress . "</span>\n";
|
||||
$historyOut .= " <span class=\"f12bp1_darkgreen\">" . $currAddress . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer25\"></td></tr>\n";
|
||||
*/
|
||||
$historyOut .= "<tr><td class=\"spacer25\"></td></tr>\n";
|
||||
|
||||
|
||||
if ($etaOut != "") :
|
||||
$historyOut .= "<tr>\n";
|
||||
$historyOut .= " <td align=\"center\" colspan=\"4\">\n";
|
||||
// $historyOut .= " <span class=\"" . $classTrStatus . "\">" . $etaOut . "</span>\n";
|
||||
$historyOut .= " <span class=\"f10np1_blue\">" . $etaOut . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer25\"></td></tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer25\"></td></tr>\n";
|
||||
endif;
|
||||
|
||||
if ($atLeastOneTourArticleDoesExist) :
|
||||
$historyOut .= "<tr>\n";
|
||||
$historyOut .= " <td align=\"center\">\n";
|
||||
$historyOut .= " <span class=\"f10bp1\">" . getLngt("Artikel") . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td align=\"center\">\n";
|
||||
$historyOut .= " <span class=\"f10bp1\">" . getLngt("Ereigniszeit") . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td align=\"center\">\n";
|
||||
$historyOut .= " <span class=\"f10bp1\">" . getLngt("Ereignis") . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"f10bp1\">" . getLngt("Bemerkung") . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer05\"></td></tr>\n";
|
||||
endif;
|
||||
|
||||
elseif ($objType == "tracking_trat" || $objType == "track_trat") :
|
||||
|
||||
if ($trackingArray[0]["trat_serialno"] != "") :
|
||||
$historyOut .= "<tr>\n";
|
||||
$historyOut .= " <td align=\"center\" colspan=\"3\">\n";
|
||||
$historyOut .= " <span class=\"f12bp1_darkgreen\">" . "Sendung" . ": " . $trackingArray[0]["trat_serialno"] . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer25\"></td></tr>\n";
|
||||
endif;
|
||||
|
||||
$historyOut .= "<tr>\n";
|
||||
$historyOut .= " <td align=\"center\">\n";
|
||||
$historyOut .= " <span class=\"f10bp1\">" . getLngt("Ereigniszeit") . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td align=\"center\">\n";
|
||||
$historyOut .= " <span class=\"f10bp1\">" . getLngt("Ereignis") . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"f10bp1\">" . getLngt("Bemerkung") . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer05\"></td></tr>\n";
|
||||
endif;
|
||||
|
||||
|
||||
// BODY
|
||||
$remAddress = "";
|
||||
$remTratSerialno = "";
|
||||
for ($i = 0; $i < $trackingArrayLen; $i++) :
|
||||
|
||||
$currAddress = $trackingArray[$i]["ad_street"] . " " . $trackingArray[$i]["tr_hsno"] . "<br>" . $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 .= "<tr>\n";
|
||||
$historyOut .= " <td width=\"50%\" align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"f10np1\">" . ($i + 1) . ". " . getLngt("Station") . "<br>\n";
|
||||
$historyOut .= $currAddress;
|
||||
$historyOut .= " </span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td width=\"20%\" align=\"left\">\n";
|
||||
if ($trackingArray[$i]["tr_status"] == "1") :
|
||||
$historyOut .= " <span class=\"f10np1_green\">" . getLngt("erledigt") . "</span>\n";
|
||||
else :
|
||||
$historyOut .= " <span class=\"f10np1_red\">" . getLngt("offen") . "</span>\n";
|
||||
endif;
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td width=\"30%\" align=\"left\">\n";
|
||||
if ($trackingArray[$i]["tr_status"] == "1") :
|
||||
$historyOut .= " <span class=\"f10np1\">" . formatOutput($trackingArray[$i]["tr_finishtime"],$outputFormatField["tr_finishtime"]) . "</span>\n";
|
||||
endif;
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer05\"></td></tr>\n";
|
||||
/*
|
||||
if (false && $trackingArray[$i]["trat_serialno"] != "") :
|
||||
$historyOut .= "<tr>\n";
|
||||
$historyOut .= " <td align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"" . $classTrStatus . "\">" . $currAddress . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
// $historyOut .= " <td align=\"center\">\n";
|
||||
// $historyOut .= " <span class=\"f10np1\">" . $currTratSerialno . "</span>\n";
|
||||
// $historyOut .= " </td>\n";
|
||||
$historyOut .= " <td align=\"center\">\n";
|
||||
$historyOut .= " <span class=\"f10np1\">" . formatOutput($trackingArray[$i]["tr_finishtime"],$outputFormatField["tr_finishtime"]) . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
// $historyOut .= " <td align=\"center\">\n";
|
||||
// $historyOut .= " <span class=\"f10np1\">" . $trackingArray[$i]["mt_value"] . "</span>\n";
|
||||
// $historyOut .= " </td>\n";
|
||||
// $historyOut .= " <td align=\"left\">\n";
|
||||
// $historyOut .= " <span class=\"f10np1\">" . $trackingArray[$i]["tratp_remark"] . "</span>\n";
|
||||
// $historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer05\"></td></tr>\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 .= "<tr>\n";
|
||||
$historyOut .= " <td align=\"center\">\n";
|
||||
$historyOut .= " <span class=\"f10np1\">" . $currTratSerialno . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td align=\"center\">\n";
|
||||
$historyOut .= " <span class=\"f10np1\">" . formatOutput($trackingArray[$i]["tratp_createtime"],$outputFormatField["tratp_createtime"]) . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td align=\"center\">\n";
|
||||
$historyOut .= " <span class=\"f10np1\">" . $trackingArray[$i]["mt_value"] . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"f10np1\">" . $trackingArray[$i]["tratp_remark"] . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer05\"></td></tr>\n";
|
||||
endif;
|
||||
endif;
|
||||
|
||||
elseif ($objType == "tracking_trat" || $objType == "track_trat") :
|
||||
|
||||
$historyOut .= "<tr>\n";
|
||||
$historyOut .= " <td align=\"center\">\n";
|
||||
$historyOut .= " <span class=\"f10np1\">" . formatOutput($trackingArray[$i]["tratp_createtime"],$outputFormatField["tratp_createtime"]) . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td align=\"center\">\n";
|
||||
$historyOut .= " <span class=\"f10np1\">" . $trackingArray[$i]["tratp_state"] . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"f10np1\">" . $trackingArray[$i]["tratp_remark"] . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer05\"></td></tr>\n";
|
||||
endif;
|
||||
|
||||
/*
|
||||
$historyOut .= "<tr>\n";
|
||||
$historyOut .= " <td width=\"30%\" align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"f10np1\">" . formatOutput($trackingArray[$i]["tratp_createtime"],$outputFormatField["tratp_createtime"]) . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td width=\"50%\" align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"f10np1\">" . $trackingArray[$i]["mt_value"] . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= " <td width=\"20%\" align=\"left\">\n";
|
||||
$historyOut .= " <span class=\"f10np1\">" . $trackingArray[$i]["tratp_state"] . "</span>\n";
|
||||
$historyOut .= " </td>\n";
|
||||
$historyOut .= "</tr>\n";
|
||||
$historyOut .= "<tr><td class=\"spacer05\"></td></tr>\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"] . "<br>\n";
|
||||
|
||||
$cmpOut .= "<tr>\n";
|
||||
$cmpOut .= " <td align=\"left\">\n";
|
||||
$cmpOut .= " <span class=\"f12bp1\">" . $row["cmp_comp"] . "<br>" . $row["cmp_comp2"] . "</span>\n";
|
||||
$cmpOut .= " </td>\n";
|
||||
$cmpOut .= "</tr>\n";
|
||||
$cmpOut .= "<tr><td class=\"spacer15\"></td></tr>\n";
|
||||
|
||||
$row["hq_name"] $row["cmp2_logo"] $row["cmp2_logo_width"] $row["cmp2_logo_height"]
|
||||
|
||||
$cmp2Out .= "<tr>\n";
|
||||
$cmp2Out .= " <td align=\"center\">\n";
|
||||
$cmp2Out .= " <span class=\"f12bp1\">" . $row["cmp2_comp"] . "<br>" . $row["cmp2_comp2"] . "</span>\n";
|
||||
$cmp2Out .= " </td>\n";
|
||||
$cmp2Out .= "</tr>\n";
|
||||
$cmp2Out .= "<tr><td class=\"spacer15\"></td></tr>\n";
|
||||
endwhile;
|
||||
$result->free();
|
||||
*/
|
||||
|
||||
endif;
|
||||
endif;
|
||||
?>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset="ISO-8859-1">
|
||||
<meta http-equiv="expires" content="0">
|
||||
|
||||
<title><?php echo $pageTitel ?></title>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
<?php if (true) : ?>
|
||||
.mcTable { border:0px; width:650px; background:<?php echo $imgCssBackground ?>; }
|
||||
.mcTable2 { border:0px; width:610px; background:<?php echo $imgCssBackground ?>; }
|
||||
<?php endif; ?>
|
||||
|
||||
.spacer05 { height:5px; background:<?php echo $imgCssBackground ?>;}
|
||||
.spacer15 { height:15px; background:<?php echo $imgCssBackground ?>;}
|
||||
.spacer25 { height:25px; background:<?php echo $imgCssBackground ?>;}
|
||||
.spacer50 { height:50px; background:<?php echo $imgCssBackground ?>;}
|
||||
|
||||
.f10np1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: normal; padding: 1px; color: #000000;}
|
||||
.f10bp1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold; padding: 1px; color: #000000;}
|
||||
.f10np1_green { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: normal; padding: 1px; color: #00BB00;}
|
||||
.f10np1_darkgreen { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: normal; padding: 1px; color: #008800;}
|
||||
.f10np1_red { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: normal; padding: 1px; color: #FF0000;}
|
||||
.f10np1_blue { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: normal; padding: 1px; color: #1b12b9;}
|
||||
.f12np1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; font-weight: normal; padding: 1px; color: #000000;}
|
||||
.f12bp1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; font-weight: bold; padding: 1px; color: #000000;}
|
||||
.f12bp1_red { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; font-weight: bold; padding: 1px; color: #FF0000;}
|
||||
.f12bp1_darkgreen { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; font-weight: bold; padding: 1px; color: #008800;}
|
||||
.f12np1_blue { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; font-weight: normal; padding: 1px; color: #1b12b9;}
|
||||
.f12bp1_blue { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12pt; font-weight: bold; padding: 1px; color: #1b12b9;}
|
||||
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
|
||||
function finishTrackingPage() {
|
||||
document.forms[0].submit();
|
||||
}
|
||||
|
||||
function selectLanguage(lng) {
|
||||
document.forms[0].selectedLanguage.value = lng;
|
||||
finishTrackingPage();
|
||||
}
|
||||
|
||||
-->
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<form action="tracking_ADSG.php" method="post">
|
||||
|
||||
<input type="hidden" name="f_act" value="">
|
||||
<input type="hidden" name="trackingID" value="<?php echo $trackingID ?>">
|
||||
<input type="hidden" name="selectedLanguage" value="<?php echo ec($selectedLanguage) ?>">
|
||||
|
||||
<center>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:650px;" align="center">
|
||||
<br><img src="../images/external/<?php echo $imgLogoFile; ?>" border="0" height="<?php echo $imgLogoHeight; ?>" width="<?php echo $imgLogoWidth; ?>">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer05"></td></tr></table>
|
||||
<?php if (false) : ?>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:305px;" align="left">
|
||||
<span class="f10np1"><a href="javascript:selectLanguage('0');"><?php echo getLngt("[Deutsch]") ?></a></span>
|
||||
<span class="f10np1"><a href="javascript:selectLanguage('1');"><?php echo getLngt("[English]") ?></a></span>
|
||||
</td>
|
||||
<td style="width:305px;" align="right">
|
||||
<!-- <span class="f10np1"><a href="javascript:finishTrackingPage();"><?php echo getLngt("[Anfrage senden]") ?></a></span> -->
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:610px;" align="left">
|
||||
<span class="f12np1_blue"><?php echo getLngt("Sendungsnummer") ?>:</span>
|
||||
<input type="text" name="trackingID" value="<?php echo $trackingID ?>" size="35">
|
||||
<span class="f10np1"><a href="javascript:finishTrackingPage();"><?php echo getLngt("[Anfrage senden]") ?></a></span>
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
<?php endif; ?>
|
||||
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
|
||||
<?php if ($csEndOut != "") : ?>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:610px;" align="left">
|
||||
<span class="f10np1_blue"><?php echo getLngt("Lieferadresse:") ?></span><br>
|
||||
<span class="f10np1"><?php echo $csEndOut ?></span>
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($cmpOut != "") : ?>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:610px;" align="left">
|
||||
<span class="f10np1_blue"><?php echo getLngt("Lieferant:") ?></span><br>
|
||||
<span class="f10np1"><?php echo $cmpOut ?></span>
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($historyOut == "" && $trOut == "") : ?>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:610px;" align="center">
|
||||
<span class="f10np1_red"><?php echo $out ?></span>
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($historyOut != "") : ?>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:610px;" align="center">
|
||||
<table class="mcTable2">
|
||||
|
||||
<?php echo $historyOut ?>
|
||||
</table>
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer25"></td></tr></table>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($trOut != "") : ?>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
<td style="width:610px;" align="center">
|
||||
<table class="mcTable2">
|
||||
<tr>
|
||||
<td width="50%" align="left">
|
||||
<span class="f10bp1"><?php echo getLngt("Auslieferungsstationen") ?></span>
|
||||
</td>
|
||||
<td width="20%" align="left">
|
||||
<span class="f10bp1"><?php echo getLngt("Status") ?></span>
|
||||
</td>
|
||||
<td width="30%" align="left">
|
||||
<span class="f10bp1"><?php echo getLngt("Zeitpunkt") ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class=\"spacer05\"></td></tr>
|
||||
<?php echo $trOut ?>
|
||||
</table>
|
||||
</td>
|
||||
<td style="width:20px;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer15"></td></tr></table>
|
||||
<?php endif; ?>
|
||||
<?php if (true) : ?>
|
||||
<table class="mcTable"><tr><td class="spacer50"></td></tr></table>
|
||||
<table class="mcTable"><tr><td class="spacer50"></td></tr></table>
|
||||
<table class="mcTable">
|
||||
<tr>
|
||||
<td style="width:650px;" align="center">
|
||||
<img src="../images/external/adsg_footer_transparent.png" border="0" height="70" width="210">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="mcTable"><tr><td class="spacer15"></td></tr></table>
|
||||
<?php endif; ?>
|
||||
</center>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
518
html/tracking/tracking_amazon.php
Normal file
518
html/tracking/tracking_amazon.php
Normal file
@@ -0,0 +1,518 @@
|
||||
<?php
|
||||
/*=======================================================================
|
||||
*
|
||||
* tracking_amazon.php
|
||||
*
|
||||
* Autor: Marc Vollmann
|
||||
*
|
||||
=======================================================================*/
|
||||
|
||||
|
||||
include_once ("../include/mcglobal.inc.php");
|
||||
|
||||
|
||||
// Write logdata into log file
|
||||
$currentTime = getDateTime("0");
|
||||
|
||||
$trackingReq = file_get_contents('php://input');
|
||||
|
||||
// writeToFile("../log/trckng_amzn.log", "POST RAW - " . $currentTime);
|
||||
writeToFile("../log/trckng_amzn.log", $currentTime);
|
||||
writeToFile("../log/trckng_amzn.log", $trackingReq);
|
||||
writeToFile("../log/trckng_amzn.log", "___________________________________________________________________________________");
|
||||
// writeToFile("../log/trckng_amzn.log", "__________");
|
||||
/*
|
||||
writeToFile("../log/trckng_amzn.log", "POST RAW - " . $currentTime);
|
||||
writeToFile("../log/trckng_amzn.log", $HTTP_RAW_POST_DATA);
|
||||
writeToFile("../log/trckng_amzn.log", "__________");
|
||||
|
||||
writeToFile("../log/trckng_amzn.log", "POST - " . $currentTime);
|
||||
writeToFile("../log/trckng_amzn.log", print_r ($_POST,true));
|
||||
writeToFile("../log/trckng_amzn.log", "__________");
|
||||
|
||||
writeToFile("../log/trckng_amzn.log", "GET - " . $currentTime);
|
||||
writeToFile("../log/trckng_amzn.log", print_r ($_GET,true));
|
||||
writeToFile("../log/trckng_amzn.log", "__________");
|
||||
|
||||
writeToFile("../log/trckng_amzn.log", "COOKIE - " . $currentTime);
|
||||
writeToFile("../log/trckng_amzn.log", print_r ($_COOKIE,true));
|
||||
writeToFile("../log/trckng_amzn.log", "__________");
|
||||
|
||||
writeToFile("../log/trckng_amzn.log", "SERVER - " . $currentTime);
|
||||
writeToFile("../log/trckng_amzn.log", print_r ($_SERVER,true));
|
||||
writeToFile("../log/trckng_amzn.log", "__________");
|
||||
|
||||
writeToFile("../log/trckng_amzn.log", "ENV - " . $currentTime);
|
||||
writeToFile("../log/trckng_amzn.log", print_r ($_ENV,true));
|
||||
writeToFile("../log/trckng_amzn.log", "__________");
|
||||
|
||||
writeToFile("../log/trckng_amzn.log", "FILES - " . $currentTime);
|
||||
writeToFile("../log/trckng_amzn.log", print_r ($_FILES,true));
|
||||
writeToFile("../log/trckng_amzn.log", "___________________________________________________________________________________");
|
||||
*/
|
||||
|
||||
// Check HTTP-Parameters
|
||||
// getSecHttpVars("1",array("f_act", "trackingReq", "selectedLanguage"));
|
||||
// $trackingReq = urldecode($trackingReq);
|
||||
|
||||
if ($selectedLanguage == "" || !is_numeric($selectedLanguage)) : $selectedLanguage = "1"; endif; // Default in English
|
||||
$languageSelected = $selectedLanguage;
|
||||
|
||||
getLanguage(__FILE__);
|
||||
getCurrentScript(__FILE__);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Event messages
|
||||
$eventMsgArray["EVENT_101"] = "Shipment has left seller facility and is in transit"; // Electronic Manifest transmitted by Amazon to the carrier and the carrier’s truck has departed the Amazon/seller facility
|
||||
$eventMsgArray["EVENT_102"] = "Shipment received by carrier"; // Origin scan which confirms possession by the carrier
|
||||
|
||||
$eventMsgArray["EVENT_201"] = "Arrival Scan"; // Arrived at any of the carrier facilities
|
||||
$eventMsgArray["EVENT_202"] = "Departure Scan"; // Departed any of the carrier facilities
|
||||
$eventMsgArray["EVENT_203"] = "Arrived at destination country"; // Arrived at the destination country
|
||||
$eventMsgArray["EVENT_204"] = "Initiated customs clearance process"; // Customs has started to clear the package
|
||||
$eventMsgArray["EVENT_205"] = "Completed customs clearance process"; // Customs has cleared the package
|
||||
$eventMsgArray["EVENT_206"] = "In transit to pickup location"; // Package is in transit to pickup location
|
||||
$eventMsgArray["EVENT_207"] = "Problem resolved and shipment is in transit"; // Resolution of exception scan and package is in transit again
|
||||
$eventMsgArray["EVENT_208"] = "Your selected store is closed for delivery and your shipment has been rerouted to a nearby store. The carrier will provide more information about the new store"; // Customer pick-up location is closed and the package was rerouted to a nearby pick-up location
|
||||
|
||||
$eventMsgArray["EVENT_300"] = "NOT DISPLAYED"; // Tendered to alternate carrier, line haul complete
|
||||
$eventMsgArray["EVENT_301"] = "Delivered"; // Delivered to the customer directly
|
||||
$eventMsgArray["EVENT_302"] = "Out for delivery"; // On the last leg of delivery to the customer
|
||||
$eventMsgArray["EVENT_304"] = "Delivery attempted"; // Carrier attempted delivery, but unable to deliver to customer
|
||||
$eventMsgArray["EVENT_306"] = "Customer contacted to arrange delivery"; // Carrier has contacted the customer to arrange delivery of the package
|
||||
$eventMsgArray["EVENT_307"] = "Delivery appointment scheduled"; // Carrier has scheduled delivery of the package with the customer
|
||||
$eventMsgArray["EVENT_308"] = "Available for pickup"; // Package is available for pickup from pickup location
|
||||
$eventMsgArray["EVENT_309"] = "Returned to seller"; // Package was delivered back to seller’s facility
|
||||
$eventMsgArray["EVENT_310"] = "Tendered to local postal carrier for final delivery"; // Local postal carrier will perform final delivery to the customer. If assigned a new tracking id, carrier name and tracking id should be provided.
|
||||
$eventMsgArray["EVENT_311"] = "Tendered to local postal carrier for final delivery and no proof of delivery will be provided"; // Local postal carrier will perform final delivery to the customer but they will not scan the package as delivered (international use).
|
||||
$eventMsgArray["EVENT_320"] = "Customer has picked up";
|
||||
$eventMsgArray["EVENT_328"] = "Shipment addressed to a company that is closed on weekends. Shipment will be deliverd on the next working day"; // Business closed. The goods/consignements/equipment could not be delivered/collected as the business was closed
|
||||
|
||||
$eventMsgArray["EVENT_401"] = "Incorrect address"; // Destination address does not exist or is incorrect
|
||||
$eventMsgArray["EVENT_402"] = "Customs clearance delay"; // Any situation which causes a delay clearing customs
|
||||
$eventMsgArray["EVENT_403"] = "Customer moved"; // Consignee no longer lives at the delivery address and left no forwarding address
|
||||
$eventMsgArray["EVENT_404"] = "Delay in delivery due to external factors"; // This represents a definite delay in delivery and will trigger correspondences to the customer to notify them of the delay
|
||||
$eventMsgArray["EVENT_405"] = "Shipment damaged"; // Carrier damaged the package
|
||||
$eventMsgArray["EVENT_406"] = "Held by carrier"; // The package is being held by the carrier
|
||||
$eventMsgArray["EVENT_407"] = "Customer refused delivery"; // Consignee refused to accept package
|
||||
$eventMsgArray["EVENT_408"] = "Returning to seller"; // Amazon has requested the package be returned to Amazon’s facility
|
||||
$eventMsgArray["EVENT_409"] = "Lost by carrier"; // Carrier lost the package
|
||||
$eventMsgArray["EVENT_411"] = "Paperwork received - did not receive shipment"; // Carrier received electronic or paper manifest, but the shipment has not been picked up
|
||||
$eventMsgArray["EVENT_412"] = "Received shipment - did not receive paperwork"; // Carrier received the package, but not the electronic/paper manifest. This is sent only when the shipment cannot move until the problem is resolved
|
||||
$eventMsgArray["EVENT_413"] = "Customer refused shipment due to customs charges"; // Customer has refused shipment due to customs duties, taxes and fees charges.
|
||||
$eventMsgArray["EVENT_414"] = "Possible delay in delivery due to arrival at incorrect carrier facility"; // Package was mis-sorted and delivery maybe delayed
|
||||
$eventMsgArray["EVENT_415"] = "Received from prior carrier"; // Carrier has received the package from the previous carrier
|
||||
$eventMsgArray["EVENT_416"] = "Undeliverable"; // Package could not be delivered, and Amazon has instructed the carrier to destroy the package or follow alternate instructions
|
||||
$eventMsgArray["EVENT_418"] = "Returning to seller due to incorrect address"; // Unable to complete delivery due to incorrect address and the shipment is being returned to the seller
|
||||
$eventMsgArray["EVENT_419"] = "Returning to seller because customer refused delivery"; // Customer refused delivery and the shipment is being returned to the seller
|
||||
$eventMsgArray["EVENT_420"] = "Delay in delivery due to weather or natural disaster"; // Shipment delivery is delayed because of weather or natural disaster
|
||||
$eventMsgArray["EVENT_421"] = "Unable to forward shipment to different address"; // Forwarding attempt failed
|
||||
$eventMsgArray["EVENT_422"] = "Shipment forwarded to a different delivery address"; // Carrier has forwarded the package to an address
|
||||
$eventMsgArray["EVENT_423"] = "Shipment damaged and will not be delivered"; // Carrier has identified the package as damaged, will not complete the delivery, and will dispose of the package
|
||||
$eventMsgArray["EVENT_424"] = "Held for payment"; // Delivery of the package cannot be completed until payment is received by Carrier
|
||||
$eventMsgArray["EVENT_425"] = "Possible delay in delivery due to extra carrier processing"; // There is possible delay in delivery because the carrier had to perform extra processing outside of the norm
|
||||
$eventMsgArray["EVENT_426"] = "Confiscated or seized by an official government authority"; // The package will not be delivered nor returned due to being seized by an official government authority
|
||||
$eventMsgArray["EVENT_427"] = "Held by carrier – seller input required"; // The package is being held by the carrier because they require additional information from Amazon
|
||||
$eventMsgArray["EVENT_428"] = "Address issue corrected by carrier but delivery could be delayed."; // The carrier was able to correct the customer’s address without any input from customer or Amazon
|
||||
$eventMsgArray["EVENT_451"] = "Returning to seller because customer did not pick up on time";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Error messages
|
||||
$errMsgArray["ERROR_101"] = "INVALID TRACKING NUMBER"; // Request contains an invalid tracking number
|
||||
$errMsgArray["ERROR_102"] = "NO TRACKING INFO FOUND"; // No data exists in the carrier’s system for the given tracking number
|
||||
|
||||
$errMsgArray["ERROR_201"] = "INVALID USERID/PASSWORD"; // Request contains an invalid user ID or password
|
||||
$errMsgArray["ERROR_202"] = "INVALID API VERSION"; // Request contains an incompatible API version
|
||||
$errMsgArray["ERROR_203"] = "XML DOCUMENT NOT WELL FORMED"; // Request is not a well-formed XML document
|
||||
$errMsgArray["ERROR_204"] = "XML DOCUMENT NOT VALID"; // Request is not a valid XML document
|
||||
|
||||
$errMsgArray["ERROR_301"] = "TRACKING SERVICE NOT AVAILABLE"; // Generic error code to handle any situation where Amazon
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Delivery location codes
|
||||
$deliveryLocCodes["AS_INSTRUCTED"] = "As instructed"; // Package was delivered as per instructions
|
||||
$deliveryLocCodes["CARPORT"] = "Carport"; // Package was left inside a carport
|
||||
$deliveryLocCodes["CUSTOMER_PICKUP"] = "Picked up by customer"; // Package was picked up by customer
|
||||
$deliveryLocCodes["DECK"] = "Deck"; // Package was left on an outside deck
|
||||
$deliveryLocCodes["DOCK"] = "Shipping dock"; // Package was left on dock
|
||||
$deliveryLocCodes["FRONT_DESK"] = "Front desk"; // Package was left at front desk
|
||||
$deliveryLocCodes["FRONT_DOOR"] = "Front door"; // Package was left in or near the front door
|
||||
$deliveryLocCodes["GARAGE"] = "Garage"; // Package was left in or near the garage door
|
||||
$deliveryLocCodes["GUARD"] = "Guard"; // Package was handed to a security guard
|
||||
$deliveryLocCodes["MAILBOX"] = "Mailbox"; // Package was left inside the residence’s mailbox
|
||||
$deliveryLocCodes["MAIL_ROOM"] = "Mail room"; // Package was left in mail room
|
||||
$deliveryLocCodes["MAIL_SLOT"] = "Mail slot"; // Package was left in mail slot
|
||||
$deliveryLocCodes["MC_BOY"] = "Delivered to male child"; // Package was handed directly to a male child.
|
||||
$deliveryLocCodes["MC_GIRL"] = "Delivered to female child"; // Package was handed directly to a female child.
|
||||
$deliveryLocCodes["MC_MAN"] = "Delivered to male adult"; // Package was handed directly to a man
|
||||
$deliveryLocCodes["MC_WOMAN"] = "Delivered to female adult"; // Package was handed directly to a woman
|
||||
$deliveryLocCodes["NEIGHBOR"] = "Left with neighbor"; // Package was handed directly to a neighbor
|
||||
$deliveryLocCodes["OUTBUILDING"] = "Outbuilding"; // Package was left in an outbuilding
|
||||
$deliveryLocCodes["PATIO"] = "Patio"; // Package was left on an outside patio
|
||||
$deliveryLocCodes["PORCH"] = "Porch"; // Package was left on an outside porch
|
||||
$deliveryLocCodes["REAR_DOOR"] = "Rear door"; // Package was in or near the rear door
|
||||
$deliveryLocCodes["RECEIVER"] = "Resident"; // Package was handed to resident
|
||||
$deliveryLocCodes["RECEPTIONIST"] = "Receptionist"; // Package was handed to a receptionist
|
||||
$deliveryLocCodes["SECURE_LOCATION"] = "Secure location"; // Package was left in a secure location
|
||||
$deliveryLocCodes["SIDE_DOOR"] = "Side door"; // Package was left at side door
|
||||
|
||||
// Pickup location codes
|
||||
$pickupLocCodes["CARRIER_FACILITY"] = "Available for pickup at carrier facility"; // Package can be picked up from carrier’s hub
|
||||
$pickupLocCodes["CONVENIENCE_STORE"] = "Available for pickup at local convenience store"; // Package can be picked up at a local store
|
||||
$pickupLocCodes["LOCAL_POST_OFFICE"] = "Available for pickup at your local post office"; // Package can be picked up at local post office
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function getSingleTagContent ($strToParse, $tagBegin, $tagEnd) {
|
||||
$tagContent = "";
|
||||
$repeat = TRUE;
|
||||
while ($repeat && !(strpos($strToParse, $tagBegin) === FALSE) && !(strpos($strToParse, $tagEnd) === FALSE)) :
|
||||
|
||||
$pos0 = strpos($strToParse, $tagBegin); // begin of tagBegin (first occurrence)
|
||||
$pos1 = strpos($strToParse, $tagBegin) + strlen($tagBegin); // end of tagBegin (first occurrence)
|
||||
$pos2 = strpos($strToParse, $tagEnd); // begin of tagEnd (first occurrence)
|
||||
$pos3 = strpos($strToParse, $tagEnd) + strlen($tagEnd); // end of tagEnd (first occurrence)
|
||||
|
||||
$repeat = FALSE;
|
||||
if ($pos2 - $pos1 > 0) :
|
||||
// Get the content of the tag
|
||||
$tagContent = substr($strToParse, $pos1, $pos2 - $pos1);
|
||||
endif;
|
||||
endwhile;
|
||||
return $tagContent;
|
||||
};
|
||||
|
||||
function getTagContent ($strToParse, $tagBegin, $tagEnd) {
|
||||
$tagContentArray = array();
|
||||
$repeat = TRUE;
|
||||
while ($repeat && !(strpos($strToParse, $tagBegin) === FALSE) && !(strpos($strToParse, $tagEnd) === FALSE)) :
|
||||
$pos0 = strpos($strToParse, $tagBegin); // begin of tagBegin (first occurrence)
|
||||
$pos1 = strpos($strToParse, $tagBegin) + strlen($tagBegin); // end of tagBegin (first occurrence)
|
||||
$pos2 = strpos($strToParse, $tagEnd); // begin of tagEnd (first occurrence)
|
||||
$pos3 = strpos($strToParse, $tagEnd) + strlen($tagEnd); // end of tagEnd (first occurrence)
|
||||
if ($pos2 - $pos1 > 0) :
|
||||
// Get the content of the tag
|
||||
$tmpContent = substr($strToParse, $pos1, $pos2 - $pos1);
|
||||
$tagContentArray[] = $tmpContent;
|
||||
$strToParse = str_replace($tagBegin . $tmpContent . $tagEnd, "", $strToParse);
|
||||
endif;
|
||||
endwhile;
|
||||
return $tagContentArray;
|
||||
}
|
||||
|
||||
function getTrackingIDOfRequest ($req) {
|
||||
global $apiVersion, $trackingUserID, $trackingPassword, $trackingIDs;
|
||||
$apiVersion = getSingleTagContent($req, "<APIVersion>", "</APIVersion>"); // API Version
|
||||
$trackingUserID = getSingleTagContent($req, "<UserID>", "</UserID>"); // User ID
|
||||
$trackingPassword = getSingleTagContent($req, "<Password>", "</Password>"); // Password
|
||||
$trackingIDs = getTagContent($req, "<TrackingNumber>", "</TrackingNumber>"); // Tracking IDs
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Generate a response for a specified tracking ID with existing tracking data
|
||||
function generateTrackingResponseXML () {
|
||||
global $tratId, $jbId, $trSort, $tratState, $tratRemark, $tratpType, $tratpState, $tratpRemark, $tratpCreatetime, $trSignname, $trHsno, $adStreet, $adZipcode, $adCity, $adCountry;
|
||||
global $trackingIDs, $eventCounter, $trackingIDErrorState, $deliveryAddress, $eventMsgArray, $errMsgArray;
|
||||
|
||||
$trackingIDsLen = count($trackingIDs);
|
||||
|
||||
$response = "";
|
||||
|
||||
$response .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
||||
$response .= "<AmazonTrackingResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"AmazonTrackingResponse.xsd\">";
|
||||
$response .= "<APIVersion>3.5</APIVersion>";
|
||||
|
||||
// List tracking events
|
||||
$eventResponse = "";
|
||||
for ($j = 0; $j < $trackingIDsLen; $j++) :
|
||||
|
||||
if ($trackingIDErrorState[$j] == "0") :
|
||||
|
||||
$eventResponse .= "<TrackingNumber>" . $trackingIDs[$j] . "</TrackingNumber>";
|
||||
$eventResponse .= "<PackageDestinationLocation>";
|
||||
$eventResponse .= "<City>" . $deliveryAddress["ad_city"] . "</City>";
|
||||
$eventResponse .= "<StateProvince></StateProvince>";
|
||||
$eventResponse .= "<PostalCode>" . $deliveryAddress["ad_zipcode"] . "</PostalCode>";
|
||||
$eventResponse .= "<CountryCode>" . $deliveryAddress["ad_country"] . "</CountryCode>";
|
||||
$eventResponse .= "</PackageDestinationLocation>";
|
||||
$eventResponse .= "<TrackingEventHistory>";
|
||||
|
||||
for ($i = 0; $i < $eventCounter[$j]; $i++) :
|
||||
|
||||
$tmpEventNo = $tratpType[$j][$i]; // Get event number of current process entry
|
||||
|
||||
if ($tmpEventNo != "" && is_numeric($tmpEventNo)) :
|
||||
$eventResponse .= "<TrackingEventDetail>";
|
||||
$eventResponse .= "<EventCode>EVENT_" . $tmpEventNo . "</EventCode>";
|
||||
$eventResponse .= "<EventCodeDesc>" . $eventMsgArray["EVENT_" . $tmpEventNo] . "</EventCodeDesc>";
|
||||
$eventResponse .= "<EventDateTime>" . substr($tratpCreatetime[$j][$i],0,10) . "T" . substr($tratpCreatetime[$j][$i],11,8) . "+01:00" . "</EventDateTime>";
|
||||
$eventResponse .= "<EventLocation>";
|
||||
$eventResponse .= "<City>" . $adCity[$j][$i] . "</City>";
|
||||
$eventResponse .= "<StateProvince>" . "" . "</StateProvince>";
|
||||
$eventResponse .= "<PostalCode>" . $adZipcode[$j][$i] . "</PostalCode>";
|
||||
$eventResponse .= "<CountryCode>" . ($adCountry[$j][$i] == "" ? "DE" : $adCountry[$j][$i]) . "</CountryCode>";
|
||||
$eventResponse .= "</EventLocation>";
|
||||
$eventResponse .= "<AdditionalLocationInfo>" . $tratpRemark[$j][$i] . "</AdditionalLocationInfo>";
|
||||
$eventResponse .= "<SignedForByName>" . $trSignname[$j][$i] . "</SignedForByName>";
|
||||
$eventResponse .= "</TrackingEventDetail>";
|
||||
endif;
|
||||
endfor;
|
||||
|
||||
$eventResponse .= "</TrackingEventHistory>";
|
||||
endif;
|
||||
endfor;
|
||||
if ($eventResponse != "") :
|
||||
$response .= "<PackageTrackingInfo>";
|
||||
$response .= $eventResponse;
|
||||
$response .= "</PackageTrackingInfo>";
|
||||
endif;
|
||||
|
||||
// List tracking errors
|
||||
for ($j = 0; $j < $trackingIDsLen; $j++) :
|
||||
|
||||
if ($trackingIDErrorState[$j] != "0") :
|
||||
|
||||
$response .= "<TrackingErrorInfo>";
|
||||
$response .= "<TrackingNumber>" . $trackingIDs[$j] . "</TrackingNumber>";
|
||||
$response .= "<TrackingErrorDetail>";
|
||||
$response .= "<ErrorDetailCode>ERROR_" . $trackingIDErrorState[$j] . "</ErrorDetailCode>";
|
||||
$response .= "<ErrorDetailCodeDesc>" . $errMsgArray["ERROR_" . $trackingIDErrorState[$j]] . "</ErrorDetailCodeDesc>";
|
||||
$response .= "</TrackingErrorDetail>";
|
||||
$response .= "</TrackingErrorInfo>";
|
||||
endif;
|
||||
endfor;
|
||||
|
||||
$response .= "</AmazonTrackingResponse>";
|
||||
|
||||
// $response = urlencode($response);
|
||||
|
||||
$responseLen = strlen($response);
|
||||
|
||||
return $response;
|
||||
};
|
||||
|
||||
// Generate a response for an invalid specified tracking ID
|
||||
function generateTrackingErrorResponse () {
|
||||
global $tratId, $jbId, $trSort, $tratState, $tratRemark, $tratpType, $tratpState, $tratpRemark, $tratpCreatetime, $trSignname, $trHsno, $adStreet, $adZipcode, $adCity, $adCountry;
|
||||
global $trackingIDs, $eventCounter, $trackingIDErrorState, $deliveryAddress, $eventMsgArray, $errMsgArray;
|
||||
|
||||
$response = "";
|
||||
|
||||
$response .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
||||
$response .= "<AmazonTrackingResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"AmazonTrackingResponse.xsd\">";
|
||||
$response .= "<APIVersion>3.5</APIVersion>";
|
||||
|
||||
for ($j = 0; $j < $trackingIDsLen; $j++) :
|
||||
|
||||
if ($trackingIDErrorState[$j] != "0") :
|
||||
|
||||
$response .= "<TrackingErrorInfo>";
|
||||
$response .= "<TrackingNumber>" . $trackingIDs[$j] . "</TrackingNumber>";
|
||||
$response .= "<TrackingErrorDetail>";
|
||||
$response .= "<ErrorDetailCode>ERROR_" . $trackingIDErrorState[$j] . "</ErrorDetailCode>";
|
||||
$response .= "<ErrorDetailCodeDesc>" . $errMsgArray["ERROR_" . $trackingIDErrorState[$j]] . "</ErrorDetailCodeDesc>";
|
||||
$response .= "</TrackingErrorDetail>";
|
||||
$response .= "</TrackingErrorInfo>";
|
||||
endif;
|
||||
endfor;
|
||||
|
||||
$response .= "</AmazonTrackingResponse>";
|
||||
|
||||
return $response;
|
||||
};
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// ******************************************
|
||||
// * Get the tracking ID out of the request *
|
||||
// ******************************************
|
||||
getTrackingIDOfRequest($trackingReq); // Set global parameters: $trackingIDs, $trackingUserID, $trackingPassword
|
||||
global $db, $PHP_SELF;
|
||||
|
||||
$trackingIDsLen = count($trackingIDs);
|
||||
|
||||
if ($apiVersion == "3.5") :
|
||||
|
||||
if ($trackingUserID == "stbx" && $trackingPassword == "cagtmv2924") :
|
||||
|
||||
// Initial code
|
||||
$generalErrorState = "0";
|
||||
|
||||
if ($trackingIDsLen > 0) :
|
||||
|
||||
// Get the array for formatting the database-values for the output according to the defined type
|
||||
$outputFormatField = defineOutputFormats();
|
||||
|
||||
// Init global arrays
|
||||
$deliveryAddress = array();
|
||||
$trackingIDErrorState = array();
|
||||
$eventCounter = array();
|
||||
$tratId = array();
|
||||
$jbId = array();
|
||||
$trSort = array();
|
||||
$tratState = array();
|
||||
$tratRemark = array();
|
||||
$tratpType = array();
|
||||
$tratpState = array();
|
||||
$tratpRemark = array();
|
||||
$tratpCreatetime = array();
|
||||
$trSignname = array();
|
||||
$trHsno = array();
|
||||
$adStreet = array();
|
||||
$adZipcode = array();
|
||||
$adCity = array();
|
||||
$adCountry = array();
|
||||
|
||||
for ($j = 0; $j < $trackingIDsLen; $j++) :
|
||||
|
||||
$trackingID = trim($trackingIDs[$j]);
|
||||
|
||||
// Init with "INVALID TRACKING NUMBER"
|
||||
$trackingIDErrorState[$j] = "101";
|
||||
|
||||
if ($trackingID != "") :
|
||||
|
||||
// Ckeck validity of the tracking ID
|
||||
// ... here ...
|
||||
if (true) :
|
||||
|
||||
// Check existence of the hash value
|
||||
// if (existsEntry("meta_object.metaobject",array("mo_hash",$trackingID))) :
|
||||
if (existsEntry("phoenix.tourarticle",array("trat_serialno",$trackingID))) :
|
||||
|
||||
/*
|
||||
$moId = getFieldValueFromId("meta_object.metaobject", "mo_hash", $trackingID, "mo_id");
|
||||
$moIdRefDB = getFieldValueFromId("meta_object.metaobject", "mo_id", $moId, "mo_id_ref_db");
|
||||
$objType = getFieldValueFromId("meta_object.metaobject", "mo_id", $moId, "mo_obj_type");
|
||||
$objId = getFieldValueFromId("meta_object.metaobject", "mo_id", $moId, "mo_obj_id");
|
||||
*/
|
||||
|
||||
if (true || $moId != "" && $moId > "0") :
|
||||
|
||||
// Get database instance
|
||||
// $dbInst = getFieldValueFromId("meta_object.metaobject", "mo_id", $moIdRefDB, "mo_value");
|
||||
|
||||
if (true || $dbInst != "") :
|
||||
|
||||
// Get database connection
|
||||
// $db_conn = getDbConnectionSpecial($dbInst, $dbname, $dblogin, $dbpassword);
|
||||
|
||||
if (true || $objType == "track") :
|
||||
|
||||
// Get tracking ID from "tourarticle"
|
||||
$sqlquery = "SELECT trat.trat_id, trat.jb_id, trat.tr_sort, trat.trat_state, trat.trat_remark,"
|
||||
. " tratp.tratp_type, tratp.tratp_state, tratp.tratp_remark, tratp.tratp_createtime,"
|
||||
. " tr.tr_signname, tr.tr_hsno,"
|
||||
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
|
||||
. " FROM phoenix.tourarticle AS trat, phoenix.tourarticleprocess AS tratp, phoenix.tour AS tr, phoenix.address AS ad"
|
||||
. " WHERE trat.trat_serialno = '" . $trackingID . "' AND"
|
||||
. " trat.trat_id = tratp.trat_id AND"
|
||||
. " trat.jb_id = tr.jb_id AND"
|
||||
. " trat.tr_sort = tr.tr_sort AND"
|
||||
. " tr.ad_id = ad.ad_id"
|
||||
. " ORDER BY tratp.tratp_createtime";
|
||||
|
||||
// $result = $db_conn->query($sqlquery);
|
||||
$result = $db->query($sqlquery);
|
||||
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
|
||||
|
||||
$i = 0;
|
||||
$eventCounter[$j] = 0;
|
||||
while ($row = $result->fetchRow()):
|
||||
|
||||
$tratId[$j][$i] = $row["trat_id"]; // [$j] = Index per tracking ID in "trat_serialno"
|
||||
$jbId[$j][$i] = $row["jb_id"];
|
||||
$trSort[$j][$i] = $row["tr_sort"];
|
||||
$tratState[$j][$i] = $row["trat_state"];
|
||||
$tratRemark[$j][$i] = $row["trat_remark"];
|
||||
|
||||
$tratpType[$j][$i] = $row["tratp_type"];
|
||||
$tratpState[$j][$i] = $row["tratp_state"];
|
||||
$tratpRemark[$j][$i] = $row["tratp_remark"];
|
||||
$tratpCreatetime[$j][$i] = $row["tratp_createtime"];
|
||||
|
||||
$trSignname[$j][$i] = $row["tr_signname"];
|
||||
$trHsno[$j][$i] = $row["tr_hsno"];
|
||||
$adStreet[$j][$i] = $row["ad_street"];
|
||||
$adZipcode[$j][$i] = $row["ad_zipcode"];
|
||||
$adCity[$j][$i] = $row["ad_city"];
|
||||
$adCountry[$j][$i] = $row["ad_country"];
|
||||
|
||||
$i++;
|
||||
$eventCounter[$j]++; // How many events per tracking ID
|
||||
endwhile;
|
||||
$result->free();
|
||||
|
||||
// Check if no tracking data is found according to the current tracking ID
|
||||
$trackingIDErrorState[$j] = "0"; // Init: OK
|
||||
if ($i == 0) :
|
||||
$trackingIDErrorState[$j] = "102"; // "NO TRACKING DATA FOUND"
|
||||
endif;
|
||||
|
||||
// -------------------------------------
|
||||
|
||||
// Get delivery address and data of the end customer
|
||||
$sqlquery = "SELECT trat.jb_id, trat.tr_sort,"
|
||||
. " tr.tr_signname, tr.tr_hsno, tr.tr_person,"
|
||||
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
|
||||
. " FROM phoenix.tourarticle AS trat, phoenix.tour AS tr, phoenix.address AS ad"
|
||||
. " WHERE trat.trat_serialno = '" . $trackingID . "' AND"
|
||||
. " trat.jb_id = tr.jb_id AND"
|
||||
. " trat.tr_sort = tr.tr_sort AND"
|
||||
. " tr.ad_id = ad.ad_id"
|
||||
. " ORDER BY trat.jb_id, trat.tr_sort";
|
||||
|
||||
// $result = $db_conn->query($sqlquery);
|
||||
$result = $db->query($sqlquery);
|
||||
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
|
||||
|
||||
// The last row is the youngest order with the corresponding station no.
|
||||
while ($row = $result->fetchRow()):
|
||||
|
||||
$deliveryAddress["jb_id"] = $row["jb_id"];
|
||||
$deliveryAddress["tr_sort"] = $row["tr_sort"];
|
||||
$deliveryAddress["ad_street"] = $row["ad_street"];
|
||||
$deliveryAddress["tr_hsno"] = $row["tr_hsno"];
|
||||
$deliveryAddress["ad_zipcode"] = $row["ad_zipcode"];
|
||||
$deliveryAddress["ad_city"] = $row["ad_city"];
|
||||
$deliveryAddress["ad_country"] = $row["ad_country"];
|
||||
$deliveryAddress["tr_person"] = $row["tr_person"];
|
||||
endwhile;
|
||||
$result->free();
|
||||
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
endfor; // End loop tracking IDs
|
||||
else :
|
||||
// No tracking ID has been sent
|
||||
for ($j = 0; $j < $trackingIDsLen; $j++) :
|
||||
$trackingIDErrorState[$j] = "204";
|
||||
endfor;
|
||||
endif;
|
||||
else :
|
||||
// UserId or password not correct (for ALL tracking IDs!!!)
|
||||
for ($j = 0; $j < $trackingIDsLen; $j++) :
|
||||
$trackingIDErrorState[$j] = "201";
|
||||
endfor;
|
||||
endif;
|
||||
else :
|
||||
// API version not correct (for ALL tracking IDs!!!)
|
||||
for ($j = 0; $j < $trackingIDsLen; $j++) :
|
||||
$trackingIDErrorState[$j] = "202";
|
||||
endfor;
|
||||
endif;
|
||||
|
||||
// Generate response
|
||||
$response = generateTrackingResponseXML();
|
||||
?>
|
||||
|
||||
<?php echo $response ?>
|
||||
324
html/tracking/tracking_amazon_IFTSTA.php
Normal file
324
html/tracking/tracking_amazon_IFTSTA.php
Normal file
@@ -0,0 +1,324 @@
|
||||
<?php
|
||||
/*=======================================================================
|
||||
*
|
||||
* tracking_amazon_IFTSTA.php
|
||||
*
|
||||
=======================================================================*/
|
||||
|
||||
|
||||
// Generates an IFTSTA document according to specified tracking IDs and a "from timestamp"
|
||||
function generateTrackingIFTSTA($trackingIDs, $createTimeFrom) {
|
||||
global $db, $PHP_SELF;
|
||||
|
||||
// *****************
|
||||
// * Define events *
|
||||
// *****************
|
||||
|
||||
// Event messages
|
||||
$eventMsgArray["EVENT_101"] = "Shipment has left seller facility and is in transit"; // Electronic Manifest transmitted by Amazon to the carrier and the carrier’s truck has departed the Amazon/seller facility
|
||||
$eventMsgArray["EVENT_102"] = "Shipment received by carrier"; // Origin scan which confirms possession by the carrier
|
||||
|
||||
$eventMsgArray["EVENT_201"] = "Arrival Scan"; // Arrived at any of the carrier facilities
|
||||
$eventMsgArray["EVENT_202"] = "Departure Scan"; // Departed any of the carrier facilities
|
||||
$eventMsgArray["EVENT_203"] = "Arrived at destination country"; // Arrived at the destination country
|
||||
$eventMsgArray["EVENT_204"] = "Initiated customs clearance process"; // Customs has started to clear the package
|
||||
$eventMsgArray["EVENT_205"] = "Completed customs clearance process"; // Customs has cleared the package
|
||||
$eventMsgArray["EVENT_206"] = "In transit to pickup location"; // Package is in transit to pickup location
|
||||
$eventMsgArray["EVENT_207"] = "Problem resolved and shipment is in transit"; // Resolution of exception scan and package is in transit again
|
||||
$eventMsgArray["EVENT_208"] = "Your selected store is closed for delivery and your shipment has been rerouted to a nearby store. The carrier will provide more information about the new store"; // Customer pick-up location is closed and the package was rerouted to a nearby pick-up location
|
||||
|
||||
$eventMsgArray["EVENT_300"] = "NOT DISPLAYED"; // Tendered to alternate carrier, line haul complete
|
||||
$eventMsgArray["EVENT_301"] = "Delivered"; // Delivered to the customer directly
|
||||
$eventMsgArray["EVENT_302"] = "Out for delivery"; // On the last leg of delivery to the customer
|
||||
$eventMsgArray["EVENT_304"] = "Delivery attempted"; // Carrier attempted delivery, but unable to deliver to customer
|
||||
$eventMsgArray["EVENT_306"] = "Customer contacted to arrange delivery"; // Carrier has contacted the customer to arrange delivery of the package
|
||||
$eventMsgArray["EVENT_307"] = "Delivery appointment scheduled"; // Carrier has scheduled delivery of the package with the customer
|
||||
$eventMsgArray["EVENT_308"] = "Available for pickup"; // Package is available for pickup from pickup location
|
||||
$eventMsgArray["EVENT_309"] = "Returned to seller"; // Package was delivered back to seller’s facility
|
||||
$eventMsgArray["EVENT_310"] = "Tendered to local postal carrier for final delivery"; // Local postal carrier will perform final delivery to the customer. If assigned a new tracking id, carrier name and tracking id should be provided.
|
||||
$eventMsgArray["EVENT_311"] = "Tendered to local postal carrier for final delivery and no proof of delivery will be provided"; // Local postal carrier will perform final delivery to the customer but they will not scan the package as delivered (international use).
|
||||
|
||||
$eventMsgArray["EVENT_401"] = "Incorrect address"; // Destination address does not exist or is incorrect
|
||||
$eventMsgArray["EVENT_402"] = "Customs clearance delay"; // Any situation which causes a delay clearing customs
|
||||
$eventMsgArray["EVENT_403"] = "Customer moved"; // Consignee no longer lives at the delivery address and left no forwarding address
|
||||
$eventMsgArray["EVENT_404"] = "Delay in delivery due to external factors"; // This represents a definite delay in delivery and will trigger correspondences to the customer to notify them of the delay
|
||||
$eventMsgArray["EVENT_405"] = "Shipment damaged"; // Carrier damaged the package
|
||||
$eventMsgArray["EVENT_406"] = "Held by carrier"; // The package is being held by the carrier
|
||||
$eventMsgArray["EVENT_407"] = "Customer refused delivery"; // Consignee refused to accept package
|
||||
$eventMsgArray["EVENT_408"] = "Returning to seller"; // Amazon has requested the package be returned to Amazon’s facility
|
||||
$eventMsgArray["EVENT_409"] = "Lost by carrier"; // Carrier lost the package
|
||||
$eventMsgArray["EVENT_411"] = "Paperwork received - did not receive shipment"; // Carrier received electronic or paper manifest, but the shipment has not been picked up
|
||||
$eventMsgArray["EVENT_412"] = "Received shipment - did not receive paperwork"; // Carrier received the package, but not the electronic/paper manifest. This is sent only when the shipment cannot move until the problem is resolved
|
||||
$eventMsgArray["EVENT_413"] = "Customer refused shipment due to customs charges"; // Customer has refused shipment due to customs duties, taxes and fees charges.
|
||||
$eventMsgArray["EVENT_414"] = "Possible delay in delivery due to arrival at incorrect carrier facility"; // Package was mis-sorted and delivery maybe delayed
|
||||
$eventMsgArray["EVENT_415"] = "Received from prior carrier"; // Carrier has received the package from the previous carrier
|
||||
$eventMsgArray["EVENT_416"] = "Undeliverable"; // Package could not be delivered, and Amazon has instructed the carrier to destroy the package or follow alternate instructions
|
||||
$eventMsgArray["EVENT_418"] = "Returning to seller due to incorrect address"; // Unable to complete delivery due to incorrect address and the shipment is being returned to the seller
|
||||
$eventMsgArray["EVENT_419"] = "Returning to seller because customer refused delivery"; // Customer refused delivery and the shipment is being returned to the seller
|
||||
$eventMsgArray["EVENT_420"] = "Delay in delivery due to weather or natural disaster"; // Shipment delivery is delayed because of weather or natural disaster
|
||||
$eventMsgArray["EVENT_421"] = "Unable to forward shipment to different address"; // Forwarding attempt failed
|
||||
$eventMsgArray["EVENT_422"] = "Shipment forwarded to a different delivery address"; // Carrier has forwarded the package to an address
|
||||
$eventMsgArray["EVENT_423"] = "Shipment damaged and will not be delivered"; // Carrier has identified the package as damaged, will not complete the delivery, and will dispose of the package
|
||||
$eventMsgArray["EVENT_424"] = "Held for payment"; // Delivery of the package cannot be completed until payment is received by Carrier
|
||||
$eventMsgArray["EVENT_425"] = "Possible delay in delivery due to extra carrier processing"; // There is possible delay in delivery because the carrier had to perform extra processing outside of the norm
|
||||
$eventMsgArray["EVENT_426"] = "Confiscated or seized by an official government authority"; // The package will not be delivered nor returned due to being seized by an official government authority
|
||||
$eventMsgArray["EVENT_427"] = "Held by carrier – seller input required"; // The package is being held by the carrier because they require additional information from Amazon
|
||||
$eventMsgArray["EVENT_428"] = "Address issue corrected by carrier but delivery could be delayed."; // The carrier was able to correct the customer’s address without any input from customer or Amazon
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Error messages
|
||||
$errMsgArray["ERROR_101"] = "INVALID TRACKING NUMBER"; // Request contains an invalid tracking number
|
||||
$errMsgArray["ERROR_102"] = "NO TRACKING INFO FOUND"; // No data exists in the carrier’s system for the given tracking number
|
||||
|
||||
$errMsgArray["ERROR_201"] = "INVALID USERID/PASSWORD"; // Request contains an invalid user ID or password
|
||||
$errMsgArray["ERROR_202"] = "INVALID API VERSION"; // Request contains an incompatible API version
|
||||
$errMsgArray["ERROR_203"] = "XML DOCUMENT NOT WELL FORMED"; // Request is not a well-formed XML document
|
||||
$errMsgArray["ERROR_204"] = "XML DOCUMENT NOT VALID"; // Request is not a valid XML document
|
||||
|
||||
$errMsgArray["ERROR_301"] = "TRACKING SERVICE NOT AVAILABLE"; // Generic error code to handle any situation where Amazon
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Delivery location codes
|
||||
$deliveryLocCodes["AS_INSTRUCTED"] = "As instructed"; // Package was delivered as per instructions
|
||||
$deliveryLocCodes["CARPORT"] = "Carport"; // Package was left inside a carport
|
||||
$deliveryLocCodes["CUSTOMER_PICKUP"] = "Picked up by customer"; // Package was picked up by customer
|
||||
$deliveryLocCodes["DECK"] = "Deck"; // Package was left on an outside deck
|
||||
$deliveryLocCodes["DOCK"] = "Shipping dock"; // Package was left on dock
|
||||
$deliveryLocCodes["FRONT_DESK"] = "Front desk"; // Package was left at front desk
|
||||
$deliveryLocCodes["FRONT_DOOR"] = "Front door"; // Package was left in or near the front door
|
||||
$deliveryLocCodes["GARAGE"] = "Garage"; // Package was left in or near the garage door
|
||||
$deliveryLocCodes["GUARD"] = "Guard"; // Package was handed to a security guard
|
||||
$deliveryLocCodes["MAILBOX"] = "Mailbox"; // Package was left inside the residence’s mailbox
|
||||
$deliveryLocCodes["MAIL_ROOM"] = "Mail room"; // Package was left in mail room
|
||||
$deliveryLocCodes["MAIL_SLOT"] = "Mail slot"; // Package was left in mail slot
|
||||
$deliveryLocCodes["MC_BOY"] = "Delivered to male child"; // Package was handed directly to a male child.
|
||||
$deliveryLocCodes["MC_GIRL"] = "Delivered to female child"; // Package was handed directly to a female child.
|
||||
$deliveryLocCodes["MC_MAN"] = "Delivered to male adult"; // Package was handed directly to a man
|
||||
$deliveryLocCodes["MC_WOMAN"] = "Delivered to female adult"; // Package was handed directly to a woman
|
||||
$deliveryLocCodes["NEIGHBOR"] = "Left with neighbor"; // Package was handed directly to a neighbor
|
||||
$deliveryLocCodes["OUTBUILDING"] = "Outbuilding"; // Package was left in an outbuilding
|
||||
$deliveryLocCodes["PATIO"] = "Patio"; // Package was left on an outside patio
|
||||
$deliveryLocCodes["PORCH"] = "Porch"; // Package was left on an outside porch
|
||||
$deliveryLocCodes["REAR_DOOR"] = "Rear door"; // Package was in or near the rear door
|
||||
$deliveryLocCodes["RECEIVER"] = "Resident"; // Package was handed to resident
|
||||
$deliveryLocCodes["RECEPTIONIST"] = "Receptionist"; // Package was handed to a receptionist
|
||||
$deliveryLocCodes["SECURE_LOCATION"] = "Secure location"; // Package was left in a secure location
|
||||
$deliveryLocCodes["SIDE_DOOR"] = "Side door"; // Package was left at side door
|
||||
|
||||
// Pickup location codes
|
||||
$pickupLocCodes["CARRIER_FACILITY"] = "Available for pickup at carrier facility"; // Package can be picked up from carrier’s hub
|
||||
$pickupLocCodes["CONVENIENCE_STORE"] = "Available for pickup at local convenience store"; // Package can be picked up at a local store
|
||||
$pickupLocCodes["LOCAL_POST_OFFICE"] = "Available for pickup at your local post office"; // Package can be picked up at local post office
|
||||
|
||||
|
||||
// Event messages for IFTSTA
|
||||
$eventMsgIFTSTA["xxx"] = "..."; // Electronic Manifest transmitted by Amazon to the carrier and the carrier’s truck has departed the Amazon/seller facility
|
||||
$eventMsgIFTSTA["xxx"] = "..."; // Origin scan which confirms possession by the carrier
|
||||
|
||||
|
||||
// Mapping array of event numbers
|
||||
$mapEventNo["101"] = "xxx";
|
||||
$mapEventNo["102"] = "xxx";
|
||||
|
||||
$mapEventNo["201"] = "xxx";
|
||||
$mapEventNo["202"] = "xxx";
|
||||
|
||||
$mapEventNo["301"] = "xxx";
|
||||
$mapEventNo["302"] = "xxx";
|
||||
$mapEventNo["304"] = "xxx";
|
||||
$mapEventNo["306"] = "xxx";
|
||||
$mapEventNo["307"] = "xxx";
|
||||
$mapEventNo["308"] = "xxx";
|
||||
$mapEventNo["309"] = "xxx";
|
||||
|
||||
$mapEventNo["401"] = "xxx";
|
||||
$mapEventNo["403"] = "xxx";
|
||||
$mapEventNo["404"] = "xxx";
|
||||
$mapEventNo["405"] = "xxx";
|
||||
$mapEventNo["406"] = "xxx";
|
||||
$mapEventNo["407"] = "xxx";
|
||||
$mapEventNo["408"] = "xxx";
|
||||
|
||||
|
||||
// *************************
|
||||
// * Get new tracking data *
|
||||
// *************************
|
||||
|
||||
$response = ""; // Init response to be returned
|
||||
$trackingIDsLen = count($trackingIDs);
|
||||
|
||||
if ($trackingIDsLen > 0 && $createTimeFrom != "") :
|
||||
|
||||
// Init arrays
|
||||
$deliveryAddress = array();
|
||||
$eventCounter = array();
|
||||
$tratId = array();
|
||||
$jbId = array();
|
||||
$trSort = array();
|
||||
$tratState = array();
|
||||
$tratRemark = array();
|
||||
$tratpType = array();
|
||||
$tratpState = array();
|
||||
$tratpRemark = array();
|
||||
$tratpCreatetime = array();
|
||||
$trSignname = array();
|
||||
$trHsno = array();
|
||||
$adStreet = array();
|
||||
$adZipcode = array();
|
||||
$adCity = array();
|
||||
$adCountry = array();
|
||||
|
||||
for ($j = 0; $j < $trackingIDsLen; $j++) :
|
||||
|
||||
$trackingID = trim($trackingIDs[$j]);
|
||||
|
||||
if ($trackingID != "") :
|
||||
|
||||
// Get tracking ID from "tourarticle"
|
||||
$sqlquery = "SELECT trat.trat_id, trat.jb_id, trat.tr_sort, trat.trat_state, trat.trat_remark,"
|
||||
. " tratp.tratp_type, tratp.tratp_state, tratp.tratp_remark, tratp.tratp_createtime,"
|
||||
. " tr.tr_signname, tr.tr_hsno,"
|
||||
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
|
||||
. " FROM phoenix.tourarticle AS trat, phoenix.tourarticleprocess AS tratp, phoenix.tour AS tr, phoenix.address AS ad"
|
||||
. " WHERE trat.trat_serialno = '" . $trackingID . "' AND"
|
||||
. " trat.trat_id = tratp.trat_id AND"
|
||||
. " tratp.tratp_createtime >= '" . $createTimeFrom . "' AND"
|
||||
. " trat.jb_id = tr.jb_id AND"
|
||||
. " trat.tr_sort = tr.tr_sort AND"
|
||||
. " tr.ad_id = ad.ad_id"
|
||||
. " ORDER BY tratp.tratp_createtime";
|
||||
|
||||
$result = $db_conn->query($sqlquery);
|
||||
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
|
||||
|
||||
$i = 0;
|
||||
$eventCounter[$j] = 0;
|
||||
while ($row = $result->fetch_assoc()):
|
||||
|
||||
$tratId[$j][$i] = $row["trat_id"]; // [$j] = Index per tracking ID in "trat_serialno"
|
||||
$jbId[$j][$i] = $row["jb_id"];
|
||||
$trSort[$j][$i] = $row["tr_sort"];
|
||||
$tratState[$j][$i] = $row["trat_state"];
|
||||
$tratRemark[$j][$i] = $row["trat_remark"];
|
||||
|
||||
$tratpType[$j][$i] = $row["tratp_type"];
|
||||
$tratpState[$j][$i] = $row["tratp_state"];
|
||||
$tratpRemark[$j][$i] = $row["tratp_remark"];
|
||||
$tratpCreatetime[$j][$i] = $row["tratp_createtime"];
|
||||
|
||||
$trSignname[$j][$i] = $row["tr_signname"];
|
||||
$trHsno[$j][$i] = $row["tr_hsno"];
|
||||
$adStreet[$j][$i] = $row["ad_street"];
|
||||
$adZipcode[$j][$i] = $row["ad_zipcode"];
|
||||
$adCity[$j][$i] = $row["ad_city"];
|
||||
$adCountry[$j][$i] = $row["ad_country"];
|
||||
|
||||
$i++;
|
||||
$eventCounter[$j]++; // How many events per tracking ID
|
||||
endwhile;
|
||||
$result->free();
|
||||
|
||||
// -------------------------------------
|
||||
|
||||
// Get delivery address and data of the end customer
|
||||
$sqlquery = "SELECT trat.jb_id, trat.tr_sort,"
|
||||
. " tr.tr_signname, tr.tr_hsno, tr.tr_person,"
|
||||
. " ad.ad_street, ad.ad_zipcode, ad.ad_city, ad.ad_country"
|
||||
. " FROM phoenix.tourarticle AS trat, phoenix.tour AS tr, phoenix.address AS ad"
|
||||
. " WHERE trat.trat_serialno = '" . $trackingID . "' AND"
|
||||
. " trat.jb_id = tr.jb_id AND"
|
||||
. " trat.tr_sort = tr.tr_sort AND"
|
||||
. " tr.ad_id = ad.ad_id"
|
||||
. " ORDER BY trat.jb_id, trat.tr_sort";
|
||||
|
||||
$result = $db_conn->query($sqlquery);
|
||||
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
|
||||
|
||||
// The last row is the youngest order with the corresponding station no.
|
||||
while ($row = $result->fetch_assoc()):
|
||||
|
||||
$deliveryAddress["jb_id"] = $row["jb_id"];
|
||||
$deliveryAddress["tr_sort"] = $row["tr_sort"];
|
||||
$deliveryAddress["ad_street"] = $row["ad_street"];
|
||||
$deliveryAddress["tr_hsno"] = $row["tr_hsno"];
|
||||
$deliveryAddress["ad_zipcode"] = $row["ad_zipcode"];
|
||||
$deliveryAddress["ad_city"] = $row["ad_city"];
|
||||
$deliveryAddress["ad_country"] = $row["ad_country"];
|
||||
$deliveryAddress["tr_person"] = $row["tr_person"];
|
||||
endwhile;
|
||||
$result->free();
|
||||
|
||||
endif;
|
||||
endfor; // End loop tracking IDs
|
||||
|
||||
|
||||
// *********************
|
||||
// * Generate response *
|
||||
// *********************
|
||||
|
||||
$response .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
||||
$response .= "<AmazonTrackingResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"AmazonTrackingResponse.xsd\">";
|
||||
$response .= "<APIVersion>3.1</APIVersion>";
|
||||
|
||||
// List tracking events
|
||||
$eventResponse = "";
|
||||
for ($j = 0; $j < $trackingIDsLen; $j++) :
|
||||
|
||||
$eventResponse .= "<TrackingNumber>" . $trackingIDs[$j] . "</TrackingNumber>";
|
||||
$eventResponse .= "<PackageDestinationLocation>";
|
||||
$eventResponse .= "<City>" . $deliveryAddress["ad_city"] . "</City>";
|
||||
$eventResponse .= "<StateProvince></StateProvince>";
|
||||
$eventResponse .= "<PostalCode>" . $deliveryAddress["ad_zipcode"] . "</PostalCode>";
|
||||
$eventResponse .= "<CountryCode>" . $deliveryAddress["ad_country"] . "</CountryCode>";
|
||||
$eventResponse .= "</PackageDestinationLocation>";
|
||||
$eventResponse .= "<TrackingEventHistory>";
|
||||
|
||||
for ($i = 0; $i < $eventCounter[$j]; $i++) :
|
||||
|
||||
// Get event number of current (tourarticle)process entry mapped to IFTSTA
|
||||
$tmpEventNo = $mapEventNo[$tratpType[$j][$i]];
|
||||
|
||||
if ($tmpEventNo != "" && is_numeric($tmpEventNo)) :
|
||||
$eventResponse .= "<TrackingEventDetail>";
|
||||
$eventResponse .= "<EventCode>EVENT_" . $tmpEventNo . "</EventCode>";
|
||||
$eventResponse .= "<EventCodeDesc>" . $eventMsgIFTSTA[$tmpEventNo] . "</EventCodeDesc>";
|
||||
$eventResponse .= "<EventDateTime>" . substr($tratpCreatetime[$j][$i],0,10) . "T" . substr($tratpCreatetime[$j][$i],11,8) . "+01:00" . "</EventDateTime>";
|
||||
$eventResponse .= "<EventLocation>";
|
||||
$eventResponse .= "<City>" . $adCity[$j][$i] . "</City>";
|
||||
$eventResponse .= "<StateProvince>" . "" . "</StateProvince>";
|
||||
$eventResponse .= "<PostalCode>" . $adZipcode[$j][$i] . "</PostalCode>";
|
||||
$eventResponse .= "<CountryCode>" . ($adCountry[$j][$i] == "" ? "DE" : $adCountry[$j][$i]) . "</CountryCode>";
|
||||
$eventResponse .= "</EventLocation>";
|
||||
$eventResponse .= "<AdditionalLocationInfo>" . "" . "</AdditionalLocationInfo>";
|
||||
$eventResponse .= "<SignedForByName>" . $trSignname[$j][$i] . "</SignedForByName>";
|
||||
$eventResponse .= "</TrackingEventDetail>";
|
||||
endif;
|
||||
endfor;
|
||||
|
||||
$eventResponse .= "</TrackingEventHistory>";
|
||||
endfor;
|
||||
if ($eventResponse != "") :
|
||||
$response .= "<PackageTrackingInfo>";
|
||||
$response .= $eventResponse;
|
||||
$response .= "</PackageTrackingInfo>";
|
||||
endif;
|
||||
|
||||
$response .= "</AmazonTrackingResponse>";
|
||||
|
||||
// $response = urlencode($response);
|
||||
|
||||
$responseLen = strlen($response);
|
||||
endif;
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************************************************************************
|
||||
// Generate response for TEST
|
||||
$response = generateTrackingIFTSTA(array("123456789"), "2011-09-08 00:00:00");
|
||||
echo $response;
|
||||
// ************************************************************************************************************************************
|
||||
?>
|
||||
Reference in New Issue
Block a user