<?php
error_reporting(0);
// GET DATA IN URL
$URL = $_SERVER['REQUEST_URI'];
$scatter_url = explode('/', $URL);
$thisOrderMainID = $scatter_url[3];


if (!empty($thisOrderMainID)) {
require $_SERVER['DOCUMENT_ROOT']."/home/functions/connect.php";





$trackCode = $thisOrderMainID;
$trackCode = trim($trackCode);
if (!empty($trackCode)) {
//=============== Validate tracking code ===============================
$Query = mysqli_query($connect, "SELECT * FROM WParcel WHERE trackCode = '$trackCode'");
if (mysqli_num_rows($Query) > 0) {
//==================== GET DATA =================================
$fetchData = mysqli_fetch_assoc($Query);
$trackCode = $fetchData['trackCode'];
$itemName = $fetchData['itemName'];
$senderName = $fetchData['senderName'];
$receiverName = $fetchData['receiverName'];
$itemDesc = $fetchData['itemDesc'];
$destinationAddr = $fetchData['destinationAddr'];
$Piece = $fetchData['Piece'];
$currLocation = $fetchData['currLocation'];
$status = $fetchData['status'];
$shippingType = $fetchData['shippingType'];
$serviceType = $fetchData['serviceType'];
$arrivalDate = $fetchData['arrivalDate'];
$taxFee = $fetchData['taxFee'];

$InsurFee = $fetchData['InsurFee'];
$Vat = $fetchData['Vat'];
$TotalFee = $fetchData['TotalFee'];
$TotalPaid = $fetchData['TotalPaid'];
$Map = $fetchData['Map'];
$Map = str_replace(" ", "%20", $Map);



// SETTINGS FOR DATE 
$SepTimeDate = explode(' ', $arrivalDate);
$sepDate = $SepTimeDate[0];
//============get Accurate Date ================
$getDateSplit = explode('-', $sepDate);
$year = $getDateSplit[0];
$month = $getDateSplit[1];
$day = $getDateSplit[2];
// ACCURATE MONTH 
switch ($month) {
  case 12:
    $MonthText = "December";
    break;
  case 11:
    $MonthText = "November";
    break;
  case 10:
    $MonthText = "October";
    break;
  case 9:
    $MonthText = "September";
    break;
  case 8:
    $MonthText = "August";
    break;
  case 7:
    $MonthText = "July";
    break;
  case 6:
    $MonthText = "June";
    break;
  case 5:
    $MonthText = "May";
    break;
  case 4:
    $MonthText = "April";
    break;
  case 3:
    $MonthText = "March";
    break;
  case 2:
    $MonthText = "February";
    break;
  case 1:
    $MonthText = "January";
    break;
  
  default:
    # code...
    break;
}


}




}

}

?>
