1. Import
This commit is contained in:
947
html/include/jb_list_defineoutput_MC.inc.php
Normal file
947
html/include/jb_list_defineoutput_MC.inc.php
Normal file
@@ -0,0 +1,947 @@
|
||||
<?php
|
||||
/*=======================================================================
|
||||
*
|
||||
* jb_list_defineoutput.inc.php
|
||||
*
|
||||
* Autor: Marc Vollmann
|
||||
*
|
||||
=======================================================================*/
|
||||
|
||||
include_once ("../include/image.inc.php");
|
||||
include_once ("../include/inc_file.inc.php");
|
||||
|
||||
getLanguage(__FILE__);
|
||||
|
||||
// Initialisation
|
||||
$sumOfSummationField = 0;
|
||||
$sumOfSummationField2 = 0;
|
||||
$sumOfSummationField3 = 0;
|
||||
$sumOfSummationField4 = 0;
|
||||
if (!isset($tableBody)) : $tableBody = ""; endif;
|
||||
if (!isset($globalParUseRelatedCustomer)) : $globalParUseRelatedCustomer = ""; endif;
|
||||
if (!isset($summationField)) : $summationField = ""; endif;
|
||||
if (!isset($summationField2)) : $summationField2 = ""; endif;
|
||||
if (!isset($summationField3)) : $summationField3 = ""; endif;
|
||||
if (!isset($summationField4)) : $summationField4 = ""; endif;
|
||||
if (!isset($newline)) : $newline = ""; endif;
|
||||
if (!isset($emptylines)) : $emptylines = ""; endif;
|
||||
if (!isset($noColoredCells)) : $noColoredCells = ""; endif;
|
||||
if (!isset($classNameBlink)) : $classNameBlink = ""; endif;
|
||||
$activateJS4Blinking = false;
|
||||
if (!isset($checkNumOfCsReports)) : $checkNumOfCsReports = ""; endif;
|
||||
if (!isset($stornoCheckPayment)) : $stornoCheckPayment = ""; endif;
|
||||
if (!isset($checkNumOfCsDocuments)) : $checkNumOfCsDocuments = ""; endif;
|
||||
if (!isset($docPath)) : $docPath = ""; endif;
|
||||
if (!isset($noTableHeader)) : $noTableHeader = ""; endif;
|
||||
if (!isset($jobEditPath)) : $jobEditPath = "jobs"; endif;
|
||||
if (!isset($jobEditParameter)) : $jobEditParameter = ""; endif;
|
||||
if (!isset($maskJoblistTakenJobOrdertimePlusOffsetMinutes)) : $maskJoblistTakenJobOrdertimePlusOffsetMinutes = ""; endif;
|
||||
if (!isset($maskJoblistTakenReservationJobOrdertimePlusOffsetMinutes)) : $maskJoblistTakenReservationJobOrdertimePlusOffsetMinutes = ""; endif;
|
||||
if (!isset($jobEditOffersOnly)) : $jobEditOffersOnly = ""; endif;
|
||||
if (!isset($parDispoFavEnabled)) : $parDispoFavEnabled = ""; endif;
|
||||
if (!isset($arrJbListTitleBgCol)) : $arrJbListTitleBgCol = array(); endif;
|
||||
if (!isset($fileOutput)) : $fileOutput = "0"; endif;
|
||||
|
||||
$jbAccessModeArr = array(true, true, true); // Init: ("Anzeige", "<22>nderung", "Vermittlung")
|
||||
|
||||
// Global access to longhaul jobs
|
||||
$empHasAccessToLonghaul = false;
|
||||
if (authCheckEmployeeRights($emp_id, "44")) : $empHasAccessToLonghaul = true; endif;
|
||||
// DEBUG ******************************************************
|
||||
/*
|
||||
if ($emp_id == "100001" || $emp_id == "200001" || $emp_id == "300001" || $emp_id == "867507" || $emp_id == "853915") :
|
||||
$hqArrX = getColVectorFromDB2ArrayByClause("headquarters", "hq_mnemonic", "", "hq_id", "hq_mnemonic", "");
|
||||
echo "<b>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 . " </b><br><br>";
|
||||
endif;
|
||||
*/
|
||||
// DEBUG ******************************************************
|
||||
// Optional output as file (CSV)
|
||||
if ($fileOutput == "1") : $outArr2File = array(); endif;
|
||||
$outPlaceholderLink = "[LINK]";
|
||||
|
||||
// Header of the list
|
||||
$tableHeader = "";
|
||||
if ($noTableHeader == "") :
|
||||
$tableHeader = "<tr>";
|
||||
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 .= "<td align=\"center\">" . $titlesArray[$i] . "</td>";
|
||||
$tableHeader .= "<td id=\"listheader_" . $fieldsArray[$i] . "\" align=\"center\"><a href=\"javascript:document.forms[0].jb_sort.value=" . $i . "; finishPage();\">" . $titlesArray[$i] . "</a></td>";
|
||||
|
||||
// Check for newline ("linefeed")
|
||||
if ($newline != ""):
|
||||
$nlValue = substr($newline, $i, 1);
|
||||
if ($nlValue == "1") :
|
||||
$tableHeader .= "</tr><tr>";
|
||||
endif;
|
||||
endif;
|
||||
endfor;
|
||||
$tableHeader .= "</tr>";
|
||||
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", "<22>nderung", "Vermittlung"
|
||||
/*
|
||||
// DEBUG ******************************************************
|
||||
if ($emp_id == "100001" || $emp_id == "200001" || $emp_id == "300001" || $emp_id == "867507" || $emp_id == "853915") :
|
||||
echo "<b>JOB: " . $row["jb_id"] . " " . "Anz.: " . ($jbAccessModeArr["0"] ? "J" : "N") . " " . "<22>nd.: " . ($jbAccessModeArr["1"] ? "J" : "N") . " " . "Verm.: " . ($jbAccessModeArr["2"] ? "J" : "N") . "</b><br>";
|
||||
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 .= "<tr><td class=\"f8np1\" colspan=\"" . $fieldsLength . "\">";
|
||||
$jobentry .= "<br><br>" . getLngt("Auftr<EFBFBD>ge ab dem") . " " . $offsetDateOut;
|
||||
$jobentry .= "</td></tr>";
|
||||
$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 .= "<tr>";
|
||||
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} . "<br>" . getLngt("Sp<EFBFBD>t.Erl.zeit:") . "<br>" . 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] = "<span class=\"f8np1_red\">(</span>" . ($jbCountriesArray[$j] != "DE" ? $jbCountriesArray[$j] . "_" : "") . $jbZipcodesArray[$j] . "<span class=\"f8np1_red\">)</span>";
|
||||
$jbZipcodesArray[$j] = "<span class=\"f8np1_darkgreen\">" . ($jbCountriesArray[$j] != "DE" ? $jbCountriesArray[$j] . "_" : "") . $jbZipcodesArray[$j] . "</span>";
|
||||
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 <img>-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 = "<span class=\"f8np1_red\">" . getLngt("0 min") . "</span>";
|
||||
else :
|
||||
if ($row["jb_reserv"] == "1") :
|
||||
if (${$tmpVarName} < 0) :
|
||||
$out = getTimeSpan((-${$tmpVarName} * 60), "12");
|
||||
else :
|
||||
$out = "<span class=\"f8np1_red\">" . "- " . getTimeSpan((${$tmpVarName} * 60), "2") . "</span>";
|
||||
endif;
|
||||
else :
|
||||
if (${$tmpVarName} < 0) :
|
||||
$out = "<span class=\"f8np1_red\">" . "- " . getTimeSpan((-${$tmpVarName} * 60), "2") . "</span>";
|
||||
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 = "<a href=\"javascript:popupWindow('../" . $targetPath . "/jb_detail.php?job_id=" .
|
||||
ec($tmpJbId) . "&dbhistory=" . $dbhistory . $jobEditParameter . "','" . getLngt("Auftrag") . "','');\">" . $tmpOut . "</a>";
|
||||
// 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 = "<a href=\"javascript:popupWindow('../" . $targetPath . "/jb_detail.php?job_id=" .
|
||||
ec($tmpJbId) . "&dbhistory=" . $dbhistory . $jobEditParameter . "','" . getLngt("Auftrag") . "','');\">" . $out . "</a>";
|
||||
// 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 = "<a href=\"javascript:makeStorno(" . $row["jb_id"] . "," . $jbPermanent . ",'" . $row["cr_id"] . "','" . $jbpIdStorno . "');\">" . getLngt("Storno") . "</a>";
|
||||
$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 = "<a href=\"../" . $jobEditPath . "/job_edit.php?jb_id=" . ec($tmpJbId) . $jobEditParameter . "\" target=\"_blank\">" . $tmpOut . "</a>";
|
||||
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 = "<a href=\"../" . $jobEditPath . "/job_edit.php?jb_id=" . ec($tmpJbId) . $jobEditParameter . "\" target=\"_blank\">" . $row["jb_id"] . "</a>";
|
||||
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 = "<a href=\"javascript:mk_cr_id_list('". $row["jb_id"] . "','" . $row["ad_zipcode"] . "','" . $f_hq_id_string . "');\">" . "???" . "</a>";
|
||||
endif;
|
||||
$outFile = "???";
|
||||
else :
|
||||
$out = "<a href=\"javascript:mk_cr_id_list('". $row["jb_id"] . "','" . $row["ad_zipcode"] . "','" . $f_hq_id_string . "');\">" . $row["cr_sid"] . "</a>";
|
||||
$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 = "<a href=\"javascript:mk_cr_id_list('". $row["jb_id"] . "','" . $row["ad_zipcode"] . "','" . $f_hq_id_string . "');\">" . "???" . "</a>";
|
||||
endif;
|
||||
$outFile = "???";
|
||||
endif;
|
||||
else :
|
||||
if ($globalParUseRelatedCustomer == "1") :
|
||||
$out = $row["cr_sid"];
|
||||
$outFile = $out;
|
||||
else :
|
||||
$out = $row["cr_sid"];
|
||||
if ($jbAccessModeArr["2"]) :
|
||||
$out = "<a href=\"javascript:mk_cr_id_list('". $row["jb_id"] . "','" . $row["ad_zipcode"] . "','" . $f_hq_id_string . "');\">" . $row["cr_sid"] . "</a>";
|
||||
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 = "<span class=\"f8np1_red\">(</span>" . $out . "<span class=\"f8np1_red\">)</span>";
|
||||
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 .= "<span class=\"f8np1_red\">!</span>";
|
||||
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 = "<span class=\"f8np1_red\">" . $out . "</span>";
|
||||
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 = "<span class=\"f8np1_red\">" . $out . "</span>";
|
||||
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 = "<span class=\"f8np1_red\">" . $out . "</span>";
|
||||
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 = "<img src=\"../admin/jb_detail_sign2.php?tr_sign=" . $row[$tmpVarName] . "\" border=\"0\" height=\"" . $maxCoord[1] . "\" width=\"" . $maxCoord[0] . "\">";
|
||||
// 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 = "<a href=\"../groupware/report.php?rpObjType=cs&g_csc_id=" . ec($tmpCscIdPayerReport) . "\" target=\"_blank\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a>";
|
||||
$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 = "<a href=\"../admin/sort.php?objType=jb&objId=" . ec($tmpJbId) . "\" target=\"_blank\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a>";
|
||||
$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 = "<a href=\"../import/data_transfer.php?objType=csc_cs&objId=" . ec($tmpCscIdPayerDocument) . "\" target=\"_blank\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a>";
|
||||
$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 = "<a href=\"../locating/map.php?jb_id=" . $tmpjbIdMap . "" . "\" target=\"_blank\"><img src=\"../images/arrow_right.png\" border=\"0\" height=\"10\" width=\"25\"></a>";
|
||||
$outFile = $outPlaceholderLink;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if (trim($out) != ""):
|
||||
$outIsNotEmpty = TRUE;
|
||||
// Check for blinking
|
||||
if ($classNameBlink != "" && $cellBlinkingState) :
|
||||
$out = "<span class=\"" . $classNameBlink . "\">" . $out . "</span>";
|
||||
$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 .= "<td " . ($noColoredCells == "" ? "bgcolor=\"" . $cellColor . "\"" : "") . " align=\"" . setAlign($alignsArray[$i]) . "\" valign=\"" . setAlign($valignsArray[$i]) . "\"> " . ($cellTextPreArray[$i] != "" ? $cellTextPreArray[$i] : "") . $out . " </td>";
|
||||
|
||||
// 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 .= "</tr><tr>";
|
||||
endif;
|
||||
endif;
|
||||
endfor;
|
||||
$jobentry .= "</tr>";
|
||||
|
||||
// Check for newline ("linefeed")
|
||||
if (is_numeric($emptylines) && $emptylines >= "1"):
|
||||
for ($k = 1; $k <= $rowArrayLen; $k++) :
|
||||
$jobentry .= "<tr><td> <br> </td></tr>";
|
||||
endfor;
|
||||
endif;
|
||||
|
||||
// Do not generate an output for emty table rows
|
||||
if ($outIsNotEmpty == FALSE) :
|
||||
$jobentry = "";
|
||||
endif;
|
||||
|
||||
$tableBody .= $jobentry;
|
||||
|
||||
endif; // Filter for displaying jobs
|
||||
endwhile;
|
||||
?>
|
||||
Reference in New Issue
Block a user