\n". $vhtID ."
\n". $crGpsTime ."
\n". $cr_occupied;
$availCol = "red";
if ($cr_occupied != 1):
$availCol = "green";
if (in_array($crSid, $cancel_man))
$availCol = "pink";
for ($i = 0; $i <= 4; $i++):
if (!is_numeric(substr($cr_locationzipcode, $i, 1))):
$availCol = "orange";
break;
endif;
endfor;
endif;
//echo "$crSid, $cr_locationzipcode, $availCol \n";
$vhtFileName = "";
if ($vhtID == "2") : $vhtFileName = "pkw_" . $availCol . ".png" ; endif;
if ($vhtID == "3") : $vhtFileName = "kombi_" . $availCol . ".png" ; endif;
if ($vhtID == "4") : $vhtFileName = "kasten_" . $availCol . ".png" ; endif;
if ($vhtID == "5") : $vhtFileName = "bus_" . $availCol . ".png" ; endif;
if ($vhtID == "6") : $vhtFileName = "grbus_" . $availCol . ".png" ; endif;
if ($vhtID == "7") : $vhtFileName = "lkw_" . $availCol . ".png" ; endif;
if ($vhtID > "7") : $vhtFileName = "lkw_" . $availCol . ".png" ; endif;
if ($vhtFileName != "") :
$imVht = @ImageCreateFromPNG ("../images/" . $vhtFileName);
$imVhtSizeX = imagesx($imVht);
$imVhtSizeY = imagesy($imVht);
// Set transparency of the vehicle icon
$currSeconds = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
$crGpsTimeSeconds = mktime(substr($crGpsTime,11,2), substr($crGpsTime,14,2), substr($crGpsTime,17,2), substr($crGpsTime,5,2), substr($crGpsTime,8,2), substr($crGpsTime,0,4));
$diffMinutes = (($currSeconds - $crGpsTimeSeconds) / 60);
$transparencyScaleVehicleIcon = min((floor($diffMinutes / 15) * 10) - 10, 80);
// $boxPointsArray = imagettftext ($im, 10, 0, 300, 500, $lineColBlack, $textFontPath, $transparencyScaleVehicleIcon);
// setTextBox ($im, $boxPointsArray, "2", $lineColBlack);
if ($transparencyScaleVehicleIcon > 0) :
$imVht = getTransparency2($imVht, $transparencyScaleVehicleIcon, $imVhtSizeX, $imVhtSizeY);
endif;
// Search for a special vehicle
if ($searchCrSid != "" && strtolower($crSid) == strtolower($searchCrSid)) :
// Zuppel the box ... :-)
$boxPointsArray[0] += 2; $boxPointsArray[5] += 2; $boxPointsArray[6] += 2; $boxPointsArray[7] += 2;
$lineColRed = imagecolorallocate ($imVht, 255, 0, 0);
setTextBox ($imVht, $boxPointsArray, "2", $lineColRed);
endif;
$imMark = @ImageCreateFromPNG ("../images/marker_white_big.png");
imagealphablending($imMark, true);
imagesavealpha($imMark, true);
$lineCol = imagecolorallocate ($imMark, 0, 0, 0);
$crSidNo = ereg_replace("[^[:digit:]+]","",$crSid);
imagettftext ($imMark, 8, 0, 10, 12, $lineCol, "../include/arial.ttf", $crSidNo);
$posx = (imagesy($imMark) - $imVhtSizeX) / 2 + 2;
$posy = (imagesx($imMark) - $imVhtSizeY) / 2 + 2;
imagecopy($imMark, $imVht, $posx, $posy, 0, 0, $imVhtSizeX, $imVhtSizeY);
imagepng($imMark, "../temp/captchas/" . $jb_id . $crSid . ".png");
return array($imVhtSizeX, $imVhtSizeY);
endif;
}
function generateStationImage ($jb_id, $tr_sort, $tr_status) {
$imgFilename = "../temp/captchas/" . $jb_id . "-" . $tr_sort . ".png";
$imMark = ($tr_status == 1 ? @ImageCreateFromPNG ("../images/marker_green.png") : @ImageCreateFromPNG ("../images/marker_red.png"));
imagealphablending($imMark, true);
imagesavealpha($imMark, true);
$lineCol = imagecolorallocate ($imMark, 0, 0, 0);
$x = 11;
if ($tr_sort > 9)
$x = 8;
imagettftext ($imMark, 8, 0, $x, 14, $lineCol, "../include/arial.ttf", $tr_sort);
imagepng($imMark, $imgFilename);
return $imgFilename;
}
$errorMsg = "";
$hq_marker = "../images/marker_sb.png";
if ($hq_id >= 100)
$hq_marker = "../images/marker_ht.png";
$lat = 0;
$long = 0;
// Zentrale
$sqlquery = "SELECT hq_gps_long, hq_gps_lat FROM headquarters WHERE hq_id = '$hq_id'";
$markers_javascript = "";
$res = $db->query($sqlquery);
if (DB::isError($res))
die ("$PHP_SELF: '$sqlquery' : " . $res->getMessage());
if ($row = $res->fetch_assoc()):
$lat = $row["hq_gps_lat"];
$long = $row["hq_gps_long"];
$markers_javascript .= "setMarker($long, $lat, '$hq_marker', size1, offset1, popupSize1, ' Zentrale', 'central');\n";
endif;
$res->free();
// Wenn ein Auftrag angegeben und dieser bereits einen Fahrer hat, dann nur diesen in die Liste der Fahrer übernehmen
$cr_sid = "";
$customer_special = false;
if ($usr_type == 2 || $usr_id == 10041): //HTM18156 || admin_m
$cr_sid = getParameterValue("0", "MASK_JB_MAP_VIEW_COURIERS_" . $cs_id, "0");
if ($usr_id == 10041)
$cr_sid = "M047','M048','M072','M099";
$customer_special = true;
endif;
$cancel_man = array();
if ($jb_id != ""):
$jb_status_clause = " AND NOT (jb_status IN (8,9))";
if ($usr_type == 2)
$jb_status_clause = " AND jb_status = 1";
$sqlquery = "SELECT cr_id, cr_sid, hq_id FROM job WHERE jb_id = '$jb_id'" . $jb_status_clause;
//echo $sqlquery . "
\n";
$res = $db->query($sqlquery);
if (DB::isError($res))
die ("$PHP_SELF: '$sqlquery' : " . $res->getMessage());
if ($row = $res->fetch_assoc()):
$cr_id = trim($row["cr_id"]);
$cr_sid = trim($row["cr_sid"]);
$hq_id = trim($row["hq_id"]);
endif;
$res->free();
// die ablehnenden Fahrer (logo_id = 11) sollen in einer anderen Farbe aufgeführt werden
// Testaufträge: SELECT *, COUNT(*) FROM log, phoenix.job WHERE logo_id = 11 AND phoenix_log.log.hq_id = 3 AND log_createtime > "2016-11-03 00:00:00" AND phoenix_log.log.jb_id = phoenix.job.jb_id AND phoenix.job.jb_status = 9 GROUP BY phoenix.job.jb_id
$sqlquery = "SELECT cr_sid FROM phoenix_log.log WHERE jb_id = " . $jb_id . " AND logo_id = 11";
$res = $db->query($sqlquery);
if (DB::isError($res)) reportDie ("$PHP_SELF: '$sqlquery'" . $res->getMessage());
while ($row = $res->fetch_assoc()):
$cancel_man[] = $row["cr_sid"];
endwhile;
$res->free();
endif;
//$is_occupied = array();
//$sqlQuery = "SELECT DISTINCT cr_sid FROM job WHERE jb_status = 1";
//$res = $db->query($sqlQuery);
//if (DB::isError($res)) reportDie ("$PHP_SELF: '$sqlQuery': " . $res->getMessage());
//while ($row = $res->fetch_assoc()):
// $is_occupied[$row["cr_sid"]] = 1;
//endwhile;
//$res->free();
$hq_id_refresh = $hq_id;
if ($cr_sid == ""):
list ($cr_sid) = getHttpVars(array("cr_sid"));
$hq_id_refresh = 0;
endif;
$sqlquery = "SELECT cr_sid, vht_id, cr_locationzipcode, cr_available, cr_availabletime, cr_gps_long, cr_gps_lat, cr_gps_time, cr_gps_type, cr_mobile_pda, usr_phone, usr_phone2 FROM courier, user WHERE courier.hq_id = '$hq_id' AND (cr_sid != '' AND NOT(cr_sid IS NULL)) AND cr_gps_time > '" . $start_time . "' AND courier.usr_id = user.usr_id"; //AND cr_available = 1 ORDER BY cr_gps_time, cr_sid";
$show_couriers = 1;
if (trim($cr_sid) != "" || $usr_type == "2"):
$sqlquery = "SELECT cr_sid, vht_id, cr_locationzipcode, cr_availabletime, cr_gps_long, cr_gps_lat, cr_gps_time, cr_gps_type, cr_mobile_pda, usr_phone, usr_phone2 FROM courier, user WHERE cr_sid IN ('$cr_sid') AND cr_gps_time > '" . $start_time . "' AND courier.usr_id = user.usr_id";
if ($jb_id != ""):
$locatingStateArray = checkLocatingState($cr_id);
if ($locatingStateArray[0] == "1")
$show_couriers = 0;
endif;
endif;
//echo $sqlquery . "
\n";
$res = $db->query($sqlquery);
if (DB::isError($res)) die ("$PHP_SELF: '$sqlquery' : " . $res->getMessage());
$i = 1;
$cr_sid_list = "";
while ($row = $res->fetch_assoc()):
$imgSize = generateVehicleImage($jb_id, $row["cr_sid"], $row["vht_id"], $row["cr_gps_time"], $is_occupied[$row["cr_sid"]], $row["cr_locationzipcode"]);
$markers_javascript .=
($jb_id != "" && $usr_type == "1"
? "if (typeof vht_id_str['" . $row["cr_sid"] . "'] != 'undefined' && !cr_sid_is_blocked('" . $row["cr_sid"] . "'))\n"
: "") .
" setMarker(". $row["cr_gps_long"] . ", " . $row["cr_gps_lat"] . ", '../temp/captchas/" . $jb_id . $row["cr_sid"] . ".png', size2.clone(), offset2.clone(), popupSize2.clone(),\n" .
mk_text($row["cr_locationzipcode"], $row["cr_availabletime"], $row["cr_gps_time"], $row["cr_gps_type"], $row["cr_available"], $row["cr_sid"], $row["vht_id"], $row["cr_mobile_pda"], $row["usr_phone"], $row["usr_phone2"], $jb_id) .
", 'couriers');\n";
$cr_sid_list .= ($cr_sid_list == "" ? "\'" : ",\'") . $row["cr_sid"] . "\'";
if (trim($cr_sid) != ""):
$lat = $row["cr_gps_lat"];
$long = $row["cr_gps_long"];
endif;
endwhile;
$res->free();
// Stationen eines Auftrages
if ($jb_id != ""):
$sqlquery = "SELECT ad_street, ad_zipcode, ad_city, ad_country, tr_sort, tr_comp, tr_comp2, tr_hsno, tr_remark, tr_person, tr_phone, tr_status, tr_sign, tr_signname, tr_ware_from_to, " .
"tr_finishtime, tr_commission_no, tr_status, tr_finishtime FROM tour, address WHERE jb_id = $jb_id AND tour.ad_id = address.ad_id ORDER BY tr_sort";
$res = $db->query($sqlquery);
if (DB::isError($res)) die ("$PHP_SELF: '$sqlquery' : " . $res->getMessage());
while ($row = $res->fetch_assoc()):
$imgFilename = generateStationImage($jb_id, $row["tr_sort"], $row["tr_status"]);
$coords = XSfindAddress($row["ad_country"], $row["ad_zipcode"], $row["ad_city"], $row["ad_street"], $row["tr_hsno"]);
if ($coords[0][0] != 100):
// $errorMsg .= " Fehlerhafte Adresse in Station [" . $row["tr_sort"] . "]: [" .
// $row["ad_zipcode"] . " " . $row["ad_city"] . " " . $row["ad_street"] . " " . $row["tr_hsno"] . "]\n";
else:
$finishMsg = "
\\nNoch nicht erledigt";
if ($row["tr_status"] == 1):
$finishMsg = "
\\nErledigt um " . formDate($row["tr_finishtime"]);
endif;
$offsetAdd = getCoordsOffset($coords[0][1], $coords[0][2]) * 13;
$markers_javascript .= "var specialOffset" . $row["tr_sort"] . " = new OpenLayers.Pixel(" . (-9 + $offsetAdd) . ", " . (-28 + ($offsetAdd * -1)) . ");\n";
$markers_javascript .= "setMarker(". $coords[0][1] . ", " . $coords[0][2] . ", '$imgFilename', size3.clone(), specialOffset" . $row["tr_sort"] . ", popupSize3.clone(),\n" .
" '