2332 lines
129 KiB
PHP
2332 lines
129 KiB
PHP
<?php
|
||
/*=======================================================================
|
||
*
|
||
* jb_list.php
|
||
*
|
||
* Autor: Marc Vollmann
|
||
*
|
||
=======================================================================*/
|
||
|
||
include_once ("../include/mcglobal.inc.php");
|
||
include_once ("../include/auth.inc.php");
|
||
include_once ("../include/caglobal.inc.php"); // For courier-list only
|
||
include_once ("../include/copy_job.inc.php"); // E.g. for "Storno"
|
||
include_once ("../include/ranking.inc.php"); // Checks ranking to be lost or not
|
||
include_once ("../include/bwv.inc.php"); // Longhaul jobs
|
||
include_once ("../include/inc_file.inc.php"); // For persistent data on the filesystem only
|
||
include_once ("../include/inc_user.inc.php"); // E.g. for employees enabled for dispo
|
||
include_once ("../include/inc_job.inc.php");
|
||
|
||
|
||
// Include functions if FDS is enabled only
|
||
$fastDispositionStructureEnabled = getParameterValue("0", "FAST_DISPOSITION_STRUCTURE_ENABLED", "0");
|
||
if ($fastDispositionStructureEnabled == "1") :
|
||
include ("../include/inc_vehicle.inc.php");
|
||
endif;
|
||
|
||
// Get the rights of the employee logged in and check the accessibility
|
||
authCheckEmployeeRights($emp_id, "4", "1");
|
||
|
||
// Check HTTP-Parameters
|
||
getSecHttpVars("1",array("f_act", "customerId", "cscIdRoot", "cscIdActual", "statusMessage", "dbhistory",
|
||
"defaultListStatus", "maskNumOfWin", "maskNumOfWins", "showScalingMenu", "fileOutput",
|
||
"jb_status", "jb_costcenter", "jb_sort", "job_no_from", "job_no_to",
|
||
"day_from", "month_from", "year_from", "day_to", "month_to", "year_to",
|
||
"jb_id_storno", "jb_storno_costs", "jb_storno_rhythm", "jb_storno_jbp_id", "f_jb_id",
|
||
"f_cr_sid", "f_jb_cr_price", "f_jb_cr_subprice", "f_jb_cr_markup", "f_cr_sid_search", "f_area_from", "f_area_to",
|
||
"f_filter", "f_filter_active", "f_filter_vehicletype", "f_filter_employee", "f_filter_service",
|
||
"f_sort_direction", "f_filter_related_customer",
|
||
"f_search_ad_street", "f_search_ad_zipcode", "f_search_ad_city", "f_search_ad_country",
|
||
"f_search_tr_comp", "f_search_tr_person", "f_search_tr_remark",
|
||
"f_search_tr_commission_no", "f_currentRefreshState",
|
||
"f_search_ad_street_payer", "f_search_ad_zipcode_payer", "f_search_ad_city_payer", "f_search_ad_country_payer",
|
||
"f_search_cmp_comp_payer", "f_search_cs_eid_payer", "f_search_csc_name_payer",
|
||
"f_filter_browse_start", "f_hq_id", "g_crvh_filter", "displaySearchfields", "deactivateMenu", "f_cr_availabletime_reset"));
|
||
|
||
getLanguage(__FILE__);
|
||
|
||
$deactivateMenuStatic = "1";
|
||
$pageTitel = getLngt("AUFTRAGSLISTEN");
|
||
include_once ("../admin/menu.php");
|
||
include_once ("../include/html.inc.php");
|
||
getCurrentScript(__FILE__);
|
||
|
||
|
||
// Check for authentication access and granted rights
|
||
$usrAccessArray["hq"] = "1";
|
||
authCheckForAccess($hq_id, $usr_id, $emp_id, "1", $customerId, $cscIdRoot, $cscIdActual);
|
||
|
||
// Get the emp_id of the root admin
|
||
$empIdRootAdmin = getEmpIdOfRootAdmin($userTypeName);
|
||
|
||
// Check for mode of system usage
|
||
$globalParUseRelatedCustomer = getParameterValue("0", "GLOBAL_USE_RELATED_CUSTOMER", "0");
|
||
|
||
// Path for download
|
||
$tempPath = getParameterValue("0", "TEMP_PATH", $hq_id);
|
||
if ($tempPath == "") : $tempPath = getParameterValue("0", "TEMP_PATH", "0"); endif;
|
||
if ($tempPath == "") : $tempPath = "../temp/download/"; endif;
|
||
|
||
// Optional File output of the job list if requested
|
||
if ($fileOutput != "1") :
|
||
$fileOutput = "0";
|
||
endif;
|
||
|
||
if ($jb_status == "") : $jb_status = "$defaultListStatus"; endif; // Initilize job status with default
|
||
if ($jb_status == "") : $jb_status = "8"; endif; // Initilize job status if no default exists
|
||
|
||
if ($jb_status == "10") : $jb_status = "ALL"; endif; // "10" is equal to "All jobs"
|
||
if ($jb_costcenter == "") : $jb_costcenter = "1"; endif;
|
||
|
||
// Search jobs
|
||
$idSearchArray = array();
|
||
$job_no_from = trim($job_no_from);
|
||
$job_no_to = trim($job_no_to);
|
||
if ($globalParUseRelatedCustomer == "1") :
|
||
$job_no_to = ""; // Clear because one search field does exist only
|
||
$idSearchArray = searchJobs($job_no_from);
|
||
else :
|
||
if (!is_numeric($job_no_from)) : $job_no_from = ""; endif;
|
||
if (!is_numeric($job_no_to)) : $job_no_to = ""; endif;
|
||
endif;
|
||
$idSearchArrayLen = count($idSearchArray);
|
||
|
||
$f_cr_sid_search = trim($f_cr_sid_search);
|
||
if ($f_filter_vehicletype == "") : $f_filter_vehicletype = "0"; endif;
|
||
if ($f_filter_employee == "") : $f_filter_employee = "0"; endif;
|
||
if ($f_filter_service == "") : $f_filter_service = ""; endif;
|
||
if ($f_filter_browse_start == "") : $f_filter_browse_start = "0"; endif;
|
||
if ($f_sort_direction == "1") :
|
||
$f_sort_direction_text = "DESC"; // DESCending
|
||
else :
|
||
$f_sort_direction = "0";
|
||
$f_sort_direction_text = "ASC"; // Sort is ASCending (default in SQL)
|
||
endif;
|
||
if ($displaySearchfields == "") : $displaySearchfields = "1"; endif;
|
||
|
||
// Number of frames and definition of frame names (e.g. for date fields)
|
||
if (!isset($maskNumOfWin)) : $maskNumOfWin = ""; endif; // ONLY is set if more than one frame
|
||
$currentFrameName = "maincontent";
|
||
if (is_numeric($maskNumOfWin)) :
|
||
$currentFrameName = "content" . $maskNumOfWin;
|
||
endif;
|
||
|
||
// Check global usage of the context menu
|
||
$maskGlobalUsageContextMenu = getParameterValue("0", "MASK_JOBLIST_CONTEXTMENU_ENABLED", $hq_id);
|
||
if ($maskGlobalUsageContextMenu != "1") : $maskGlobalUsageContextMenu = getParameterValue("0", "MASK_JOBLIST_CONTEXTMENU_ENABLED", "0"); endif;
|
||
$maskUsageContextMenuAllCases = getParameterValue("0", "MASK_JOBLIST_CONTEXTMENU_ALL_CASES_ENABLED", $hq_id);
|
||
if ($maskUsageContextMenuAllCases != "1") : $maskUsageContextMenuAllCases = getParameterValue("0", "MASK_JOBLIST_CONTEXTMENU_ALL_CASES_ENABLED", "0"); endif;
|
||
|
||
// Check for displaying column with cancellation links
|
||
$maskDisplayColCacellationEnabled = getParameterValue("0", "MASK_JOBLIST_DISPLAY_COL_CANCELLATION", $hq_id);
|
||
|
||
$parMaskDispositionGroup = "";
|
||
if ($globalParUseRelatedCustomer == "1") :
|
||
$parMaskDispositionGroup = getParameterValue($emp_id, "MASK_DISPOSITION_INIT_GROUP", $hq_id);
|
||
if ($f_filter_related_customer == "") : $f_filter_related_customer = ""; endif;
|
||
endif;
|
||
|
||
// Get tax value
|
||
$globalParSalesTaxRate = getParameterValue("0", "GLOBAL_SALES_TAX", "0");
|
||
if ($globalParSalesTaxRate == "" || !is_numeric($globalParSalesTaxRate)) : $globalParSalesTaxRate = 19; endif;
|
||
|
||
// Filters: "Show permanent jobs", "Show future jobs", "Show incomplete jobs"
|
||
$filter_job_permanent = "checked";
|
||
$filter_job_future = "";
|
||
$filter_job_incomplete = "";
|
||
$filter_job_serviceprice = "";
|
||
$filter_only_not_exported = "";
|
||
$filter_no_storno = "";
|
||
$filter_cr_price = "";
|
||
$filter_cr_favoured = "";
|
||
$filter_tr_time_check = "";
|
||
$filter_searchdeep = "";
|
||
$filter_only_longhaul = "";
|
||
$filter_only_offer = "";
|
||
$filter_no_offer = "";
|
||
$filter_display_invisible = "";
|
||
|
||
if ($f_filter_active == "1") : // Check if entry is from menu or joblist by itself ...
|
||
$filter_job_permanent = "";
|
||
$filter_job_future = "";
|
||
endif;
|
||
if ($f_filter != "") :
|
||
if (!(array_search("job_permanent",$f_filter) === FALSE)) : $filter_job_permanent = "checked"; endif;
|
||
if (!(array_search("job_future",$f_filter) === FALSE)) : $filter_job_future = "checked"; endif;
|
||
if (!(array_search("job_incomplete",$f_filter) === FALSE)) : $filter_job_incomplete = "checked"; endif;
|
||
if (!(array_search("job_serviceprice",$f_filter) === FALSE)) : $filter_job_serviceprice = "checked"; endif;
|
||
if (!(array_search("job_only_not_exported",$f_filter) === FALSE)) : $filter_only_not_exported = "checked"; endif;
|
||
if (!(array_search("job_no_storno",$f_filter) === FALSE)) : $filter_no_storno = "checked"; endif;
|
||
if (!(array_search("job_cr_price",$f_filter) === FALSE)) : $filter_cr_price = "checked"; endif;
|
||
if (!(array_search("job_cr_favoured",$f_filter) === FALSE)) : $filter_cr_favoured = "checked"; endif;
|
||
if (!(array_search("job_tr_time_check",$f_filter) === FALSE)) : $filter_tr_time_check = "checked"; endif;
|
||
if (!(array_search("job_tr_searchdeep",$f_filter) === FALSE)) : $filter_searchdeep = "checked"; endif;
|
||
if (!(array_search("job_only_longhaul",$f_filter) === FALSE)) : $filter_only_longhaul = "checked"; endif;
|
||
if (!(array_search("job_only_offer",$f_filter) === FALSE)) : $filter_only_offer = "checked"; endif;
|
||
if (!(array_search("job_no_offer",$f_filter) === FALSE)) : $filter_no_offer = "checked"; endif;
|
||
if (!(array_search("job_display_invisible",$f_filter) === FALSE)) : $filter_display_invisible = "checked"; endif;
|
||
endif;
|
||
|
||
// Init
|
||
mcIsSet($empIdMaster);
|
||
mcIsSet($filter_areas_from);
|
||
mcIsSet($filter_areas_to);
|
||
mcIsSet($cr_id_order_list);
|
||
mcIsSet($cr_id_order_list2);
|
||
mcIsSet($vht_id_str_js);
|
||
mcIsSet($customercourier_list);
|
||
|
||
// Mandator filter
|
||
if ($f_hq_id == "") : $f_hq_id = array(); endif;
|
||
if (count($f_hq_id) == 0) : array_push($f_hq_id, $hq_id); endif;
|
||
|
||
// HQ_ID string e.g. for courier list
|
||
$f_hq_id_string = implode(",", $f_hq_id);
|
||
|
||
// Current number of headquarters of the mandator
|
||
$numOfHq = getCountOfTable("mandatorheadquarters", "md_id = '" . $md_id . "'");
|
||
|
||
// Get usr_id of the current employee (session)
|
||
$currentSessionUsrId = getFieldValueFromId("employee", "emp_id", $emp_id, "usr_id");
|
||
$currentSessionUsrHqId = getFieldValueFromId("user", "usr_id", $currentSessionUsrId, "hq_id");
|
||
|
||
// Get the general invmode for the headquarter
|
||
$mediationMode = MODE_INTERMEDIATION;
|
||
if ($mediationMode == "") :
|
||
$mediationMode = getFieldValueFromId("headquarters", "hq_id", "$hq_id", "hq_invmode");
|
||
endif;
|
||
|
||
// Look-up for existence of the mediation-area
|
||
if ($mediationMode == "1") :
|
||
// mediation area equals a single zipcode
|
||
if ($f_area_from != "") :
|
||
if (!existsEntry("serviceplz",array("srvp_plz",$f_area_from))) :
|
||
$f_area_from = "";
|
||
endif;
|
||
endif;
|
||
if ($f_area_to != "") :
|
||
if (!existsEntry("serviceplz",array("srvp_plz",$f_area_to))) :
|
||
$f_area_to = "";
|
||
endif;
|
||
endif;
|
||
elseif ($mediationMode == "2" || $mediationMode == "3") :
|
||
// mediation area is an aggregation of zipcodes
|
||
if ($f_area_from != "") :
|
||
if (!existsEntry("serviceplzarea",array("srvpa_name",$f_area_from))) :
|
||
$f_area_from = "";
|
||
endif;
|
||
endif;
|
||
if ($f_area_to != "") :
|
||
if (!existsEntry("serviceplzarea",array("srvpa_name",$f_area_to))) :
|
||
$f_area_to = "";
|
||
endif;
|
||
endif;
|
||
endif;
|
||
|
||
// Check range of date. All fields have to be set
|
||
if ($day_from == "" || $month_from == "" || $year_from == "" ||
|
||
$day_to == "" || $month_to == "" || $year_to == "") :
|
||
|
||
// Initialize date-ranges to the current date
|
||
$fromDateRange = getDateTime("3") . " 00:00:00";
|
||
$toDateRange = getDateTime("3") . " 23:59:59";
|
||
|
||
$maskJoblistStartdateYesterday = getParameterValue("0", "MASK_JOBLIST_STARTDATE_YESTERDAY");
|
||
if ($maskJoblistStartdateYesterday == "1") :
|
||
$day_from = getDateTime("day_yesterday");
|
||
$month_from = getDateTime("month_yesterday");
|
||
$year_from = getDateTime("year_yesterday");
|
||
else :
|
||
$day_from = getDateTime("day");
|
||
$month_from = getDateTime("month");
|
||
$year_from = getDateTime("year");
|
||
endif;
|
||
$day_to = getDateTime("day_tomorrow");
|
||
$month_to = getDateTime("month_tomorrow");
|
||
$year_to = getDateTime("year_tomorrow");
|
||
else :
|
||
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . pad($day_from,2) . " 00:00:00";
|
||
$toDateRange = $year_to . "-" . pad($month_to,2) . "-" . pad($day_to,2) . " 23:59:59";
|
||
endif;
|
||
|
||
// Decision to use the archive or normal tables
|
||
$dbhistory = getDBNames($dbhistory, $year_from);
|
||
|
||
|
||
// All open jobs in the future have to be displayed
|
||
if ($filter_job_future != "") : $toDateRange = ""; endif;
|
||
|
||
// Get parameter values
|
||
$maskJoblistBrowseMax = getParameterValue($emp_id, "MASK_JOBLIST_BROWSE_MAX");
|
||
if ($maskJoblistBrowseMax == "" || !is_numeric($maskJoblistBrowseMax) || $maskJoblistBrowseMax < 100 || $maskJoblistBrowseMax > 1000) :
|
||
$maskJoblistBrowseMax = 100;
|
||
endif;
|
||
$maskJoblistShowUpToVht = getParameterValue($emp_id, "MASK_JOBLIST_SHOW_UPTO_VHT");
|
||
if ($maskJoblistShowUpToVht == "0" || !is_numeric($maskJoblistShowUpToVht)) :
|
||
$maskJoblistShowUpToVht = "";
|
||
endif;
|
||
$maskJoblistModeJobNum = getParameterValue($emp_id, "MASK_JOBLIST_MODE_JOB_NUM");
|
||
$maskJoblistModeRefresh = getParameterValue($emp_id, "MASK_JOBLIST_MODE_REFRESH");
|
||
$maskJoblistGetCourierData = getParameterValue($emp_id, "MASK_JOBLIST_GET_COURIER_DATA");
|
||
|
||
// Get minutes to be added to the ordertime a taken AD HOC job will be declared with a warning
|
||
$maskJoblistTakenJobOrdertimePlusOffsetMinutes = getParameterValue("0", "MASK_TAKEN_JOB_ORDERTIME_PLUSOFFSETMINUTES", $hq_id);
|
||
|
||
// Get minutes to be added to the ordertime a taken RESERVATION job will be declared with a warning
|
||
$maskJoblistTakenReservationJobOrdertimePlusOffsetMinutes = getParameterValue("0", "MASK_TAKEN_JOB_ORDERTIME_RESERVATION_PLUSOFFSETMINUTES", $hq_id);
|
||
|
||
// Table header fields
|
||
$maskJoblistHeaderFieldsBgColJbOrdertime = getParameterValue("0", "MASK_JOBLIST_HEADERFIELD_BGCOL_ORDERTIME", $hq_id);
|
||
if ($maskJoblistHeaderFieldsBgColJbOrdertime == "") : $maskJoblistHeaderFieldsBgColJbOrdertime = getParameterValue("0", "MASK_JOBLIST_HEADERFIELD_BGCOL_ORDERTIME", "0"); endif;
|
||
$maskJoblistHeaderFieldsBgColJbDispoinfo = getParameterValue("0", "MASK_JOBLIST_HEADERFIELD_BGCOL_DISPOINFO", $hq_id);
|
||
if ($maskJoblistHeaderFieldsBgColJbDispoinfo == "") : $maskJoblistHeaderFieldsBgColJbDispoinfo = getParameterValue("0", "MASK_JOBLIST_HEADERFIELD_BGCOL_DISPOINFO", "0"); endif;
|
||
|
||
// Get GLOBAL parameter for the number of hops (to be searched in)
|
||
$jobHopsToBeSearchedIn = "";
|
||
if ($filter_searchdeep == "checked" || $jb_status == "1") :
|
||
$jobHopsToBeSearchedIn = getParameterValue("0", "JOBLIST_NUM_OF_HOPS", "0");
|
||
endif;
|
||
if ($jobHopsToBeSearchedIn == "" || !is_numeric($jobHopsToBeSearchedIn)) :
|
||
$jobHopsToBeSearchedIn = "6"; // Default
|
||
endif;
|
||
|
||
|
||
// Get customers for displaying the jobs with special colour
|
||
$csIdColArray = getColVectorFromDB2ArrayByClause("parameter", "par_value", "par_key LIKE 'JOBLIST_CS_JB_COLOR%'", "SUBSTR(par_key,21) AS par_key");
|
||
$csIdColKeyArray = array_keys($csIdColArray);
|
||
|
||
|
||
|
||
// *** Save job-informations (Begin) ***
|
||
if ($f_act == "storno" && $jb_id_storno != "" && ($jb_storno_costs == "1" || $jb_storno_costs == "2")) :
|
||
|
||
// Set the current timestamp to store the data
|
||
$currentTime = getDateTime("0");
|
||
|
||
// Update the job-entry:
|
||
// jb_storno = 1 or 2 (selectable by hq), jb_status = 2 (finished), jb_finishtime = NOW()
|
||
|
||
TA("B");
|
||
|
||
// Get current jb_status and cr_id of the storno job
|
||
$jbStatus = getFieldValueFromId("job","jb_id",$jb_id_storno,"jb_status");
|
||
$crId = getFieldValueFromId("job","jb_id",$jb_id_storno,"cr_id");
|
||
$crIdOrder = getFieldValueFromId("job","jb_id",$jb_id_storno,"cr_id_order");
|
||
|
||
$jbStatusString = " (jb_status = '8' OR jb_status = '9' OR jb_status = '0' OR jb_status = '1') ";
|
||
if (is_numeric($jb_status)) :
|
||
$jbStatusString = "jb_status = '" . $jb_status . "'";
|
||
else :
|
||
if ($jb_status == "ALL") :
|
||
$jbStatusString = "jb_status = '" . $jbStatus . "'";
|
||
endif;
|
||
endif;
|
||
$jbStatusString .= " AND (isnull(jb_export_time) OR jb_export_time = '' OR jb_export_time = '0000-00-00 00:00:00' OR jb_export_time = '9999-12-31 23:59:59')";
|
||
|
||
$res = updateStmt("job", "jb_id", $jb_id_storno,
|
||
array("jb_storno", $jb_storno_costs, "usr_id_storno", $usr_id, "jb_status" , "2", "jb_finishtime", $currentTime), "(" . $jbStatusString . " AND (isnull(jb_storno) OR jb_storno = '0'))");
|
||
|
||
if ($db->affected_rows > 0) :
|
||
|
||
// Insert PDA command to remove job (take cr_id/cr_id_order before changing)
|
||
if ($jbStatus == "1") :
|
||
if ($crId != "" && $crId != "0") :
|
||
insertPDACommand($hq_id, $crId, "3", "1", $jb_id_storno, $currentTime, "");
|
||
insertPDACommand($hq_id, $crId, "8", "1", $jb_id_storno, $currentTime, "");
|
||
endif;
|
||
if ($crIdOrder != "" && $crIdOrder != "0" && $crIdOrder != $crId) :
|
||
insertPDACommand($hq_id, $crIdOrder, "3", "1", $jb_id_storno, $currentTime, "");
|
||
insertPDACommand($hq_id, $crIdOrder, "8", "1", $jb_id_storno, $currentTime, "");
|
||
endif;
|
||
endif;
|
||
|
||
// Check for storno-job has a standing order
|
||
$jbPermanent = getFieldValueFromId("job","jb_id",$jb_id_storno,"jb_permanent");
|
||
|
||
if ($jbPermanent != "" && $jbPermanent > "0") :
|
||
// Check for the continued existence of the standing order rule
|
||
if ($jb_storno_rhythm == "2") :
|
||
// Update row for termnination of the standing order
|
||
updateStmt("job", "jb_id", $jb_id_storno, array("jb_permanent", "0"));
|
||
endif;
|
||
endif;
|
||
|
||
// Remove payment entry/entries from table "jobpayment" for the job if not being exported
|
||
$removedFromJbp = false;
|
||
if ($jb_storno_jbp_id != "" && is_numeric($jb_storno_jbp_id)) :
|
||
// Remove ALL payments if NOT be exported
|
||
deleteStmt("jobpayment","jb_id = '" . $jb_id_storno . "' AND (jbpc_id = '' OR jbpc_id = '0')");
|
||
// Check for removal
|
||
$jbpcJbId = getFieldValueFromId("jobpayment","jbp_id",$jb_storno_jbp_id,"jb_id");
|
||
if ($jbpcJbId == "") :
|
||
$removedFromJbp = true;
|
||
$statusMessage = getLngt("ACHTUNG: Die Einnahmenbuchung dieses stornierten Auftrags wurde gel<65>scht, da noch KEIN Export stattfand!");
|
||
else :
|
||
$statusMessage = getLngt("ACHTUNG: Die Einnahmenbuchung dieses stornierten Auftrags wurde schon exportiert und kann deshalb NICHT gel<65>scht werden!");
|
||
endif;
|
||
endif;
|
||
|
||
// Remove reservation entry from table "vehicledisposition" if FDS is enabled
|
||
$removedFromFDS = false;
|
||
if ($fastDispositionStructureEnabled == "1") :
|
||
$removedFromFDS = removeAssocCrvhJb($jb_id_storno, "", "", "1");
|
||
endif;
|
||
|
||
// Storno "addmont" job
|
||
$gdcContentIdAddMon = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = 'jb' AND gdc_gen_fieldname = 'jb_id_addmont' AND gdc_obj_id = '" . $jb_id_storno . "'");
|
||
if ($gdcContentIdAddMon != "" && is_numeric($gdcContentIdAddMon)) :
|
||
updateStmt("job", "jb_id", $gdcContentIdAddMon, array("jb_storno", "2", "jb_status", "2", "jb_incomplete", "1", "jb_finishtime", $currentTime));
|
||
endif;
|
||
|
||
// Get all stations (tr_id) of the job to remove potential existing "check_exist" entries in GDC (as result of import) to enable a new import after cancellation
|
||
$trIdArray = getColVectorFromDB2ArrayByClause("tour", "tr_id", "jb_id = '" . $jb_id_storno . "'");
|
||
if (count($trIdArray) > 0) :
|
||
deleteStmt("genericdatacontainer","gdc_obj_type = 'tr' AND gdc_gen_fieldname = 'check_exist' AND gdc_obj_id IN (" . implode(",", $trIdArray) . ")");
|
||
endif;
|
||
deleteStmt("genericdatacontainer","gdc_obj_type = 'jb' AND gdc_gen_fieldname = 'check_exist' AND gdc_obj_id = '" . $jb_id_storno . "'");
|
||
|
||
$jb_id_insurance = $db->getOne("SELECT gdc_content FROM genericdatacontainer WHERE gdc_obj_type = 'jb' AND gdc_obj_id = " . $jb_id_storno . " AND gdc_gen_fieldname = 'jb_id_insurance'");
|
||
if ($jb_id_insurance != "") {
|
||
deleteStmt("genericdatacontainer", "gdc_obj_type = 'jb' AND gdc_obj_id = " . $jb_id_storno . " AND gdc_gen_fieldname = 'jb_id_insurance'");
|
||
deleteStmt("job", "jb_id = " . $jb_id_insurance);
|
||
deleteStmt("tour", "jb_id = " . $jb_id_insurance);
|
||
deleteStmt("tourservice", "jb_id = " . $jb_id_insurance);
|
||
}
|
||
|
||
// Write logdata into log database
|
||
writeToLogDB("10",$hq_id,$jb_id_storno,$currentSessionUsrId,"","","","COSTS=" . ($jb_storno_costs == "1" ? "YES" : "NO") . "|JB_RHYTHM_DEL=" . $jb_storno_rhythm . "|JBP_REMOVAL=" . ($removedFromJbp ? "YES" : "NO") . "|FDS_REMOVAL=" . ($removedFromFDS ? "YES" : "NO"));
|
||
|
||
// Call for generation of a new job with negative invoice data
|
||
if ($globalParUseRelatedCustomer != "1") :
|
||
copy_job($jb_id_storno, $jb_storno_costs, $jbStatus, true);
|
||
else :
|
||
// Remove commission no.
|
||
updateStmt("tour", "jb_id", $jb_id_storno, array("tr_commission_no", ""));
|
||
endif;
|
||
|
||
|
||
// **** Send cancellation mail if enabled for payer ****
|
||
|
||
// Exclude jobs with special vehicles (E.g.: Do not generate a mail if internal job is generated with vehicle SID=1888)
|
||
$excludedVehicles = getParameterValue("0", "EMAIL_CRVHSID_NO_MAIL", "0"); // "Meta-Global" <=> hq_id = 0
|
||
$whereClauseExcludedVehicles = "";
|
||
if ($excludedVehicles != "") :
|
||
$tmp = spliti(",",$excludedVehicles);
|
||
$lenTmp = count($tmp);
|
||
for ($i = 0; $i < $lenTmp; $i++) {
|
||
$whereClauseExcludedVehicles .= " jb.cr_sid != '" . $tmp[$i] . "' AND ";
|
||
};
|
||
endif;
|
||
$whereClauseExcludedVehicles = " ";
|
||
$sqlquery = "SELECT usr.usr_email, jb.cr_sid, jb.hq_id, cs.cs_jbstatusmail2csc, cscad.cscad_email, cs.cs_id"
|
||
. " FROM job AS jb, costcenter AS csc, customer AS cs, costcenteraddress AS cscad, employee AS emp, user AS usr"
|
||
. " WHERE jb.jb_id = '" . $jb_id_storno . "' AND"
|
||
. " jb.jb_offer = '0' AND"
|
||
. $whereClauseExcludedVehicles
|
||
. " jb.csc_id_payer = csc.csc_id AND"
|
||
. " csc.cs_id = cs.cs_id AND"
|
||
. " SUBSTRING(cs.cs_jbstatusmail_fields,8,1) = '1' AND"
|
||
. " cs.cs_admin = emp.emp_id AND"
|
||
. " emp.usr_id = usr.usr_id AND"
|
||
. " csc.csc_id = cscad.csc_id AND"
|
||
. " cscad.adt_id = '2' ";
|
||
|
||
$result = $db->query($sqlquery);
|
||
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
|
||
$jbRetArray = array();
|
||
while ($row = $result->fetch_assoc()):
|
||
$jbRetArray = array($row["usr_email"], $row["cr_sid"], $row["hq_id"], $row["cs_jbstatusmail2csc"], $row["cscad_email"], $row["cs_id"]);
|
||
endwhile;
|
||
$result->free();
|
||
|
||
$jbRetArrayLen = count($jbRetArray);
|
||
if ($jbRetArrayLen > 0) :
|
||
|
||
$f_email = trim($jbRetArray[0]);
|
||
$f_email = str_replace(" ", "", $f_email);
|
||
$f_email_csc = trim($jbRetArray[4]);
|
||
$f_email_csc = str_replace(" ", "", $f_email_csc);
|
||
if ($f_email_csc != "" && $jbRetArray[3] == "1") :
|
||
$f_email = $f_email_csc;
|
||
endif;
|
||
$csIdPayer = $jbRetArray[5];
|
||
|
||
// Check language by payer for sending email and take customer parameter
|
||
$csLanguageMail = getParameterValue("0", "JOBDETAILS_EMAIL_LANGUAGE_" . $csIdPayer, "0");
|
||
if ($csLanguageMail == "") : $csLanguageMail = "0"; endif;
|
||
$remLanguageSelected = "";
|
||
if ($languageSelected != $csLanguageMail) :
|
||
$remLanguageSelected = $languageSelected;
|
||
$languageSelected = $csLanguageMail;
|
||
getLanguage(__FILE__);
|
||
endif;
|
||
|
||
$mailContent = getLngt("Der Transportauftrag") . " " . $jb_id_storno . " ". getLngt("wurde storniert!");
|
||
$mailSubject = getLngt("Storno Transportauftrag") . " " . $jb_id_storno;
|
||
$mailTo = $f_email;
|
||
if ($mailTo == "") :
|
||
$mailTo = getParameterValue("0", "MAIL_SENDER_ADDRESS", $hq_id);
|
||
endif;
|
||
$mailResult = false;
|
||
if ($mailTo != "") :
|
||
$mailResult = sendExternalMailExtended($mailContent, $mailSubject, $mailTo);
|
||
endif;
|
||
|
||
// Reset language
|
||
if ($remLanguageSelected != "") :
|
||
$languageSelected = $remLanguageSelected;
|
||
getLanguage(__FILE__);
|
||
endif;
|
||
|
||
writeToLogDB("149",$hq_id,$jb_id_storno,$currentSessionUsrId,"","","","MAIL_STATE=" . ($mailResult ? "SENT" : "NOT SENT") . "|MAIL_TO=" . $mailTo);
|
||
endif;
|
||
endif;
|
||
|
||
TA("C");
|
||
TA("E");
|
||
endif;
|
||
|
||
|
||
if ($f_act == "setCourier" && $f_cr_sid != "" && $f_jb_id != "") :
|
||
|
||
// Get current cr_id of the job before changing the courier
|
||
$crIdCurrent = getFieldValueFromId("job","jb_id",$f_jb_id,"cr_id");
|
||
$crIdOrderCurrent = getFieldValueFromId("job","jb_id",$f_jb_id,"cr_id_order");
|
||
$jbHqId = getFieldValueFromId("job","jb_id",$f_jb_id,"hq_id_dispo");
|
||
$jbStatusCurrent = getFieldValueFromId("job","jb_id",$f_jb_id,"jb_status");
|
||
if ($jbHqId == "" || !is_numeric($jbHqId) || $jbHqId == "0") : $jbHqId = $hq_id; endif;
|
||
if ($f_cr_availabletime_reset != "1") : $f_cr_availabletime_reset = "0"; endif;
|
||
|
||
// getDbFieldValues("courier",array("cr_id","cr_occupied"),array("cr_sid",$f_cr_sid));
|
||
$cr_id = getFieldValueFromClause("courier","cr_id","cr_sid = '" . $f_cr_sid . "' ORDER BY cr_logintime");
|
||
$jb_status_new = "0";
|
||
$cr_id_new = "";
|
||
|
||
if ($cr_id == ""): // Offline-Dispo
|
||
$cr_id = getFieldValueFromClause("couriervehicle","cr_id","crvh_sid = '" . $f_cr_sid . "' ORDER BY crvh_export_time DESC");
|
||
if ($cr_id != "")
|
||
$jb_status_new = "1";
|
||
$cr_id_new = $cr_id;
|
||
endif;
|
||
|
||
if ($cr_id != "" && ($crIdCurrent != $cr_id || $jbStatusCurrent != "1")) :
|
||
|
||
$crHqId = getFieldValueFromId("courier","cr_id",$cr_id,"hq_id");
|
||
|
||
// RANKING
|
||
// Special treatment according to vehicletype ("BUS" or greater will NOT be revoked if job-order is "PKW")
|
||
// Get cr.vht_id and jb.vht_id
|
||
/*
|
||
$arLooseRanking = "1"; // Init: Loose ranking "yes"
|
||
$courierVhtId = getFieldValueFromId("courier","cr_id",$cr_id,"vht_id");
|
||
$jobVhtId = getFieldValueFromId("job","jb_id",$f_jb_id,"vht_id");
|
||
if ($courierVhtId != "" && $jobVhtId != "" && $courierVhtId >= getVhtId("5", "transporter_01") && $jobVhtId <= getVhtId("3", "car_02")) :
|
||
$arLooseRanking = "0"; // Loose ranking "no"
|
||
endif;
|
||
*/
|
||
// Special treatment according areas
|
||
$jbAdressIdStart = getFieldValueFromClause("tour", "ad_id", "jb_id = '" . $f_jb_id . "' AND tr_sort = '1'");
|
||
$jbZipcodeStart = getFieldValueFromId("address", "ad_id", $jbAdressIdStart, "ad_zipcode");
|
||
|
||
// 29.01.2018: No check for looseRanking if the job is in the future
|
||
$sqlStmt = "SELECT jb_ordertime, srvp_traveltime, job.hq_id_dispo, DATE_SUB(jb_ordertime, INTERVAL GREATEST(srvp_traveltime, 30) MINUTE) AS datesub, UNIX_TIMESTAMP(DATE_SUB(jb_ordertime, INTERVAL GREATEST(srvp_traveltime, 30) MINUTE)) AS unixtimestamp" .
|
||
" FROM serviceplz, serviceplztraveltime, job" .
|
||
" WHERE serviceplz.srvp_id = serviceplztraveltime.srvp_id AND srvp_plz = '" . $jbZipcodeStart . "' AND serviceplztraveltime.hq_id = job.hq_id_dispo AND jb_id = " . $f_jb_id;
|
||
writeLog_("../log/jb_list_", $sqlStmt);
|
||
$res = $db->query($sqlStmt);
|
||
if ($row = $res->fetch_assoc()):
|
||
writeLog_("../log/jb_list_", "jb_id = " . $f_jb_id . ", jbZipcodeStart = " . $jbZipcodeStart . ", srvp_traveltime = " . $row['srvp_traveltime'] . ", hq_id = " . $row["hq_id_dispo"] . ", jb_ordertime = " . $row['jb_ordertime'] . ", datesub = " . $row['datesub'] . ", unixtimestamp = " . $row['unixtimestamp']);
|
||
$unixtimestamp = $row['unixtimestamp'];
|
||
endif;
|
||
$res->free();
|
||
$arLooseRanking = "0";
|
||
if ($unixtimestamp < time()):
|
||
writeLog_("../log/jb_list_", "looseRanking will be checked\n");
|
||
$arLooseRanking = looseRanking($cr_id, $jbZipcodeStart, $jbHqId);
|
||
else:
|
||
writeLog_("../log/jb_list_", "looseRanking will _not_ be checked\n");
|
||
endif;
|
||
|
||
// Check first that courier is NOT occupied
|
||
// $cr_occupied = getFieldValueFromId("courier", "cr_id", $cr_id, "cr_occupied");
|
||
// if ($cr_occupied == "0") :
|
||
// if (getCountOfTable("job","cr_id_order = '" . $cr_id . "' AND (jb_status = '1' OR jb_status = '0') AND (isnull(jb_globaljob) or jb_globaljob = '0')") == 0) :
|
||
|
||
$currentTime = getDateTime("0");
|
||
|
||
TA("B");
|
||
|
||
// Update job
|
||
// According to be TA-safe the WHERE-Clause depends on the current list the user is in
|
||
$jbStatusString = " (jb_status = '8' OR jb_status = '9' OR jb_status = '0' OR jb_status = '1') ";
|
||
if (is_numeric($jb_status)) : $jbStatusString = "jb_status = '" . $jb_status . "'"; endif;
|
||
$res = updateStmt("job", "jb_id", $f_jb_id, array("cr_id", $cr_id_new, "cr_id_order", $cr_id, "jb_status", $jb_status_new, "cr_sid", $f_cr_sid, "jb_globaljob", "0", "jb_autoranking", "0"), $jbStatusString);
|
||
if ($db->affected_rows > 0) :
|
||
$jb_cr_price_tmp = "";
|
||
if ($f_jb_cr_price != "" && $f_jb_cr_subprice != "") {
|
||
$res = updateStmt("job", "jb_id", $f_jb_id, array("jb_cr_price", $f_jb_cr_price));
|
||
$res = updateStmt("jobprice", "jb_id", $f_jb_id, array("jbprc_price", $f_jb_cr_subprice), "mt_sort = 10");
|
||
$jb_cr_price_tmpArr = array();
|
||
$jb_cr_price_tmp = $db->getOne("SELECT gdc_content FROM genericdatacontainer WHERE gdc_obj_type = 'jb' AND gdc_obj_id = " . $f_jb_id . " AND gdc_gen_fieldname = 'jb_cr_price_tmp'");
|
||
if ($jb_cr_price_tmp != "") {
|
||
$jb_cr_price_tmp_time = substr($jb_cr_price_tmp, 0, 19);
|
||
$pos_start = strpos($jb_cr_price_tmp, "\$cr_id=" . $cr_id);
|
||
if ($pos_start !== false) {
|
||
$pos_end = strpos($jb_cr_price_tmp, "`", $pos_start);
|
||
if ($pos_end !== false) {
|
||
//writeLog_("../log/jb_list_", "substr(\$jb_cr_price_tmp, \$pos_start, \$pos_end - \$pos_start) = " . substr($jb_cr_price_tmp, $pos_start, $pos_end - $pos_start));
|
||
$jb_cr_price_tmp = substr($jb_cr_price_tmp, $pos_start, $pos_end - $pos_start);
|
||
$jb_cr_price_tmpArr = explode("|", $jb_cr_price_tmp);
|
||
//writeLog_("../log/jb_list_", " var_export(\$jb_cr_price_tmpArr, true) = " . var_export($jb_cr_price_tmpArr, true));
|
||
//writeLog_("../log/jb_list_", "count(\$jb_cr_price_tmpArr) = " . count($jb_cr_price_tmpArr));
|
||
for($j = 0; $j < count($jb_cr_price_tmpArr); $j++) {
|
||
$jb_cr_price_tmp_entry = explode("=", $jb_cr_price_tmpArr[$j]);
|
||
//writeLog_("../log/jb_list_", " var_export(\$jb_cr_price_tmp_entry, true) = " . var_export($jb_cr_price_tmp_entry, true));
|
||
unset($jb_cr_price_tmpArr[$j]);
|
||
$jb_cr_price_tmpArr[$jb_cr_price_tmp_entry[0]] = $jb_cr_price_tmp_entry[1];
|
||
}
|
||
}
|
||
}
|
||
}
|
||
//writeLog_("../log/jb_list_", "count(\$jb_cr_price_tmpArr) = " . count($jb_cr_price_tmpArr));
|
||
//writeLog_("../log/jb_list_", " var_export(\$jb_cr_price_tmpArr, true) = " . var_export($jb_cr_price_tmpArr, true));
|
||
if (count($jb_cr_price_tmpArr) > 0) {
|
||
deleteStmt("genericdatacontainer", "gdc_obj_type = 'jb' AND gdc_obj_id = " . $f_jb_id . " AND gdc_gen_fieldname = 'jb_cr_price_retour'");
|
||
insertStmt("genericdatacontainer", array("gdc_obj_type", "jb", "gdc_obj_id", $f_jb_id, "gdc_gen_fieldname", "jb_cr_price_retour", "gdc_content", $jb_cr_price_tmpArr["\$jb_cr_price"] . "|" . $jb_cr_price_tmpArr["\$jb_cr_price_sub"] , "gdc_context", ""));
|
||
$jb_km_unrounded = $db->getOne("SELECT jbprc_price FROM jobprice WHERE jb_id = " . $f_jb_id . " AND mt_sort = 11");
|
||
$jb_cr_price_text = mk_jb_cr_price_text($jb_cr_price_tmpArr, $f_jb_id, $jb_cr_price_tmp_time, $jb_km_unrounded);
|
||
// "\$cur_jb_ordertime=" . $cur_jb_ordertime . "|" .
|
||
$jb_freetext_3 = $db->getOne("SELECT jb_freetext_3 FROM job WHERE jb_id = " . $f_jb_id);
|
||
//writeLog_("../log/jb_list_", "strpos(\$jb_freetext_3, \"~~~\" . PHP_EOL) = " . strpos($jb_freetext_3, "~~~" . PHP_EOL));
|
||
//writeLog_("../log/jb_list_", "\$jb_freetext_3_honk = " . $jb_freetext_3);
|
||
//writeLog_("../log/jb_list_", "\$jb_freetext_3_explode = " . var_export(explode("\n", $jb_freetext_3), true));
|
||
if (!(strpos($jb_freetext_3, "~~~") === false)):
|
||
$jb_freetext_3Arr = explode("\n", $jb_freetext_3);
|
||
$jb_freetext_3 = "";
|
||
$isintexttobedeleted = false;
|
||
for ($j = 0; $j < count($jb_freetext_3Arr); $j++) {
|
||
//writeLog_("../log/jb_list_", "\$jb_freetext_3 = #" . $jb_freetext_3Arr[$j]) . "#";
|
||
if ($jb_freetext_3Arr[$j] == "~~~") {
|
||
$isintexttobedeleted = !$isintexttobedeleted;
|
||
} else {
|
||
if (!$isintexttobedeleted) {
|
||
$jb_freetext_3 .= $jb_freetext_3Arr[$j] . "\n";
|
||
//writeLog_("../log/jb_list_", "\$jb_freetext_3 = |" . $jb_freetext_3Arr[$j]) . "|";
|
||
}
|
||
}
|
||
}
|
||
// $jb_cr_price_text_old = strstr($jb_freetext_3, "~~~" . PHP_EOL);
|
||
//writeLog_("../log/jb_list_", "\$jb_cr_price_text_old = " . $jb_cr_price_text_old);
|
||
// $jb_cr_price_text_old = substr($jb_cr_price_text_old, 0, strpos($jb_cr_price_text_old, "~~~" . PHP_EOL, strlen("~~~" . PHP_EOL)) + strlen("~~~" . PHP_EOL));
|
||
//writeLog_("../log/jb_list_", "\$jb_cr_price_text_old = " . $jb_cr_price_text_old);
|
||
// if ($jb_cr_price_text_old == "~~~" . PHP_EOL) {
|
||
// $jb_cr_price_text_old = strstr($jb_freetext_3_old, "~~~" . PHP_EOL);
|
||
//writeLog_("../log/jb_list_", "\$jb_cr_price_text_old = " . $jb_cr_price_text_old);
|
||
// $jb_cr_price_text_old = substr($jb_cr_price_text_old, 0, strpos($jb_cr_price_text_old, "~~~", strlen("~~~")) + strlen("~~~"));
|
||
//writeLog_("../log/jb_list_", "\$jb_cr_price_text_old = " . $jb_cr_price_text_old);
|
||
// }
|
||
// $jb_freetext_3 = str_replace($jb_cr_price_text_old, "", $jb_freetext_3);
|
||
//writeLog_("../log/jb_list_", "\$jb_freetext_3_honk = " . $jb_freetext_3);
|
||
endif;
|
||
$jb_cr_price_text = "~~~\n" . $jb_cr_price_text . "~~~\n";
|
||
writeLog_("../log/jb_list_", "\$jb_cr_price_text = " . $jb_cr_price_text);
|
||
//writeLog_("../log/jb_list_", "\$jb_freetext_3_honk = " . $jb_freetext_3);
|
||
$res = updateStmt("job", "jb_id", $f_jb_id, array("jb_freetext_3", $jb_cr_price_text . $jb_freetext_3));
|
||
// Kuriere mit Auftrag: Ziel-PLZ und Aktuelle Tour kaputt gemacht
|
||
}
|
||
}
|
||
if ($f_jb_cr_markup != "" && $f_jb_cr_markup != "0") {
|
||
$db->query("DELETE FROM jobprice WHERE jb_id = " . $f_jb_id . " AND mt_sort IN (" . JB_CR_MARKUP . ", " . JB_CR_MARKUP_MAN . ")");
|
||
$db->query("INSERT INTO jobprice (jb_id, mt_sort, jbprc_price, jbprc_remark) VALUES (" . $f_jb_id . ", " . JB_CR_MARKUP . ", " . $f_jb_cr_markup . ", '')");
|
||
}
|
||
|
||
// Set current assigning time for revoking a job if not taken by the courier
|
||
if (existsEntry("autoranking",array("jb_id",$f_jb_id,"cr_id",$cr_id))) :
|
||
updateStmt("autoranking", "jb_id", $f_jb_id, array("ar_challenge", "0", "ar_lastassigntime", $currentTime, "ar_looseranking", $arLooseRanking, "ar_locating", "0"),"cr_id = '" . $cr_id . "'");
|
||
else :
|
||
insertStmt("autoranking", array("jb_id", $f_jb_id, "cr_id", $cr_id, "ar_challenge", "0", "ar_lastassigntime", $currentTime, "ar_looseranking", $arLooseRanking, "ar_locating", "0"));
|
||
endif;
|
||
|
||
// Insert PDA command to remove job (take cr_id/cr_id_order before changing)
|
||
$currentTimePDA = getDateTime("datetime_plus_offset", array(0,0,30,0,0,0), $formatStr = "Y-m-d H:i:s");
|
||
if ($crIdCurrent != "" && $crIdCurrent != "0" && $crIdCurrent != $cr_id) :
|
||
insertPDACommand($jbHqId, $crIdCurrent, "4", "1", $f_jb_id, $currentTimePDA, "");
|
||
endif;
|
||
if ($crIdOrderCurrent != "" && $crIdOrderCurrent != "0" && $crIdOrderCurrent != $crIdCurrent && $crIdOrderCurrent != $cr_id) :
|
||
insertPDACommand($jbHqId, $crIdOrderCurrent, "4", "1", $f_jb_id, $currentTimePDA, "");
|
||
endif;
|
||
|
||
// Reset availabletime of the OLD courier if requested by the disposition manually
|
||
if ($f_cr_availabletime_reset == "1") :
|
||
updateStmt("courier", "cr_id", $crIdCurrent, array("cr_availabletime", $currentTime));
|
||
endif;
|
||
|
||
deleteStmt("genericdatacontainer", "gdc_obj_type = 'jb' AND gdc_obj_id = " . $f_jb_id . " AND gdc_gen_fieldname = 'jb_cr_price_tmp'");
|
||
// Write logdata into log database
|
||
writeToLogDB("7",$jbHqId,$f_jb_id,$currentSessionUsrId,$cr_id,$f_cr_sid,"","LOST_RANKING=" . ($arLooseRanking == "1" ? "YES" : "NO") . ($jb_cr_price_tmp != "" ? "|" . "\$jb_cr_price_tmp_time=" . $jb_cr_price_tmp_time . "|" . $jb_cr_price_tmp : ""));
|
||
|
||
// Survey
|
||
checkJobForSurvey($f_jb_id);
|
||
endif;
|
||
|
||
TA("C");
|
||
TA("E");
|
||
// else :
|
||
// $statusMessage = getLngt("Dem Fahrzeug") . " " . $f_cr_sid . " " . getLngt("wurde zwischenzeitlich ein Auftrag zugewiesen! Bitte ein anderes Fahrzeug w<>hlen.");
|
||
// endif;
|
||
else :
|
||
if ($cr_id != ""):
|
||
// Write logdata into log database
|
||
writeToLogDB("7",$jbHqId,$f_jb_id,$currentSessionUsrId,$cr_id,$f_cr_sid,"","STATE=CR_SAME_COURIER");
|
||
endif;
|
||
endif;
|
||
endif;
|
||
|
||
|
||
// Push all jobs (of the current search result !!!) with jb_status = '9' into autoranking
|
||
if ($f_act == "goAutoranking" || $f_act == "goReservAutoranking") :
|
||
|
||
// Set the current timestamp to store the data
|
||
$currentTime = getDateTime("0");
|
||
|
||
TA("B");
|
||
|
||
// $whereClauseHq = " AND jb.hq_id = '" . $hq_id . "' ";
|
||
$whereClauseHq = " AND (jb.hq_id = '" . $hq_id . "' OR jb.hq_id_dispo = '" . $hq_id . "') ";
|
||
// if ($f_hq_id_string != "") : $whereClauseHq = " AND jb.hq_id IN (" . $f_hq_id_string . ") "; endif;
|
||
if ($f_hq_id_string != "") : $whereClauseHq = " AND (jb.hq_id IN (" . $f_hq_id_string . ") OR jb.hq_id_dispo IN (" . $f_hq_id_string . ")) "; endif;
|
||
|
||
// Get job IDs ONLY for logging
|
||
$tmpLogJobsArray = array();
|
||
if ($f_act == "goReservAutoranking") :
|
||
$sqlStmt = "SELECT jb.jb_id FROM job AS jb, costcenter AS csc, customer AS cs "
|
||
. " WHERE jb.jb_status = '9' AND jb.jb_ordertime >= '" . $fromDateRange . "' AND DATE_SUB(jb.jb_ordertime, INTERVAL 30 MINUTE) <= '" . $currentTime . "' " . $whereClauseHq . " AND "
|
||
. " jb.jb_reserv = '1' AND jb.jb_offer = '0' AND jb.vht_id < '" . getVhtId("7", "truck_01") . "' AND jb.csc_id_payer = csc.csc_id AND csc.cs_id = cs.cs_id AND (ISNULL(cs_joblist_disabled) OR cs_joblist_disabled = '0')";
|
||
else :
|
||
$sqlStmt = "SELECT jb_id FROM job AS jb "
|
||
. " WHERE jb.jb_status = '9' AND jb.jb_ordertime >= '" . $fromDateRange . "' AND jb.jb_ordertime <= '" . $currentTime . "' " . $whereClauseHq . " AND "
|
||
. " jb.jb_cr_fav = '0' AND (isnull(jb.jb_reserv) OR jb.jb_reserv = '0') AND jb.jb_offer = '0' AND jb.vht_id < '" . getVhtId("7", "truck_01") . "'";
|
||
endif;
|
||
|
||
$res = $db->query($sqlStmt);
|
||
while ($row = $res->fetch_assoc()):
|
||
$tmpLogJobsArray[] = $row["jb_id"];
|
||
endwhile;
|
||
$res->free();
|
||
$tmpLogJobsArrayLen = count($tmpLogJobsArray);
|
||
|
||
// Change jb_status (go autoranking)
|
||
$clauseRemoveCourier = ", cr_id= '', cr_id_order = '', cr_sid = ''";
|
||
$parGoAutorankingNoRemovalCourier = getParameterValue("0", "JOB_GO_AUTORANKING_NOT_REMOVAL_COURIER", $hq_id);
|
||
if ($parGoAutorankingNoRemovalCourier == "") :
|
||
$parGoAutorankingNoRemovalCourier = getParameterValue("0", "JOB_GO_AUTORANKING_NOT_REMOVAL_COURIER", "0");
|
||
endif;
|
||
if ($parGoAutorankingNoRemovalCourier == "1") :
|
||
$clauseRemoveCourier = "";
|
||
endif;
|
||
/*
|
||
if ($f_act == "goReservAutoranking") :
|
||
$sqlStmt = "UPDATE job SET jb_status = '8', jb_globaljob = '0'" . $clauseRemoveCourier
|
||
. " WHERE jb_status = '9' AND jb_ordertime >= '$fromDateRange' AND DATE_SUB(jb_ordertime, INTERVAL 30 MINUTE) <= '$currentTime' " . $whereClauseHq . " AND "
|
||
. " jb_reserv = '1' AND jb_offer = '0' AND vht_id < '" . getVhtId("7", "truck_01") . "'";
|
||
else :
|
||
$sqlStmt = "UPDATE job SET jb_status = '8', jb_globaljob = '0'" . $clauseRemoveCourier
|
||
. " WHERE jb_status = '9' AND jb_ordertime >= '$fromDateRange' AND jb_ordertime <= '$currentTime' " . $whereClauseHq . " AND "
|
||
. " jb_cr_fav = '0' AND (isnull(jb_reserv) OR jb_reserv = '0') AND jb_offer = '0' AND vht_id < '" . getVhtId("7", "truck_01") . "'";
|
||
endif;
|
||
*/
|
||
if ($tmpLogJobsArrayLen > 0) :
|
||
|
||
$sqlStmt = "UPDATE job SET jb_status = '8', jb_globaljob = '0'" . $clauseRemoveCourier . " WHERE jb_id IN (" . implode(",", $tmpLogJobsArray) . ")";
|
||
|
||
$res = $db->query($sqlStmt);
|
||
if (DB::isError($res)) : die ("$PHP_SELF: " . $res->getMessage()); endif;
|
||
|
||
// Write logdata into log database
|
||
for ($j = 0; $j < $tmpLogJobsArrayLen; $j++) :
|
||
if ($f_act == "goReservAutoranking") :
|
||
writeToLogDB("56",$hq_id,$tmpLogJobsArray[$j],$currentSessionUsrId,"","","","jb_reserv=1");
|
||
else :
|
||
writeToLogDB("56",$hq_id,$tmpLogJobsArray[$j],$currentSessionUsrId,"","","","");
|
||
endif;
|
||
endfor;
|
||
endif;
|
||
|
||
TA("C");
|
||
TA("E");
|
||
endif;
|
||
|
||
// *** Save job-informations (End) ***
|
||
|
||
|
||
// Get the array for formatting the database-values for the output according to the defined type
|
||
$outputFormatField = defineOutputFormats();
|
||
|
||
// Get the pathname of the actual costcenter
|
||
// NOT necessary in HQ-administration, but in CS-administration
|
||
/*
|
||
$tmpFields = getFieldsValueFromId("costcenter","csc_id",$cscIdActual,array("csc_path","csc_name"));
|
||
$cscPathActual = $tmpFields[0];
|
||
$cscNameActual = $tmpFields[1];
|
||
*/
|
||
|
||
|
||
// Search filter in use?
|
||
$searchFiltersInUse = false;
|
||
$searchFiltersPayerInUse = false;
|
||
$searchFiltersStationsInUse = false;
|
||
if (strlen($f_search_ad_street_payer) > 2 || strlen($f_search_ad_zipcode_payer) > 2 || strlen($f_search_ad_city_payer) > 2 || ($f_search_ad_country_payer != "" && $f_search_ad_country_payer != "--") ||
|
||
strlen($f_search_cmp_comp_payer) > 2 || strlen($f_search_cs_eid_payer) > 2 || strlen($f_search_csc_name_payer) > 2) :
|
||
$searchFiltersPayerInUse = true;
|
||
endif;
|
||
if (strlen($f_search_ad_street) > 2 || strlen($f_search_ad_zipcode) > 2 || strlen($f_search_ad_city) > 2 || ($f_search_ad_country != "" && $f_search_ad_country != "--") ||
|
||
strlen($f_search_tr_comp) > 2 || strlen($f_search_tr_person) > 2 || strlen($f_search_tr_remark) > 2 || strlen($f_search_tr_commission_no) > 2) :
|
||
$searchFiltersStationsInUse = true;
|
||
endif;
|
||
$searchFiltersInUse = $searchFiltersPayerInUse || $searchFiltersStationsInUse;
|
||
|
||
$filterOnlyOfferCheckbox = "";
|
||
$filterNoOfferCheckbox = "";
|
||
if ($jb_status == "9" || ($globalParUseRelatedCustomer == "1" && ($jb_status == "9" || $jb_status == "0"))) :
|
||
$filterOnlyOfferCheckbox .= " <input type=\"checkbox\" name=\"f_filter[]\" value=\"job_only_offer\"" . $filter_only_offer . ">" . getLngt("Nur Angebote");
|
||
$filterNoOfferCheckbox .= "<input type=\"checkbox\" name=\"f_filter[]\" value=\"job_no_offer\"" . $filter_no_offer . ">" . getLngt("Ohne Angebote") . " ";
|
||
endif;
|
||
|
||
$filterDisplayInvisibleCheckbox = "";
|
||
if ($jb_status == "9") :
|
||
$filterDisplayInvisibleCheckbox .= " <input type=\"checkbox\" name=\"f_filter[]\" value=\"job_display_invisible\"" . $filter_display_invisible . ">" . getLngt("Ausgeblendete Auftr<74>ge einblenden");
|
||
endif;
|
||
|
||
|
||
// --- JOB -------------------
|
||
|
||
// initialize
|
||
if (true) :
|
||
$dspTitles = array(); $dspFields = array(); $dspAligns = array();
|
||
$dspTitles["jb_id"] = getLngt("Nr."); $dspFields["jb_id"] = "jb_id"; $dspAligns["jb_id"] = "r";
|
||
$dspTitles["jb_id_parent"] = getLngt("Bezugs-Nr."); $dspFields["jb_id_parent"] = "jb_id_parent"; $dspAligns["jb_id_parent"] = "r";
|
||
$dspTitles["business_volume"] = getLngt("Preis"); $dspFields["business_volume"] = "business_volume"; $dspAligns["business_volume"] = "r";
|
||
$dspTitles["business_volume_gross"] = getLngt("Bruttopreis"); $dspFields["business_volume_gross"] = "business_volume_gross"; $dspAligns["business_volume_gross"] = "r";
|
||
$dspTitles["jb_tourname"] = getLngt("Tourenname"); $dspFields["jb_tourname"] = "jb_tourname"; $dspAligns["jb_tourname"] = "l";
|
||
$dspTitles["tr_comp"] = getLngt("Firma"); $dspFields["tr_comp"] = "tr_comp"; $dspAligns["tr_comp"] = "l";
|
||
$dspTitles["tr_comp2"] = getLngt("Fa.2"); $dspFields["tr_comp2"] = "tr_comp2"; $dspAligns["tr_comp2"] = "l";
|
||
$dspTitles["streethsno"] = getLngt("Startadresse"); $dspFields["streethsno"] = "streethsno"; $dspAligns["streethsno"] = "l";
|
||
$dspTitles["zipcodecity"] = getLngt("Start-PLZ/Ort"); $dspFields["zipcodecity"] = "zipcodecity"; $dspAligns["zipcodecity"] = "l";
|
||
$dspTitles["streethsno2"] = getLngt("2.Adresse"); $dspFields["streethsno2"] = "streethsno2"; $dspAligns["streethsno2"] = "l";
|
||
$dspTitles["zipcodecity2"] = getLngt("2.PLZ/Ort"); $dspFields["zipcodecity2"] = "zipcodecity2"; $dspAligns["zipcodecity2"] = "l";
|
||
if ($globalParUseRelatedCustomer == "1") :
|
||
$dspTitles["tr2_comp"] = getLngt("Kunde"); $dspFields["tr2_comp"] = "tr2_comp"; $dspAligns["tr2_comp"] = "l";
|
||
else :
|
||
$dspTitles["tr2_comp"] = getLngt("2.Firma"); $dspFields["tr2_comp"] = "tr2_comp"; $dspAligns["tr2_comp"] = "l";
|
||
endif;
|
||
$dspTitles["jb_tourzipcodes"] = getLngt("PLZn"); $dspFields["jb_tourzipcodes"] = "jb_tourzipcodes"; $dspAligns["jb_tourzipcodes"] = "c";
|
||
$dspTitles["jb_tourcities"] = getLngt("Orte"); $dspFields["jb_tourcities"] = "jb_tourcities"; $dspAligns["jb_tourcities"] = "c";
|
||
$dspTitles["vht_value"] = getLngt("Fahrz."); $dspFields["vht_value"] = "vht_value"; $dspAligns["vht_value"] = "c";
|
||
$dspTitles["jb_ordertime"] = getLngt("Auftragszeit"); $dspFields["jb_ordertime"] = "jb_ordertime"; $dspAligns["jb_ordertime"] = "c";
|
||
$dspTitles["jb_reserv"] = getLngt("R."); $dspFields["jb_reserv"] = "jb_reserv"; $dspAligns["jb_reserv"] = "c";
|
||
$dspTitles["jb_permanent"] = getLngt("D."); $dspFields["jb_permanent"] = "jb_permanent"; $dspAligns["jb_permanent"] = "c";
|
||
$dspTitles["cr_id_favoured"] = getLngt("B."); $dspFields["cr_id_favoured"] = "cr_id_favoured"; $dspAligns["cr_id_favoured"] = "c";
|
||
$dspTitles["jb_csc_id"] = getLngt("K."); $dspFields["jb_csc_id"] = "jb_csc_id"; $dspAligns["jb_csc_id"] = "c";
|
||
$dspTitles["jb_emp_hq_id"] = getLngt("CC."); $dspFields["jb_emp_hq_id"] = "jb_emp_hq_id"; $dspAligns["jb_emp_hq_id"] = "c";
|
||
$dspTitles["cr_sid"] = getLngt("Fahrer"); $dspFields["cr_sid"] = "cr_sid"; $dspAligns["cr_sid"] = "c";
|
||
$dspTitles["jb_latesttaketime"] = getLngt("Sp<EFBFBD>t.Annahmez."); $dspFields["jb_latesttaketime"] = "jb_latesttaketime"; $dspAligns["jb_latesttaketime"] = "c";
|
||
$dspTitles["jb_taketime"] = getLngt("Annahme"); $dspFields["jb_taketime"] = "jb_taketime"; $dspAligns["jb_taketime"] = "c";
|
||
$dspTitles["jb_edit"] = getLngt("Bearb."); $dspFields["jb_edit"] = "jb_edit"; $dspAligns["jb_edit"] = "c";
|
||
$dspTitles["jb_cr_price"] = getLngt("Frachtverg."); $dspFields["jb_cr_price"] = "jb_cr_price"; $dspAligns["jb_cr_price"] = "r";
|
||
$dspTitles["jb_cr_price_gross"] = getLngt("Bruttofrachtverg."); $dspFields["jb_cr_price_gross"] = "jb_cr_price_gross"; $dspAligns["jb_cr_price_gross"] = "r";
|
||
$dspTitles["jb_cr_subprice"] = getLngt("Man. Frachtverg."); $dspFields["jb_cr_subprice"] = "jb_cr_subprice"; $dspAligns["jb_cr_subprice"] = "r";
|
||
$dspTitles["jb_cr_subprice_gross"] = getLngt("Man. Bruttofrachtverg."); $dspFields["jb_cr_subprice_gross"] = "jb_cr_subprice"; $dspAligns["jb_cr_subprice_gross"] = "r";
|
||
if ($jb_status != "ALL" || $maskDisplayColCacellationEnabled == "1") :
|
||
$dspTitles["jb_storno"] = getLngt("Storno"); $dspFields["jb_storno"] = "jb_storno"; $dspAligns["jb_storno"] = "c";
|
||
endif;
|
||
$dspTitles["jb_service"] = getLngt("Service"); $dspFields["jb_service"] = "jb_service"; $dspAligns["jb_service"] = "r";
|
||
$dspTitles["ad_zipcode"] = getLngt("Start-PLZ"); $dspFields["ad_zipcode"] = "ad_zipcode"; $dspAligns["ad_zipcode"] = "c";
|
||
$dspTitles["ad2_zipcode"] = getLngt("2. PLZ"); $dspFields["ad2_zipcode"] = "ad2_zipcode"; $dspAligns["ad2_zipcode"] = "c";
|
||
$dspTitles["jb_lastzipcode"] = getLngt("Ziel-PLZ"); $dspFields["jb_lastzipcode"] = "jb_lastzipcode"; $dspAligns["jb_lastzipcode"] = "c";
|
||
$dspTitles["jb_dispoinfo"] = getLngt("Dispo-Info"); $dspFields["jb_dispoinfo"] = "jb_dispoinfo"; $dspAligns["jb_dispoinfo"] = "l";
|
||
$dspTitles["jb_warningtime"] = getLngt("Warnzeit"); $dspFields["jb_warningtime"] = "jb_warningtime"; $dspAligns["jb_warningtime"] = "c";
|
||
$dspTitles["jb_bsg"] = " " . getLngt("BSG") . " [%]"; $dspFields["jb_bsg"] = "jb_bsg"; $dspAligns["jb_bsg"] = "r";
|
||
$dspTitles["jb_cs_report"] = getLngt("Berichte"); $dspFields["jb_cs_report"] = "jb_cs_report"; $dspAligns["jb_cs_report"] = "c";
|
||
$dspTitles["jb_cs_documents"] = getLngt("Dokumente"); $dspFields["jb_cs_documents"] = "jb_cs_documents"; $dspAligns["jb_cs_documents"] = "c";
|
||
if (($jb_status == "9" || $jb_status == "8" || $jb_status == "0" || $jb_status == "1") && authCheckEmployeeRights($emp_id, "30")) :
|
||
$dspTitles["jb_tr_sort"] = getLngt("Sortierung"); $dspFields["jb_tr_sort"] = "jb_tr_sort"; $dspAligns["jb_tr_sort"] = "c";
|
||
endif;
|
||
$dspTitles["jb_map"] = getLngt("Karte"); $dspFields["jb_map"] = "jb_map"; $dspAligns["jb_map"] = "c";
|
||
if ($maskJoblistGetCourierData == "1" && ($jb_status == "1" || $jb_status == "2")) :
|
||
$dspTitles["cr_cmp_remark"] = getLngt("Transp.Bemerk"); $dspFields["cr_cmp_remark"] = "cr_cmp_remark"; $dspAligns["cr_cmp_remark"] = "l";
|
||
$dspTitles["cr_cmp_remark2"] = getLngt("Transp.Int.Bemerk."); $dspFields["cr_cmp_remark2"] = "cr_cmp_remark2"; $dspAligns["cr_cmp_remark2"] = "l";
|
||
endif;
|
||
$dspTitles["gdc_addmont_context"] = getLngt("GZM"); $dspFields["gdc_addmont_context"] = "gdc_addmont_context"; $dspAligns["gdc_addmont_context"] = "r";
|
||
$dspTitles["gdc_addmont_content"] = getLngt("RZM"); $dspFields["gdc_addmont_content"] = "gdc_addmont_content"; $dspAligns["gdc_addmont_content"] = "r";
|
||
$dspTitles["gdc_toll_content"] = getLngt("Maut"); $dspFields["gdc_toll_content"] = "gdc_toll_content"; $dspAligns["gdc_toll_content"] = "r";
|
||
$dspTitles["business_volume_with_toll"] = getLngt("Preis m.M."); $dspFields["business_volume_with_toll"] = "business_volume_with_toll"; $dspAligns["business_volume_with_toll"] = "r";
|
||
$dspTitles["jb_cr_price_with_toll"] = getLngt("Frachtverg<EFBFBD>tung m.M."); $dspFields["jb_cr_price_with_toll"] = "jb_cr_price_with_toll"; $dspAligns["jb_cr_price_with_toll"] = "r";
|
||
$dspTitles["jb_cr_subprice_with_toll"] = getLngt("Frachtverg. o.Z.m.M."); $dspFields["jb_cr_subprice_with_toll"] = "jb_cr_subprice_with_toll"; $dspAligns["jb_cr_subprice_with_toll"] = "r";
|
||
$dspTitles["business_volume_gross_with_toll"] = getLngt("Preis m.M."); $dspFields["business_volume_gross_with_toll"] = "business_volume_gross_with_toll"; $dspAligns["business_volume_gross_with_toll"] = "r";
|
||
$dspTitles["jb_cr_price_gross_with_toll"] = getLngt("Frachtverg. m.M."); $dspFields["jb_cr_price_gross_with_toll"] = "jb_cr_price_gross_with_toll"; $dspAligns["jb_cr_price_gross_with_toll"] = "r";
|
||
$dspTitles["jb_serviceprice"] = getLngt("Service-Preis"); $dspFields["jb_serviceprice"] = "jb_serviceprice"; $dspAligns["jb_serviceprice"] = "r";
|
||
$dspTitles["jb_markup"] = getLngt("TSZ [%]"); $dspFields["jb_markup"] = "jb_markup"; $dspAligns["jb_markup"] = "r";
|
||
$dspTitles["jb_finishtime"] = getLngt("Erledigungszeit"); $dspFields["jb_finishtime"] = "jb_finishtime"; $dspAligns["jb_finishtime"] = "c";
|
||
$dspTitles["jb_km"] = getLngt("KM"); $dspFields["jb_km"] = "jb_km"; $dspAligns["jb_km"] = "r";
|
||
$dspTitles["jb_co2e"] = getLngt("CO2/<2F>q"); $dspFields["jb_co2e"] = "jb_co2e"; $dspAligns["jb_co2e"] = "r";
|
||
$dspTitles["tr_commission_no"] = getLngt("Komm.-Nr"); $dspFields["tr_commission_no"] = "tr_commission_no"; $dspAligns["tr_commission_no"] = "c";
|
||
$dspTitles["jb_traveltime"] = getLngt("Vorlaufzeit"); $dspFields["jb_traveltime"] = "jb_traveltime"; $dspAligns["jb_traveltime"] = "c";
|
||
|
||
|
||
// Get the parameter to set the order of the columns to be displayed
|
||
$displayedListCols = getParameterValue($emp_id, "MASK_JB_LIST_COLS");
|
||
if ($displayedListCols == "") :
|
||
$displayedListCols = getParameterValue("0", "MASK_JB_LIST_COLS", $hq_id);
|
||
if ($displayedListCols == "") :
|
||
// Default settings
|
||
if ($globalParUseRelatedCustomer == "1") :
|
||
$displayedListCols = "jb_id,business_volume_gross,tr_comp,tr_comp2,streethsno,tr2_comp,jb_tourzipcodes,vht_value,jb_ordertime,jb_csc_id,cr_sid";
|
||
else :
|
||
// $displayedListCols = "jb_id,business_volume,jb_tourname,tr_comp,tr_comp2,s5treethsno,jb_tourzipcodes,vht_value,jb_ordertime,jb_reserv,jb_permanent,cr_id_favoured,jb_csc_id,cr_sid";
|
||
$displayedListCols = "jb_id,business_volume,jb_markup,jb_cr_price,jb_cr_subprice,jb_serviceprice,jb_bsg,jb_tourname,tr_comp,streethsno,jb_tourzipcodes,vht_value,jb_taketime,jb_ordertime,jb_warningtime,jb_map,jb_tr_sort,jb_reserv,jb_permanent,cr_id_favoured,jb_csc_id,cr_sid";
|
||
endif;
|
||
$displayedListCols .= (FALSE ? ",jb_latesttaketime" : ""); // Latest taketime
|
||
// $displayedListCols .= ",jb_taketime";
|
||
if ($jb_status != "ALL" || $maskDisplayColCacellationEnabled == "1") :
|
||
$displayedListCols .= ",jb_storno"; // Cancellation
|
||
else :
|
||
$displayedListCols .= ($jb_status != "ALL" ? ",jb_storno" : ""); // Cancellation
|
||
endif;
|
||
// $displayedListCols .= ",jb_edit";
|
||
$displayedListCols .= ",jb_edit,ad_zipcode,ad2_zipcode,jb_lastzipcode,jb_tourcities,jb_dispoinfo,jb_cs_report,jb_emp_hq_id,jb_cs_documents,gdc_toll_content,jb_finishtime";
|
||
if ($maskJoblistGetCourierData == "1" && ($jb_status == "1" || $jb_status == "2")) :
|
||
$displayedListCols .= ",cr_cmp_remark,cr_cmp_remark2";
|
||
endif;
|
||
endif;
|
||
endif;
|
||
$displayedListColsArray = spliti(",",$displayedListCols);
|
||
$displayedListColsArrayLen = count($displayedListColsArray);
|
||
|
||
$tmpKeys = array_keys($dspFields);
|
||
$titles = ""; $fields = ""; $aligns = ""; $valigns = ""; $cellTextPre = "";
|
||
for ($i = 0; $i < $displayedListColsArrayLen; $i++) {
|
||
// Search for the value "$displayedListColsArray" in "$dspColArray" and get the key (index)
|
||
$j = array_search($displayedListColsArray[$i], $tmpKeys);
|
||
if (!($j === FALSE)) :
|
||
$titles .= $dspTitles[$tmpKeys[$j]] . ",";
|
||
$fields .= $dspFields[$tmpKeys[$j]] . ",";
|
||
$aligns .= $dspAligns[$tmpKeys[$j]] . ",";
|
||
endif;
|
||
}
|
||
// Remove last ","-sign
|
||
if (substr($titles, -1) == ",") : $titles = substr($titles, 0, -1); endif;
|
||
if (substr($fields, -1) == ",") : $fields = substr($fields, 0, -1); endif;
|
||
if (substr($aligns, -1) == ",") : $aligns = substr($aligns, 0, -1); endif;
|
||
endif;
|
||
|
||
$titlesArray = spliti(",",$titles);
|
||
$fieldsArray = spliti(",",$fields);
|
||
$fieldsLength = count($fieldsArray);
|
||
$alignsArray = spliti(",",$aligns);
|
||
$valignsArray = spliti(",",$valigns);
|
||
$cellTextPreArray = spliti(",",$cellTextPre);
|
||
|
||
$fieldClause = getDBFields("job") . "," . getDBFields("jb_edit") . "," . "jb.hq_id AS jb_hq_id" . "," . "jb.hq_id_exec AS jb_hq_id_exec" . "," . "jb.hq_id_dispo AS jb_hq_id_dispo" . "," . "jb.hq_id_sales AS jb_hq_id_sales" . "," . "usr.hq_id AS jb_emp_hq_id,usr.usr_type AS jb_emp_usr_type," . getDBFields("jb_tourzipcodes") . "," . getDBFields("jb_tourcities") . "," . getDBFields("tour") . "," . getDBFields("address") . "," .
|
||
getDBFields("vehicletype") . "," . getDBFields("ad_street_hsno") . "," . getDBFields("ad_zipcode_city") . "," . getDBFields("ad_street_hsno_2") . "," . getDBFields("ad_zipcode_city_2") . "," .
|
||
getDBFields("jb_latesttaketime") . "," . getDBFields("jb_traveltime") .
|
||
", IF (jb.jb_cr_price != 0, IF(jb.jb_totalprice != 0, ((jb.jb_totalprice - jb.jb_cr_price) / jb.jb_totalprice) * 100, 0), 0) AS jb_bsg";
|
||
if (MASK_JOBLIST_TOTALPRICE == "1") :
|
||
$fieldClause .= "," . "SUM(trs.trs_price * ((100 - trs.trs_discount) / 100)) AS business_volume ";
|
||
else :
|
||
$fieldClause .= "," . "jb.jb_totalprice AS business_volume ";
|
||
endif;
|
||
$fieldClause .= "," . "(jb.jb_totalprice * (1 + (" . $globalParSalesTaxRate . " / 100))) AS business_volume_gross ";
|
||
$fieldClause .= "," . "(jb.jb_cr_price * (1 + (" . $globalParSalesTaxRate . " / 100))) AS jb_cr_price_gross ";
|
||
$fieldClause .= "," . "(jb.jb_totalprice + IF (gdc_toll.gdc_content != '', gdc_toll.gdc_content, 0)) AS business_volume_with_toll ";
|
||
$fieldClause .= "," . "(jb.jb_cr_price + IF (gdc_toll.gdc_content != '', gdc_toll.gdc_content, 0)) AS jb_cr_price_with_toll ";
|
||
$fieldClause .= "," . "(jb.jb_cr_subprice + IF (gdc_toll.gdc_content != '', gdc_toll.gdc_content, 0)) AS jb_cr_subprice_with_toll ";
|
||
$fieldClause .= "," . "(jb.jb_totalprice * (1 + (" . $globalParSalesTaxRate . " / 100)) + IF (gdc_toll.gdc_content != '', gdc_toll.gdc_content, 0)) AS business_volume_gross_with_toll ";
|
||
$fieldClause .= "," . "(jb.jb_cr_price * (1 + (" . $globalParSalesTaxRate . " / 100)) + IF (gdc_toll.gdc_content != '', gdc_toll.gdc_content, 0)) AS jb_cr_price_gross_with_toll ";
|
||
$fieldClause .= "," . " ad2.ad_zipcode AS ad2_zipcode " . "," . " srvpt.srvpt_traveltime , jb.csc_id AS jb_csc_id ";
|
||
$fieldClause .= "," . " SUBSTRING_INDEX(SUBSTRING(jb.jb_tourdata, 1, (INSTR(jb.jb_tourdata, '|') - 1) ), ';', -1) AS jb_lastzipcode ";
|
||
$fieldClause .= "," . " jb.csc_id_payer AS jb_cs_report ";
|
||
$fieldClause .= "," . " jb.csc_id_payer AS jb_cs_documents ";
|
||
$fieldClause .= "," . " jb.jb_id AS jb_tr_sort ";
|
||
$fieldClause .= "," . " jb.jb_id AS jb_map ";
|
||
$fieldClause .= "," . " jbprc_km.jbprc_price AS jb_km ";
|
||
$fieldClause .= "," . " jbprc_co2e.jbprc_price AS jb_co2e ";
|
||
$fieldClause .= "," . " cs_payer.cs_id AS cs_id_payer ";
|
||
$fieldClause .= "," . " cs_payer.cs_price_warn_uncomplete ";
|
||
$fieldClause .= "," . " tr.tr_status AS tr1_status, tr2.tr_status AS tr2_status, tr2.tr_comp AS tr2_comp ";
|
||
|
||
// Check for inclusion of courier data
|
||
if ($maskJoblistGetCourierData == "1" && ($jb_status == "1" || $jb_status == "2")) :
|
||
$fieldClause .= "," . " LEFT(cmp2.cmp_remark, 20) AS cr_cmp_remark " . "," . " LEFT(cmp2.cmp_remark2, 20) AS cr_cmp_remark2 ";
|
||
endif;
|
||
|
||
// Active if jb_status IN (8,9,0,1) OR filter is set
|
||
if (MASK_JOBLIST_CR_FAVOURED == "1") :
|
||
if (($jb_status != "ALL" && $jb_status != "2" && $jb_status != "1") || $filter_cr_favoured == "checked") :
|
||
$fieldClause .= "," . " cscr.cr_id AS cr_id_favoured " . "," . " cr.vht_id AS vht_id_cr_favoured ";
|
||
endif;
|
||
else :
|
||
$fieldClause .= "," . " jb.jb_cr_fav AS cr_id_favoured ";
|
||
endif;
|
||
|
||
$fieldClause .= ", gdc_toll.gdc_content AS gdc_toll_content ";
|
||
$fieldClause .= ", gdc_blink.gdc_content AS gdc_blink_content ";
|
||
if ($globalParUseRelatedCustomer == "1") :
|
||
$fieldClause .= ", gdc_addmont.gdc_content AS gdc_addmont_content, gdc_addmont.gdc_context AS gdc_addmont_context ";
|
||
$fieldClause .= ", gdc_search.gdc_content AS gdc_search_content ";
|
||
endif;
|
||
|
||
$fromClause = " metatype AS vht, " . $dbh_jb . " AS jb ";
|
||
$fromClause .= " LEFT JOIN costcenter AS csc_payer ON jb.csc_id_payer = csc_payer.csc_id ";
|
||
$fromClause .= " LEFT JOIN customer AS cs_payer ON csc_payer.cs_id = cs_payer.cs_id ";
|
||
$fromClause .= " LEFT JOIN user AS usr ON usr.usr_id = jb.emp_id ";
|
||
$fromClause .= " LEFT JOIN " . $dbh_tr . " AS tr ON tr.jb_id = jb.jb_id AND tr.tr_sort = '1' ";
|
||
$fromClause .= " LEFT JOIN address AS ad ON ad.ad_id = tr.ad_id ";
|
||
$fromClause .= " LEFT JOIN serviceplz AS srvp ON ad.ad_zipcode = srvp.srvp_plz ";
|
||
// $fromClause .= " LEFT JOIN serviceplztraveltime AS srvpt ON srvp.srvp_id = srvpt.srvp_id AND srvpt.hq_id = jb.hq_id ";
|
||
$fromClause .= " LEFT JOIN serviceplztraveltime AS srvpt ON srvp.srvp_id = srvpt.srvp_id AND srvpt.hq_id = jb.hq_id_dispo ";
|
||
$fromClause .= " LEFT JOIN jobprice AS jbprc_km ON jbprc_km.jb_id = jb.jb_id AND jbprc_km.mt_sort = '11' ";
|
||
$fromClause .= " LEFT JOIN jobprice AS jbprc_co2e ON jbprc_co2e.jb_id = jb.jb_id AND jbprc_co2e.mt_sort = '12' ";
|
||
|
||
if (MASK_JOBLIST_TOTALPRICE == "1") :
|
||
$fromClause .= " LEFT JOIN " . $dbh_trs . " AS trs ON trs.jb_id = jb.jb_id ";
|
||
endif;
|
||
$fromClause .= " LEFT JOIN " . $dbh_tr . " AS tr2 ON tr2.jb_id = jb.jb_id AND tr2.tr_sort = '2' ";
|
||
$fromClause .= " LEFT JOIN address AS ad2 ON ad2.ad_id = tr2.ad_id ";
|
||
|
||
if ($globalParUseRelatedCustomer == "1") :
|
||
if ($parMaskDispositionGroup != "") :
|
||
$fromClause .= " LEFT JOIN costcenter AS csc_related ON csc_related.csc_id = jb.csc_id_related ";
|
||
$fromClause .= " LEFT JOIN customer AS cs_related ON cs_related.cs_id = csc_related.cs_id ";
|
||
$fromClause .= " LEFT JOIN company AS cmp_related ON cmp_related.cmp_id = cs_related.cmp_id ";
|
||
endif;
|
||
// $fromClause .= " LEFT JOIN genericdatacontainer AS gdc_hide ON gdc_hide.gdc_obj_type = 'jb' AND gdc_hide.gdc_obj_id = jb.jb_id AND gdc_hide.gdc_gen_fieldname = 'hide' ";
|
||
$fromClause .= " LEFT JOIN genericdatacontainer AS gdc_addmont ON gdc_addmont.gdc_obj_type = 'jb' AND gdc_addmont.gdc_obj_id = jb.jb_id AND gdc_addmont.gdc_gen_fieldname = 'jb_addmont' ";
|
||
$fromClause .= " LEFT JOIN genericdatacontainer AS gdc_search ON gdc_search.gdc_obj_type = 'jb' AND gdc_search.gdc_obj_id = jb.jb_id AND gdc_search.gdc_gen_fieldname = 'jb_search' ";
|
||
endif;
|
||
$fromClause .= " LEFT JOIN genericdatacontainer AS gdc_toll ON gdc_toll.gdc_obj_type = 'jb' AND gdc_toll.gdc_obj_id = jb.jb_id AND gdc_toll.gdc_gen_fieldname = 'jb_toll' ";
|
||
$fromClause .= " LEFT JOIN genericdatacontainer AS gdc_blink ON gdc_blink.gdc_obj_type = 'jb' AND gdc_blink.gdc_obj_id = jb.jb_id AND gdc_blink.gdc_gen_fieldname = 'jb_blink' ";
|
||
|
||
if (MASK_JOBLIST_CR_FAVOURED == "1") :
|
||
if (($jb_status != "ALL" && $jb_status != "2" && $jb_status != "1") || $filter_cr_favoured == "checked") :
|
||
$fromClause .= " LEFT JOIN costcenter AS csc ON (jb.csc_id_payer = csc.csc_id) OR (jb.csc_id_payer_cash = csc.csc_id) ";
|
||
$fromClause .= " LEFT JOIN customercourier AS cscr ON csc.cs_id = cscr.cs_id AND cscr_sort = '1' AND cscr_relation = '1' ";
|
||
$fromClause .= " LEFT JOIN courier AS cr ON cscr.cr_id = cr.cr_id AND cr.vht_id >= jb.vht_id ";
|
||
endif;
|
||
endif;
|
||
|
||
// Check for inclusion of courier data
|
||
if ($maskJoblistGetCourierData == "1" && ($jb_status == "1" || $jb_status == "2")) :
|
||
$fromClause .= " LEFT JOIN courier AS cr2 ON cr2.cr_id = jb.cr_id ";
|
||
$fromClause .= " LEFT JOIN company AS cmp2 ON cr2.cmp_id = cmp2.cmp_id";
|
||
endif;
|
||
|
||
$whereClause = "";
|
||
$orderByClause = "jb_ordertime";
|
||
if ($jb_sort != "") :
|
||
$orderByClause = $fieldsArray[$jb_sort];
|
||
// Check for emptiness because e.g. in list "all jobs" no coloumn "storno" does exist
|
||
// and the offset has to be decremented. Pay attention for more restrictions in the future.
|
||
while ($orderByClause == "" && $jb_sort > 0) :
|
||
$jb_sort--;
|
||
$orderByClause = $fieldsArray[$jb_sort];
|
||
endwhile;
|
||
else :
|
||
$defSortValue = array_search("jb_ordertime",$fieldsArray);
|
||
if (!($defSortValue === FALSE)) :
|
||
$jb_sort = $defSortValue;
|
||
endif;
|
||
// List of jobs taken by the courier in special order: ORDER BY jb_taketime
|
||
if ($jb_status == "1") :
|
||
$specialOrderByTakenJobs = getParameterValue("0", "MASK_JOBLIST_TAKENJOB_ORDERBY");
|
||
if ($specialOrderByTakenJobs == "1") :
|
||
$defSortValue = array_search("jb_taketime",$fieldsArray);
|
||
if (!($defSortValue === FALSE)) :
|
||
$orderByClause = $fieldsArray[$defSortValue];
|
||
$jb_sort = $defSortValue;
|
||
endif;
|
||
endif;
|
||
endif;
|
||
endif;
|
||
// ASCending or DESCending
|
||
// if ($orderByClause == "jb_ordertime") : $orderByClause = "jb_ordertime ASC"; endif;
|
||
$orderByClause .= " " . $f_sort_direction_text . " ";
|
||
|
||
// $whereClause .= " (jb.hq_id IN " . getSQLMandatorArray($f_hq_id) . " OR jb.hq_id_dispo IN " . getSQLMandatorArray($f_hq_id) . ") ";
|
||
$whereClauseHqId = " jb.hq_id IN " . getSQLMandatorArray($f_hq_id);
|
||
$whereClauseHqIdExec = " jb.hq_id_exec IN " . getSQLMandatorArray($f_hq_id);
|
||
$whereClauseHqIdDispo = " jb.hq_id_dispo IN " . getSQLMandatorArray($f_hq_id);
|
||
$whereClauseHqIdSales = " jb.hq_id_sales IN " . getSQLMandatorArray($f_hq_id);
|
||
$whereClause .= "[HQ_ID_MC]"; // This macro has to be replaced regarding UNION
|
||
|
||
// Separate list for each status
|
||
if ($jb_status != "" && is_numeric($jb_status)) : $whereClause .= " AND jb.jb_status = " . $jb_status; endif;
|
||
/*
|
||
// Separate list for each status but jb_status = "9" and jb_status = "0" in ONE list
|
||
// ATTENTION: To use this (again), remove entry for job_status = "9" in metatype !!!
|
||
if ($jb_status != "") :
|
||
if ($jb_status == "0") :
|
||
$whereClause .= " AND (jb.jb_status = 0 OR jb.jb_status = 9)";
|
||
else :
|
||
$whereClause .= " AND jb.jb_status = " . $jb_status;
|
||
endif;
|
||
endif;
|
||
*/
|
||
|
||
// Only show longhaul jobs
|
||
if ($filter_only_longhaul == "checked") :
|
||
$whereClause .= " AND (NOT isnull(jb.jb_longhaul) AND jb.jb_longhaul != '0' AND jb.jb_longhaul != '2')";
|
||
endif;
|
||
|
||
// Only show incomplete jobs
|
||
if ($filter_job_incomplete == "checked") :
|
||
$whereClause .= " AND jb.jb_incomplete = '1'";
|
||
endif;
|
||
|
||
// Only show jobs with service price
|
||
if ($filter_job_serviceprice == "checked") :
|
||
$whereClause .= " AND jb.jb_serviceprice != '0'";
|
||
endif;
|
||
|
||
// Only show incomplete jobs
|
||
if ($jb_status == "9") :
|
||
if ($filter_only_offer == "checked") :
|
||
$whereClause .= " AND jb.jb_offer = '1'";
|
||
endif;
|
||
if ($filter_no_offer == "checked") :
|
||
$whereClause .= " AND jb.jb_offer != '1'";
|
||
endif;
|
||
endif;
|
||
|
||
// Especially ONE vehicle type
|
||
if (is_numeric($f_filter_vehicletype) && $f_filter_vehicletype > 0) :
|
||
$whereClause .= " AND jb.vht_id = '" . $f_filter_vehicletype . "'";
|
||
endif;
|
||
|
||
// Especially ONE employee created the job
|
||
if (is_numeric($f_filter_employee) && $f_filter_employee > 0) :
|
||
$whereClause .= " AND jb.emp_id = '" . $f_filter_employee . "'";
|
||
endif;
|
||
|
||
if ($globalParUseRelatedCustomer == "1") :
|
||
if ($f_filter_service != "" && is_numeric($f_filter_service)) :
|
||
$tmpService = pow(2,$f_filter_service);
|
||
$whereClause .= " AND (jb.jb_service & " . $tmpService . ") = " . $tmpService . " ";
|
||
endif;
|
||
endif;
|
||
|
||
// Special related customer
|
||
if ($globalParUseRelatedCustomer == "1" && $parMaskDispositionGroup != "") :
|
||
if (is_numeric($f_filter_related_customer) && $f_filter_related_customer > 0) :
|
||
$whereClause .= " AND jb.csc_id_related = csc_related.csc_id AND csc_related.cs_id = cs_related.cs_id AND cs_related.cs_id = '" . $f_filter_related_customer . "' AND cmp_related.cmp_id = cs_related.cmp_id AND cmp_related.cmp_comp != 'EXTERN' AND cs_related.cs_id_parent != '0' AND NOT isnull(cs_related.cs_id_parent) AND cs_related.cs_group LIKE '%," . $parMaskDispositionGroup . ",%'";
|
||
endif;
|
||
$whereClause .= " AND (NOT EXISTS (SELECT * FROM genericdatacontainer AS gdc_addmont WHERE gdc_addmont.gdc_obj_type = 'jb' AND gdc_addmont.gdc_obj_id = jb.jb_id AND gdc_addmont.gdc_gen_fieldname = 'hide')) ";
|
||
else :
|
||
$whereClause .= " AND (NOT EXISTS (SELECT * FROM genericdatacontainer AS gdc_hide WHERE gdc_hide.gdc_obj_type = 'jb' AND gdc_hide.gdc_obj_id = jb.jb_id AND gdc_hide.gdc_gen_fieldname = 'hide')) ";
|
||
endif;
|
||
|
||
// Display vehicle type only up to "$maskJoblistShowUpToVht" (overruled by filter "$f_filter_vehicletype" !!!)
|
||
if ($maskJoblistShowUpToVht != "" && $f_filter_vehicletype == 0) :
|
||
$whereClause .= " AND jb.vht_id <= '" . $maskJoblistShowUpToVht . "'";
|
||
endif;
|
||
$whereClause .= " AND (jb.vht_id = vht.mt_sort AND vht.mt_type = 'vehicletype')";
|
||
|
||
// Time-range (disabled if existence of id-range-search)
|
||
if ($job_no_from == "" && $job_no_to == "" && $idSearchArrayLen == 0) :
|
||
if ($fromDateRange != "") :
|
||
$whereClause .= " AND jb.jb_ordertime >= '$fromDateRange'";
|
||
endif;
|
||
if ($toDateRange != "") :
|
||
$whereClause .= " AND jb.jb_ordertime <= '$toDateRange'";
|
||
endif;
|
||
endif;
|
||
|
||
// ID range
|
||
if ($globalParUseRelatedCustomer == "1" && $idSearchArrayLen > 0) :
|
||
$whereClause .= " AND jb.jb_id IN (" . implode(",",$idSearchArray) . ")";
|
||
else :
|
||
if ($job_no_from != "") :
|
||
$whereClause .= " AND jb.jb_id >= '" . $job_no_from . "'";
|
||
if ($globalParUseRelatedCustomer == "1") :
|
||
$job_no_from = getJobIdOutput($job_no_from);
|
||
endif;
|
||
endif;
|
||
if ($job_no_to != "") :
|
||
$whereClause .= " AND jb.jb_id <= '" . $job_no_to . "'";
|
||
if ($globalParUseRelatedCustomer == "1") :
|
||
$job_no_to = getJobIdOutput($job_no_to);
|
||
endif;
|
||
endif;
|
||
endif;
|
||
|
||
// SID
|
||
if ($f_cr_sid_search != "") :
|
||
// Without subjobs
|
||
// $whereClause .= " AND jb.cr_sid = '$f_cr_sid_search'";
|
||
|
||
// With subjobs
|
||
$fromClause .= " LEFT JOIN " . $dbh_jb . " AS jb_sub ON jb.jb_id = jb_sub.jb_id_parent ";
|
||
$whereClause .= " AND (jb.cr_sid = '$f_cr_sid_search' OR jb_sub.cr_sid = '$f_cr_sid_search')";
|
||
endif;
|
||
// mediation-area
|
||
if ($f_area_from != "") :
|
||
$whereClause .= " AND jb.jb_mediationarea_name >= '$f_area_from'";
|
||
endif;
|
||
if ($f_area_to != "") :
|
||
$whereClause .= " AND jb.jb_mediationarea_name <= '$f_area_to'";
|
||
endif;
|
||
|
||
// Do not show storno jobs
|
||
if ($jb_status == "ALL" || $jb_status == "2") :
|
||
if ($filter_no_storno == "checked") :
|
||
$whereClause .= " AND (ISNULL(jb.jb_storno) OR (jb.jb_storno = '0')) ";
|
||
endif;
|
||
if ($filter_cr_price == "checked") :
|
||
$whereClause .= " AND jb.jb_cr_price != '0' ";
|
||
endif;
|
||
endif;
|
||
// Optional search filters for list of done jobs only
|
||
if ($jb_status == "2") :
|
||
// Only show not exported jobs
|
||
if ($filter_only_not_exported == "checked") :
|
||
$whereClause .= " AND (ISNULL(jb.jb_export_time) OR (jb.jb_export_time = '0000-00-00 00:00:00')) ";
|
||
endif;
|
||
endif;
|
||
// Filter by selected vehicle filters
|
||
if ($jb_status == "ALL" || $jb_status == "2") :
|
||
if ($g_crvh_filter != "") :
|
||
$tmpFilter = spliti(",",$g_crvh_filter);
|
||
$lenTmp = count($tmpFilter);
|
||
for ($i = 0; $i < $lenTmp; $i++) :
|
||
// $whereClause .= " AND (jb.jb_cr_filter LIKE '%" . $tmpFilter[$i] . "%' OR jb.jb_cr_filter_opt LIKE '%" . $tmpFilter[$i] . "%') ";
|
||
$tfx = $tmpFilter[$i];
|
||
$tfxLen = strlen($tfx) + 1; // with comma
|
||
$whereClause .= " AND (jb.jb_cr_filter = '" . $tfx . "' OR jb.jb_cr_filter LIKE '%," . $tfx . ",%' OR LEFT(jb.jb_cr_filter," . $tfxLen . ") = '" . $tfx . ",' OR RIGHT(jb.jb_cr_filter," . $tfxLen . ") = '," . $tfx . "' OR
|
||
jb.jb_cr_filter_opt = '" . $tfx . "' OR jb.jb_cr_filter_opt LIKE '%," . $$tfx . ",%' OR LEFT(jb.jb_cr_filter_opt," . $tfxLen . ") = '" . $tfx . ",' OR RIGHT(jb.jb_cr_filter_opt," . $tfxLen . ") = '," . $tfx . "')";
|
||
endfor;
|
||
endif;
|
||
endif;
|
||
|
||
// Check for displaying state regarding visibility in joblists
|
||
if ($jb_status == "9" && $filter_display_invisible == "") :
|
||
$whereClause .= " AND cs_payer.cs_joblist_disabled = '0' ";
|
||
endif;
|
||
|
||
// Optional search filters for list of done or of all jobs
|
||
if (($jb_status == "ALL" || $jb_status == "2") && $searchFiltersInUse) :
|
||
|
||
// Payer
|
||
if ($searchFiltersPayerInUse) :
|
||
|
||
$fromClause .= " LEFT JOIN costcenter AS csc_search_payer ON jb.csc_id_payer = csc_search_payer.csc_id ";
|
||
$fromClause .= " LEFT JOIN customer AS cs_search_payer ON csc_search_payer.cs_id = cs_search_payer.cs_id ";
|
||
$fromClause .= " LEFT JOIN company AS cmp_search_payer ON cs_search_payer.cmp_id = cmp_search_payer.cmp_id ";
|
||
$fromClause .= " LEFT JOIN address AS ad_search_payer ON cmp_search_payer.ad_id = ad_search_payer.ad_id ";
|
||
|
||
if ($f_search_ad_street_payer != "") :
|
||
$whereClause .= " AND (ad_search_payer.ad_street LIKE '%" . $f_search_ad_street_payer . "%') ";
|
||
endif;
|
||
if ($f_search_ad_zipcode_payer != "") :
|
||
$whereClause .= " AND (ad_search_payer.ad_zipcode LIKE '%" . $f_search_ad_zipcode_payer . "%') ";
|
||
endif;
|
||
if ($f_search_ad_city_payer != "") :
|
||
$whereClause .= " AND (ad_search_payer.ad_city LIKE '%" . $f_search_ad_city_payer . "%') ";
|
||
endif;
|
||
if ($f_search_ad_country_payer != "" && $f_search_ad_country_payer != "--") :
|
||
$whereClause .= " AND (ad_search_payer.ad_country = '" . $f_search_ad_country_payer . "') ";
|
||
endif;
|
||
if ($f_search_cmp_comp_payer != "") :
|
||
$whereClause .= " AND (cmp_search_payer.cmp_comp LIKE '%" . $f_search_cmp_comp_payer . "%') ";
|
||
endif;
|
||
if ($f_search_cs_eid_payer != "") :
|
||
$whereClause .= " AND (cs_search_payer.cs_eid LIKE '%" . $f_search_cs_eid_payer . "%') ";
|
||
endif;
|
||
if ($f_search_csc_name_payer != "") :
|
||
$whereClause .= " AND (csc_search_payer.csc_name LIKE '%" . $f_search_csc_name_payer . "%') ";
|
||
endif;
|
||
endif;
|
||
|
||
// Stations
|
||
if ($searchFiltersStationsInUse) :
|
||
$whereClause .= " AND EXISTS ( "
|
||
. " SELECT 1 FROM " . $dbh_tr . " AS tr_search LEFT JOIN address AS ad_search ON tr_search.ad_id = ad_search.ad_id WHERE tr_search.jb_id = jb.jb_id ";
|
||
|
||
if ($f_search_ad_street != "") :
|
||
$whereClause .= " AND (ad_search.ad_street LIKE '%" . $f_search_ad_street . "%')";
|
||
endif;
|
||
if ($f_search_ad_zipcode != "") :
|
||
$whereClause .= " AND (ad_search.ad_zipcode LIKE '%" . $f_search_ad_zipcode . "%')";
|
||
endif;
|
||
if ($f_search_ad_city != "") :
|
||
$whereClause .= " AND (ad_search.ad_city LIKE '%" . $f_search_ad_city . "%')";
|
||
endif;
|
||
if ($f_search_ad_country != "" && $f_search_ad_country != "--") :
|
||
$whereClause .= " AND (ad_search.ad_country LIKE '%" . $f_search_ad_country . "%')";
|
||
endif;
|
||
if ($f_search_tr_comp != "") :
|
||
$whereClause .= " AND (tr_search.tr_comp LIKE '%" . $f_search_tr_comp . "%')";
|
||
endif;
|
||
if ($f_search_tr_person != "") :
|
||
$whereClause .= " AND (tr_search.tr_person LIKE '%" . $f_search_tr_person . "%')";
|
||
endif;
|
||
if ($f_search_tr_remark != "") :
|
||
$whereClause .= " AND (tr_search.tr_remark LIKE '%" . $f_search_tr_remark . "%')";
|
||
endif;
|
||
if ($f_search_tr_commission_no != "") :
|
||
$whereClause .= " AND (tr_search.tr_commission_no LIKE '%" . $f_search_tr_commission_no . "%')";
|
||
endif;
|
||
|
||
$whereClause .= ") "; // EXISTS
|
||
endif;
|
||
endif;
|
||
|
||
// Group for price
|
||
if (MASK_JOBLIST_TOTALPRICE == "1") :
|
||
$whereClause .= " GROUP BY trs.jb_id ";
|
||
endif;
|
||
|
||
// Set limit for browsing
|
||
// $f_filter_browse_start contains the factor to be multiplicated with the number of rows to be displayed
|
||
$orderByClause .= " LIMIT ". ($f_filter_browse_start * $maskJoblistBrowseMax) . "," . $maskJoblistBrowseMax;
|
||
|
||
// Generate statement
|
||
// $sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
|
||
$whereClauseA = str_replace("[HQ_ID_MC]",$whereClauseHqId,$whereClause);
|
||
$whereClauseB = str_replace("[HQ_ID_MC]",$whereClauseHqIdExec,$whereClause);
|
||
$whereClauseC = str_replace("[HQ_ID_MC]",$whereClauseHqIdDispo,$whereClause);
|
||
$whereClauseD = str_replace("[HQ_ID_MC]",$whereClauseHqIdSales,$whereClause);
|
||
$sqlqueryA = generateStatement($fieldClause,$fromClause,$whereClauseA,"");
|
||
$sqlqueryB = generateStatement($fieldClause,$fromClause,$whereClauseB,"");
|
||
$sqlqueryC = generateStatement($fieldClause,$fromClause,$whereClauseC,"");
|
||
$sqlqueryD = generateStatement($fieldClause,$fromClause,$whereClauseD,"");
|
||
$sqlquery = "(" . $sqlqueryA . ") UNION (" . $sqlqueryB . ") UNION (" . $sqlqueryC . ") UNION (" . $sqlqueryD . ") ORDER BY " . $orderByClause;
|
||
// if ($jb_status == "ALL") : echo $sqlquery . "<br>"; endif;
|
||
// echo $sqlquery . "<br>"; // die();
|
||
|
||
// FILTER-DEFINITIONS
|
||
$filter_status = addOptionsFromTable("metatype","mt_sort","mt_value","mt_sort","mt_type = 'job_status'",($jb_status == "ALL" ? "10" : $jb_status));
|
||
$filter_costcenter = addOptionsFromTable("metatype","mt_sort","mt_value","mt_sort","mt_type = 'job_costcenter'",$jb_costcenter);
|
||
|
||
// Related customer
|
||
if ($globalParUseRelatedCustomer == "1" && $parMaskDispositionGroup != "") :
|
||
$filter_related_customer = " " . getLngt("Bezugskunde:") . "\n";
|
||
$filter_related_customer .= "<select name=\"f_filter_related_customer\" class=\"f8np1\">\n";
|
||
$filter_related_customer .= " <option value=\"\"" . ($f_filter_related_customer == "" ? "selected" : "") . ">" . getLngt("------") . "</option>\n";
|
||
$filter_related_customer .= addOptionsFromTable("customer AS cs, company AS cmp","cs.cs_id","cmp.cmp_comp","cmp.cmp_comp","cs.hq_id IN " . getSQLMandatorArray(array($hq_id)) . " AND cmp.cmp_id = cs.cmp_id AND cmp.cmp_comp != 'EXTERN' AND cs.cs_id_parent != '0' AND NOT isnull(cs.cs_id_parent) AND cs.cs_group LIKE '%," . $parMaskDispositionGroup . ",%'",$f_filter_related_customer);
|
||
$filter_related_customer .= "</select> \n";
|
||
endif;
|
||
|
||
// Date-ranges
|
||
$filter_dateranges = getLngt("von:") . "\n";
|
||
$filter_dateranges .= "<select name=\"day_from\" class=\"f8np1\" style=\"width: 4em;\" onchange=\"fillDateFieldsCheck(0, '" . $currentFrameName . "', 'jb_list', 'day_from', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
|
||
$filter_dateranges .= "<select name=\"month_from\" class=\"f8np1\" style=\"width: 4em;\" onchange=\"fillDateFieldsCheck(0, '" . $currentFrameName . "', 'jb_list', 'month_from', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
|
||
$filter_dateranges .= "<select name=\"year_from\" class=\"f8np1\" style=\"width: 6em;\" onchange=\"fillDateFieldsCheck(0, '" . $currentFrameName . "', 'jb_list', 'year_from', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
|
||
|
||
$filter_dateranges .= getLngt("bis:") . "\n";
|
||
$filter_dateranges .= "<select name=\"day_to\" class=\"f8np1\" style=\"width: 4em;\" onchange=\"fillDateFieldsCheck(0, '" . $currentFrameName . "', 'jb_list', 'day_to', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
|
||
$filter_dateranges .= "<select name=\"month_to\" class=\"f8np1\" style=\"width: 4em;\" onchange=\"fillDateFieldsCheck(0, '" . $currentFrameName . "', 'jb_list', 'month_to', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
|
||
$filter_dateranges .= "<select name=\"year_to\" class=\"f8np1\" style=\"width: 6em;\" onchange=\"fillDateFieldsCheck(0, '" . $currentFrameName . "', 'jb_list', 'year_to', 'day_from', 'month_from', 'year_from', '', '', '', 'day_to', 'month_to', 'year_to', '', '', '')\"></select>\n";
|
||
|
||
// Vehicle type OR services
|
||
$filter_vehicletype = "";
|
||
$filter_service = "";
|
||
if ($globalParUseRelatedCustomer == "1") :
|
||
$filter_service = " " . getLngt("Service:") . "\n";
|
||
$filter_service .= "<select name=\"f_filter_service\" class=\"f8np1\">\n";
|
||
$filter_service .= " <option value=\"\" " . ($f_filter_service == "" ? "selected" : "") . ">----</option>\n";
|
||
$filter_service .= addOptionsFromTable("metatype","mt_sort","mt_value","mt_sort","mt_type = 'service' AND mt_sort != '1'",$f_filter_service);
|
||
$filter_service .= "</select>\n";
|
||
else :
|
||
$filter_vehicletype = " " . getLngt("Typ:") . "\n";
|
||
$filter_vehicletype .= "<select name=\"f_filter_vehicletype\" class=\"f8np1\">\n";
|
||
$filter_vehicletype .= addOptionsFromTable("metatype","mt_sort","mt_value","mt_sort","mt_type = 'vehicletype'",$f_filter_vehicletype);
|
||
$filter_vehicletype .= "</select>\n";
|
||
endif;
|
||
|
||
$filter_employee = getLngt("MA:") . "\n";
|
||
$filter_employee .= "<select name=\"f_filter_employee\" class=\"f8np1\">\n";
|
||
$filter_employee .= " <option value=\"\" " . ($f_filter_employee == "" ? "selected" : "") . ">----</option>\n";
|
||
$filter_employee .= addOptionsFromTable("user","usr_id","CONCAT(usr_name,' ',LEFT(usr_firstname,1),'.') AS usr_name","usr_name, usr_firstname","usr_type = '1' AND hq_id = '" . $hq_id . "' AND usr_name NOT LIKE 'Admin%' ",$f_filter_employee);
|
||
$filter_employee .= "</select>\n";
|
||
|
||
// Buttons for sort
|
||
$filter_sort_direction = "";
|
||
if ($f_sort_direction == "0") :
|
||
$filter_sort_direction .= "<input type=\"image\" src=\"../images/arrow2_up_disabled.jpg\" alt=\"Aufsteigend\" height=\"15\" width=\"15\" disabled> ";
|
||
$filter_sort_direction .= "<input type=\"image\" src=\"../images/arrow2_down.jpg\" alt=\"Absteigend\" height=\"15\" width=\"15\" onClick=\"javascript:setSortState(1);\">";
|
||
else :
|
||
$filter_sort_direction .= "<input type=\"image\" src=\"../images/arrow2_up.jpg\" alt=\"Aufsteigend\" height=\"15\" width=\"15\" onClick=\"javascript:setSortState(0);\"> ";
|
||
$filter_sort_direction .= "<input type=\"image\" src=\"../images/arrow2_down_disabled.jpg\" alt=\"Absteigend\" height=\"15\" width=\"15\" disabled>";
|
||
endif;
|
||
|
||
// Buttons for browsing
|
||
$filter_browse = defineButtonType08("<", "action_browse_back", "setBrowseStartRange(1);", "10px", "left", "1", "", "", "", ($f_filter_browse_start == 0 ? "disabled" : ""));
|
||
$filter_browse .= "<div class=\"f8np1\" style=\"float:left\">" . ($f_filter_browse_start * $maskJoblistBrowseMax) . "-" . (($f_filter_browse_start * $maskJoblistBrowseMax) + $maskJoblistBrowseMax) . " </div>\n";
|
||
$filter_browse .= defineButtonType08(">", "action_browse_forward", "setBrowseStartRange(2);", "10px", "left", "3", "", "", "", ($f_filter_browse_start > 8 ? "disabled" : ""));
|
||
|
||
|
||
// Javascript-function as template only for
|
||
$js_date = "<script type=\"text/javascript\">\n";
|
||
$js_date .= "<!--\n";
|
||
$js_date .= "var enableCancellationWithCosts = '" . MASK_JOBLIST_CANCELLATION_WITH_COSTS . "';"; // This line only is needed for cancellation (Storno)
|
||
$js_date .= "\n\n";
|
||
$js_date .= "function initForm() {\n";
|
||
$js_date .= " fillDateFields(1,\"" . $currentFrameName . "\",\"jb_list\",\"\",\"day_from\",\"month_from\",\"year_from\",\"\",\"\",\"\");\n";
|
||
$js_date .= " setDateTimeFields(\"" . $currentFrameName . "\",\"jb_list\",".$day_from.",".$month_from.",".$year_from.", \"\", \"\", \"day_from\", \"month_from\", \"year_from\", \"\", \"\", \"\");\n";
|
||
$js_date .= " fillDateFields(1,\"" . $currentFrameName . "\",\"jb_list\", \"\", \"day_to\", \"month_to\", \"year_to\", \"\", \"\", \"\");\n";
|
||
$js_date .= " setDateTimeFields(\"" . $currentFrameName . "\",\"jb_list\",".$day_to.",".$month_to.",".$year_to.", \"\", \"\", \"day_to\", \"month_to\", \"year_to\", \"\", \"\", \"\");\n";
|
||
$js_date .= "}\n";
|
||
$js_date .= "-->\n";
|
||
$js_date .= "</script>\n";
|
||
|
||
|
||
// Other special filters (parameter $filters_out ONLY for output)
|
||
$filters_out = "";
|
||
$filter_01 = ""; $filter_02 = ""; $filter_03 = ""; $filter_04 = ""; $filter_05 = ""; $filter_06 = ""; $filter_07 = ""; $filter_08 = ""; $filter_09 = ""; $filter_10 = "";
|
||
|
||
if ($jb_status == "ALL" || $jb_status == "2") :
|
||
|
||
if (MASK_JOBLIST_CR_FAVOURED == "1") :
|
||
$filter_01 .= "<input type=\"checkbox\" name=\"f_filter[]\" value=\"job_cr_favoured\"" . $filter_cr_favoured . "> " . getLngt("Bevorzugte Fahrer") . " ";
|
||
endif;
|
||
$filter_02 .= "<input type=\"checkbox\" name=\"f_filter[]\" value=\"job_tr_time_check\"" . $filter_tr_time_check . "> " . getLngt("Pr<EFBFBD>fung Etappenzeit") . " ";
|
||
$filter_04 .= "<input type=\"checkbox\" name=\"f_filter[]\" value=\"job_no_storno\"" . $filter_no_storno . "> " . getLngt("Keine stornierten") . " ";
|
||
$filter_09 .= "<input type=\"checkbox\" name=\"f_filter[]\" value=\"job_cr_price\"" . $filter_cr_price . "> " . getLngt("Nur mit Frachtverg<72>tung") . " ";
|
||
|
||
if ($jb_status == "2") :
|
||
$filter_03 .= "<input type=\"checkbox\" name=\"f_filter[]\" value=\"job_only_not_exported\"" . $filter_only_not_exported . "> " . getLngt("Nur nicht exportierte") . " ";
|
||
// $filter_05 .= "<input type=\"checkbox\" name=\"f_filter[]\" value=\"job_printview\"" . $filter_printview . "> " . getLngt("Druckansicht") . " ";
|
||
if (authCheckEmployeeRights($emp_id, "42")) :
|
||
$filter_10 .= "<input type=\"checkbox\" name=\"fileOutput\" value=\"1\" " . ($fileOutput == "1" ? "" : "") . "> " . getLngt("CSV") . " ";
|
||
endif;
|
||
endif;
|
||
if (authCheckEmployeeRights($emp_id, "12")) :
|
||
$filter_06 .= "<input type=\"checkbox\" name=\"f_filter[]\" value=\"job_tr_searchdeep\"" . $filter_searchdeep . "> " . getLngt("Suche in allen Etappen") . " ";
|
||
endif;
|
||
$filter_08 .= getLngt("Filter") . ": <input class=\"f8np1\" type=\"text\" name=\"g_crvh_filter\" value=\"" . $g_crvh_filter . "\" size=\"7\" readonly > ";
|
||
// $filter_08 .= defineButtonType08("...", "action_filter", "openFilters();", "20", "", "2");
|
||
$filter_08 .= "<input type=\"button\" class=\"f8np1\" name=\"action_filter\" value=\"...\" onclick=\"openFilters();\">";
|
||
|
||
$filters_out .= $filter_01; // Filter for coloumn favoured couriers
|
||
$filters_out .= $filter_02; // Filter for computing time between stops
|
||
$filters_out .= $filter_03; // Filter for done and not exported jobs
|
||
$filters_out .= $filter_04; // Filter for no storno jobs
|
||
$filters_out .= $filter_09; // Filter for "cr_price != 0"
|
||
$filters_out .= $filter_05; // Print view
|
||
$filters_out .= $filter_10; // File export as CSV
|
||
$filters_out .= $filter_06; // Filter for searchdeep in tour
|
||
// $filters_out .= $filter_07; // Filter for longhaul (see below output association to filter of mandators !!!)
|
||
$filters_out .= $filter_08; // Filter for vehicle filters and special filters
|
||
endif;
|
||
|
||
// Mandators filter
|
||
$filterMandators = "";
|
||
if (authCheckEmployeeRights($emp_id, "10")) :
|
||
$filter_07 = "<div style=\"float:left;\"><input type=\"checkbox\" name=\"f_filter[]\" value=\"job_only_longhaul\"" . $filter_only_longhaul . "> " . getLngt("Nur Ferntouren") . " </div>\n";
|
||
|
||
// Check for "callcenter mode"
|
||
$empHqList = getParameterValue("0", "HEADQUARTERS_MULTIPLE_ACCESS_EMPLOYEES", "0");
|
||
$showMultipleHqSelection = isInParameterString($emp_id, $empHqList);
|
||
|
||
if ($showMultipleHqSelection) :
|
||
$filterMandators = $filter_07;
|
||
$filterMandators .= "<div style=\"float:left;\">" . getLngt("Niederlassungen:") . " " . addCheckboxesFromTable("f_hq_id","headquarters","hq_id","hq_mnemonic","hq_mnemonic","",$f_hq_id, " ","") . "</div\n>";
|
||
$filterMandators .= defineButtonType08("Alle", "f_hq_check_all", "hqCheckAll(" . $numOfHq . ");", "50px", "left", "3");
|
||
$filterMandators .= defineButtonType08("Keine", "f_hq_uncheck_all", "hqUncheckAll(" . $numOfHq . ");", "50px", "left");
|
||
else :
|
||
$filterMandators = $filter_07 . getHeadquartersCheckboxes($f_hq_id, "", "left");
|
||
endif;
|
||
endif;
|
||
|
||
// Search fields
|
||
$filter_search = "";
|
||
$filter_search2 = "";
|
||
if ($jb_status == "ALL" || $jb_status == "2") :
|
||
// Search parameter for tour data
|
||
$f_search_ad_street = trim($f_search_ad_street);
|
||
$f_search_ad_zipcode = trim($f_search_ad_zipcode);
|
||
$f_search_ad_city = trim($f_search_ad_city);
|
||
$f_search_ad_country = "--";
|
||
$f_search_tr_comp = trim($f_search_tr_comp);
|
||
$f_search_tr_person = trim($f_search_tr_person);
|
||
$f_search_tr_remark = trim($f_search_tr_remark);
|
||
$f_search_tr_commission_no = trim($f_search_tr_commission_no);
|
||
|
||
// Search parameter for payer data
|
||
$f_search_ad_street_payer = trim($f_search_ad_street_payer);
|
||
$f_search_ad_zipcode_payer = trim($f_search_ad_zipcode_payer);
|
||
$f_search_ad_city_payer = trim($f_search_ad_city_payer);
|
||
$f_search_ad_country_payer = "--";
|
||
$f_search_cmp_comp_payer = trim($f_search_cmp_comp_payer);
|
||
$f_search_cs_eid_payer = trim($f_search_cs_eid_payer);
|
||
$f_search_csc_name_payer = trim($f_search_csc_name_payer);
|
||
|
||
|
||
// Filter for tour data
|
||
$filter_search .= "<div style=\"float:left; width:130px;\">" . getLngt("ETAPPEN-FILTER:") . "</div>";
|
||
$filter_search .= "<div>";
|
||
$filter_search .= getLngt("Str.:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_ad_street\" value=\"" . $f_search_ad_street . "\" size=\"10\">\n";
|
||
$filter_search .= getLngt("PLZ:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_ad_zipcode\" value=\"" . $f_search_ad_zipcode . "\" size=\"5\">\n";
|
||
$filter_search .= getLngt("Ort:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_ad_city\" value=\"" . $f_search_ad_city . "\" size=\"10\">\n";
|
||
$filter_search .= " <select class=\"f8np1\" name=\"f_search_ad_country\"><option value=\"--\" selected></option>" . getCountryCodesAsOptions($f_search_ad_country, "cou_iso_2", "cou_iso_2", "cou_iso_2") . "</select>\n";
|
||
$filter_search .= getLngt("Firma:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_tr_comp\" value=\"" . $f_search_tr_comp . "\" size=\"10\">\n";
|
||
$filter_search .= getLngt("Person:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_tr_person\" value=\"" . $f_search_tr_person . "\" size=\"10\">\n";
|
||
$filter_search .= getLngt("Bemerkung:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_tr_remark\" value=\"" . $f_search_tr_remark . "\" size=\"10\">\n";
|
||
$filter_search .= getLngt("Komm.-Nr.:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_tr_commission_no\" value=\"" . $f_search_tr_commission_no . "\" size=\"10\">\n";
|
||
$filter_search .= "</div>\n";
|
||
$filter_search .= "<div style=\"width:100%; height:5px\"></div>";
|
||
|
||
// Filter for payer data
|
||
$filter_search2 .= "<div style=\"float:left; width:130px;\">" . getLngt("BEZAHLER-FILTER:") . "</div>";
|
||
$filter_search2 .= "<div>";
|
||
$filter_search2 .= getLngt("Str.:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_ad_street_payer\" value=\"" . $f_search_ad_street_payer . "\" size=\"10\">\n";
|
||
$filter_search2 .= getLngt("PLZ:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_ad_zipcode_payer\" value=\"" . $f_search_ad_zipcode_payer . "\" size=\"5\">\n";
|
||
$filter_search2 .= getLngt("Ort:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_ad_city_payer\" value=\"" . $f_search_ad_city_payer . "\" size=\"10\">\n";
|
||
$filter_search2 .= " <select class=\"f8np1\" name=\"f_search_ad_country_payer\"><option value=\"--\" selected></option>" . getCountryCodesAsOptions($f_search_ad_country_payer, "cou_iso_2", "cou_iso_2", "cou_iso_2") . "</select>\n";
|
||
$filter_search2 .= getLngt("Firma:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_cmp_comp_payer\" value=\"" . $f_search_cmp_comp_payer . "\" size=\"10\">\n";
|
||
$filter_search2 .= getLngt("EID:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_cs_eid_payer\" value=\"" . $f_search_cs_eid_payer . "\" size=\"10\">\n";
|
||
$filter_search2 .= getLngt("Kst.-Name:") . " <input type=\"text\" class=\"f8np1\" name=\"f_search_csc_name_payer\" value=\"" . $f_search_csc_name_payer . "\" size=\"10\">\n";
|
||
$filter_search2 .= "</div>\n";
|
||
$filter_search2 .= "<div style=\"width:100%; height:5px\"></div>";
|
||
endif;
|
||
|
||
|
||
// Send request to database
|
||
if ($jb_status == "2" || $jb_status == "10" || $jb_status == "ALL") :
|
||
$checkDeepSearchStr = $f_search_ad_street . $f_search_ad_zipcode . $f_search_ad_city . $f_search_tr_comp . $f_search_tr_person . $f_search_tr_remark
|
||
. $f_search_ad_street_payer . $f_search_ad_zipcode_payer . $f_search_cmp_comp_payer . $f_search_cs_eid_payer . $f_search_csc_name_payer;
|
||
if (($fromDateRange != "" && $toDateRange != "" && mcDateDiff($fromDateRange, $toDateRange) > 2) || $checkDeepSearchStr != "") :
|
||
global $dbhostStatistic;
|
||
if ($dbhostStatistic != "") :
|
||
global $dbname2, $dblogin2, $dbpassword2;
|
||
$db_conn = getDbConnectionSpecial($dbhostStatistic, $dbname2, $dblogin2, $dbpassword2);
|
||
$result = $db_conn->query($sqlquery);
|
||
else :
|
||
getDb2Connection(); // Try to connect request server because of performance
|
||
$result = $db2->query($sqlquery);
|
||
endif;
|
||
else :
|
||
getDb2Connection(); // Try to connect request server because of performance
|
||
$result = $db2->query($sqlquery);
|
||
endif;
|
||
else :
|
||
$result = $db->query($sqlquery);
|
||
endif;
|
||
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
|
||
|
||
|
||
// Special links
|
||
$special_links = "";
|
||
$special_links .= "<a href=\"javascript:openCourierStatistics();\">K</a>";
|
||
if ($jb_status == "9") :
|
||
$special_links .= " <a href=\"javascript:goAutoranking();\">A</a>";
|
||
$special_links .= " <a href=\"javascript:goReservAutoranking();\">R</a>";
|
||
if (authCheckEmployeeRights($emp_id, "10")) :
|
||
// Get scaling for BWV window to be opened
|
||
$maskBWVwindowScaling = getParameterValue("0", "MASK_LONGHAUL_WINDOW_SCALE", "0");
|
||
$maskBWVwindowScaling = spliti(",",$maskBWVwindowScaling);
|
||
|
||
$special_links .= " <a href=\"javascript:openMap(". $maskBWVwindowScaling[0] . "," . $maskBWVwindowScaling[1] .");\">BWV</a>";
|
||
|
||
// ******************************************************
|
||
// Very special treatment for access to remote database
|
||
if (BWV2_checkEmpRemoteDBAccess("13", $emp_id)) :
|
||
$special_links .= " <a href=\"javascript:openMap2(". $maskBWVwindowScaling[0] . "," . $maskBWVwindowScaling[1] .");\">BWV2</a>";
|
||
endif;
|
||
// ******************************************************
|
||
endif;
|
||
endif;
|
||
if ($jb_status == "1") :
|
||
// $special_links .= " <a href=\"javascript:openMfHistory();\">N</a>";
|
||
$openMsgs = getCountOfTable("phoenix_log.messageforum", "hq_id = '" . $hq_id . "' AND mf_createtime >= '" . getDateTime("3") . " 00:00:00' AND mf_createtime <= '" . getDateTime("3") . " 23:59:59' AND mf_usr_type = '3' AND mf_state < '2'");
|
||
if ($openMsgs > "0") :
|
||
// $special_links .= " <img src=\"../images/question.gif\" height=\"11\" width=\"10\" border=\"0\">";
|
||
$special_links .= " <a href=\"../admin/mf_history.php\" target=\"_blank\" ><img src=\"../images/question.gif\" height=\"16\" width=\"15\" border=\"0\"></a>";
|
||
endif;
|
||
endif;
|
||
// if ($jb_status == "2") :
|
||
// $special_links .= " <a href=\"javascript:openJobInvoiceAssoc();\">R</a>";
|
||
// endif;
|
||
|
||
|
||
// Header and entries of the list
|
||
if ($globalParUseRelatedCustomer == "1") :
|
||
$summationField = "business_volume_gross";
|
||
else :
|
||
// if ($jb_status == "2") :
|
||
$summationField = "business_volume";
|
||
$summationField2 = "business_volume_with_toll";
|
||
// $summationField3 = "jb_cr_subprice";
|
||
// $summationField4 = "jb_cr_subprice_with_toll";
|
||
$summationField3 = "jb_cr_price";
|
||
// $summationField4 = "jb_cr_price_with_toll";
|
||
$summationField4 = "jb_bsg";
|
||
// endif;
|
||
endif;
|
||
$targetPath = "admin"; // used in following include-file
|
||
$classNameBlink = "blink";
|
||
|
||
// Get path for listed customer document data (type "CS")
|
||
$checkNumOfCsDocuments = getParameterValue("0", "MASK_JOBLIST_CHECK_NUM_OF_CS_DOCS", "0");
|
||
if (mcIsSet($docPath) == "") : $docPath = "../import/upload/"; endif;
|
||
$docPath = getPathForObjectData($docPath, "CS");
|
||
|
||
// Get number of reports of listed customer
|
||
$checkNumOfCsReports = getParameterValue("0", "MASK_JOBLIST_CHECK_NUM_OF_CS_REPORTS", "0");
|
||
|
||
// Get switch to enable check for "NO STORNO LINK IF PAID NOT CASH".
|
||
// If it does NOT exist then
|
||
$stornoCheckPayment = getParameterValue("0", "MASK_JOBLIST_STORNO_CHECK_PAYMENT", $hq_id);
|
||
if ($stornoCheckPayment == "") : $stornoCheckPayment = getParameterValue("0", "MASK_JOBLIST_STORNO_CHECK_PAYMENT", "0"); endif;
|
||
|
||
// Get parameter for displaying OFFERS only
|
||
$jobEditOffersOnly = getParameterValue("0", "MASK_JOBLIST_DISPLAY_OFFERS_ONLY", "0");
|
||
// DEBUG ******************************************************
|
||
include_once ("../include/jb_list_defineoutput_MC.inc.php");
|
||
// DEBUG ******************************************************
|
||
// if (($sumOfSummationField != 0 || $sumOfSummationField2 != 0) && $filter_printview == "") :
|
||
if ($rowCounter > 0 && $filter_printview == "") :
|
||
$tableBody .= "<tr><td class=\"f8np1_red\" colspan=\"" . (count($fieldsArray) - 1) . "\"></br><span class=\"joblist_result\">" . getLngt("EINTR<EFBFBD>GE:") . "</span><span class=\"joblist_sum_value\">" . $rowCounter . "</span></td></tr>\n";
|
||
// if ($sumOfSummationField != 0) :
|
||
$tableBody .= "<tr><td class=\"f8np1_red\" colspan=\"" . (count($fieldsArray) - 1) . "\"><span class=\"joblist_result\">" . getLngt("GESAMTKUNDENPREIS:") . "</span><span class=\"joblist_sum_value\">" . number_format(round($sumOfSummationField,2), 2, ",", ".") . "</span></td></tr>\n";
|
||
// endif;
|
||
// if ($sumOfSummationField2 != 0) :
|
||
// $tableBody .= "<tr><td class=\"f8np1_red\" colspan=\"" . (count($fieldsArray) - 1) . "\"><span class=\"joblist_result\">" . getLngt("GESAMTKUNDENPREIS MIT MAUT:") . "</span><span class=\"joblist_sum_value\">" . number_format(round($sumOfSummationField2,2), 2, ",", ".") . "</span></td></tr>\n";
|
||
// endif;
|
||
|
||
// if ($sumOfSummationField3 != 0) :
|
||
$tableBody .= "<tr><td class=\"f8np1_red\" colspan=\"" . (count($fieldsArray) - 1) . "\"><span class=\"joblist_result\">" . getLngt("GESAMTFRACHTVERG<EFBFBD>TUNG:") . "</span><span class=\"joblist_sum_value\">" . number_format(round($sumOfSummationField3,2), 2, ",", ".") . "</span></td></tr>\n";
|
||
// endif;
|
||
// if ($sumOfSummationField4 != 0) :
|
||
// $tableBody .= "<tr><td class=\"f8np1_red\" colspan=\"" . (count($fieldsArray) - 1) . "\"><span class=\"joblist_result\">" . getLngt("GESAMTFRACHTVERG<52>TUNG MIT MAUT:") . "</span><span class=\"joblist_sum_value\">" . number_format(round($sumOfSummationField4,2), 2, ",", ".") . "</span></td></tr>\n";
|
||
// endif;
|
||
|
||
// if ($sumOfSummationField4 != 0) :
|
||
$tableBody .= "<tr><td class=\"f8np1_red\" colspan=\"" . (count($fieldsArray) - 1) . "\"><span class=\"joblist_result\">" . getLngt("BSG [%]:") . "</span><span class=\"joblist_sum_value\">" . number_format(round(($sumOfSummationField != 0 ? ((($sumOfSummationField - $sumOfSummationField3) / $sumOfSummationField) * 100) : 0 ),2), 2, ",", ".") . (false ? " <=> " . ($sumOfSummationField4 / $rowCounter) : "") . "</span></td></tr>\n";
|
||
// endif;
|
||
endif;
|
||
|
||
$result->free();
|
||
|
||
|
||
// Optional output to file
|
||
$f_secretFileName = "";
|
||
if ($fileOutput == "1") :
|
||
|
||
// Remove old files
|
||
foreach (glob($tempPath . "*.jb.csv") as $fileNameToBoRemoved) {
|
||
if ((time() - filemtime($fileNameToBoRemoved)) > 60) :
|
||
if (file_exists($fileNameToBoRemoved)) :
|
||
unlink($fileNameToBoRemoved);
|
||
endif;
|
||
endif;
|
||
}
|
||
|
||
// Convert matrix to CSV
|
||
$outputLinesArray = convertMatrixToCsv($outArr2File);
|
||
$outputLinesArrayLen = count($outputLinesArray);
|
||
if ($outputLinesArrayLen > 0) :
|
||
|
||
$f_fileName = "JOBLIST_" . date("YmdHis");
|
||
$f_secretFileName = md5($f_fileName) . ".jb.csv";
|
||
|
||
for ($i = 0; $i < $outputLinesArrayLen; $i++) :
|
||
writeToFile($tempPath . $f_secretFileName, $outputLinesArray[$i]); // write statistic data
|
||
endfor;
|
||
else :
|
||
$statusMessage = "Es wurden keine Daten gefunden! Eine Datei wurde deshalb nicht generiert!";
|
||
$fileOutput = "0";
|
||
endif;
|
||
endif;
|
||
|
||
|
||
// wenn MASK_AUTO_REFRESH == 0, dann wird die Kurierliste dynamisch (bei Aufruf) aufgebaut
|
||
// wenn MASK_AUTO_REFRESH == 1, dann wird die Kurierliste statisch (hier) aufgebaut
|
||
if (MASK_AUTO_REFRESH == "1"):
|
||
include_once("../jobs/job_courier.inc.php");
|
||
endif;
|
||
$auto_refresh = MASK_AUTO_REFRESH;
|
||
$cr_id_order_list_out = "var MASK_COURIER_SORT_BY_OCCUPIED = \"\";\nvar jb_longhaul = \"0\";\n" . $cr_id_order_list . $cr_id_order_list2 . $vht_id_str_js . $customercourier_list . "when = \"" . date("H:i") . "\";\n";
|
||
|
||
$reload_status = "1";
|
||
if ($jb_status == "2" || $jb_status == "10" || $jb_status == "ALL") :
|
||
$reload_status = "0";
|
||
endif;
|
||
// Check if employee parameter for refreshing state is active
|
||
if ($maskJoblistModeRefresh == "1") :
|
||
if ($jb_status != "2" && $jb_status != "10" && $jb_status != "ALL") :
|
||
if ($f_currentRefreshState == "0") :
|
||
$reload_status = 0;
|
||
endif;
|
||
endif;
|
||
endif;
|
||
?>
|
||
|
||
<html>
|
||
<head>
|
||
<title><?php echo $pageTitel ?></title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../css/reset.css">
|
||
<link rel="stylesheet" type="text/css" href="../css/phoenix.css">
|
||
<style type="text/css">
|
||
<?php include_once ("../css/navigation.css.php"); ?>
|
||
span.joblist_result { display: inline-block; width: 180px;}
|
||
span.joblist_sum_value { display: inline-block; text-align: right;}
|
||
</style>
|
||
|
||
<?php include_once ("../include/js_framework.inc.php"); ?>
|
||
|
||
<script src="../include/lib_global.js" type="text/javascript"></script>
|
||
|
||
<script src="../include/lib_courier.6.1.js" type="text/javascript"></script>
|
||
|
||
<?php if (false) : ?>
|
||
<script src="../include/key_events_content.js" language="JavaScript1.2" type="text/javascript"></script>
|
||
<script for="document" event="onkeydown()" language="JScript" type="text/jscript">
|
||
<!--
|
||
{
|
||
if (window.event.altKey && event.keyCode >= 49 && event.keyCode <= 57) {
|
||
actionMapEvent(window.event, event.keyCode);
|
||
}
|
||
}
|
||
//-->
|
||
</script>
|
||
<?php endif; ?>
|
||
|
||
|
||
<?php echo $js_date ?>
|
||
|
||
|
||
<script type="text/javascript">
|
||
<!--
|
||
// NAVIGATION
|
||
<?php echo $jsMenuOut; ?>
|
||
|
||
// For identification of the window
|
||
var iname = "job_list";
|
||
|
||
var checkReloadCnt = 0;
|
||
|
||
var refreshStatus = <?php echo $reload_status ?>;
|
||
var rememberRefreshState = refreshStatus;
|
||
|
||
function setRefreshStatus() {
|
||
if (document.forms[0].refreshStatusCheckbox.checked == true) {
|
||
refreshStatus = 1;
|
||
startTimeout();
|
||
} else {
|
||
refreshStatus = 0;
|
||
}
|
||
}
|
||
|
||
function startReload()
|
||
{
|
||
if (refreshStatus == 1) {
|
||
checkReload();
|
||
// self.location.reload();
|
||
finishPage();
|
||
}
|
||
}
|
||
|
||
function checkReload()
|
||
{
|
||
if (++checkReloadCnt == 300)
|
||
{
|
||
// alert("Der Server antwortet nicht. Bitte <20>berpr<70>fen Sie\n" +
|
||
// "ob Sie noch mit dem Internet verbunden sind!");
|
||
// self.close();
|
||
}
|
||
else
|
||
self.setTimeout("checkReload()", 100);
|
||
}
|
||
|
||
// Opens a new (popup-)window with specified parameters
|
||
function popupWindow(url,title,config) {
|
||
|
||
// popup = window.open(url,title,config);
|
||
|
||
var widthPopupWin = screen.width - 80;
|
||
var heightPopupWin = screen.height - 180;
|
||
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2);
|
||
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2);
|
||
var popup;
|
||
popup = window.open(url,title,
|
||
"dependent=yes,width=" + widthPopupWin + ",height=" +
|
||
heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin +
|
||
",scrollbars=yes");
|
||
|
||
}
|
||
|
||
function finishPage() {
|
||
for(i=0;i<document.forms[0].jb_status_select.length;++i) {
|
||
if (document.forms[0].jb_status_select.options[i].selected == true) {
|
||
document.forms[0].jb_status.value=document.forms[0].jb_status_select.options[i].value;
|
||
}
|
||
};
|
||
// Check status for CSV export
|
||
if (document.forms[0].jb_status.value != 2) {
|
||
// If selected list is NOT "finished jobs" then reset flag for CSV export
|
||
if (document.forms[0].fileOutput) {document.forms[0].fileOutput.checked = false;} ;
|
||
};
|
||
// Refresh status
|
||
document.forms[0].f_currentRefreshState.value = refreshStatus;
|
||
// Submit page
|
||
document.forms[0].submit();
|
||
};
|
||
|
||
// In case of having a payment for the cash job to be removed a remark has to be entered and will be checked here
|
||
function checkRemarkForStornoAndFinishPage(jb_id) {
|
||
myhide('actioncontainer');
|
||
var stornoRemark = document.forms[0].f_jb_storno_remark.value;
|
||
if (jb_id != '' && stornoRemark != '') {
|
||
// Store remark for storno into the database
|
||
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=100&submode=1&db_table=job&db_id_field=jb_id&search_value=' + jb_id + '&db_op_field=jb_freetext_3&new_content=' + stornoRemark);
|
||
document.forms[0].jb_id_storno.value = jb_id;
|
||
document.forms[0].f_act.value = 'storno';
|
||
// Reset auto-refreshing state
|
||
document.forms[0].refreshStatusCheckbox.checked = rememberRefreshState;
|
||
setRefreshStatus();
|
||
// Reload page
|
||
finishPage();
|
||
} else {
|
||
alert('<?php echo getLngt("Bitte geben Sie einen Stornogrund ein!") ?>');
|
||
// Reset auto-refreshing state
|
||
document.forms[0].refreshStatusCheckbox.checked = rememberRefreshState;
|
||
setRefreshStatus();
|
||
}
|
||
}
|
||
|
||
function makeStorno(jb_id,jb_permanent,cr_id,jbp_id) {
|
||
if (confirm('<?php echo getLngt("Auftrag") ?> ' + jb_id + ' <?php echo getLngt("wirklich stornieren?") ?>')) {
|
||
document.forms[0].jb_id_storno.value = jb_id;
|
||
document.forms[0].f_act.value = 'storno';
|
||
|
||
var doStorno = true;
|
||
if (cr_id != '') {
|
||
if (enableCancellationWithCosts == '1') {
|
||
if (confirm('<?php echo getLngt("Sollen Stornokosten einbezogen werden?") ?>')) {
|
||
document.forms[0].jb_storno_costs.value = '1';
|
||
};
|
||
};
|
||
};
|
||
|
||
if (jb_permanent != '' && jb_permanent > 0) {
|
||
if (confirm('<?php echo getLngt("Soll die Dauerauftragsregel gel<65>scht werden?") ?>')) {
|
||
document.forms[0].jb_storno_rhythm.value = '2';
|
||
} else {
|
||
document.forms[0].jb_storno_rhythm.value = '1';
|
||
}
|
||
};
|
||
|
||
// Check for global usage of the context menu.
|
||
var globalUsageContextMenu = '<?php echo $maskGlobalUsageContextMenu ?>';
|
||
var usageContextMenuAllCases = '<?php echo $maskUsageContextMenuAllCases ?>';
|
||
if (globalUsageContextMenu == '1') {
|
||
doStorno = false;
|
||
|
||
// If at least one payment does exist then a storno reason has to be entered
|
||
var jbp_id = '';
|
||
ajaxRequestGet('../include/ajaxReqLib.php', 'mode=0&db_table=jobpayment&db_id_field=jb_id&search_value=' + jb_id + '&db_return_field=jbp_id');
|
||
if (retValue != '') {
|
||
jbp_id = retValue;
|
||
}
|
||
if (jbp_id != '' || usageContextMenuAllCases == '1') {
|
||
// Stop auto-refreshing of the list
|
||
rememberRefreshState = document.forms[0].refreshStatusCheckbox.checked;
|
||
document.forms[0].refreshStatusCheckbox.checked = false;
|
||
setRefreshStatus();
|
||
|
||
document.forms[0].jb_storno_jbp_id.value = jbp_id;
|
||
vSetElementContent('ac_title', '<b><?php echo getLngt("Storno") ?></b>');
|
||
vSetElementContent('ac_description', '<?php echo getLngt("Bitte geben Sie einen Storno-Grund ein!") ?>');
|
||
// vSetElementContent('ac_01', '<textarea class="f8np1" name="f_jb_storno_remark" cols="60" rows="3">' + '' + '</textarea>');
|
||
vSetElementContent('ac_01', '<textarea class="f8np1" style="width: 400px; height: 100px; max-width: 500px; max-height: 300px;" name="f_jb_storno_remark">' + '' + '</textarea>');
|
||
vSetElementContent('ac_02', '<a href=\"javascript:checkRemarkForStornoAndFinishPage(' + jb_id + ');\"><?php echo getLngt("Speichern und stornieren") ?></a>');
|
||
vSetElementContent('ac_03', '');
|
||
vSetElementContent('ac_04', '');
|
||
vSetElementContent('ac_05', '');
|
||
myshow('actioncontainer');
|
||
} else {
|
||
// There is no payment entry
|
||
doStorno = true;
|
||
}
|
||
};
|
||
|
||
if (doStorno) {
|
||
finishPage();
|
||
} else {
|
||
document.forms[0].jb_id_storno.value = '';
|
||
document.forms[0].f_act.value = '';
|
||
};
|
||
};
|
||
};
|
||
|
||
|
||
// *** Browse-Limit ***
|
||
|
||
function setBrowseStartRange(direction) {
|
||
var currVal = document.forms[0].f_filter_browse_start.value;
|
||
// Skip back
|
||
if (direction == 1) {
|
||
if (currVal > 0) {
|
||
document.forms[0].f_filter_browse_start.value = currVal-1;
|
||
finishPage();
|
||
};
|
||
};
|
||
// Skip forward
|
||
if (direction == 2) {
|
||
document.forms[0].f_filter_browse_start.value = ++currVal;
|
||
finishPage();
|
||
};
|
||
};
|
||
|
||
// *** Courier-List ***
|
||
|
||
function setCourier(jb_id,cr_sid,cr_availabletime_reset,jb_cr_price, jb_cr_subprice, jb_cr_markup) {
|
||
document.forms[0].f_jb_id.value = jb_id;
|
||
document.forms[0].f_cr_sid.value = cr_sid;
|
||
document.forms[0].f_jb_cr_price.value = jb_cr_price;
|
||
document.forms[0].f_jb_cr_subprice.value = jb_cr_subprice;
|
||
document.forms[0].f_jb_cr_markup.value = jb_cr_markup;
|
||
if (cr_availabletime_reset != '1') {cr_availabletime_reset = '0';};
|
||
document.forms[0].f_cr_availabletime_reset.value = cr_availabletime_reset;
|
||
document.forms[0].f_act.value = 'setCourier';
|
||
//alert(jb_id + "|" + cr_sid + "|" + cr_availabletime_reset + "|" + jb_cr_price + "|" + jb_cr_subprice + "|" + jb_cr_markup);
|
||
finishPage();
|
||
};
|
||
|
||
var cr_id_order_list = new Array();
|
||
<?php echo $cr_id_order_list_out ?>
|
||
|
||
|
||
<?php if ($classNameBlink != "" && $activateJS4Blinking) : ?>
|
||
// For blinking cells only
|
||
function cellBlink() {
|
||
$('.<?php echo $classNameBlink; ?>').fadeOut('slow', function() {
|
||
$(this).fadeIn('slow', function() {
|
||
});
|
||
});
|
||
};
|
||
<?php endif; ?>
|
||
|
||
|
||
var auto_refresh = "<?php echo $auto_refresh ?>";
|
||
|
||
function startTimeout()
|
||
{
|
||
self.setTimeout("startReload()", 60000);
|
||
<?php if ($classNameBlink != "" && $activateJS4Blinking) : ?>
|
||
blinkState = self.setInterval("cellBlink()", 3000);
|
||
<?php endif; ?>
|
||
}
|
||
|
||
var statusMessage = "<?php echo $statusMessage ?>";
|
||
|
||
function displayStatusMessage() {
|
||
if (statusMessage != "") {
|
||
alert(statusMessage);
|
||
}
|
||
};
|
||
|
||
|
||
// ONLY for scaling the lists (frames)
|
||
function finishPageForScaling(maskNumOfWins) {
|
||
urlString = "../admin/jb_list_fs.php?maskNumOfWins=" + maskNumOfWins + "&setPercentValues=1";
|
||
for(i=1; i<=maskNumOfWins; ++i) {
|
||
var tmp = eval("document.forms[0].percentScaleValueWin_" + i + ".value");
|
||
urlString = urlString + "&percentScaleValueWin_" + i + "=" + tmp;
|
||
}
|
||
top.maincontent.location.href = urlString;
|
||
document.forms[0].submit();
|
||
};
|
||
|
||
function openCourierStatistics() {
|
||
var widthPopupWin = 900;
|
||
var heightPopupWin = 700;
|
||
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
|
||
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
|
||
var popupWin;
|
||
popupWin = window.open("../statistic/statistic.php?f_act=calculate&f_category=2&f_statistic=10&noStatisticMenu=1&outputColumnMode=1&outputTitle=Auftragsverteilung&specialAligns=l,l,l,l&deactivateMenu=1","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
|
||
};
|
||
|
||
function goAutoranking() {
|
||
if (confirm('<?php echo getLngt("Sollen die zuzuweisenden Auftr<74>ge in die automatische Vermittlung gestellt werden?") ?>')) {
|
||
document.forms[0].f_act.value = 'goAutoranking';
|
||
finishPage();
|
||
};
|
||
};
|
||
|
||
function goReservAutoranking() {
|
||
if (confirm('<?php echo getLngt("Sollen die Reservierungen in die automatische Vermittlung gestellt werden?") ?>')) {
|
||
document.forms[0].f_act.value = 'goReservAutoranking';
|
||
finishPage();
|
||
};
|
||
};
|
||
|
||
<?php if (false) : ?>
|
||
function openMfHistory() {
|
||
var widthPopupWin = 900;
|
||
var heightPopupWin = 700;
|
||
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
|
||
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
|
||
var popupWin;
|
||
popupWin = window.open("../admin/mf_history.php","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
|
||
};
|
||
|
||
function openJobInvoiceAssoc() {
|
||
var widthPopupWin = 1200;
|
||
var heightPopupWin = 1024;
|
||
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
|
||
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
|
||
var popupWin;
|
||
popupWin = window.open("../jobs/jb_inv_assoc.php","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
|
||
};
|
||
<?php endif; ?>
|
||
|
||
function openMap(widthPopupWin,heightPopupWin) {
|
||
if (widthPopupWin == '') {widthPopupWin = 1280};
|
||
if (heightPopupWin == '') {heightPopupWin = 1024};
|
||
var leftPopupWin = 0;
|
||
var topPopupWin = 0;
|
||
var popupWin;
|
||
popupWin = window.open("../longhaul/jb_longhaul.php","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes,resizable=yes");
|
||
};
|
||
|
||
function openMap2(widthPopupWin,heightPopupWin) {
|
||
if (widthPopupWin == '') {widthPopupWin = 1280};
|
||
if (heightPopupWin == '') {heightPopupWin = 1024};
|
||
var leftPopupWin = 0;
|
||
var topPopupWin = 0;
|
||
var popupWin;
|
||
popupWin = window.open("../longhaul/jb_longhaul.php?useRemoteDB=13","","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes,resizable=yes");
|
||
};
|
||
|
||
function setSortState(sortDirection) {
|
||
document.forms[0].f_sort_direction.value = sortDirection;
|
||
finishPage();
|
||
};
|
||
|
||
function hqCheckAll(numOfHq) {
|
||
for (i = 0; i < numOfHq; i++) {
|
||
document.getElementsByName('f_hq_id[]')[i].checked = true;
|
||
}
|
||
}
|
||
|
||
function hqUncheckAll(numOfHq) {
|
||
for (i = 0; i < numOfHq; i++) {
|
||
document.getElementsByName('f_hq_id[]')[i].checked = false;
|
||
}
|
||
}
|
||
|
||
// Shows/Hides the header of the job list
|
||
function changeJobListHead(displayState) {
|
||
for(i=0;i<document.forms[0].jb_status_select.length;++i) {
|
||
if (document.forms[0].jb_status_select.options[i].selected == true) {
|
||
document.forms[0].jb_status.value=document.forms[0].jb_status_select.options[i].value;
|
||
}
|
||
};
|
||
if (displayState == 'on') {
|
||
myshow('jobListHead');
|
||
myhide('jobListHeadReduced');
|
||
document.forms[0].displaySearchfields.value = '1';
|
||
};
|
||
if (displayState == 'off') {
|
||
myshow('jobListHeadReduced');
|
||
myhide('jobListHead');
|
||
document.forms[0].displaySearchfields.value = '0';
|
||
};
|
||
}
|
||
|
||
// Employee specific function
|
||
function setToNum(elem) {
|
||
document.forms[0].job_no_to.value = elem.value;
|
||
}
|
||
|
||
function openFilters() {
|
||
var widthPopupWin = 900;
|
||
var heightPopupWin = 700;
|
||
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
|
||
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
|
||
var popupWin;
|
||
var f_crvh_filter_str = document.forms[0].g_crvh_filter.value;
|
||
popupWin = window.open("../admin/filter.php?f_crvh_filter_str=" + f_crvh_filter_str,"","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
|
||
}
|
||
|
||
function closeActionContainer () {
|
||
myhide('actioncontainer');
|
||
// Reset auto-refreshing state
|
||
document.forms[0].refreshStatusCheckbox.checked = rememberRefreshState;
|
||
setRefreshStatus();
|
||
}
|
||
|
||
function setBgColOfListHeaderFields () {
|
||
var bgColHeaderField = '<?php $arrJbListTitleBgCol["jb_ordertime"] = mcArrIsSet($arrJbListTitleBgCol, "jb_ordertime"); echo $arrJbListTitleBgCol["jb_ordertime"]?>'
|
||
if (bgColHeaderField != '') {
|
||
$('#listheader_jb_ordertime').css('background-color', bgColHeaderField);
|
||
}
|
||
bgColHeaderField = '<?php echo $arrJbListTitleBgCol["jb_dispoinfo"] = mcArrIsSet($arrJbListTitleBgCol, "jb_dispoinfo"); $arrJbListTitleBgCol["jb_dispoinfo"]?>'
|
||
if (bgColHeaderField != '') {
|
||
$('#listheader_jb_dispoinfo').css('background-color', bgColHeaderField);
|
||
}
|
||
}
|
||
|
||
function downloadFile() {
|
||
var widthPopupWin = 850;
|
||
var heightPopupWin = 600;
|
||
var leftPopupWin = (screen.width / 2) - (widthPopupWin / 2) - 12;
|
||
var topPopupWin = (screen.height / 2) - (heightPopupWin / 2) - 50;
|
||
var popupWin;
|
||
|
||
popupWin = window.open("../include/data_download.php?f_path=<?php echo 'EMC2' . substr($tempPath, 2); ?>&f_fileName=<?php echo $f_secretFileName ?>", "","dependent=yes,width=" + widthPopupWin + ",height=" + heightPopupWin +",left=" + leftPopupWin + ",top=" + topPopupWin + ",scrollbars=yes");
|
||
};
|
||
-->
|
||
</script>
|
||
|
||
<?php
|
||
// Browser specific setup for special <div>....</div> as "actioncontainer"
|
||
if ($isFirefox) :
|
||
$actioncontainerDivPos = "style=\"position:fixed; top:0px; left:450; width:600px; height:500px; z-index:10; background-color:#AACCAA;\"";
|
||
else :
|
||
$actioncontainerDivPos = "";
|
||
?>
|
||
<style type="text/css">
|
||
#actioncontainer { position:absolute; top:0px; left:450px; width:600px; height:500px; z-index:10; background-color:#AACCAA; }
|
||
html>body #actioncontainer { position: fixed; }
|
||
</style>
|
||
<?php
|
||
endif;
|
||
?>
|
||
|
||
<noscript>
|
||
<center>
|
||
<b><br>JavaScript ist nicht verfügbar. Bitte aktivieren Sie JavaScript<br><br>
|
||
in Ihrem Browser, damit diese Seite ordnungsgemäß funktioniert!</b><br><br>
|
||
</center>
|
||
</noscript>
|
||
</head>
|
||
<?php // echo $displaySearchfields . "<br>"; ?>
|
||
<body onLoad="<?php echo $phpCurrentNavigationOnLoad ?>myhide('actioncontainer');setBgColOfListHeaderFields();initForm();startTimeout();displayStatusMessage();<?php if ($displaySearchfields == "1") : echo "changeJobListHead('on');"; else : echo "changeJobListHead('off');"; endif; if ($fileOutput == "1") : echo "downloadFile();"; endif; ?> ">
|
||
|
||
<?php echo $phpMenuOut ?>
|
||
<?php echo $phpReducedMenuOut ?>
|
||
<?php echo $phpPageTitelOut ?>
|
||
|
||
<div class="maincontent" name="maincontent" id="maincontent">
|
||
|
||
<form name="jb_list" action="../admin/jb_list_MC.php" method="post" target="<?php echo $currentFrameName ?>">
|
||
<input type="hidden" name="customerId" value="<?php echo $customerId ?>">
|
||
<input type="hidden" name="cscIdRoot" value="<?php echo $cscIdRoot ?>">
|
||
<input type="hidden" name="cscIdActual" value="<?php echo $cscIdActual ?>">
|
||
<input type="hidden" name="empIdMaster" value="<?php echo $empIdMaster ?>">
|
||
<input type="hidden" name="maskNumOfWin" value="<?php echo $maskNumOfWin ?>">
|
||
<input type="hidden" name="dbhistory" value="<?php echo $dbhistory ?>">
|
||
|
||
<input type="hidden" name="jb_costcenter" value="1">
|
||
<input type="hidden" name="jb_status" value="">
|
||
<input type="hidden" name="jb_sort" value="<?php echo $jb_sort ?>">
|
||
<input type="hidden" name="f_filter_active" value="1">
|
||
<input type="hidden" name="f_filter_browse_start" value="<?php echo $f_filter_browse_start ?>">
|
||
<input type="hidden" name="f_sort_direction" value="<?php echo $f_sort_direction ?>">
|
||
<input type="hidden" name="f_currentRefreshState" value="<?php echo $reload_status ?>">
|
||
<input type="hidden" name="f_cr_availabletime_reset" value="">
|
||
|
||
<input type="hidden" name="displaySearchfields" value="<?php echo $displaySearchfields ?>">
|
||
<?php echo $phpCurrentNavigationInputHidden ?>
|
||
<input type="hidden" name="deactivateMenu" value="<?php echo ec($deactivateMenu) ?>">
|
||
|
||
<div id="jobListHead" name="jobListHead">
|
||
<?php echo htmlDivLineSpacer("3px"); ?>
|
||
<?php echo defineButtonType08("-", "action_lock", "changeJobListHead('off');", "10", "left", "3") ?>
|
||
<!-- Refresh status of the list -->
|
||
<div style="float:left;">
|
||
<input type="checkbox" name="refreshStatusCheckbox" value="<?php echo $reload_status ?>" onClick="javascript:setRefreshStatus();"> <?php echo getLngt("Ref.") ?>
|
||
<script type="text/javascript">
|
||
if (refreshStatus == 1) {
|
||
document.forms[0].refreshStatusCheckbox.checked = true;
|
||
} else {
|
||
document.forms[0].refreshStatusCheckbox.checked = false;
|
||
}
|
||
</script>
|
||
</div>
|
||
<!-- Job-status -->
|
||
<div style="float:left;">
|
||
<select class="f8np1" name="jb_status_select">
|
||
<?php echo $filter_status ?>
|
||
</select>
|
||
</div>
|
||
<!-- Date ranges -->
|
||
<div style="float:left; width:430px">
|
||
<?php echo $filter_dateranges ?>
|
||
</div>
|
||
<!-- ID-range -->
|
||
<?php if ($globalParUseRelatedCustomer != "1") : ?>
|
||
<div style="float:left; width:240px">
|
||
<?php echo getLngt("Auftrag von:") ?>
|
||
<input class="f8np1" type="text" name="job_no_from" value="<?php echo $job_no_from ?>" <?php if ($maskJoblistModeJobNum == "1" && $globalParUseRelatedCustomer != "1") : echo "onBlur=\"setToNum(this)\""; endif; ?> size="5">
|
||
<?php echo getLngt("bis:") ?>
|
||
<input class="f8np1" type="text" name="job_no_to" value="<?php echo $job_no_to ?>" size="5">
|
||
</div>
|
||
<?php else : ?>
|
||
<div style="float:left; width:215px">
|
||
<?php echo getLngt("Suche:") ?>
|
||
<input class="f8np1" type="text" name="job_no_from" value="<?php echo $job_no_from ?>" size="10">
|
||
<input type="hidden" name="job_no_to" value="">
|
||
</div>
|
||
<?php endif; ?>
|
||
<!-- SID -->
|
||
<div>
|
||
<?php echo getLngt("Fzg:") ?>
|
||
<input class="f8np1" type="text" name="f_cr_sid_search" value="<?php echo $f_cr_sid_search ?>" size="5">
|
||
|
||
<?php echo $filter_employee ?>
|
||
</div>
|
||
|
||
<?php echo htmlDivLineSpacer("5px"); ?>
|
||
<div style="float:left;">
|
||
<input type="checkbox" name="f_filter[]" value="job_permanent" <?php echo $filter_job_permanent ?>> <?php echo getLngt("Dauerauftr<74>ge") ?>
|
||
</div>
|
||
<div style="float:left;">
|
||
<input type="checkbox" name="f_filter[]" value="job_future" <?php echo $filter_job_future ?>> <?php echo getLngt("Zuk<75>nftige") ?>
|
||
</div>
|
||
<div style="float:left;">
|
||
<input type="checkbox" name="f_filter[]" value="job_incomplete" <?php echo $filter_job_incomplete ?>> <?php echo getLngt("Nur nachzubearb.") ?>
|
||
</div>
|
||
<div style="float:left;">
|
||
<input type="checkbox" name="f_filter[]" value="job_serviceprice" <?php echo $filter_job_serviceprice ?>> <?php echo getLngt("Nur mit Servicepreis") ?>
|
||
</div>
|
||
<!-- Search direction -->
|
||
<div style="float:left;">
|
||
<?php echo $filter_sort_direction ?>
|
||
</div>
|
||
<!-- Search button -->
|
||
<?php echo defineButtonType08(getLngt("Anzeigen"), "action_search", "finishPage();", "70", "left", "3") ?>
|
||
<!-- Browse -->
|
||
<div style="float:left;">
|
||
<?php echo $filter_browse ?>
|
||
</div>
|
||
<?php if ($globalParUseRelatedCustomer == "1" && $parMaskDispositionGroup != "") : ?>
|
||
<!-- Related customer -->
|
||
<div style="float:left;">
|
||
<?php echo $filter_related_customer ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
<!-- Area range -->
|
||
<div style="float:left;">
|
||
Bereich von:
|
||
<input class="f8np1" type="text" name="f_area_from" value="<?php echo $filter_areas_from ?>" size="5">
|
||
bis:
|
||
<input class="f8np1" type="text" name="f_area_to" value="<?php echo $filter_areas_to ?>" size="5">
|
||
</div>
|
||
<!-- Vehicle type --> <!-- Special links -->
|
||
<?php if ($filter_vehicletype != ""): ?>
|
||
<div>
|
||
<?php echo $filter_vehicletype ?>
|
||
|
||
<?php echo $special_links ?>
|
||
</div>
|
||
<?php echo htmlDivLineSpacer("10px"); ?>
|
||
<?php endif; ?>
|
||
<!-- Service -->
|
||
<?php if ($filter_service != ""): ?>
|
||
<div>
|
||
<?php echo $filter_service ?>
|
||
</div>
|
||
<?php echo htmlDivLineSpacer("10px"); ?>
|
||
<?php endif; ?>
|
||
<div>
|
||
<!-- Offers -->
|
||
<?php if ($filterOnlyOfferCheckbox != "" || $filterNoOfferCheckbox != ""): ?>
|
||
<?php echo $filterOnlyOfferCheckbox . " " . $filterNoOfferCheckbox . " "; ?>
|
||
<?php endif; ?>
|
||
<!-- Invisible jobs -->
|
||
<?php echo $filterDisplayInvisibleCheckbox ?>
|
||
</div>
|
||
<?php echo htmlDivLineSpacer("10px"); ?>
|
||
<!-- search filters -->
|
||
<div>
|
||
<?php echo $filters_out ?>
|
||
</div>
|
||
<?php echo htmlDivLineSpacer("5px"); ?>
|
||
<div>
|
||
<?php echo $filter_search ?>
|
||
</div>
|
||
<div>
|
||
<?php echo $filter_search2 ?>
|
||
</div>
|
||
<!-- mandator filters -->
|
||
<div style="float:left;">
|
||
<div>
|
||
<?php echo $filterMandators ?>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<?php echo htmlDivLineSpacer("5px", "", "left"); ?>
|
||
|
||
<div id="jobListHeadReduced" name="jobListHeadReduced">
|
||
<?php echo defineButtonType08("+", "action_lock", "changeJobListHead('on');", "10", "left", "3") ?>
|
||
<div>
|
||
<div style="width:100%; height:3px;"></div>
|
||
<div class="f10bp1_blue">
|
||
<?php echo getFieldValueFromClause("metatype","mt_value","mt_type = 'job_status' AND mt_sort = '" . ($jb_status == "ALL" ? "10" : $jb_status) . "'") ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<?php echo htmlDivLineSpacer("10px"); ?>
|
||
|
||
<!-- TABLE OF JOBS -->
|
||
<div id="jobListBody" name="jobListBody">
|
||
<table width="100%" align="left" cellspacing="0" cellpadding="0" vspace="0" hspace="0">
|
||
<?php echo $tableHeader ?>
|
||
<?php echo $tableBody ?>
|
||
</table>
|
||
</div>
|
||
|
||
<input type="hidden" name="jb_id_storno" value="">
|
||
<input type="hidden" name="jb_storno_costs" value="2">
|
||
<input type="hidden" name="jb_storno_rhythm" value="0">
|
||
<input type="hidden" name="jb_storno_jbp_id" value="">
|
||
<input type="hidden" name="f_cr_sid" value="">
|
||
<input type="hidden" name="f_jb_id" value="2">
|
||
<input type="hidden" name="f_act" value="">
|
||
<input type="hidden" name="f_jb_cr_price" value="">
|
||
<input type="hidden" name="f_jb_cr_subprice" value="">
|
||
<input type="hidden" name="f_jb_cr_markup" value="">
|
||
|
||
<!-- Container for actions -->
|
||
<?php if ($maskGlobalUsageContextMenu == "1") : ?>
|
||
<div id="actioncontainer" <?php echo $actioncontainerDivPos ?>>
|
||
<input type="hidden" name="actionObjType" value="">
|
||
<input type="hidden" name="actionObjId" value="">
|
||
|
||
<?php echo defineButtonType08("Schlie<69>en", "action_actioncontainer_close", "closeActionContainer();", "100", "", "") ?>
|
||
<?php echo htmlDivLineSpacer("30px"); ?>
|
||
|
||
<div style="float:left;width:40px;height:100%">
|
||
|
||
</div>
|
||
<div>
|
||
<div id="ac_title"></div>
|
||
<?php echo htmlDivLineSpacer("20px"); ?>
|
||
<div id="ac_description"></div>
|
||
<?php echo htmlDivLineSpacer("10px"); ?>
|
||
<div id="ac_01"></div>
|
||
<?php echo htmlDivLineSpacer("5px"); ?>
|
||
<div id="ac_02"></div>
|
||
<?php echo htmlDivLineSpacer("5px"); ?>
|
||
<div id="ac_03"></div>
|
||
<?php echo htmlDivLineSpacer("5px"); ?>
|
||
<div id="ac_04"></div>
|
||
<?php echo htmlDivLineSpacer("5px"); ?>
|
||
<div id="ac_05"></div>
|
||
<?php echo htmlDivLineSpacer("5px"); ?>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
</form>
|
||
</div>
|
||
</body>
|
||
</html>
|