0) : // Get the customers associated to the vehicles $csIdArray = getColVectorFromDB2ArrayByClause("customervehicle", "cs_id", "crvh_id IN (" . implode(",", $crvhIdOfCrLoggedInArray) . ")", "", "cs_id", "DISTINCT"); if ($csId == "") : $csId = $csIdArray[0]; $csGroup = getFieldValueFromId("customer","cs_id",$csId,"cs_group"); $csGroupArray = spliti(",", $csGroup); $grpId = $csGroupArray[1]; endif; endif; // Job restrictions for courier logged in (either jb.cr_id is set for taken and finished jobs OR jb.cr_id_order is set AND job is in FDS for the courier) // if ($parRestrictedAccessClauseJob != "") : $parRestrictedAccessClauseJob .= " AND "; endif; $parRestrictedAccessClauseJob .= " (jb.cr_id = '" . $crIdLoggedIn . "' OR (jb.jb_status = '0' AND (NOT ISNULL(jb.cr_id_order) AND jb.cr_id_order != '0') AND EXISTS (SELECT * FROM vehicledisposition AS vhd, couriervehicle AS crvh WHERE vhd.jb_id = jb.jb_id AND vhd.crvh_id = crvh.crvh_id AND crvh.cr_id = '" . $crIdLoggedIn . "'))) AND "; // Vehicle restrictions for courier logged in if ($parRestrictedAccessClauseVehicle != "") : $parRestrictedAccessClauseVehicle .= " AND "; endif; $parRestrictedAccessClauseVehicle .= " crvh.cr_id = '" . $crIdLoggedIn . "' "; endif; // Get global mode of usage $globalParUseRelatedCustomer = getParameterValue("0", "GLOBAL_USE_RELATED_CUSTOMER", "0"); // Global scaling factorfor output if ($timeLineScalingFactor == "" || !is_numeric($timeLineScalingFactor)) : $timeLineScalingFactor = 2; $parMaskDispositionScalingFactorDefault = getParameterValue("0", "MASK_DISPOSITION_SCALING_FACTOR_DEFAULT", $f_hq_id); if ($parMaskDispositionScalingFactorDefault == "") : $parMaskDispositionScalingFactorDefault = getParameterValue("0", "MASK_DISPOSITION_SCALING_FACTOR_DEFAULT", "0"); endif; if ($parMaskDispositionScalingFactorDefault != "" && is_numeric($parMaskDispositionScalingFactorDefault) && $parMaskDispositionScalingFactorDefault >= 1 && $parMaskDispositionScalingFactorDefault <= 9) : $timeLineScalingFactor = $parMaskDispositionScalingFactorDefault; endif; endif; // Mandator filter if ($f_hq_id == "") : $f_hq_id = $hq_id; endif; // Get parameter for displaying eco ID in drag bar $parMaskDispositionItemShowDragbarEcoId = getParameterValue("0", "MASK_DISPOSITION_ITEM_DRAGBAR_SHOW_JB_ID", $f_hq_id); if ($parMaskDispositionItemShowDragbarEcoId == "") : $parMaskDispositionItemShowDragbarEcoId = getParameterValue("0", "MASK_DISPOSITION_ITEM_DRAGBAR_SHOW_JB_ID", "0"); endif; // Get all types of service being a kind of DELIVERY, e.g. "Aufmaß" (service & 4 == 4) will be an installation in every case (service & 2 == 0) $parDeliveryServices = getObjectBasedParameterValue("DISPOSITION_DELIVERYSERVICES", $csId, $f_hq_id); $parDeliveryServiceArray = spliti(",", $parDeliveryServices); $parDeliveryServiceArrayLen = count($parDeliveryServiceArray); // Get all types of service being a kind of INSTALLATION, e.g. "Küche" (service & 16 == 16) will be an installation in every case (service & 2 == 2) $parInstallationServices = getObjectBasedParameterValue("DISPOSITION_INSTALLATIONSERVICES", $csId, $f_hq_id); $parInstallationServiceArray = spliti(",", $parInstallationServices); $parInstallationServiceArrayLen = count($parInstallationServiceArray); // Get service colors $parServiceColours = getObjectBasedParameterValue("MASK_DISPOSITION_SERVICECOLOURS", $csId, $f_hq_id); $serviceColourArray = array(); if ($parServiceColours != "") : $serviceColourArray = getKeyValueArrayFromString($parServiceColours); endif; $serviceColourArrayLen = count($serviceColourArray); // Get parameter for called function for generating cartage note $parMaskDispositionFunctionnameCartageNote = getParameterValue("0", "MASK_DISPOSITION_FUNCTIONNAME_CARTAGE_NOTE", $f_hq_id); if ($parMaskDispositionFunctionnameCartageNote == "") : $parMaskDispositionFunctionnameCartageNote = getParameterValue("0", "MASK_DISPOSITION_FUNCTIONNAME_CARTAGE_NOTE", "0"); if ($parMaskDispositionFunctionnameCartageNote == "") : $parMaskDispositionFunctionnameCartageNote = "getCartageNote"; endif; endif; // Get parameter for displaying clock times on timeline $parMaskDispositionHideHoursOnTimeline = getParameterValue("0", "MASK_DISPOSITION_TIMELINE_HOURS_HIDE", $f_hq_id); if ($parMaskDispositionHideHoursOnTimeline == "") : $parMaskDispositionHideHoursOnTimeline = getParameterValue("0", "MASK_DISPOSITION_TIMELINE_HOURS_HIDE", "0"); endif; // Get parameter for dropping objects on past time slots $parMaskDispositionEnableDroppingOnPastTimeslots = getParameterValue("0", "MASK_DISPOSITION_TIMELINE_ENABLE_DROPPING_ON_PAST_TIMESLOTS", $f_hq_id); if ($parMaskDispositionEnableDroppingOnPastTimeslots == "") : $parMaskDispositionEnableDroppingOnPastTimeslots = getParameterValue("0", "MASK_DISPOSITION_TIMELINE_ENABLE_DROPPING_ON_PAST_TIMESLOTS", "0"); endif; // Check search item $idSearchArray = array(); $search_type = ""; if ($search_item != "") : if ($globalParUseRelatedCustomer != "1" && is_numeric($search_item)) : $searchJbOrdertime = getFieldValueFromClause("job","jb_ordertime","jb_id = '" . $search_item . "' AND hq_id = '" . $hq_id . "'"); if ($searchJbOrdertime != "") : array_push($idSearchArray, $search_item); $selDay = substr($searchJbOrdertime,8,2); $selMonth = substr($searchJbOrdertime,5,2); $selYear = substr($searchJbOrdertime,0,4); $search_type = "jb"; endif; else : $idSearchArray = searchJobs($search_item); $idSearchArrayLen = count($idSearchArray); if ($idSearchArrayLen > 0) : // Search day to be displayed for the first job only $searchJbOrdertime = getFieldValueFromClause("job","jb_ordertime","jb_id = '" . $idSearchArray[0] . "' AND hq_id = '" . $hq_id . "'"); if ($searchJbOrdertime != "") : $selDay = substr($searchJbOrdertime,8,2); $selMonth = substr($searchJbOrdertime,5,2); $selYear = substr($searchJbOrdertime,0,4); $search_type = "jb"; endif; endif; // Check for eco /* $remSearchItem = $search_item; if (substr($search_item,-2) == "/1") : $search_item = substr($search_item,0,-2); endif; if (substr($search_item,-2) == "/2") : $search_item = substr($search_item,0,-2); if (is_numeric($search_item)) : $search_item = getFieldValueFromId("job", "jb_id_parent", $search_item, "jb_id"); endif; endif; if ($search_item == "") : $search_item = getFieldValueFromId("tour", "tr_commission_no", $remSearchItem, "jb_id"); endif; if ($search_item == "") : $search_item = getFieldValueFromClause("genericdatacontainer","gdc_obj_id","gdc_obj_type = 'jb' AND gdc_gen_fieldname = 'info_0' AND gdc_content = '" . $remSearchItem . "'"); endif; if ($search_item != "" && is_numeric($search_item)) : $searchJbOrdertime = getFieldValueFromClause("job","jb_ordertime","jb_id = '" . $search_item . "' AND hq_id = '" . $hq_id . "'"); if ($searchJbOrdertime != "") : $selDay = substr($searchJbOrdertime,8,2); $selMonth = substr($searchJbOrdertime,5,2); $selYear = substr($searchJbOrdertime,0,4); $search_type = "jb"; endif; endif; */ endif; endif; // Selected day $currentDayTime = getDateTime("0"); // "Y-m-d H:i:s" (current timestamp) $currYear = getDateTime("year"); $currentDay = getDateTime("3"); // "Y-m-d" (today) $currentTime = getDateTime("4"); // Current time ("H:i:s") if ($selDay == "" || $selMonth == "" || $selYear == "") : // Initialize date-ranges to the current date $selDay = getDateTime("day"); $selMonth = getDateTime("month"); $selYear = $currYear; endif; $currentSelectedDay = $selYear . "-" . pad($selMonth,2) . "-" . pad($selDay,2); // $dayBeforeCurrentSelectedDay = date("Y-m-d", mktime(0,0,0,$selMonth, $selDay - 1, $selYear)); $currentDayNumOfTheWeek = date("w", mktime(0, 0, 0, $selMonth, $selDay, $selYear)); // 0 = Sunday, 1 = Monday, etc. if ($currentDayNumOfTheWeek == 0) : $currentDayNumOfTheWeek = "7"; endif; // Reformat to 1 = Monday, ... , 7 = Sunday $calWeekDays = getColVectorFromDB2Array("metatype","mt_type","cal_week_days","mt_value","mt_sort"); $fromDateRange = $selYear . "-" . pad($selMonth,2) . "-" . pad($selDay,2) . " 00:00:00"; $toDateRange = $selYear . "-" . pad($selMonth,2) . "-" . pad($selDay,2) . " 23:59:59"; // Hours per day // $hours = getParameterValue("0", "DISPOSITION_HOURS", $hq_id); // if ($hours == "" || !is_numeric($hours)) : $hours = getParameterValue("0", "DISPOSITION_HOURS", "0"); if ($hours == "" || !is_numeric($hours)) : $hours = 23; endif; // endif; // Time units of a hour (e.g. 12 units per 5 minutes <=> 6 units per 10 minutes <=> one hour) // $hourTimeUnits = getParameterValue("0", "DISPOSITION_HOUR_TIME_UNITS", $hq_id); // if ($hourTimeUnits == "" || !is_numeric($hourTimeUnits)) : $hourTimeUnits = getParameterValue("0", "DISPOSITION_HOUR_TIME_UNITS", "0"); if ($hourTimeUnits == "" || !is_numeric($hourTimeUnits)) : $hourTimeUnits = 6; endif; // endif; // Get mask configuration for the current employee logged in regarding to the group and customer setting in employee master data if ($userTypeName == "hq") : $parMaskDispositionGroup = $grpId; $parMaskDispositionCustomer = $csId; if ($grpId == "" || $csId == "") : $parMaskDispositionGroup = getParameterValue($emp_id, "MASK_DISPOSITION_INIT_GROUP", $hq_id); $parMaskDispositionCustomer = getParameterValue($emp_id, "MASK_DISPOSITION_INIT_CS", $hq_id); // Check for "init customer" is in "init group" $tmpGrpArray = spliti(",", $parMaskDispositionGroup); $tmpCsGroupArray = getGroupMemberIDs($tmpGrpArray, "cs", array($f_hq_id)); if (array_search($parMaskDispositionCustomer, $tmpCsGroupArray) === FALSE) : $parMaskDispositionCustomer = ""; endif; if ($parMaskDispositionGroup != "" && $parMaskDispositionGroup != "0" && $parMaskDispositionCustomer != "" && $parMaskDispositionCustomer != "0") : $grpId = $parMaskDispositionGroup; $csId = $parMaskDispositionCustomer; endif; endif; endif; // Get maximum of defined time units (in metatype) of the customer // E.g.: Three daytime intervals (08:00 - 12:00, 12:00 - 16:00, 16:00 - 21:00), take the min and max values (08:00 - 21:00) and compute number of time units between (78) // $numOfTimeUnitsOfTheSelectedDay = getNumOfTimeUnitsBetweenInterval($csId, "", $hourTimeUnits); // Array for the elements of the time line for each vehicle (coordinates of the top-left-corner, state of occupation, etc) // Daily view: $masterArray[crvh_id][hour(00..23)][time_unit(0..6|12|...)] = array("occupation_state(0..1)", "coordinate_top(0..y)", "coordinate_left(0..x)") $masterArray = array(); // Get array of weekdays $weekDays = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'cal_week_days'", "", "mt_sort", ""); $weekDayNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'cal_week_days'", "", "mt_sort", ""); $weekDaysLen = count($weekDays); // Get array of day times by default if ($csId != "") : $dayTimes = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'day_time' AND mt_objtype = 'cs' AND mt_objid = '" . $csId . "'", "", "mt_sort", ""); $dayTimeNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'day_time' AND mt_objtype = 'cs' AND mt_objid = '" . $csId . "'", "", "mt_sort", ""); $dayTimeMappedValues = getColVectorFromDB2ArrayByClause("metatype", "mt_mapped_value", "mt_type = 'day_time' AND mt_objtype = 'cs' AND mt_objid = '" . $csId . "'", "", "mt_sort", ""); else : $dayTimes = array(); // $dayTimes = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'day_time'", "", "mt_sort", ""); // $dayTimeNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'day_time'", "", "mt_sort", ""); // $dayTimeMappedValues = getColVectorFromDB2ArrayByClause("metatype", "mt_mapped_value", "mt_type = 'day_time'", "", "mt_sort", ""); endif; $dayTimesLen = count($dayTimes); // Daily working range of the related customer (e.g. 07:00 - 21:00 => array("07", "00", "21", "00")) $dispositionStartHourOffset = getParameterValue("0", "DISPOSITION_START_HOUR_OFFSET", $hq_id); if ($dispositionStartHourOffset == "" || !is_numeric($dispositionStartHourOffset)) : $dispositionStartHourOffset = getParameterValue("0", "DISPOSITION_START_HOUR_OFFSET", "0"); endif; if ($dispositionStartHourOffset == "" || !is_numeric($dispositionStartHourOffset)) : $dispositionStartHourOffset = 0; endif; $dispositionEndHourOffset = getParameterValue("0", "DISPOSITION_END_HOUR_OFFSET", $hq_id); if ($dispositionEndHourOffset == "" || !is_numeric($dispositionEndHourOffset)) : $dispositionEndHourOffset = getParameterValue("0", "DISPOSITION_END_HOUR_OFFSET", "0"); endif; if ($dispositionEndHourOffset == "" || !is_numeric($dispositionEndHourOffset)) : $dispositionEndHourOffset = 0; endif; $csRelatedDayTimeRange = array(0,0,0,0); if ($dayTimesLen > 0) : $tmpVal = intval(substr($dayTimeMappedValues[0],0,2)); if ($tmpVal != "" && is_numeric($tmpVal)) : $csRelatedDayTimeRange[0] = $tmpVal + $dispositionStartHourOffset; endif; $tmpVal = intval(substr($dayTimeMappedValues[0],3,2)); if ($tmpVal != "" && is_numeric($tmpVal)) : $csRelatedDayTimeRange[1] = $tmpVal; endif; $tmpVal = intval(substr($dayTimeMappedValues[($dayTimesLen - 1)],8,2)); if ($tmpVal != "" && is_numeric($tmpVal)) : $csRelatedDayTimeRange[2] = $tmpVal + $dispositionEndHourOffset; endif; $tmpVal = intval(substr($dayTimeMappedValues[($dayTimesLen - 1)],11,2)); if ($tmpVal != "" && is_numeric($tmpVal)) : $csRelatedDayTimeRange[3] = $tmpVal; endif; endif; // Init service array if it is empty (no service selected). Get all services from "metatype" and init the service array with all of them if ($f_services == "" || count($f_services) == 0) : // DISABLED, because the meaning "Mindestens die selektierte Dienstleistung" // $f_services = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'service' AND mt_objtype = '' AND mt_objid = '0'", "", "mt_sort", ""); $f_services = array(); endif; $numOfAllServices = getCountOfTable("metatype", "mt_type = 'service' AND mt_objtype = '' AND mt_objid = '0'"); // Number of ALL services $numOfRequestedServices = count($f_services); // Number of services set in the mask by the user $ecoWhereClauseService = ""; $crvhWhereClauseService = ""; if ($numOfRequestedServices != 0 && $numOfAllServices != $numOfRequestedServices) : $serviceValue = mcConvertSel2Num($f_services); $ecoWhereClauseService = " (jb.jb_service & " . $serviceValue . " = " . $serviceValue . ") "; // Set filter for eco WHERE clause $crvhWhereClauseService = " (crvh.crvh_service & " . $serviceValue . " = " . $serviceValue . ") "; // Set filter for vehicle WHERE clause endif; // Check for excluded vehicles (e.g. "booking vehicles") being displayed $crvhWhereClauseExcludesVehicles = " crvh.crvh_vhd_disabled = '0' "; $dispositionDisplayExcludedVehicles = getParameterValue("0", "DISPOSITION_SHOW_EXCLUDED_VEHICLES", $hq_id); if ($dispositionDisplayExcludedVehicles == "") : $dispositionDisplayExcludedVehicles = getParameterValue("0", "DISPOSITION_SHOW_EXCLUDED_VEHICLES", "0"); endif; if ($dispositionDisplayExcludedVehicles == "1") : $crvhWhereClauseExcludesVehicles = ""; endif; if ($crvhWhereClauseExcludesVehicles != "") : if ($crvhWhereClauseService != "") : $crvhWhereClauseService .= " AND "; endif; $crvhWhereClauseService .= $crvhWhereClauseExcludesVehicles; endif; // Check for payload capacity of the vehicles $checkTotalweight = "0"; $dispositionCheckingForTotalweightDisabled = getParameterValue("0", "DISPOSITION_CHECK_TOTALWEIGHT_ENABLED", $hq_id); if ($dispositionCheckingForTotalweightDisabled == "") : $dispositionCheckingForTotalweightDisabled = getParameterValue("0", "DISPOSITION_CHECK_TOTALWEIGHT_ENABLED", "0"); endif; if ($dispositionCheckingForTotalweightDisabled == "1") : $checkTotalweight = "1"; endif; // Check for activated checkbox "all [ECO] jobs" $dispositionEcoContainerDisplayAllJobsPermanently = getParameterValue("0", "DISPOSITION_ECO_CONTAINER_DISPLAY_ALL_JOBS_PERMANENTLY", $hq_id); if ($dispositionEcoContainerDisplayAllJobsPermanently == "") : $dispositionEcoContainerDisplayAllJobsPermanently = getParameterValue("0", "DISPOSITION_ECO_CONTAINER_DISPLAY_ALL_JOBS_PERMANENTLY", "0"); endif; if ($dispositionEcoContainerDisplayAllJobsPermanently == "1") : $f_eco_show_all = "1"; endif; // ******************** // * Get the vehicles * // ******************** // ************************************** // Check restricted access clause if ($parRestrictedAccessClauseVehicle != "") : if ($crvhWhereClauseService != "") : $crvhWhereClauseService .= " AND "; endif; $crvhWhereClauseService .= $parRestrictedAccessClauseVehicle; endif; if ($userTypeName == "hq" && $f_filter_cr != "") : if ($crvhWhereClauseService != "") : $crvhWhereClauseService .= " AND "; endif; $crvhWhereClauseService .= " cr.cr_id = '" . $f_filter_cr . "' "; endif; // ************************************** $crList = array(); $crvhList = array(); if ($userTypeName == "hq" && $csId != "") : $sqlquery = getStmtCustomerVehicleRelation("", $csId, $crvhWhereClauseService, "crvh.crvh_sid"); // echo $sqlquery . "
"; $result = $db->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage()); while ($row = $result->fetch_assoc()): $crvhList[] = array($row["crvh_id"], $row["cs_id"], $row["cs_eid"], $row["csvh_day_times"], $row["crvh_sid"], $row["csvh_relation"], $row["cmp_comp"], $row["cmp_comp2"], $row["hq_id"], $row["csvh_description"], $row["crvh_service"], $row["cr_id"]); // Get all couriers associated to the selected related customer $crList[$row["cr_id"]] = $row["usr_name"] . ", " . $row["usr_firstname"]; endwhile; $result->free(); elseif ($userTypeName == "cr") : $sqlquery = "SELECT crvh.crvh_id, crvh.crvh_sid, cmp.cmp_comp, cmp.cmp_comp2, cr.hq_id, crvh.crvh_service, cr.cr_id" . " FROM couriervehicle AS crvh, courier AS cr, company AS cmp" . " WHERE cr.cr_id_parent = '" . $crIdLoggedIn . "' AND cr.cr_sid = crvh.crvh_sid AND crvh.crvh_modify_status != '3' AND cr.cmp_id = cmp.cmp_id" . " ORDER BY crvh.crvh_sid"; // echo $sqlquery . "
"; $result = $db->query($sqlquery); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage()); while ($row = $result->fetch_assoc()): $crvhList[] = array($row["crvh_id"], "", "", "", $row["crvh_sid"], "", $row["cmp_comp"], $row["cmp_comp2"], $row["hq_id"], "", $row["crvh_service"], $row["cr_id"]); endwhile; $result->free(); endif; $crvhListLen = count($crvhList); // Check for each vehicle displayed the existence of entries in "vehicledisposition", "vehicleavailability" and "vehicleavailabilitytimeunits". // If it does not exist then generate it to handle the drag and dropping the jobs etc. // Generate structure for "today" or future days only! if ($currentSelectedDay >= $currentDay) : if ($csId != "" && $csId > "0") : for ($v = 0; $v < $crvhListLen; $v++) : $crvhId = $crvhList[$v][0]; if (!existsEntry("vehicledisposition",array("crvh_id",$crvhId,"LEFT(vhd_timeslot, 10)",$currentSelectedDay))) : // Generate all new timeslot entries for the vehicle for the specified day generatePersistentTimeslots($crvhId, $currentSelectedDay, $hourTimeUnits, $csId); endif; endfor; endif; endif; // Check restrictions on the timeline of the current day of the vehicle regarding the daytimes and the selected special zone // At least one of the daytimes the vehicle has to drive for the customer on the specified day and therefore the vehicle has to be displayed in the disposition list if ($userTypeName == "hq") : if ($crvhListLen > 0 && $f_servicezone != "" && $f_servicezone != "ALL") : $crvhListTmp = $crvhList; // Copy to temp $crvhListTmpLen = count($crvhListTmp); $crvhList = array(); // Reset original for ($v = 0; $v < $crvhListTmpLen; $v++) : $crvhId = $crvhListTmp[$v][0]; $removeVehicleRegardingZone = true; $tmpDaytimeZoneArray = getDaytimeAvailabilityOfVehicle($crvhId, $currentDayNumOfTheWeek, $csId, "1"); // $tmpDaytimeZoneArray[daytime] = zone // Iterate given daytimes (got from customer !!!!) for ($i = 0; $i < $dayTimesLen; $i++) : if ($tmpDaytimeZoneArray[$i] == "" || $tmpDaytimeZoneArray[$i] == $f_servicezone) : $removeVehicleRegardingZone = false; // Zone matched or one of the daytimes contains "All zones" for the vehicle for the specified day. => Display vehicle endif; endfor; // Remove vehicle out of the list if (!$removeVehicleRegardingZone) : $crvhList[] = $crvhListTmp[$v]; endif; endfor; $crvhListLen = count($crvhList); endif; endif; // Check for mode the vehicle is blocked for courier disposition. Display for courier only if it is blocked !!!! if ($userTypeName == "cr") : $crvhListTmp = $crvhList; // Copy to temp $crvhListTmpLen = count($crvhListTmp); $crvhList = array(); // Reset original for ($v = 0; $v < $crvhListTmpLen; $v++) : $crvhId = $crvhListTmp[$v][0]; $removeVehicleRegardingCourierDisposition = false; $crvhBlockedState = crvhBlockedState($crvhId, $currentSelectedDay); if (($crvhBlockedState & 2) != 2) : $removeVehicleRegardingCourierDisposition = true; endif; // Remove vehicle out of the list if (!$removeVehicleRegardingCourierDisposition) : $crvhList[] = $crvhListTmp[$v]; endif; endfor; $crvhListLen = count($crvhList); endif; // ******************** // * Disposition menu * // ******************** $outputMenu = ""; // DIV to hide vehicle timelines by scrolling $outputMenu .= "
\n"; $outputMenu .= "
\n"; $outputMenu .= "" . $pageTitel . "" . "  |  "; if ($userTypeName == "hq") : // Customer selection $outputMenu .= ""; $outputMenu .= "  "; $outputMenu .= ""; $outputMenu .= " | "; // Servicezone selection if ($f_servicezone == "") : $parMaskFirstZoneSelected = getParameterValue("0", "MASK_DISPOSITION_FIRST_ZONE_SELECTED", $hq_id); if ($parMaskFirstZoneSelected == "") : $parMaskFirstZoneSelected = getParameterValue("0", "MASK_DISPOSITION_FIRST_ZONE_SELECTED", "0"); endif; if ($parMaskFirstZoneSelected == "1") : $f_servicezone = getOneStmt("SELECT srvz_no FROM servicezone WHERE cs_id = '" . $csId . "' ORDER BY srvz_no LIMIT 0,1", "srvz_no"); endif; endif; // $outputMenu .= getLngt("Zone") . ": "; $outputMenu .= ""; $outputMenu .= " | "; $outputMenu .= " " . getLngt("Alle Aufträge"); $outputMenu .= " | "; endif; // Selection of a specific day $currentFrameName = ""; // $outputMenu .= getLngt("Datum") . ": "; $outputMenu .= "\n"; $outputMenu .= "\n"; $outputMenu .= "\n"; $outputMenu .= " (" . substr($calWeekDays[$currentDayNumOfTheWeek - 1], 0, 2) . ".)"; // $outputMenu .= $currentSelectedDay . " (" . substr($calWeekDays[$currentDayNumOfTheWeek - 1], 0, 2) . ".)"; // " . $currentDayNumOfTheWeek . "  $outputMenu .= " "; $outputMenu .= ""; $outputMenu .= " | "; // Refresh button // $outputMenu .= defineButtonType08(getLngt("Refresh"), "action_refresh", "finishPage();", "100", "", ""); $outputMenu .= ""; $outputMenu .= " | "; // Search eco $outputMenu .= "" . " "; if ($userTypeName == "hq") : $outputMenu .= " | "; // Services checkboxes $outputMenu .= ""; $outputMenu .= " | "; // Check day is blocked $gdcSelectedDayIsBlocked = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = 'vha' AND gdc_obj_id = '" . $csId . "' AND gdc_gen_fieldname = 'vha_day_blocked' AND gdc_context = '" . $currentSelectedDay . "'"); if ($gdcSelectedDayIsBlocked == "1") : $outputMenu .= ""; else : $outputMenu .= ""; endif; $outputMenu .= " | "; // Selection of couriers to filter vehicles $outputMenu .= ""; $outputMenu .= " | "; endif; $outputMenu .= getLngt("x"); $outputMenu .= ""; $outputMenu .= "
\n"; // ********************************************************************* // * INIT output parameter for ECO CONTAINER and for VEHICLE TIMELINES * // ********************************************************************* // * ECO * $posTop = 30; $ecoWidth = 130; $ecoDragBarWidth = 12; $ecoWidthContainer = 150; $ecoArrayMaxLen = 100; // Max. displayed ecos in container $outputEcoJS = "var ecoArray = new Array(" . $ecoArrayMaxLen . ");\n"; $outputEcoJS .= "var ecoTextDefaultArray = new Array();\n"; $outputCrvhEcoJS = "var crvhEco = new Array();\n"; $outputEco = ""; // * Vehicle timelines * $vhtPosTop = 130; $vhtPosLeft = 130; $timeLineHeight = 15; $vhtHeight = 110; // * Timeline parameters * $hourWidthDefault = 66; $hourWidth = ($hourWidthDefault * $timeLineScalingFactor); $timeUnitWidth = round(($hourWidth / $hourTimeUnits), 0); // * Working time and offset horizontal offset for timeline output * $hoursLowerRange = max(0, $csRelatedDayTimeRange[0]); $hoursUpperRange = min($hours, $csRelatedDayTimeRange[2]); $hourHorizontalOffset = -($csRelatedDayTimeRange[0] * $hourWidth); // E.g. starttime 07:00 => "negative" offset = (7 * $hourWidth) $outputVehicle = ""; $outputMasterJS = "var masterArray = new Array(" . $crvhListLen . ");\n"; // ***************** // * Container eco * // ***************** // Select ecos NOT being associated to ANY vehicle for the selected day only $whereClause = ""; $whereClauseCs = ""; if ($csId != "") : $whereClauseCs .= " csc.cs_id = '" . $csId . "' AND"; endif; // Check for displaying ALL related customers if all jobs of all zones shall be displayed on ECO container if ($f_eco_show_all == "1") : $dispositionEcoContainerDisplayAllCsRelated = getParameterValue("0", "DISPOSITION_ECO_CONTAINER_ALL_CS_RELATED", $hq_id); if ($dispositionEcoContainerDisplayAllCsRelated == "") : $dispositionEcoContainerDisplayAllCsRelated = getParameterValue("0", "DISPOSITION_ECO_CONTAINER_ALL_CS_RELATED", "0"); endif; if ($dispositionEcoContainerDisplayAllCsRelated == "1") : $whereClauseCs = " jb.hq_id = '" . $hq_id . "' AND"; // Overwrite filter for current related customer endif; endif; $whereClause .= $whereClauseCs; if ($f_eco_show_all != "1" && $f_servicezone != "" && $f_servicezone != "ALL") : $srvzId = getFieldValueFromClause("servicezone","srvz_id","srvz_no = '" . $f_servicezone . "' AND cs_id = '" . $csId . "'"); // $whereClause .= " AND jb.jb_mediationarea_id = '" . $srvzId . "'"; $whereClause .= " jb.jb_mediationarea_id = '" . $srvzId . "' AND"; endif; // ************************************** // Check restricted access clause if ($parRestrictedAccessClauseJob != "") : // if ($whereClause != "") : $whereClause .= " AND "; endif; $whereClause .= $parRestrictedAccessClauseJob . " "; endif; // ************************************** // If "system customer mode" then exclude NOT hidden jobs <=> show hidden jobs (regarding job list) only $whereClauseHidden = ""; if ($globalParUseRelatedCustomer != "1") : $whereClauseHidden = " gdc4.gdc_content = '1' AND "; endif; // Output eco container $ecoArray = array(); if ($userTypeName == "hq") : // Check for offers being displayed on eco container $whereClauseOffers = " jb.jb_offer = '0' AND "; $dispositionEcoContainerOffersEnabled = getParameterValue("0", "DISPOSITION_ECO_CONTAINER_OFFERS", "0"); if ($dispositionEcoContainerOffersEnabled == "1") : $whereClauseOffers = ""; endif; $whereClause .= $whereClauseOffers; // Exclude NOT hidden jobs $whereClause .= $whereClauseHidden; // Get jobs for eco container $ecoArray = getVehicleJobList("", $currentSelectedDay, $timeUnitWidth, "3", $whereClause); $ecoArrayLen = count($ecoArray); $outputEco .= "
\n"; // Associate ecos to container array for ($i = 0; $i < $ecoArrayLen; $i++) : if ($search_type == "jb" && in_array($ecoArray[$i]["jb_id"], $idSearchArray)) : $ecoBgCol = "background-color: #BB5555;"; else : if ($ecoArray[$i]["jb_offer"] == "1") : $ecoBgCol = "background-color: #A349A4;"; elseif ($globalParUseRelatedCustomer != "1" && $ecoArray[$i]["jb_is_operative"] != "") : $ecoBgCol = "background-color: #A349A4;"; elseif ($ecoArray[$i]["gdc1_content"] == "1") : $ecoBgCol = "background-color: #FF8000;"; if ($ecoArray[$i]["jb_totalprice"] == 0 && $ecoArray[$i]["jb_cr_price"] == 0) : $ecoBgCol = "background-color: #CC8000;"; endif; else : $ecoBgCol = getDispositionStandardColours($ecoArray[$i]["jb_service"]); // Standard colours endif; endif; // Check output of the eco ID $ecoIdOut = getJobIdOutput($ecoArray[$i]["jb_id"], $ecoArray[$i]["jb_id_parent"]); // Output on drag bar $ecoIdDragBarOut = ""; $ecoIdOutPrefix = ""; if ($parMaskDispositionItemShowDragbarEcoId == "1") : $ecoIdDragBarOut = getJobIdDragBarOutput($ecoIdOut, -2); if ($ecoArray[$i]["jb_is_installation"] == "1") : $ecoIdOutPrefix = getJobIdDragBarOutput("M", "", "|"); else : $ecoIdOutPrefix = getJobIdDragBarOutput("L", "", "|"); endif; endif; $posLeft = ($i * $ecoWidthContainer); $outputEco .= "
" . $ecoIdDragBarOut . "
\n"; $outputEco .= "
" . $ecoIdOutPrefix . $ecoIdOut . "
" . $ecoArray[$i]["eco_body"] . "
\n"; $outputEcoJS .= "ecoArray[" . $i . "] = new Array(" . $ecoArray[$i]["jb_id"] . "," . $posLeft . "," . $posTop . ");\n"; $outputEcoJS .= "ecoTextDefaultArray[" . $ecoArray[$i]["jb_id"] . "] = '" . $ecoIdOut . "
" . $ecoArray[$i]["eco_body_default"] . "';\n"; endfor; // Fill up the container array with empty elements but with positions for ($i = $ecoArrayLen; $i < $ecoArrayMaxLen; $i++) : $posLeft = ($i * $ecoWidthContainer); $outputEcoJS .= "ecoArray[" . $i . "] = new Array(''," . $posLeft . "," . $posTop . ");\n"; endfor; endif; // ********************************************** // * Vehicles with timeline and associated jobs * // ********************************************** function displayEcos ($mode = "0", $jbStatus) { global $vhtEcoArray, $csId, $currentSelectedDay, $search_type, $idSearchArray, $timeUnitWidth, $ecoDragBarWidth; global $masterArray, $crvhId, $timeLineScalingFactor, $outputEco, $outputEcoJS, $outputCrvhEcoJS, $globalParUseRelatedCustomer; $vhtEcoArrayLen = count($vhtEcoArray); for ($i = 0; $i < $vhtEcoArrayLen; $i++) : $ecoId = $vhtEcoArray[$i]["jb_id"]; $ecoIdParent = $vhtEcoArray[$i]["jb_id_parent"]; $ecoTimeslots = $vhtEcoArray[$i]["jb_timeunits"]; // $ecoParentLevel = $vhtEcoArray[$i]["jb_parent_level"]; $ecoService = $vhtEcoArray[$i]["jb_service"]; $ecoTotalprice = $vhtEcoArray[$i]["jb_totalprice"]; $ecoCrPrice = $vhtEcoArray[$i]["jb_cr_price"]; $ecoOffer = $vhtEcoArray[$i]["jb_offer"]; $ecoIsInstallation = $vhtEcoArray[$i]["jb_is_installation"]; $ecoOrdertime = $vhtEcoArray[$i]["jb_ordertime"]; $ecoOrderDate = substr($vhtEcoArray[$i]["jb_ordertime"],0,10); $ecoIsService = $vhtEcoArray[$i]["gdc1_content"]; $ecoIsOperative = $vhtEcoArray[$i]["jb_is_operative"]; $ecoHidden = $vhtEcoArray[$i]["jb_hide"]; $ecoBodyDefault = $vhtEcoArray[$i]["eco_body_default"]; $ecoBody = $vhtEcoArray[$i]["eco_body"]; $ecoBodyFull = $vhtEcoArray[$i]["eco_body_full"]; $ecoUrlList = my_str_check_js("?maskNumOfWins=1&jb_status=" . $jbStatus . "&day_from=$selDay&month_from=$selMonth&year_from=$selYear&day_to=$selDay&month_to=$selMonth&year_to=$selYear"); if ($ecoId != "") : // HAS TO EXIST !!!! // Check eco is multiple day job $ecoIsMultipleDayJob = false; if (isMultipleDayJob($ecoId, $csId) == "1") : $ecoIsMultipleDayJob = true; endif; // Get start time unit of the eco to compute the position if ($ecoIsMultipleDayJob) : $startTimeOfEco = getMinOfField("vehicledisposition", "vhd_timeslot", "jb_id = '" . $ecoId . "' AND LEFT(vhd_timeslot,10) = '" . $currentSelectedDay . "'"); // Overwrite timeslots of the job with timeslots of the current day $ecoTimeslots = getCountOfTable("vehicledisposition", "jb_id = '" . $ecoId . "' AND LEFT(vhd_timeslot,10) = '" . $currentSelectedDay . "'"); else : $startTimeOfEco = getMinOfField("vehicledisposition", "vhd_timeslot", "jb_id = '" . $ecoId . "'"); endif; if ($startTimeOfEco != "") : // HAS TO EXIST !!!! // Get position (top, left) from the hour and the hour time unit $tmpEcoStartHour = intval(substr($startTimeOfEco, 11, 2)); $tmpEcoStartTimeUnit = intval(substr($startTimeOfEco, 14, 2)); $tmpEcoPosLeft = $masterArray[$crvhId][$tmpEcoStartHour][$tmpEcoStartTimeUnit][1]; $tmpEcoPosTop = $masterArray[$crvhId][$tmpEcoStartHour][$tmpEcoStartTimeUnit][2]; if ($mode == "0") : $tmpEcoWidth = ($ecoTimeslots - 1) * $timeUnitWidth; else : $tmpEcoWidth = $ecoTimeslots * $timeUnitWidth; endif; $ecoBgCol = ""; if ($search_type == "jb" && in_array($ecoId, $idSearchArray)) : $ecoBgCol = "background-color: #BB5555;"; else : if ($mode == "0") : if ($ecoOffer == "1") : $ecoBgCol = "background-color: #A349A4;"; elseif ($globalParUseRelatedCustomer != "1" && $ecoIsOperative != "") : $ecoBgCol = "background-color: #A349A4;"; elseif ($ecoIsService == "1") : $ecoBgCol = "background-color: #FF8000;"; if ($ecoTotalprice == 0 && $ecoCrPrice == 0) : $ecoBgCol = "background-color: #CC8000;"; endif; else : $ecoBgCol = getDispositionStandardColours($ecoService); // Standard colours endif; elseif ($mode == "1") : $ecoBgCol = " background-color: #BBBBBB; "; endif; endif; // Check output of the eco ID $ecoIdOut = getJobIdOutput($ecoId, $ecoIdParent); // $newStrLen = floor((($ecoTimeslots - 1) * $timeUnitWidth) / 7); $newStrLen = floor(((($ecoTimeslots - 1) * $timeUnitWidth) * $timeLineScalingFactor) / 7); // Output on drag bar AND prefix of eco ID $ecoIdDragBarOut = ""; $ecoIdOutPrefix = ""; if ($mode == "0" && $parMaskDispositionItemShowDragbarEcoId == "1") : $ecoIdDragBarOut = getJobIdDragBarOutput($ecoIdOut, -2); if ($ecoIsInstallation == "1") : $ecoIdOutPrefix = getJobIdDragBarOutput("M", "", "|"); else : $ecoIdOutPrefix = getJobIdDragBarOutput("L", "", "|"); endif; $newStrLen -= 2; if ($newStrLen < 0) : $newStrLen = 2; endif; elseif ($mode == "1" || $mode == "2") : if ($ecoIsInstallation == "1") : $ecoIdOutPrefix = getLngt("M|"); else : $ecoIdOutPrefix = getLngt("L|"); endif; endif; // $ecoIdOutItem = substr($ecoIdOut,0,$newStrLen); $ecoIdOutItem = substr($ecoIdOutPrefix . $ecoIdOut,0,$newStrLen); // Handle "MULTIPLE DAY ECO" $showDragItem = true; $tmpEcoPosLeftOffset = $ecoDragBarWidth; if ($ecoIsMultipleDayJob) : $tmpEcoWidth = ($ecoTimeslots - 1) * $timeUnitWidth; // Set parameter for output if ($ecoOrderDate != $currentSelectedDay || $mode != "0") : // Get earliest start time of the related customer $showDragItem = false; $tmpEcoWidth += $timeUnitWidth; if ($ecoOrderDate != $currentSelectedDay) : $tmpEcoPosLeftOffset = 0; endif; endif; // Reformat output $ecoBodyArray = spliti("
",$ecoBody); $ecoBodyArrayLen = count($ecoBodyArray); for ($c = 0; $c < $ecoBodyArrayLen; $c++) : $ecoBodyArray[$c] = substr($ecoBodyArray[$c],0,$newStrLen); endfor; $ecoBody = implode("
",$ecoBodyArray); endif; // Add difference of the part of ONE timeunit because width of the drag bar could be smaller than a single time unit if ($mode == "0") : $tmpEcoWidth += ($timeUnitWidth - $ecoDragBarWidth); endif; if ($mode == "0") : if ($showDragItem) : $outputEco .= "
" . $ecoIdDragBarOut . "
\n"; endif; $outputEco .= "
" . $ecoIdOutItem . "
" . $ecoBody . "
\n"; elseif ($mode == "1") : $outputEco .= "
" . $ecoIdOutItem . "
" . $ecoBody . "
\n"; elseif ($mode == "2") : $outputEco .= "
" . $ecoIdOutItem . "
" . $ecoBody . "
\n"; endif; // Set JS array $outputEcoJS .= "ecoTextDefaultArray[" . $ecoId . "] = '" . $ecoIdOut . "
" . $ecoBodyDefault . "';\n"; $outputCrvhEcoJS .= "crvhEco[" . $crvhId . "][" . $i . "] = '" . $ecoId . "';\n"; endif; endif; endfor; } // Get blocked vehicles of the selected day $crvhBlockedArray = getColVectorFromDB2ArrayByClause("vehicleavailability", "vha_blocked", "vha_day = '" . $currentSelectedDay . "' AND vha_blocked > '0'", "crvh_id", "", ""); for ($v = 0; $v < $crvhListLen; $v++) : $crvhId = $crvhList[$v][0]; $crvhSid = $crvhList[$v][4]; $crvhServices = ""; if ($crvhList[$v][10] != "" && $crvhList[$v][10] != "0") : $crvhServices = implode(",", getColVectorFromDB2ArrayByClause("metatype", "mt_mapped_value", "mt_type = 'service' AND mt_objtype = '' AND mt_objid = '0' AND mt_sort IN (" . implode(",", mcConvertNum2Sel($crvhList[$v][10])) . ") AND mt_sort != '1'", "", "mt_sort", "")); endif; $outputMasterJS .= "masterArray[" . $crvhId . "] = new Array(" . $hoursUpperRange . ");\n"; $outputCrvhEcoJS .= "crvhEco[" . $crvhId . "] = new Array();\n"; // Check availibility of the current vehicle regarding the daytime $vehicleAvailableArray = array(); // Init NO availibility of the selected day if ($userTypeName == "cr") : // Iterate ALL given daytimes for ($i = 0; $i < $dayTimesLen; $i++) : // All vehicles of the carrier are available in all zones AND all daytimes !!!! $vehicleAvailableArray[] = array(substr($dayTimeMappedValues[$i],0,2), substr($dayTimeMappedValues[$i],3,2), substr($dayTimeMappedValues[$i],8,2), substr($dayTimeMappedValues[$i],11,2)); endfor; else : // $userTypeName == "hq" !!!! if ($f_servicezone != "" && $f_servicezone != "ALL") : $tmpDaytimeZoneArray = getDaytimeAvailabilityOfVehicle($crvhId, $currentDayNumOfTheWeek, $csId, "1"); // $tmpDaytimeZoneArray[daytime] = zone // Iterate given daytimes (got from customer !!!!) for ($i = 0; $i < $dayTimesLen; $i++) : if ($tmpDaytimeZoneArray[$i] == "" || $tmpDaytimeZoneArray[$i] == $f_servicezone) : // Vehicle is available in all zones OR in the selected zone for this daytime on the selected day. Extend availibility interval array for this daytime $vehicleAvailableArray[] = array(substr($dayTimeMappedValues[$i],0,2), substr($dayTimeMappedValues[$i],3,2), substr($dayTimeMappedValues[$i],8,2), substr($dayTimeMappedValues[$i],11,2)); endif; endfor; endif; endif; $vehicleAvailableArrayLen = count($vehicleAvailableArray); // Timeline for ($i = $hoursLowerRange; $i <= $hoursUpperRange; $i++) : $outputVehicle .= "
" . ($parMaskDispositionHideHoursOnTimeline != "1" ? pad($i, 2) : " ") . "
\n"; endfor; $posTop = (($v * $vhtHeight) + $vhtPosTop + $timeLineHeight); // Check for vehicle being blocked for the selected day $crvhBgCol = "#AADDAA;"; if ($userTypeName == "hq") : $blockedState = $crvhBlockedArray[$crvhId]; // Represents vha.vha_blocked if ($blockedState == "") : $blockedState = 0; endif; if (($blockedState & 1) == 1) : // Blocked by headquarters disposition $crvhBgCol = "#FF6A6A;"; endif; if (($blockedState & 2) == 2) : // Blocked for courier disposition, overrules the state above $crvhBgCol = "#BBBBBB;"; endif; endif; // Vehicle information(s) $outputVehicle .= "
" . "
 " . $crvhSid . "" . "
 " . "[" . $crvhServices . "]
\n"; // Display time units $count = 0; for ($i = $hoursLowerRange; $i <= $hoursUpperRange; $i++) : $changeCol = true; $outputMasterJS .= "masterArray[" . $crvhId . "][" . $i . "] = new Array(" . $hourTimeUnits . ");\n"; for ($j = 0; $j < $hourTimeUnits; $j++) : $tmpCol = "#BBBBBB"; if ($changeCol) : $tmpCol = "#000000"; $changeCol = false; endif; $posLeft = (($count * $timeUnitWidth) + $vhtPosLeft); // Check for current timeslot being activated for dropping or not. Therefore iterate all available intervals $tmpTimeUnitsToMinutes = $j * (60 / $hourTimeUnits); $tmpCrvhTimeSlot = pad($i, 2) . pad($tmpTimeUnitsToMinutes, 2); $timeSlotClass = "time_slot_deactivated"; $timeSlotBgCol = "#DDDDDD"; // Activate droppable timeslots for future days or for today with timeslot > current time if ($parMaskDispositionEnableDroppingOnPastTimeslots == "1" || ($userTypeName == "hq" && ($currentSelectedDay > $currentDay || ($currentSelectedDay == $currentDay && $currentTime <= pad($i, 2) . ":" . $tmpTimeUnitsToMinutes . ":00"))) || ($userTypeName == "cr" && $currentSelectedDay >= $currentDay) ) : for ($k = 0; $k < $vehicleAvailableArrayLen; $k++) : $tmpTimeFrom = $vehicleAvailableArray[$k][0] . $vehicleAvailableArray[$k][1]; $tmpTimeTo = $vehicleAvailableArray[$k][2] . $vehicleAvailableArray[$k][3]; if ($tmpTimeFrom <= $tmpCrvhTimeSlot && $tmpCrvhTimeSlot < $tmpTimeTo) : $timeSlotClass = "time_slot"; $timeSlotBgCol = "#AADDAA"; break; endif; endfor; endif; // Init master array $masterArray[$crvhId][$i][$j] = array("0", $posLeft, $posTop); $outputMasterJS .= "masterArray[" . $crvhId . "][" . $i . "][" . $j . "] = new Array(0," . $posLeft . "," . $posTop . ");\n"; // Output droppable timeline elements $outputVehicle .= "
"; $outputVehicle .= "
\n"; $outputVehicle .= "
\n"; $outputVehicle .= "
\n"; $count++; endfor; endfor; // Get all ecos associated to the current vehicle for the specified day $vhtEcoArray = array(); if ($userTypeName == "hq") : $vhtEcoArray = getVehicleJobList($crvhId, $currentSelectedDay, $timeUnitWidth, "0", " jb.jb_status = '9' AND " . $whereClauseHidden); // Headquarter view with jobs can be disposed endif; if ($userTypeName == "cr") : $vhtEcoArray = getVehicleJobList($crvhId, $currentSelectedDay, $timeUnitWidth, "0", $parRestrictedAccessClauseJob . " jb.jb_timeunits > '0' AND " . $whereClauseHidden); endif; displayEcos("0", "9"); // All jobs disposed by the courier by the current vehicle for the specified day if ($userTypeName == "hq") : $vhtEcoArray = getVehicleJobList($crvhId, $currentSelectedDay, $timeUnitWidth, "0", $parRestrictedAccessClauseJob . " jb.jb_status = '0' AND " . $whereClauseHidden); displayEcos("1", "1"); endif; // All jobs taken by the current vehicle for the specified day $vhtEcoArray = getVehicleJobList($crvhId, $currentSelectedDay, $timeUnitWidth, "1", $parRestrictedAccessClauseJob . $whereClauseHidden); // Add taken multiple day jobs to be displayed if (true) : $tmpEcoArray = $vhtEcoArray; $tmpEcoArrayLen = count($tmpEcoArray); $vhtMultiDayEcoArray = getVehicleJobList($crvhId, $currentSelectedDay, $timeUnitWidth, "0", " jb.jb_status = '1' AND " . $whereClauseHidden); $vhtMultiDayEcoArrayLen = count($vhtMultiDayEcoArray); for ($i = 0; $i < $vhtMultiDayEcoArrayLen; $i++) : for ($j = 0; $j < $tmpEcoArrayLen; $j++) : $tmpEcoIdFound = false; if ($vhtMultiDayEcoArray[$i]["jb_id"] == $tmpEcoArray[$j]["jb_id"]) : $tmpEcoIdFound = true; break 1; endif; endfor; if (!$tmpEcoIdFound) : $nextElemPos = count($vhtEcoArray); $vhtEcoArray[$nextElemPos] = $vhtMultiDayEcoArray[$i]; // Get time units of the added job $vhtEcoArray[$nextElemPos]["jb_timeunits"] = getCountOfTable("vehicledisposition", "jb_id = '" . $vhtMultiDayEcoArray[$i]["jb_id"] . "' AND LEFT(vhd_timeslot,10) = '" . $currentSelectedDay . "'"); // Get ordertime of added taken multi day job from vehicledisposition !!!! $startTimeOfEco = getMinOfField("vehicledisposition", "vhd_timeslot", "jb_id = '" . $vhtMultiDayEcoArray[$i]["jb_id"] . "' AND LEFT(vhd_timeslot,10) = '" . $currentSelectedDay . "'"); if ($startTimeOfEco != "") : $vhtEcoArray[$nextElemPos]["jb_ordertime"] = substr($startTimeOfEco,0,10) . " " . substr($startTimeOfEco,11,2) . ":" . pad(strval(floor(intval(substr($startTimeOfEco,14,2)) * (60 / $hourTimeUnits))),2) . ":00"; endif; // Reformat output $ecoBodyArray = spliti("
",$vhtEcoArray[$nextElemPos]["eco_body"]); $ecoBodyArrayLen = count($ecoBodyArray); for ($c = 0; $c < $ecoBodyArrayLen; $c++) : $ecoBodyArray[$c] = substr($ecoBodyArray[$c],0,$vhtEcoArray[$nextElemPos]["jb_timeunits"]); endfor; $vhtEcoArray[$nextElemPos]["eco_body"] = implode("
",$ecoBodyArray); $vhtEcoArray[$nextElemPos]["added_taken_job_from_day_before"] = "1"; endif; endfor; endif; displayEcos("2", "1"); // All done jobs by the current vehicle for the specified day $vhtEcoArray = getVehicleJobList($crvhId, $currentSelectedDay, $timeUnitWidth, "2", $parRestrictedAccessClauseJob . $whereClauseHidden); $vhtEcoArrayLen = count($vhtEcoArray); for ($i = 0; $i < $vhtEcoArrayLen; $i++) : $ecoId = $vhtEcoArray[$i]["jb_id"]; $ecoIdParent = $vhtEcoArray[$i]["jb_id_parent"]; $ecoService = $vhtEcoArray[$i]["jb_service"]; $ecoIsInstallation = $vhtEcoArray[$i]["jb_is_installation"]; $ecoOrdertime = $vhtEcoArray[$i]["jb_ordertime"]; $ecoTimeslots = $vhtEcoArray[$i]["jb_timeunits"]; $ecoBodyDefault = $vhtEcoArray[$i]["eco_body_default"]; $ecoBody = $vhtEcoArray[$i]["eco_body"]; $ecoBodyFull = $vhtEcoArray[$i]["eco_body_full"]; $ecoUrlList = my_str_check_js("?maskNumOfWins=1&jb_status=2&day_from=$selDay&month_from=$selMonth&year_from=$selYear&day_to=$selDay&month_to=$selMonth&year_to=$selYear"); if ($ecoId != "") : // HAS TO EXIST !!!! // Get position (top, left) from the hour and the hour time unit $tmpEcoStartHour = intval(substr($ecoOrdertime, 11, 2)); $tmpEcoStartMinute = intval(substr($ecoOrdertime, 14, 2)); // $tmpEcoStartTimeUnit = pad($tmpEcoStartHour,2) . "_" . pad(strval(ceil(intval($tmpEcoStartMinute) * ($hourTimeUnits / 60))), 2); $tmpEcoStartTimeUnit = strval(ceil(intval($tmpEcoStartMinute) * ($hourTimeUnits / 60))); $tmpEcoPosLeft = $masterArray[$crvhId][$tmpEcoStartHour][$tmpEcoStartTimeUnit][1]; $tmpEcoPosTop = $masterArray[$crvhId][$tmpEcoStartHour][$tmpEcoStartTimeUnit][2]; $tmpEcoWidth = $ecoTimeslots * $timeUnitWidth; $ecoBgCol = ""; if ($search_type == "jb" && in_array($ecoId, $idSearchArray)) : $ecoBgCol = " background-color: #BB5555; "; endif; // Check output of the eco ID $ecoIdOut = getJobIdOutput($ecoId, $ecoIdParent); if ($ecoIsInstallation == "1") : $ecoIdOutPrefix = getLngt("M|"); else : $ecoIdOutPrefix = getLngt("L|"); endif; // Resize output $newStrLen = floor(((($ecoTimeslots - 1) * $timeUnitWidth) * $timeLineScalingFactor) / 7); $ecoIdOutItem = substr($ecoIdOutPrefix . $ecoIdOut,0,$newStrLen); $outputEco .= "
" . $ecoIdOutItem . "
" . $ecoBody . "
\n"; // Set JS array $outputEcoJS .= "ecoTextDefaultArray[" . $ecoId . "] = '" . $ecoIdOut . "
" . $ecoBodyDefault . "';\n"; endif; endfor; endfor; // **** ACTIONS ********************************************************************************************************************************************************* // Selection of hour and minute $outputDayTimes = " \n"; $outputDayTimes .= "\n"; $outputDayTimes = my_str_check_js($outputDayTimes); // For output only! $jsExecBodyOnLoadArray = array("0","0","0","0","0"); // If one component is set to "1" then execute a special JS function according to "body onLoad" // Resets the parameters selected and set by each context menu function resetActionParameters () { global $f_actionObjType, $f_actionObjId, $f_actionID; $f_actionObjType = ""; $f_actionObjId = ""; $f_actionID = ""; } // *************************************************** // * Process specified action for a specified object * // *************************************************** // if ($f_act == "processAction") : if ($f_actionObjType != "" && $f_actionObjId != "" && $f_actionID != "") : if ($f_actionObjType = "crvh") : if ($f_actionID == "101") : // Get position on map // ... elseif ($f_actionID == "102") : // Get delivery run sheet // getLogData("log.logo_id = '1000' AND log.id_01 = '" . $f_actionObjId . "'"); // getSuHistoryData("0", "AND stk.stk_pre_id = '" . $rootStockSU . "' AND atih.atih_serialno = '" . $f_actionObjId . "'"); if ($f_act == "processAction") : $maskDisplay01Switch = "0"; $maskDisplay02Switch = "0"; $maskDisplay03Switch = "0"; $maskDisplay04Switch = "1"; $maskDisplay05Switch = "0"; $maskDisplay06Switch = "0"; $maskDisplay07Switch = "0"; endif; elseif ($f_actionID == "103") : // Get service jobs $f_jb_filter_2 = $f_actionObjId; // Set filter for service jobs regarding the serialnumber of the service unit // getServiceJoblist(); // Will be called later including this filter !!! if ($f_act == "processAction") : $maskDisplay01Switch = "0"; $maskDisplay02Switch = "0"; $maskDisplay03Switch = "1"; $maskDisplay04Switch = "0"; $maskDisplay05Switch = "0"; $maskDisplay06Switch = "0"; $maskDisplay07Switch = "0"; endif; resetActionParameters(); elseif ($f_actionID == "104") : // getSuMessageData($f_actionObjId); if ($f_act == "processAction") : $maskDisplay01Switch = "0"; $maskDisplay02Switch = "0"; $maskDisplay03Switch = "0"; $maskDisplay04Switch = "0"; $maskDisplay05Switch = "1"; $maskDisplay06Switch = "0"; $maskDisplay07Switch = "0"; endif; elseif ($f_actionID == "105") : // Set form fields for the administration // $f_su_admin_filter_1 = $f_actionObjId; // Set filter for administration of the service unit $jsExecBodyOnLoadArray[2] = "1"; // Set service unit form data according to $f_actionObjId if ($f_act == "processAction") : $jsExecBodyOnLoadArray[0] = "1"; // Set form by "body onLoad" $maskDisplay01Switch = "0"; $maskDisplay02Switch = "0"; $maskDisplay03Switch = "0"; $maskDisplay04Switch = "0"; $maskDisplay05Switch = "0"; $maskDisplay06Switch = "1"; $maskDisplay07Switch = "0"; endif; resetActionParameters(); endif; endif; endif; // Check $parMaskDispositionCheckDeliveryBeforeService = getParameterValue("0", "MASK_DISPOSITION_CHECK_DELIVERY_BEFORE_SERVICE_DISABLED", $f_hq_id); if ($parMaskDispositionCheckDeliveryBeforeService == "") : $parMaskDispositionCheckDeliveryBeforeService = getParameterValue("0", "MASK_DISPOSITION_CHECK_DELIVERY_BEFORE_SERVICE_DISABLED", "0"); endif; // Calendar $parMaskDispositionCalenderSubmitDisabled = getParameterValue("0", "MASK_DISPOSITION_CALENDER_SUBMIT_DISABLED", $f_hq_id); if ($parMaskDispositionCalenderSubmitDisabled == "") : $parMaskDispositionCalenderSubmitDisabled = getParameterValue("0", "MASK_DISPOSITION_CALENDER_SUBMIT_DISABLED", "0"); endif; ?> <?php echo $pageTitel ?> .... as "actioncontainer" if ($isFirefox) : $actioncontainerDivPos = "style=\"position:fixed; top:100px; left:450; width:700px; height:700px; z-index:12; overflow:auto; background-color:#AACCAA;\""; $calendarcontainerDivPos = "style=\"position:fixed; top:100px; left:650; width:180px; height:190px; z-index:13; overflow:auto; background-color:#AAAACC;\""; $servicefiltercontainerDivPos = "style=\"position:fixed; top:100px; left:950; width:150px; height:250px; z-index:13; overflow:auto; background-color:#AACCAA;\""; $itemsortcontainerDivPos = "style=\"position:fixed; top:110px; left:100; width:500px; height:800px; z-index:14; overflow:auto; background-color:#AACCAA;\""; $menuselectioncontainerDivPos = "style=\"position:fixed; top:100px; left:100; width:250px; height:150px; z-index:13; overflow:auto; background-color:#AACCAA;\""; else : $actioncontainerDivPos = ""; ?>
>
 
>
" onClick="callCalendar();">
>
"; echo addCheckboxesFromTable("f_services","metatype","mt_sort","mt_mapped_value","mt_sort","mt_type = 'service' AND mt_objtype = '' AND mt_objid = '0' AND mt_sort != '1'",$f_services, "
"); ?>
" onClick="callServiceFilter();">
>
" onClick="callItemSort();">     " onClick="finishPageItemSort();">