GOD MODE: " . ($empHasAccessToLonghaul ? "YES" : "NO") . "     USER-HQ: "; $f_hq_id_len = count($f_hq_id); for ($f = 0; $f < $f_hq_id_len; $f++) : echo $hqArrX[$f_hq_id[$f]] . " "; endfor; echo "     EMP-ID: " . $emp_id . "     Akt. Liste: " . $jb_status . "        

"; endif; */ // DEBUG ****************************************************** // Optional output as file (CSV) if ($fileOutput == "1") : $outArr2File = array(); endif; $outPlaceholderLink = "[LINK]"; // Header of the list $tableHeader = ""; if ($noTableHeader == "") : $tableHeader = ""; for ($i = 0; $i < $fieldsLength; $i++) : // Output header to file if requested if ($fileOutput == "1") : $outFile = $titlesArray[$i]; $outFile = str_replace(" ", " ", $outFile); $outArr2File[0][$i] = $outFile; endif; if (trim($titlesArray[$i]) == "") : $titlesArray[$i] = " "; endif; // $tableHeader .= "" . $titlesArray[$i] . ""; $tableHeader .= "" . $titlesArray[$i] . ""; // Check for newline ("linefeed") if ($newline != ""): $nlValue = substr($newline, $i, 1); if ($nlValue == "1") : $tableHeader .= ""; endif; endif; endfor; $tableHeader .= ""; endif; // Get date (today plus offset) $offsetDate = getDateTime("date_plus_offset",array(0,MASK_DATE_PLUSOFFSETDAYS,0),"Y-m-d"); $offsetDateOut = getDateTime("date_plus_offset",array(0,MASK_DATE_PLUSOFFSETDAYS,0),"d.m.Y"); // Current timestamp $currentDateTime = getDateTime("0"); // Create filter for vehicles $vehicleFilter = spliti(",",MASK_JOBLIST_VEHICLE_FILTER); $vehicleFilterLen = count($vehicleFilter); // Entries of the list $rowCounter = 0; $showFutureJobsFlag = TRUE; $showPermanentJobsFlag = TRUE; if (isset($filter_job_future) && $filter_job_future == "") : $showFutureJobsFlag = FALSE; endif; if (isset($filter_job_permanent) && $filter_job_permanent == "") : $showPermanentJobsFlag = FALSE; endif; while ($row = $result->fetch_assoc()): $jobentry = ""; $jbPermanent = "0"; if ($row["jb_permanent"] != "") : $jbPermanent = $row["jb_permanent"]; endif; $jbLonghaul = "0"; if ($row["jb_longhaul"] != "") : $jbLonghaul = $row["jb_longhaul"]; endif; // Filter for displaying jobs. Do not show: // - "sub-jobs" (jb_id_parent is not empty) // - permanent jobs if not requested // Rules to display subjobs: // - CS never sees subjobs // - HQ only sees subjobs if jb_status == "2" // 1. jb_totalprice of the main job > 0 AND jb_totalprice > 0 of the current sub job => no display sub jobs being a credit note // 2. jb_totalprice of the main job < 0 AND jb_totalprice < 0 of the current sub job => no display sub jobs being a debit note $displayCurrentRow = false; if ( ($jbPermanent == "0" || ($jbPermanent > 0 && $showPermanentJobsFlag)) && ( ($userTypeName == "hq") || ($userTypeName == "cs" && ($globalParUseRelatedCustomer == "1" || ($row["jb_id_parent"] == "" || $row["jb_id_parent"] == "0" || $row["jb_id_parent"] == "-1")) ) ) ): $displayCurrentRow = true; endif; // Special treatment for HQ because of the special cases according to subjobs. // Subjobs ONLY are displayed in the list of done jobs (jb_status = "2") if ($displayCurrentRow && $userTypeName == "hq") : $displayCurrentRow = false; if ($globalParUseRelatedCustomer == "1" || ($row["jb_id_parent"] == "" || $row["jb_id_parent"] == "0" || $row["jb_id_parent"] == "-1")) : // Current job is a "normal" job (no sub job) or a main job, no special checks according to sub job $displayCurrentRow = true; else : if ($row["jb_id_parent"] > 0) : // Get jb_totalprice of the mainjob $jbTotalpriceOfMainJOB = getFieldValueFromId("job", "jb_id", $row["jb_id_parent"], "jb_totalprice"); if (($jbTotalpriceOfMainJOB >= 0 && $row["jb_status"] == "2" && $row["jb_totalprice"] >= "0" && $row["jb_id_parent"] > "0") || ($jbTotalpriceOfMainJOB < 0 && $row["jb_status"] == "2" && $row["jb_totalprice"] < "0" && $row["jb_id_parent"] > "0") ) : // ONLY show done jobs $displayCurrentRow = true; endif; endif; endif; endif; // Check access rights regarding the headquarter types (roles) if ($displayCurrentRow && $userTypeName == "hq") : $jbHqIdArr = array($row["jb_hq_id"], $row["jb_hq_id_dispo"], $row["jb_hq_id_exec"], $row["jb_hq_id_sales"]); $jbAccessModeArr = getAccessHqTypeJbStatus($jbHqIdArr, $row["jb_status"], $empHasAccessToLonghaul, $jb_status); // "Anzeige", "�nderung", "Vermittlung" /* // DEBUG ****************************************************** if ($emp_id == "100001" || $emp_id == "200001" || $emp_id == "300001" || $emp_id == "867507" || $emp_id == "853915") : echo "JOB: " . $row["jb_id"] . "    " . "Anz.: " . ($jbAccessModeArr["0"] ? "J" : "N") . "    " . "�nd.: " . ($jbAccessModeArr["1"] ? "J" : "N") . "    " . "Verm.: " . ($jbAccessModeArr["2"] ? "J" : "N") . "
"; endif; // DEBUG ****************************************************** */ $displayCurrentRow = $jbAccessModeArr["0"]; // Access to displyaing job ("Anzeige") endif; // Display job if ($displayCurrentRow) : $rowCounter++; // Get states and finishtimes of all stations of the current job if it has status "taken" $jbTrStatusArr = array(); $jbTrFinishtimeArr = array(); if ($row["jb_status"] == "1") : $jbTrStatusArr = getColVectorFromDB2ArrayByClause("tour", "tr_status", "jb_id = '" . $row["jb_id"] . "'", "tr_sort", "", ""); $jbTrFinishtimeArr = getColVectorFromDB2ArrayByClause("tour", "UNIX_TIMESTAMP(tr_finishtime) AS finishtime", "jb_id = '" . $row["jb_id"] . "' AND tr_status = '1'", "tr_sort", "", ""); endif; // Split output per date (ONLY if sorted by ORDERTIME) if ($showFutureJobsFlag && $row["jb_ordertime"] >= $offsetDate) : if ($fieldsArray[$jb_sort] == "jb_ordertime" && ($row["jb_status"] == "0" || $row["jb_status"] == "8" || $row["jb_status"] == "9")) : $jobentry .= ""; $jobentry .= "

" . getLngt("Auftr�ge ab dem") . " " . $offsetDateOut; $jobentry .= ""; $showFutureJobsFlag = FALSE; endif; endif; // Do not generate an output for empty table rows $outIsNotEmpty = FALSE; // Init checks for single summation of requested summation fields $checkSummationFieldsExecutedByCurrentIteration = array(false,false,false,false,false,false,false,false,false,false); $jobentry .= ""; for ($i = 0; $i < $fieldsLength; $i++) : $outFile = ""; $cellBlinkingState = false; // Init value if ($rowCounter % 2 == 0 && $i % 2 == 0) : $cellColor = "#BBBBFF"; endif; if ($rowCounter % 2 == 0 && $i % 2 == 1) : $cellColor = "#CCCCFF"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 0) : $cellColor = "#DDDDDD"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 1) : $cellColor = "#EEEEEE"; endif; // Change colour if job is not associated with a courier (not placed into the global market) if ($row["jb_status"] == 9 || $row["jb_status"] == 8) : if ($rowCounter % 2 == 0 && $i % 2 == 0) : $cellColor = "#FFBBBB"; endif; if ($rowCounter % 2 == 0 && $i % 2 == 1) : $cellColor = "#FFCCCC"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 0) : $cellColor = "#DDDDDD"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 1) : $cellColor = "#EEEEEE"; endif; endif; // Job is for all couriers if ($row["jb_status"] == 0 && $row["jb_type"] == 1) : if ($rowCounter % 2 == 0 && $i % 2 == 0) : $cellColor = "#BBFFBB"; endif; if ($rowCounter % 2 == 0 && $i % 2 == 1) : $cellColor = "#CCFFCC"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 0) : $cellColor = "#BBFFBB"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 1) : $cellColor = "#CCFFCC"; endif; endif; // Job is incomplete and has to be updated before invoicing if ($row["jb_incomplete"] == 1 && $row["jb_status"] == 2) : if ($rowCounter % 2 == 0 && $i % 2 == 0) : $cellColor = "#FFBBBB"; endif; if ($rowCounter % 2 == 0 && $i % 2 == 1) : $cellColor = "#FFCCCC"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 0) : $cellColor = "#FFBBBB"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 1) : $cellColor = "#FFCCCC"; endif; endif; $tmpVarName = $fieldsArray[$i]; // ${$tmpVarName} = $row[$tmpVarName]; ${$tmpVarName} = mcArrIsSet($row, $tmpVarName); // *** Special treatment of fields *** // Job is permanent if ($tmpVarName == "jb_id" && $jbPermanent > 0 && ($row["jb_status"] == "0" || $row["jb_status"] == "1" || $row["jb_status"] == "8" || $row["jb_status"] == "9")) : $cellColor = "#01C025"; // #01C025 #66FFCC endif; // Job is generated by an employee of another headquarters [Case 1: Inserted by callcenter employee | Case 2: Inserted by employee of another headquarters] if ($userTypeName == "hq") : if ($tmpVarName == "business_volume" || $tmpVarName == "business_volume_gross") : // if ($currentSessionUsrHqId != "" && $row[jb_emp_hq_id] != "" && $row[jb_emp_hq_id] != "0" && $currentSessionUsrHqId != $row[jb_emp_hq_id]) : if ($row["jb_hq_id"] != "" && $row["jb_emp_hq_id"] != "" && $row["jb_hq_id"] != $row["jb_emp_hq_id"]) : $cellColor = "#FFA500"; // Orange endif; endif; if ($tmpVarName == "jb_emp_hq_id") : // if ($currentSessionUsrHqId != "" && $row[jb_emp_hq_id] != "" && $row[jb_emp_hq_id] != "0" && $currentSessionUsrHqId != $row[jb_emp_hq_id]) : if ($row["jb_hq_id"] != "" && $row["jb_emp_hq_id"] != "" && $row["jb_hq_id"] != $row["jb_emp_hq_id"]) : ${$tmpVarName} = "1"; else : ${$tmpVarName} = "0"; endif; endif; endif; // Job is generated by customer if ($userTypeName == "hq") : if ($tmpVarName == "business_volume" || $tmpVarName == "business_volume_gross") : if ($row["jb_csc_id"] > 0 || $row["jb_emp_usr_type"] == "2") : $cellColor = "#FFFF00"; // Init with "yellow" if (($row["gdc_blink_content"] == "1") || ($row["cs_price_warn_uncomplete"] == "1" && (${$tmpVarName} == "0.0000" || ${$tmpVarName} == "0.00" || ${$tmpVarName} == "0"))) : $cellBlinkingState = true; endif; endif; // Set or overwrite cell background colour defined in customer administration if ($row["cs_id_payer"] != "" && is_numeric($row["cs_id_payer"]) && $row["cs_id_payer"] > "0" && in_array($row["cs_id_payer"], $csIdColKeyArray) && $csIdColArray[$row["cs_id_payer"]] != "FFFFFF") : $cellColor = "#" . $csIdColArray[$row["cs_id_payer"]]; endif; endif; endif; // Job has a warning time to be finished if ($userTypeName == "hq") : if ($tmpVarName == "jb_dispoinfo" && ($row["jb_status"] == "0" || $row["jb_status"] == "1" || $row["jb_status"] == "8" || $row["jb_status"] == "9")) : if ($row["jb_warningtime"] != "" && $row["jb_warningtime"] != "0000-00-00 00:00:00" && $currentDateTime >= $row["jb_warningtime"]) : $cellColor = "#FF0000"; // Red ${$tmpVarName} = ${$tmpVarName} . "
" . getLngt("Sp�t.Erl.zeit:") . "
" . formatOutput($row["jb_warningtime"],$outputFormatField["jb_warningtime"]); $arrJbListTitleBgCol[$tmpVarName] = $maskJoblistHeaderFieldsBgColJbDispoinfo; endif; endif; endif; // Ordertime if ($tmpVarName == "jb_ordertime") : $tmp = ${$tmpVarName}; if ($row["jb_reserv"] == 1) : // mktime(hour,minute,second,month,day,year) $latestTakeTime = LATEST_TAKETIME_IN_MINUTES; if (is_numeric($row["srvpt_traveltime"]) && $row["srvpt_traveltime"] > 0) : $latestTakeTime = $row["srvpt_traveltime"]; endif; $compareTime = date("Y-m-d H:i:s", mktime(substr($tmp,11,2),substr($tmp,14,2)-($latestTakeTime),substr($tmp,17,2),substr($tmp,5,2),substr($tmp,8,2),substr($tmp,2,2))); else : $compareTime = date("Y-m-d H:i:s", mktime(substr($tmp,11,2),substr($tmp,14,2)+5,substr($tmp,17,2),substr($tmp,5,2),substr($tmp,8,2),substr($tmp,2,2))); endif; mcIsSet($maskJoblistHeaderFieldsBgColJbOrdertime); if ((date("Y-m-d H:i:s") > $compareTime) && ($row["jb_status"] == "0" || $row["jb_status"] == "8" || $row["jb_status"] == "9") && $row["jb_offer"] != "1") : if ($rowCounter % 2 == 0 && $i % 2 == 0) : $cellColor = "#FF1133"; endif; if ($rowCounter % 2 == 0 && $i % 2 == 1) : $cellColor = "#FF3333"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 0) : $cellColor = "#FF4444"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 1) : $cellColor = "#FF5555"; endif; $arrJbListTitleBgCol[$tmpVarName] = $maskJoblistHeaderFieldsBgColJbOrdertime; endif; // If a courier has taken an AD HOC job then check first station is finished if ($row["jb_reserv"] != 1 && $maskJoblistTakenJobOrdertimePlusOffsetMinutes != "" && is_numeric($maskJoblistTakenJobOrdertimePlusOffsetMinutes)) : $offsetDateTime = getDateTime("datetime_plus_offset", array(0,-($maskJoblistTakenJobOrdertimePlusOffsetMinutes),0,0,0,0), $formatStr = "Y-m-d H:i:s"); if ($row["jb_status"] == "1" && $row["tr_status"] != "1" && $offsetDateTime >= $row["jb_ordertime"]) : if ($rowCounter % 2 == 0 && $i % 2 == 0) : $cellColor = "#FF1133"; endif; if ($rowCounter % 2 == 0 && $i % 2 == 1) : $cellColor = "#FF3333"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 0) : $cellColor = "#FF4444"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 1) : $cellColor = "#FF5555"; endif; $arrJbListTitleBgCol[$tmpVarName] = $maskJoblistHeaderFieldsBgColJbOrdertime; endif; endif; // If a courier has taken a RESERVATION job then check first station is finished if ($row["jb_reserv"] == 1 && $maskJoblistTakenReservationJobOrdertimePlusOffsetMinutes != "" && is_numeric($maskJoblistTakenReservationJobOrdertimePlusOffsetMinutes)) : $offsetDateTime = getDateTime("datetime_plus_offset", array(0,-($maskJoblistTakenReservationJobOrdertimePlusOffsetMinutes),0,0,0,0), $formatStr = "Y-m-d H:i:s"); if ($row["jb_status"] == "1" && $row["tr_status"] != "1" && $offsetDateTime >= $row["jb_ordertime"]) : if ($rowCounter % 2 == 0 && $i % 2 == 0) : $cellColor = "#FF1133"; endif; if ($rowCounter % 2 == 0 && $i % 2 == 1) : $cellColor = "#FF3333"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 0) : $cellColor = "#FF4444"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 1) : $cellColor = "#FF5555"; endif; $arrJbListTitleBgCol[$tmpVarName] = $maskJoblistHeaderFieldsBgColJbOrdertime; endif; endif; endif; // Latest taketime if ($tmpVarName == "jb_latesttaketime") : if ($row["jb_waittime"] != "") : ${$tmpVarName} = $row["jb_waittime"]; else : $tmp = ${$tmpVarName}; if ($row["jb_reserv"] == 1) : // mktime(hour,minute,second,month,day,year) $latestTakeTime = LATEST_TAKETIME_IN_MINUTES; if (is_numeric($row["srvpt_traveltime"]) && $row["srvpt_traveltime"] > 0) : $latestTakeTime = $row["srvpt_traveltime"]; endif; ${$tmpVarName} = date("Y-m-d H:i:s", mktime(substr($tmp,11,2),substr($tmp,14,2)-($latestTakeTime),substr($tmp,17,2),substr($tmp,5,2),substr($tmp,8,2),substr($tmp,2,2))); else : ${$tmpVarName} = date("Y-m-d H:i:s", mktime(substr($tmp,11,2),substr($tmp,14,2)+5,substr($tmp,17,2),substr($tmp,5,2),substr($tmp,8,2),substr($tmp,2,2))); endif; endif; if ((date("Y-m-d H:i:s") > ${$tmpVarName}) && ($row["jb_status"] == "0" || $row["jb_status"] == "8" || $row["jb_status"] == "9") && $row["jb_offer"] != "1") : if ($rowCounter % 2 == 0 && $i % 2 == 0) : $cellColor = "#FF1133"; endif; if ($rowCounter % 2 == 0 && $i % 2 == 1) : $cellColor = "#FF3333"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 0) : $cellColor = "#FF4444"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 1) : $cellColor = "#FF5555"; endif; endif; endif; // All zipcodes of the tour if ($tmpVarName == "jb_tourzipcodes") : if ($row["jb_tourzipcodes"] != "" && !(strpos($row["jb_tourzipcodes"], "|") === false)) : // Zipcodes $jbZipcodes = substr($row["jb_tourzipcodes"], 0, strpos($row["jb_tourzipcodes"], "|")); $jbZipcodes = trim($jbZipcodes); if (substr($jbZipcodes, -1) == ";") : // Remove last character if ";" again $jbZipcodes = substr($jbZipcodes, 0, -1); endif; // Countries $jbCountries = substr($row["jb_tourzipcodes"], strrpos($row["jb_tourzipcodes"], "|") + 1); $jbCountries = trim($jbCountries); if (substr($jbZipcodes, -1) == ";") : // Remove last character if ";" again $jbCountries = substr($jbCountries, 0, -1); endif; // Display zipcodes (with country if not "DE") // Zipcodes $jbZipcodes = str_replace (";", ",", $jbZipcodes); $jbZipcodesArray = explode(",", $jbZipcodes); $jbZipcodesArrayLen = count($jbZipcodesArray); // Countries $jbCountries = str_replace (";", ",", $jbCountries); $jbCountriesArray = explode(",", $jbCountries); // Display with brackets if station finished for ($j = 0; $j < $jbZipcodesArrayLen; $j++) : if ($row["jb_status"] == "1") : // if ($row["tr" . ($j + 1) . "_status"] == "1") : if ($jbTrStatusArr[($j + 1)] == "1") : // $jbZipcodesArray[$j] = "(" . ($jbCountriesArray[$j] != "DE" ? $jbCountriesArray[$j] . "_" : "") . $jbZipcodesArray[$j] . ")"; $jbZipcodesArray[$j] = "" . ($jbCountriesArray[$j] != "DE" ? $jbCountriesArray[$j] . "_" : "") . $jbZipcodesArray[$j] . ""; else : $jbZipcodesArray[$j] = ($jbCountriesArray[$j] != "DE" ? $jbCountriesArray[$j] . "_" : "") . $jbZipcodesArray[$j]; endif; else : $jbZipcodesArray[$j] = ($jbCountriesArray[$j] != "DE" ? $jbCountriesArray[$j] . "_" : "") . $jbZipcodesArray[$j]; endif; endfor; $jbZipcodes = implode(", ", $jbZipcodesArray); ${$tmpVarName} = $jbZipcodes; else : ${$tmpVarName} = $row["ad_zipcode"]; if ($row["ad2_zipcode"] != "") : ${$tmpVarName} .= ", " . $row["ad2_zipcode"]; endif; endif; endif; // All cities of the tour if ($tmpVarName == "jb_tourcities") : if ($row["jb_tourcities"] != "" && !(strpos($row["jb_tourcities"], "|") === false)) : $jbCities = substr($row["jb_tourcities"], strpos($row["jb_tourcities"], "|") + 1); $jbCities = substr($jbCities, 0, strrpos($jbCities, "|")); $jbCities = trim($jbCities); if (substr($jbCities, -1) == ";") : // Remove last character if ";" again $jbCities = substr($jbCities, 0, -1); endif; $jbCities = str_replace (";", ", ", $jbCities); ${$tmpVarName} = $jbCities; else : ${$tmpVarName} = $row["ad_city"]; if ($row["ad2_city"] != "") : ${$tmpVarName} .= ", " . $row["ad2_city"]; endif; endif; endif; // Optional summation of one or more fields if (!$checkSummationFieldsExecutedByCurrentIteration[0] && $summationField != "" && ($tmpVarName == $summationField) && is_numeric(${$tmpVarName})) : // Check for row is NOT a subjob if ($globalParUseRelatedCustomer == "1" || !($row["jb_id_parent"] > "0")) : // && ($row["jb_storno"] == "" || $row["jb_storno"] == "0") <=> not in use because of existence of corresponding credit note $sumOfSummationField += ${$tmpVarName}; $checkSummationFieldsExecutedByCurrentIteration[0] = true; endif; endif; if (!$checkSummationFieldsExecutedByCurrentIteration[1] && $summationField2 != "" && ($tmpVarName == $summationField2) && is_numeric(${$tmpVarName})) : // Check for row is NOT a subjob if ($globalParUseRelatedCustomer == "1" || !($row["jb_id_parent"] > "0")) : // && ($row["jb_storno"] == "" || $row["jb_storno"] == "0") <=> not in use because of existence of corresponding credit note $sumOfSummationField2 += ${$tmpVarName}; $checkSummationFieldsExecutedByCurrentIteration[1] = true; endif; endif; if (!$checkSummationFieldsExecutedByCurrentIteration[2] && $summationField3 != "" && ($tmpVarName == $summationField3) && is_numeric(${$tmpVarName})) : // Check for row is NOT a subjob if ($globalParUseRelatedCustomer == "1" || !($row["jb_id_parent"] > "0")) : // && ($row["jb_storno"] == "" || $row["jb_storno"] == "0") <=> not in use because of existence of corresponding credit note $sumOfSummationField3 += ${$tmpVarName}; $checkSummationFieldsExecutedByCurrentIteration[2] = true; endif; endif; if (!$checkSummationFieldsExecutedByCurrentIteration[3] && $summationField4 != "" && ($tmpVarName == $summationField4) && is_numeric(${$tmpVarName})) : // Check for row is NOT a subjob if ($globalParUseRelatedCustomer == "1" || !($row["jb_id_parent"] > "0")) : // && ($row["jb_storno"] == "" || $row["jb_storno"] == "0") <=> not in use because of existence of corresponding credit note $sumOfSummationField4 += ${$tmpVarName}; $checkSummationFieldsExecutedByCurrentIteration[3] = true; endif; endif; // Convert output from "float" to "float_rounded_2" if ($tmpVarName == "jb_cr_price" && is_numeric($row["jb_cr_price"])) : $outputFormatField[$tmpVarName] = "float_rounded_2"; endif; if ($tmpVarName == "jb_bsg") : if ($row["jb_bsg"] != 0 && $row["jb_totalprice"] != 0) : $outputFormatField[$tmpVarName] = "float_rounded_2"; // ${$tmpVarName} = ((($row[jb_totalprice] - $row[jb_bsg]) / $row[jb_totalprice]) * 100); ${$tmpVarName} = $row["jb_bsg"]; else : ${$tmpVarName} = 0; endif; endif; // Convert output "float_rounded_2" if (($tmpVarName == "jb_km" && is_numeric($row["jb_km"])) || ($tmpVarName == "jb_co2e" && is_numeric($row["jb_co2e"]))) : $outputFormatField[$tmpVarName] = "float_rounded_2"; endif; // Screen output $out = formatOutput(${$tmpVarName},mcArrIsSet($outputFormatField, $tmpVarName)); // File output $outFile = $out; // Specials for output, e.g. to avoid -tags, etc. if ($tmpVarName == "jb_reserv" && $row["jb_reserv"] == 1) : $outFile = getLngt("JA"); endif; if ($tmpVarName == "jb_permanent" && $row["jb_permanent"] == 1) : $outFile = getLngt("JA"); endif; if ($tmpVarName == "jb_csc_id" && $row["jb_csc_id"] > 0) : $outFile = getLngt("JA"); endif; if ($tmpVarName == "cr_id_favoured" && $row["cr_id_favoured"] > 0) : $outFile = getLngt("JA"); endif; if ($tmpVarName == "jb_storno") : $outFile = getLngt("Storno/Gegenbuchung"); endif; if ($tmpVarName == "jb_emp_hq_id" && $currentSessionUsrHqId != $row["jb_hq_id"]) : $outFile = getLngt("JA"); endif; // Traveltime if ($tmpVarName == "jb_traveltime") : if ($row["jb_status"] == "0" || ($row["jb_status"] == "1" && $row["tr_sort"] == "1" && $row["tr_status"] != "1") || $row["jb_status"] == "8" || $row["jb_status"] == "9") : if (${$tmpVarName} == 0) : $out = "" . getLngt("0 min") . ""; else : if ($row["jb_reserv"] == "1") : if (${$tmpVarName} < 0) : $out = getTimeSpan((-${$tmpVarName} * 60), "12"); else : $out = "" . "- " . getTimeSpan((${$tmpVarName} * 60), "2") . ""; endif; else : if (${$tmpVarName} < 0) : $out = "" . "- " . getTimeSpan((-${$tmpVarName} * 60), "2") . ""; else : $out = getTimeSpan((${$tmpVarName} * 60), "12"); endif; endif; endif; else : $out = ""; endif; endif; if ($tmpVarName == "jb_tourname") : $out = substr($out,0,MASK_JOBLIST_LENGTH_TOURNAME); $outFile = $row["jb_tourname"]; endif; if ($tmpVarName == "jb_id" || $tmpVarName == "jb_tourname") : if ($globalParUseRelatedCustomer == "1") : $tmpJbId = $row["jb_id"]; $tmpOut = $out; if ($tmpVarName == "jb_id") : $tmpOut = $row["jb_id"] . "/1"; if ($row["jb_id_parent"] > "0") : $tmpOut = $row["jb_id_parent"] . "/2"; endif; endif; $out = $tmpOut; // if ($jbAccessModeArr["1"]) : $out = "" . $tmpOut . ""; // endif; $outFile = $tmpOut; else : // Check job for being a subjob $tmpJbId = $row["jb_id"]; if ($row["jb_id_parent"] > "0") : $tmpJbId = $row["jb_id_parent"]; endif; // if ($jbAccessModeArr["1"]) : $out = "" . $out . ""; // endif; endif; endif; if ($tmpVarName == "jb_storno") : if (($row["jb_export_time"] == "" || $row["jb_export_time"] == "0000-00-00 00:00:00" || $row["jb_export_time"] == "9999-12-31 23:59:59") && ($globalParUseRelatedCustomer == "1" || ($row["jb_id_parent"] == "" || $row["jb_id_parent"] == "0" || $row["jb_id_parent"] == "-1"))) : if ($userTypeName == "hq" || ($userTypeName == "cs" && $row["jb_status"] != 2)) : if (${$tmpVarName} == "" || ${$tmpVarName} == "0") : // Check for access to storno link regarding the payment being CASH ONLY (!!!!) $showStornoLink = true; $jbpIdStorno = ""; if ($globalParUseRelatedCustomer == "1") : if ($stornoCheckPayment == "1") : $showStornoLink = false; // Storno for jb_status == 9 OR jb_status == 0 ONLY (!!!!) // In case of storno for every job has to be created a credit note for the customer, except the case for CASH payment only at the counter if ($row["jb_status"] == 9 || $row["jb_status"] == 0) : $jbpIdStorno = getFieldValueFromClause("jobpayment","jbp_id","jb_id = '" . $row["jb_id"] . "' AND jbp_mode = '0' AND jbp_counter = '1'"); if ($jbpIdStorno != "") : $showStornoLink = true; // Payment in cash, link can be displayed else : // Check existence of another payment mode $jbpIdStorno = getFieldValueFromClause("jobpayment","jbp_id","jb_id = '" . $row["jb_id"] . "' AND jbp_mode != '0' AND jbp_counter = '1'"); if ($jbpIdStorno == "") : $showStornoLink = true; // In this case no payment has been done, therefore display the storno link endif; endif; endif; endif; endif; if ($userTypeName == "cs") : $showStornoLink = false; if ($row["jb_status"] == 8 || $row["jb_status"] == 9) : $jbStornoEmpUsrType = ""; if ($row["jb_csc_id"] == 0) : $jbStornoEmpUsrType = getFieldValueFromId("user","usr_id",$row["emp_id"],"usr_type"); endif; if ($row["jb_csc_id"] > 0 || $jbStornoEmpUsrType == "2") : $showStornoLink = true; endif; endif; endif; if ($showStornoLink && $jbAccessModeArr["1"]) : // if ($row["jb_status"] == 0 || $row["jb_status"] == 9) : $out = "" . getLngt("Storno") . ""; $outFile = $outPlaceholderLink; // else : // $out = ""; // $outFile = ""; // endif; endif; else : if ($rowCounter % 2 == 0 && $i % 2 == 0) : $cellColor = "#FF2222"; endif; if ($rowCounter % 2 == 0 && $i % 2 == 1) : $cellColor = "#FF3333"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 0) : $cellColor = "#FF4444"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 1) : $cellColor = "#FF5555"; endif; if (${$tmpVarName} == "1") : $out = getLngt("St.m.K."); $outFile = $out; elseif (${$tmpVarName} == "2") : $out = getLngt("St.o.K."); $outFile = $out; endif; endif; else : if ($userTypeName == "cs" && $row["jb_status"] == 2 && (${$tmpVarName} == "1" || ${$tmpVarName} == "2")) : $out = getLngt("Storniert"); $outFile = $out; endif; endif; else : $out = ""; $outFile = $out; endif; endif; // Only jobs generated by customers or jobs generated by headquarters can be modified if (($userTypeName == "hq" || ($row["jb_csc_id"] > 0 && MASK_JB_CS_EDITJOB == "1" && ($row["jb_status"] == "8" || $row["jb_status"] == "9"))) && $tmpVarName == "jb_edit") : // $userTypeName == "hq" && if ($globalParUseRelatedCustomer == "1") : if (($row["jb_export_time"] == "" || $row["jb_export_time"] == "0000-00-00 00:00:00") && ($jobEditOffersOnly == "" || ($jobEditOffersOnly == "1" && $row["jb_offer"] == "1"))) : $tmpJbId = $row["jb_id"]; $tmpOut = $row["jb_id"] . "/1"; if ($row["jb_id_parent"] > "0") : $tmpOut = $row["jb_id_parent"] . "/2"; endif; $out = $tmpJbId; if ($jbAccessModeArr["1"]) : $out = "" . $tmpOut . ""; endif; $outFile = $tmpOut; else : $out = ""; $outFile = $out; endif; else : if (($row["jb_export_time"] == "" || $row["jb_export_time"] == "0000-00-00 00:00:00") && ($jobEditOffersOnly == "" || ($jobEditOffersOnly == "1" && $row["jb_offer"] == "1"))) : // Check job for being a subjob $tmpJbId = $row["jb_id"]; if ($row["jb_id_parent"] > "0") : $tmpJbId = $row["jb_id_parent"]; endif; $out = $row["jb_id"]; if ($jbAccessModeArr["1"]) : $out = "" . $row["jb_id"] . ""; endif; $outFile = $row["jb_id"]; // if ($row["jb_id_parent"] == "-1") : // $out = "* " . $out . " *"; // endif; if ($row["jb_id_parent"] > "0") : $out = "* " . $out . " *"; $outFile = "* " . $outFile . " *"; endif; $outFile = $outPlaceholderLink . " [" . $outFile . "]"; else : $out = ""; $outFile = ""; if ($row["jb_id_parent"] == "-1") : $out = "* " . getLngt("HA") . " *"; $outFile = "* " . getLngt("HA") . " *"; endif; if ($row["jb_id_parent"] > "0") : $out = "* " . getLngt("UA") . " *"; $outFile = "* " . getLngt("UA") . " *"; endif; endif; endif; endif; if ($userTypeName == "cs" && $tmpVarName == "cr_sid" && $parDispoFavEnabled == "1") : if ($globalParUseRelatedCustomer != "1" && $row["jb_status"] != "2" && ($row["jb_export_time"] == "" || $row["jb_export_time"] == "0000-00-00 00:00:00")) : if ($row["jb_hq_id"] != "" && is_numeric($row["jb_hq_id"])) : $f_hq_id_string = $row["jb_hq_id"]; endif; if ($row["cr_sid"] == "") : $out = "???"; if ($jbAccessModeArr["2"]) : $out = "" . "???" . ""; endif; $outFile = "???"; else : $out = "" . $row["cr_sid"] . ""; $outFile = $row["cr_sid"]; endif; endif; endif; if ($userTypeName == "hq" && $tmpVarName == "cr_sid") : // Check for subjob, if it is then no output ... if ($globalParUseRelatedCustomer == "1" || ($row["jb_id_parent"] == "" || $row["jb_id_parent"] == "0" || $row["jb_id_parent"] == "-1")) : if (($row["jb_export_time"] == "" || $row["jb_export_time"] == "0000-00-00 00:00:00") && ($jbLonghaul == "0" || ($jbLonghaul == "1" || $jbLonghaul == "3") && authCheckEmployeeRights($emp_id, "10")) ) : // Takes care that the vehicle disposition view will have vehicles from the job headquarters only. // "$f_hq_id_string" will be overwritten, probably it does take affect each time for all displayed jobs if ($row["jb_hq_id"] != "" && is_numeric($row["jb_hq_id"])) : $f_hq_id_string = $row["jb_hq_id"]; endif; // Set new cell background colour defined in customer administration /* if ($row["cs_id_payer"] != "" && is_numeric($row["cs_id_payer"]) && $row["cs_id_payer"] > "0" && in_array($row["cs_id_payer"], $csIdColKeyArray) && $csIdColArray[$row["cs_id_payer"]] != "FFFFFF") : $cellColor = "#" . $csIdColArray[$row["cs_id_payer"]]; endif; */ if ($row["cr_sid"] == "") : if ($globalParUseRelatedCustomer != "1") : $out = "???"; if ($jbAccessModeArr["2"]) : $out = "" . "???" . ""; endif; $outFile = "???"; endif; else : if ($globalParUseRelatedCustomer == "1") : $out = $row["cr_sid"]; $outFile = $out; else : $out = $row["cr_sid"]; if ($jbAccessModeArr["2"]) : $out = "" . $row["cr_sid"] . ""; endif; $outFile = $row["cr_sid"]; endif; // Show red brackets if at least one stop of the tour (the first one) is done (ONLY taken jobs!) if ($row["jb_status"] == "1") : if ($row["tr_status"] == "1") : $out = "(" . $out . ")"; endif; endif; if ($row["jb_status"] == "2") : $out = $row["cr_sid"]; $outFile = $out; endif; // Show alert if time between the legs of the tour if (MASK_JOBLIST_ALERT_LEG_TIME_SECONDS != "" && is_numeric(MASK_JOBLIST_ALERT_LEG_TIME_SECONDS)) : $maxDeltaLegTime = MASK_JOBLIST_ALERT_LEG_TIME_SECONDS; $jbTrStatusArrKey = array_keys($jbTrStatusArr); $jbTrStatusArrKeyLen = count($jbTrStatusArrKey); // Iterate all "tr_sort" (<=> keys of $jbTrStatusArr) for ($x = 0; $x < $jbTrStatusArrKeyLen; $x++) : $tmpTrSort = $jbTrStatusArrKey[$x]; if ($tmpTrSort >= "2") : if ($jbTrStatusArr[$tmpTrSort] == "1" && $jbTrStatusArr[($tmpTrSort - 1)] == "1") : if (($jbTrFinishtimeArr[$tmpTrSort] - $jbTrFinishtimeArr[($tmpTrSort - 1)]) < $maxDeltaLegTime) : $out .= "!"; endif; endif; endif; endfor; endif; endif; else : if (($jbLonghaul == "1" || $jbLonghaul == "3") && !authCheckEmployeeRights($emp_id, "10")) : $out = "FT"; // Longhaul job not to be mediated by employees without mandatory right ("FT" = "Ferntour") $outFile = $out; else : $out = $row["cr_sid"]; $outFile = $out; endif; endif; // Check job is an offer if ($row["jb_offer"] == "1") : $out = getLngt("Angebot"); $outFile = $out; endif; else : $out = $row["cr_sid"]; $outFile = $out; endif; endif; if ($tmpVarName == "vht_value" && $row["jb_cr_filter"] != "") : for ($j = 0; $j < $vehicleFilterLen; $j++) : if (!(strpos($row["jb_cr_filter"] . ",", $vehicleFilter[$j] . ",") === FALSE)) : $out .= " " . $vehicleFilter[$j]; $outFile = $out; endif; endfor; endif; // Set the colour of the credit notes if ($userTypeName == "hq" && MASK_JOBLIST_CREDITNOTE_COLOUR == "1") : if (($tmpVarName == "business_volume" && is_numeric($row["business_volume"]) && $row["business_volume"] < 0) || ($tmpVarName == "jb_cr_price" && is_numeric($row["jb_cr_price"]) && $row["jb_cr_price"] < 0)) : $out = "" . $out . ""; endif; if (($tmpVarName == "business_volume_gross" && is_numeric($row["business_volume_gross"]) && $row["business_volume_gross"] < 0) || ($tmpVarName == "jb_cr_price" && is_numeric($row["jb_cr_price"]) && $row["jb_cr_price"] < 0)) : $out = "" . $out . ""; endif; endif; // Set the colour of the BSG if ($userTypeName == "hq") : if ($tmpVarName == "jb_bsg" && is_numeric($row["jb_bsg"]) && $row["jb_bsg"] < 0) : $out = "" . $out . ""; endif; endif; // Customer-sign if ($tmpVarName == "tour_1_sign" || $tmpVarName == "tour_2_sign" || $tmpVarName == "tour_3_sign" || $tmpVarName == "tour_4_sign" || $tmpVarName == "tour_5_sign" || $tmpVarName == "tour_6_sign") : if ($row["tr_sign"] != "") : $rawCoord = splitRawCoordinates ($row[$tmpVarName]); $maxCoord = checkMaxCoordinates($rawCoord); // if ($jbAccessModeArr["1"]) : $out = ""; // endif; $outFile = ""; endif; endif; if ($userTypeName == "hq" && $tmpVarName == "jb_cs_report") : // Check for having reports $tmpCscIdPayerReport = $row["jb_cs_report"]; if ($tmpCscIdPayerReport > "0") : $out = ""; $outFile = ""; if ($jbAccessModeArr["1"]) : $out = ""; $outFile = $outPlaceholderLink; endif; endif; endif; if ($userTypeName == "hq" && $tmpVarName == "jb_tr_sort" && ($row["jb_status"] == "9" || $row["jb_status"] == "8" || $row["jb_status"] == "0" || $row["jb_status"] == "1")) : $out = ""; $outFile = ""; if ($jbAccessModeArr["1"]) : $tmpJbId = $row["jb_id"]; $out = ""; $outFile = $outPlaceholderLink; endif; endif; if ($userTypeName == "hq" && $tmpVarName == "jb_cs_documents") : // Check for having documents $tmpCscIdPayerDocument = $row["jb_cs_documents"]; if ($tmpCscIdPayerDocument > "0") : $out = ""; $outFile = $out; $showLinkToCsDocuments = true; if ($checkNumOfCsDocuments != "" && $docPath != "") : $showLinkToCsDocuments = false; // Get EID from the customer $tmpCsId = getFieldValueFromId("costcenter", "csc_id", $tmpCscIdPayerDocument, "cs_id"); $tmpCsEid = getFieldValueFromId("customer", "cs_id", $tmpCsId, "cs_eid"); // Get number of documents for the current customer $numOfFiles = getNumOfFilesByFilterInFolder($docPath, $tmpCsEid . "_", "1"); if ($numOfFiles > 0) : $showLinkToCsDocuments = true; endif; endif; if ($showLinkToCsDocuments) : $out = ""; $outFile = ""; if ($jbAccessModeArr["1"]) : $out = ""; $outFile = $outPlaceholderLink; endif; endif; endif; endif; if ($userTypeName == "hq" && $tmpVarName == "jb_map") : // Check for having reports $tmpjbIdMap = $row["jb_map"]; if ($tmpjbIdMap > "0") : $out = ""; $outFile = ""; if ($jbAccessModeArr["1"]) : $out = ""; $outFile = $outPlaceholderLink; endif; endif; endif; if (trim($out) != ""): $outIsNotEmpty = TRUE; // Check for blinking if ($classNameBlink != "" && $cellBlinkingState) : $out = "" . $out . ""; $activateJS4Blinking = true; // At least one cell has to blink $cellBlinkingState = false; // Reset value not to have blinking in the next fields endif; endif; if ($userTypeName == "cs" && $tmpVarName == "tr_remark") : // Remove some internal annotations fron station remark if (!(strpos($out, "[[") === false) && !(strpos($out, "]]") === false)) : $jb_cr_priceStr = strstr($out, "[["); $jb_cr_priceStr = substr($jb_cr_priceStr, 0, strpos($jb_cr_priceStr, "]]", 2) + 2); $out = str_replace($jb_cr_priceStr, "", $out); endif; $out = nl2br($out); endif; // Screen output mcArrIsSet($alignsArray, $i); mcArrIsSet($valignsArray, $i); mcArrIsSet($cellTextPreArray, $i); $jobentry .= " " . ($cellTextPreArray[$i] != "" ? $cellTextPreArray[$i] : "") . $out . " "; // File output $outFile = str_replace(" ", "", $outFile); if ($fileOutput == "1") : $outArr2File[$rowCounter][] = $outFile; endif; // Check for newline ("linefeed") if ($newline != ""): $nlValue = substr($newline, $i, 1); if ($nlValue == "1") : $jobentry .= ""; endif; endif; endfor; $jobentry .= ""; // Check for newline ("linefeed") if (is_numeric($emptylines) && $emptylines >= "1"): for ($k = 1; $k <= $rowArrayLen; $k++) : $jobentry .= " 
 "; endfor; endif; // Do not generate an output for emty table rows if ($outIsNotEmpty == FALSE) : $jobentry = ""; endif; $tableBody .= $jobentry; endif; // Filter for displaying jobs endwhile; ?>