0) : $historicJobParameterState = $jbHistoryDataArray[0]; $jobentry = $jbHistoryDataArray[1]; $tourentry = $jbHistoryDataArray[2]; $jobcosts = $jbHistoryDataArray[3]; $courierentry = $jbHistoryDataArray[4]; $employeeentry = $jbHistoryDataArray[5]; $takeRealJobData = false; $historicJobParameterState = str_replace("|", "-,-", $historicJobParameterState); $historicJobParameterArray = spliti("-,-", $historicJobParameterState); $historicJobParameterArrayLen = count($historicJobParameterArray); for ($l = 0; $l < $historicJobParameterArrayLen; $l++) : $singleJobParameterArray = spliti("=", $historicJobParameterArray[$l]); ${$singleJobParameterArray[0]} = trim($singleJobParameterArray[1]); endfor; endif; endif; endif; endif; if ($takeRealJobData) : // --- JOB ------------------- // Initialize if ($f_act == "mailsend" || $f_act == "printjob") : // $titles = "Nr.,Fahrzeug,Auftragszeit,Annahme,Erledigung"; $titles = getLngt("Nr.") . "," . getLngt("Fahrzeug") . "," . getLngt("Auftragszeit") . "," . getLngt("Annahme") . "," . getLngt("Erledigung"); $fields = "jb_id,vht_value,jb_ordertime,jb_taketime,jb_finishtime"; else : $titles = getLngt("Nr.") . "," . getLngt("Tourenname") . "," . getLngt("Kostenstelle") . "," . getLngt("Fahrzeug angefordert ") . "," . getLngt("Fahrzeug gefahren") . "," . getLngt("Auslage") . "," . getLngt("Gewicht") . "," . getLngt("Auftragszeit") . "," . getLngt("Reservierung") . "," . getLngt("Dauerauftrag") . "," . getLngt("Anforderung") . "," . getLngt("Permanente Anford.") . "," . getLngt("Storno") . "," . getLngt("Spät. Annahmezeit") . "," . getLngt("Annahme") . "," . getLngt("Erledigung") . "," . getLngt("Filter") . "," . getLngt("Opt. Filter") . "," . getLngt("L x B x H") . "," . getLngt("Dispo-Info"); $fields = "jb_id,jb_tourname,csc_name,vht_value,vht_value_real,jb_outlay,jb_weight,jb_ordertime,jb_reserv,jb_permanent,cr_sid,cr_id_permanent,jb_storno,jb_latesttaketime,jb_taketime,jb_finishtime,jb_cr_filter,jb_cr_filter_opt,jb_crvh_measures,jb_dispoinfo"; endif; $titlesArray = spliti(",",$titles); $titlesLength = count($titlesArray); $fieldsArray = spliti(",",$fields); $fieldsLength = count($fieldsArray); // Get csc_id of the current job (job entered by customer [csc_id > 0] or headquarter [csc_id = 0]) $job_csc_id = getFieldValueFromId($dbh_jb, "jb_id", "$job_id", "csc_id"); if ($job_csc_id == "") : $job_csc_id = "0"; endif; $fieldClause = getDBFields("job") . "," . getDBFields("vehicletype") . "," . getDBFields("vehicletype_real") . "," . getDBFields("jobstatus") . "," . getDBFields("jb_latesttaketime"); $fieldClause .= ", CONCAT(jb.jb_crvh_length,' x ',jb.jb_crvh_width,' x ',jb.jb_crvh_height) AS jb_crvh_measures"; $fieldClause .= ", srvpt.srvpt_traveltime "; // Check for existing costcenter if ($job_csc_id != "0") : $fieldClause .= "," . getDBFields("costcenter"); endif; // $fromClause = $dbh_jb . " AS jb, metatype AS vht, metatype AS jbs "; $fromClause = "metatype AS vht, metatype AS jbs "; if ($job_csc_id != "0") : $fromClause .= ", costcenter AS csc "; endif; $fromClause .= ", " . $dbh_jb . " AS jb "; // Additional joins e.g. for traveltime to startaddress $fromClause .= " LEFT JOIN " . $dbh_tr . " AS tr ON jb.jb_id = tr.jb_id AND tr.tr_sort = '1' "; $fromClause .= " LEFT JOIN address AS ad ON tr.ad_id = ad.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 metatype AS vht_real ON jb.vht_id_real = vht_real.mt_sort AND vht_real.mt_type = 'vehicletype' "; // $whereClause = "jb.hq_id = " . $currentHqId . " AND "; $whereClause = "jb.jb_id = " . $job_id . " AND "; if ($job_csc_id != "0") : $whereClause .= "(jb.csc_id = csc.csc_id) AND "; endif; $whereClause .= "(jb.vht_id = vht.mt_sort AND vht.mt_type = 'vehicletype') AND "; $whereClause .= "(jb.jb_status = jbs.mt_sort AND jbs.mt_type = 'job_status') "; // Changes only because of jb_status='9' within the SAME list as jb_status='0'! Look in "jb_list.php" // $whereClause .= "((jb.jb_status = jbs.mt_sort OR jb.jb_status-9 = jbs.mt_sort) AND jbs.mt_type = 'job_status') "; $orderByClause = ""; $sqlqueryJob = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause); // echo $sqlqueryJob; die(); // Send request to database $result = $db->query($sqlqueryJob); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage() . ": " . $sqlqueryJob); // Job-data $jobentry = ""; $jobCourierId = ""; $job_usr_id = ""; $job_status = ""; $job_cr_sid = ""; $job_longhaul = ""; while ($row = $result->fetch_assoc()): for ($i = 0; $i < $fieldsLength; $i++) : $showCol = TRUE; if ($i % 2 == 0) : $cellColor = "#BBBBFF"; $cellColor2 = "#DDDDDD"; endif; if ($i % 2 == 1) : $cellColor = "#CCCCFF"; $cellColor2 = "#EEEEEE"; endif; if (trim($titlesArray[$i]) == "") : $titlesArray[$i] = " "; endif; $jobentry .= ""; $jobentry .= "" . $titlesArray[$i] . ""; $tmpVarName = $fieldsArray[$i]; ${$tmpVarName} = $row[$tmpVarName]; // Some parameters (e.g. for mail, booking, changing tourname, etc.) $job_status = $row["jb_status"]; $job_tourname = $row["jb_tourname"]; $job_export_time = $row["jb_export_time"]; $job_reserv = $row["jb_reserv"]; $job_incomplete = $row["jb_incomplete"]; $job_cr_sid = $row["cr_sid"]; $job_longhaul = $row["jb_longhaul"]; $job_id_parent = $row["jb_id_parent"]; $job_subtotalprice = $row["jb_subtotalprice"]; $job_markup = $row["jb_markup"]; $job_ordertime = $row["jb_ordertime"]; // Get the current courier-ID of the job // if ($tmpVarName == "cr_id") : $jobCourierId = $row[cr_id]; endif; $jobCourierId = $row["cr_id"]; // Get the payer of the job $cscIdPayer = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "csc_id_payer"); $csIdPayer = getFieldValueFromId("costcenter", "csc_id", $cscIdPayer, "cs_id"); // If automailer is running check job for having subjobs to change // courier data to courier data of the subjob to get the real driver if ($automailer == "1" || $f_act == "mailsend") : if ($job_id_parent == "-1") : // $tmpJobIdParent = getFieldValueFromId($dbh_jb,"jb_id_parent",$job_id,"jb_id"); $tmpJobIdParent = getFieldValueFromClause($dbh_jb,"jb_id"," jb_id_parent = '" . $job_id . "' ORDER BY jb_id DESC "); $jobCourierId = getFieldValueFromId($dbh_jb,"jb_id",$tmpJobIdParent,"cr_id"); $job_cr_sid = getFieldValueFromId($dbh_jb,"jb_id",$tmpJobIdParent,"cr_sid"); endif; endif; // Get the current employee (user-id !!!) of the job // HAS TO BE IN THE field-list TO GET HERE !!!!!!!!!! // if ($tmpVarName == "emp_id") : $job_usr_id = $row["emp_id"]; endif; // Special job-data if ($tmpVarName == "jb_latesttaketime") : if ($row["jb_waittime"] != "") : ${$tmpVarName} = $row["jb_waittime"]; else : $tmp = ${$tmpVarName}; if ($row["jb_reserv"] == 1) : // mktime(hour,minute,second,month,day,year) $latestTakeTime = LATEST_TAKETIME_IN_MINUTES; if (is_numeric($row["srvpt_traveltime"]) && $row["srvpt_traveltime"] > 0) : $latestTakeTime = $row["srvpt_traveltime"]; endif; ${$tmpVarName} = date("Y-m-d H:i:s", mktime(substr($tmp,11,2),substr($tmp,14,2)-($latestTakeTime),substr($tmp,17,2),substr($tmp,5,2),substr($tmp,8,2),substr($tmp,2,2))); else : ${$tmpVarName} = date("Y-m-d H:i:s", mktime(substr($tmp,11,2),substr($tmp,14,2)+5,substr($tmp,17,2),substr($tmp,5,2),substr($tmp,8,2),substr($tmp,2,2))); endif; endif; if ((date("Y-m-d H:i:s") > ${$tmpVarName}) && ($row["jb_status"] == 0)) : if ($i % 2 == 0) : $cellColor = "#FF2222"; $cellColor2 = "#FF4444"; endif; if ($i % 2 == 1) : $cellColor = "#FF3333"; $cellColor2 = "#FF5555"; endif; endif; endif; if ($showCol) : $out = formatOutput(${$tmpVarName},$outputFormatField[$tmpVarName]); if ($tmpVarName == "jb_storno") : if (${$tmpVarName} != "0" && ${$tmpVarName} != "") : if ($rowCounter % 2 == 0 && $i % 2 == 0) : $cellColor = "#FF2222"; endif; if ($rowCounter % 2 == 0 && $i % 2 == 1) : $cellColor = "#FF3333"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 0) : $cellColor = "#FF4444"; endif; if ($rowCounter % 2 == 1 && $i % 2 == 1) : $cellColor = "#FF5555"; endif; if (${$tmpVarName} == "1") : $out = getLngt("St.m.K."); elseif (${$tmpVarName} == "2") : $out = getLngt("St.o.K."); endif; endif; endif; if ($tmpVarName == "csc_name" && $job_csc_id == "0") : $out = getLngt("Zentrale"); endif; $jobentry .= "" . $out . ""; endif; $jobentry .= ""; endfor; // Link to copy the job and link to history if ($f_act != "mailsend" && $f_act != "printjob") : // Get some informations for the following links $tmpCmpIdPayer = getFieldValueFromId("customer", "cs_id", $csIdPayer, "cmp_id"); $tmpCmpPayerFields = getFieldsValueFromId("company", "cmp_id", $tmpCmpIdPayer, array("cmp_authenticated","cmp_visible")); $jobentry .= "
"; $jobentry .= "" . getLngt("Auftrag kopieren") . "
"; if ($tmpCmpPayerFields[0] == "0" || $tmpCmpPayerFields[1] == "0") : $jobentry .= "(" . getLngt("ACHTUNG") . ": " . getLngt("Der Bezahler ist") . " "; if ($tmpCmpPayerFields[0] == "0") : $jobentry .= getLngt("gesperrt"); endif; if ($tmpCmpPayerFields[0] == "0" && $tmpCmpPayerFields[1] == "0") : $jobentry .= getLngt(" und "); endif; if ($tmpCmpPayerFields[1] == "0") : $jobentry .= getLngt("ausgeblendet"); endif; $jobentry .= "!)
"; endif; $jobentry .= "
" . getLngt("Auftragshistorie") . ""; // $jobentry .= "" . getLngt("Auftragshistorie") . ""; $jobentry .= ""; endif; endwhile; $result->free(); // --- TOUR ------------------ // initialize if ($f_act == "mailsend" || $f_act == "printjob") : $tmpTitlePart = ""; $tmpFieldPart = ""; $csJbstatusmailFields = getFieldValueFromId("customer","cs_id",$csIdPayer,"cs_jbstatusmail_fields"); if (substr($csJbstatusmailFields, 0, 1) == "1") : $tmpTitlePart = getLngt("Bemerkung") . ","; $tmpFieldPart = "tr_remark,"; endif; $titles = getLngt("Firma") . "," . "" . "," . getLngt("Person") . "," . getLngt("Straße + Hausnr.") . "," . getLngt("PLZ + Ort") . "," . getLngt("EID") . "," . getLngt("Kostenstelle") . "," . getLngt("Tel.") . "," . $tmpTitlePart . getLngt("Kommissionsnummer") . "," . getLngt("Erledigungszeit") . "," . getLngt("Klartext") . "," . getLngt("Unterschrift"); $fields = "tr_comp,tr_comp2,tr_person,ad_street_hsno,ad_zipcode_city,cs_eid,csc_name,tr_phone," . $tmpFieldPart . "tr_commission_no,tr_finishtime,tr_signname,tr_sign"; else : $titles = getLngt("Firma") . "," . "" . "," . getLngt("Person") . "," . getLngt("Straße + Hausnr.") . "," . getLngt("PLZ + Ort") . "," . getLngt("Tel. (Kunde)") . "," . getLngt("Email (Kunde)") . "," . getLngt("EID") . "," . getLngt("Kostenstelle") . "," . getLngt("Tel.") . "," . getLngt("Bemerkung") . "," . getLngt("Kommissionsnummer") . "," . getLngt("Erledigungszeit") . "," . getLngt("Status") . "," . getLngt("Klartext") . "," . getLngt("Unterschrift"); $fields = "tr_comp,tr_comp2,tr_person,ad_street_hsno,ad_zipcode_city,usr_phone,usr_email,cs_eid,csc_name,tr_phone,tr_remark,tr_commission_no,tr_finishtime,tr_status,tr_signname,tr_sign"; endif; $titlesArray = spliti(",",$titles); $titlesLength = count($titlesArray); $fieldsArray = spliti(",",$fields); $fieldsLength = count($fieldsArray); $fieldClause = getDBFields("tour") . "," . getDBFields("address") . "," . getDBFields("costcenter"); $fieldClause .= ", CONCAT(ad_street,' ',tr_hsno) AS ad_street_hsno, CONCAT(ad_zipcode,' ',ad_city) AS ad_zipcode_city "; $fromClause = $dbh_tr . " AS tr, address AS ad, costcenter AS csc "; $whereClause = "tr.jb_id = " . $job_id . " AND tr.ad_id = ad.ad_id AND tr.csc_id = csc.csc_id"; $orderByClause = "tr.tr_sort"; // Additional customer informations (phone, name, ...) $fieldClause .= " , cs.cs_eid, usr.usr_phone, usr.usr_email "; $fromClause .= " LEFT JOIN customer AS cs ON cs.cs_id = csc.cs_id "; $fromClause .= " LEFT JOIN employee AS emp ON emp.emp_id = cs.cs_admin "; $fromClause .= " LEFT JOIN user AS usr ON usr.usr_id = emp.usr_id "; $sqlqueryTour = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause); // Send request to database $result = $db->query($sqlqueryTour); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage() . ": " . $sqlqueryTour); // Tour-data $tourentry = ""; $rowCounter = 0; $imgFilenames = array(); while ($row = $result->fetch_assoc()): $rowCounter++; $tourentry .= ""; for ($i = 0; $i < $fieldsLength; $i++) : if ($i % 2 == 0) : $cellColor = "#BBBBFF"; $cellColor2 = "#DDDDDD"; endif; if ($i % 2 == 1) : $cellColor = "#CCCCFF"; $cellColor2 = "#EEEEEE"; endif; if (trim($titlesArray[$i]) == "") : $titlesArray[$i] = " "; endif; $tourentry .= ""; if ($rowCounter == 1) : $tourentry .= ""; // elseif ($i == floor($fieldsLength / 2)) : elseif ($i == 0) : $tourentry .= ""; else : $tourentry .= ""; endif; $tmpVarName = $fieldsArray[$i]; ${$tmpVarName} = $row[$tmpVarName]; $out = formatOutput(${$tmpVarName},$outputFormatField[$tmpVarName]); // Customer-sign if ($tmpVarName == "tr_sign") : if ($row["tr_sign"] != "") : $rawCoord = splitRawCoordinates ($row["tr_sign"]); $maxCoord = checkMaxCoordinates($rawCoord); if ($f_act == "mailsend") : $tmpSignPath = "../temp/signs/"; if (SIGNS_PATH != "") : $tmpSignPath = SIGNS_PATH; endif; $imgFilename = $tmpSignPath . $job_id . "_" . $row["tr_sort"] . ".png"; $imgFilenames[] = $imgFilename; $im = createSignImage($rawCoord); imagepng ($im, $imgFilename); $out = ""; else : $out = "" . "" . ""; endif; endif; endif; if ($tmpVarName == "tr_remark") : $out = nl2br($out); endif; // Email if ($tmpVarName == "usr_email") : if ($job_status == "2") : $out = "" . $out . ""; endif; endif; // Special formatting for tour-fields if ($tmpVarName == "tr_status") : switch($out) { case "0" : $out = "offen"; break; case "1" : $out = "erledigt"; break; }; endif; // Finishtime of the stop if ($tmpVarName == "tr_finishtime") : if (substr($tr_finishtime,0,4) == "1970") : $out = ""; endif; endif; // Do not show customer data if external costcenter if ($tmpVarName == "usr_phone" || $tmpVarName == "usr_email" || $tmpVarName == "cs_eid") : if (!(strpos(strtoupper($row["csc_path"]), "//EXTERN//") === FALSE)) : $out = ""; endif; endif; $tourentry .= ""; $tourentry .= ""; endfor; $tourentry .= "
" . $titlesArray[$i] . " " . $out . "
"; endwhile; $result->free(); // --- COURIER ------------------ // Initialize for template-output $courierentry = ""; if ($jobCourierId != "") : // initialize if ($f_act == "mailsend" || $f_act == "printjob") : $titles = getLngt("Name") . "," . getLngt("Vorname") . "," . getLngt("SID"); $fields = "usr_name,usr_firstname,cr_sid"; else : $titles = getLngt("Firma") . "," . "" . "," . getLngt("Name") . "," . getLngt("Vorname") . "," . getLngt("Tel.") . "," . getLngt("Tel.2") . "," . getLngt("Tel.PDA/VPA") . "," . getLngt("SID") . "," . getLngt("ExtID") . "," . getLngt("Kennz.") . "," . getLngt("Online") . "," . getLngt("Nutzlast") . "," . getLngt("L x B x H"); $fields = "cmp_comp,cmp_comp2,usr_name,usr_firstname,usr_phone,usr_phone2,cr_mobile_pda,cr_sid,cr_eid" . ($job_cr_sid != "" ? ",crvh_vh_sign" : "") . ",cr_available" . ($job_cr_sid != "" ? ",crvh_payload" : "") . ($job_cr_sid != "" ? ",crvh_measures" : ""); endif; $titlesArray = spliti(",",$titles); $titlesLength = count($titlesArray); $fieldsArray = spliti(",",$fields); $fieldsLength = count($fieldsArray); $fieldClause = getDBFields("courier") . "," . getDBFields("company") . "," . getDBFields("user") . " "; $fromClause = "courier AS cr, company AS cmp, user AS usr "; $whereClause = "cr.cr_id = " . $jobCourierId . " AND cmp.cmp_id = cr.cmp_id AND usr.usr_id = cr.usr_id"; $orderByClause = ""; if ($job_cr_sid != "") : $fieldClause .= ",crvh.crvh_vh_sign, crvh.crvh_payload, CONCAT(crvh.crvh_length,' x ',crvh.crvh_width,' x ',crvh.crvh_height) AS crvh_measures "; // $fromClause = "courier AS cr LEFT JOIN couriervehicle AS crvh ON cr.cr_id = crvh.cr_id AND crvh.crvh_sid = '" . $job_cr_sid . "', company AS cmp, user AS usr "; $fromClause = "courier AS cr LEFT JOIN couriervehicle AS crvh ON crvh.crvh_sid = '" . $job_cr_sid . "', company AS cmp, user AS usr "; endif; $orderByClause = ""; $sqlqueryCourier = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause); // Send request to database $result = $db->query($sqlqueryCourier); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage() . ": " . $sqlqueryCourier); // Courier-data while ($row = $result->fetch_assoc()): // $courierentry .= ""; for ($i = 0; $i < $fieldsLength; $i++) : if ($i % 2 == 0) : $cellColor = "#BBBBFF"; $cellColor2 = "#DDDDDD"; endif; if ($i % 2 == 1) : $cellColor = "#CCCCFF"; $cellColor2 = "#EEEEEE"; endif; if (trim($titlesArray[$i]) == "") : $titlesArray[$i] = " "; endif; $courierentry .= ""; $courierentry .= ""; $tmpVarName = $fieldsArray[$i]; ${$tmpVarName} = $row[$tmpVarName]; $out = formatOutput(${$tmpVarName},$outputFormatField[$tmpVarName]); // Take cr_sid from job because (1:n)-relation "courier:vehicle" if ($tmpVarName == "cr_sid") : $out = $job_cr_sid; endif; // special formatting for tour-fields if ($tmpVarName == "cr_available") : switch($out) { case "0" : $out = getLngt("nicht online"); break; case "1" : $out = getLngt("online"); break; }; endif; $courierentry .= ""; $courierentry .= ""; endfor; // Link to copy the job and link to history if ($f_act != "mailsend" && $f_act != "printjob") : $courierentry .= ""; endif; // $courierentry .= "
" . $titlesArray[$i] . "" . $out . "

"; $courierentry .= "" . getLngt("Kurierhistorie") . ""; $courierentry .= "
"; endwhile; $result->free(); endif; // Check for global mediation if ($f_act != "mailsend" && $f_act != "printjob") : if ($job_longhaul == "1" && !authCheckEmployeeRights($emp_id, "10")) : $courierentry = "" . getLngt("FERNTOUR") . ""; endif; endif; // --- USER (EMPLOYEE) ------------------ // Initialize for template-output $employeeentry = ""; // Display only the creator of the job or display the history of employees if (MASK_JOBDETAILS_USER_HISTORY == "" || MASK_JOBDETAILS_USER_HISTORY == "0") : // Get the user (employee) of the current job $job_usr_id = getFieldValueFromId($dbh_jb,"jb_id",$job_id,"emp_id"); if ($job_usr_id != "") : // initialize $titles = getLngt("Name") . "," . getLngt("Vorname") . "," . getLngt("Telefon") . "," . getLngt("E-Mail"); $titlesArray = spliti(",",$titles); $titlesLength = count($titlesArray); $fields = "usr_name,usr_firstname,usr_phone,usr_email"; $fieldsArray = spliti(",",$fields); $fieldsLength = count($fieldsArray); $fieldClause = getDBFields("user") . " "; $fromClause = "user AS usr "; $whereClause = "usr.usr_id = " . $job_usr_id; $orderByClause = ""; $sqlqueryUser = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause); // Send request to database $result = $db->query($sqlqueryUser); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage() . ": " . $sqlqueryUser); // Courier-data $employeeentry .= "" . getLngt("MITARBEITER:") . ""; while ($row = $result->fetch_assoc()): // $employeeentry .= ""; for ($i = 0; $i < $fieldsLength; $i++) : if ($i % 2 == 0) : $cellColor = "#BBBBFF"; $cellColor2 = "#DDDDDD"; endif; if ($i % 2 == 1) : $cellColor = "#CCCCFF"; $cellColor2 = "#EEEEEE"; endif; if (trim($titlesArray[$i]) == "") : $titlesArray[$i] = " "; endif; $employeeentry .= ""; $employeeentry .= ""; $tmpVarName = $fieldsArray[$i]; ${$tmpVarName} = $row[$tmpVarName]; $out = formatOutput(${$tmpVarName},$outputFormatField[$tmpVarName]); $employeeentry .= ""; $employeeentry .= ""; endfor; // $employeeentry .= "
" . $titlesArray[$i] . "" . $out . "
"; endwhile; $result->free(); endif; else : // Display history of employees if (FALSE) : // From table "jobemployee" $fieldClause = getDBFields("jobemployee") . "," . getDBFields("user") . " "; $fromClause = "jobemployee AS jbemp, user AS usr "; $whereClause = "jbemp.jb_id = '" . $job_id . "' AND jbemp.usr_id = usr.usr_id"; $orderByClause = "jbemp.jbemp_modifytime"; else : // From table "log" $fieldClause = getDBFields("logoperation") . "," . getDBFields("log") . "," . getDBFields("user") . " "; $fromClause = " phoenix_log.logoperation AS logo, phoenix_log.log AS log " . " LEFT JOIN phoenix.user AS usr ON log.usr_id = usr.usr_id "; $whereClause = " log.jb_id = '" . $job_id . "' AND log.logo_id = logo.logo_id AND logo.logo_id IN (1,2,5,10,13,14,15,16,17,18,19,20,21,22,23,25,26,32)"; $orderByClause = "log.log_createtime"; endif; $sqlqueryUser = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause); // Send request to database $result = $db->query($sqlqueryUser); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage() . ": " . $sqlqueryUser); // Generate list with header $titleArray = array(getLngt("Vorgang "),getLngt("Zeitpunkt "),getLngt("Name "),getLngt("Vorname "),getLngt("Telefon ")); if (FALSE) : // From table "jobemployee" $fieldArray = array("jbemp_description","jbemp_modifytime","usr_name","usr_firstname","usr_phone"); else : // From table "log" $fieldArray = array("logo_op_shortname","log_createtime","usr_name","usr_firstname","usr_phone"); endif; $aligns = "l,l,l,l,l,l"; $alignArray = spliti(",",$aligns); $alignTitles = "left"; $widths = "50,150,50,50,50"; $widthArray = spliti(",",$widths); $summationField = ""; $mode = "1"; // Output from DB-RESULT $sortDBField = ""; // Used in following include-file for sorting per column; include ("../include/inc_list_defineoutput.inc.php"); $employeeentry .= "" . getLngt("MITARBEITER:") . ""; $employeeentry .= $tableHeader . $tableBody; $result->free(); endif; // --- JOB-COSTS ------------------ /* $jobcosts = "KOSTEN:"; $jobcosts .= ""; $jobCostArr = getJobCostsByID($job_id); foreach ($jobCostArr as $costArr) { $jobcosts .= "Zahler: " . $costArr[0] . "
"; for ($j = 0; $j < (count($costArr[1]) - 1); $j++): $jobcosts .= $costArr[1][$j][0] . ": " . number_format($costArr[1][$j][1], 2, ',', '.') . "
"; endfor; $jobcosts .= "" . $costArr[1][$j][0] . ": "; $jobcosts .= "" . number_format($costArr[1][$j][1], 2, ',', '.') . "" . "
"; } $jobcosts .= ""; */ // Get the persistent tourservice data $fieldString = getDBFields("tourservice"); /* $sqlqueryCosts = "SELECT " . $fieldString . ",csc.csc_name, (trs.trs_price * ((100 - trs.trs_discount) / 100)) AS business_volume" . " FROM " . $dbh_trs . " AS trs LEFT JOIN costcenter AS csc ON trs.csc_id = csc.csc_id" . " WHERE trs.jb_id = '" . $job_id . "'" . " ORDER BY trs.csc_id, trs.tr_sort"; */ $sqlqueryCosts = "SELECT " . $fieldString . ",csc.csc_name, cscad.cscad_phone, cs.cs_eid, CONCAT(cmp.cmp_comp,'
',cmp.cmp_comp2) AS cmp_comp, (trs.trs_price * ((100 - trs.trs_discount) / 100)) AS business_volume" . " FROM " . $dbh_trs . " AS trs LEFT JOIN costcenter AS csc ON trs.csc_id = csc.csc_id" . " LEFT JOIN costcenteraddress AS cscad ON csc.csc_id = cscad.csc_id AND cscad.adt_id = '4'" . " LEFT JOIN customer AS cs ON csc.cs_id = cs.cs_id" . " LEFT JOIN company AS cmp ON cs.cmp_id = cmp.cmp_id" . " WHERE trs.jb_id = '" . $job_id . "'" . " ORDER BY trs.csc_id, trs.tr_sort"; $result = $db->query($sqlqueryCosts); if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage() . ": " . $sqlqueryCosts); // Generate list with header $titleArray = array(getLngt("Kostenstelle "),getLngt("Tel. "),getLngt("EID "),getLngt("Kunde"),getLngt("Leistung "),getLngt("Betrag")); $fieldArray = array("csc_name","cscad_phone","cs_eid","cmp_comp","trs_srv_name","business_volume"); $aligns = "l,l,l,l,l,r"; $alignArray = spliti(",",$aligns); $alignTitles = "left"; $widths = "150,120,50,150,0"; $widthArray = spliti(",",$widths); $summationField = "business_volume"; $mode = "1"; // Output from DB-RESULT $sortDBField = ""; // Used in following include-file for sorting per column; include ("../include/inc_list_defineoutput.inc.php"); // $jobcosts = "" . getLngt("KOSTEN:") . "\n"; $jobcosts .= $tableHeader . $tableBody; $jobcosts .= "" . getLngt("GESAMTSUMME:") . "" . number_format(round($sumOfSummationField,2), 2, ",", ".") . "\n"; if ($job_markup != 0) : // $jobcosts .= "  "; $jobcosts .= "[" . getLngt("Ohne Aufschlag") . " (" . $job_markup . "%):" . number_format(round($job_subtotalprice,2), 2, ",", ".") . "]\n"; endif; endif; // Historic data or real data // --- FAVOURED COURIERS OF THE CUSTOMER (ONLY PAYER !!!) ASSOCIATED TO THE JOB --------------- $jobFavouredCouriers = ""; if ($job_id != "") : // Get vehicle type of the job $jbVhtId = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "vht_id"); // Check first job is a cashpayer one // $cscIdPayer = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "csc_id_payer"); // DEFINED ABOVE !!! // Get parameter $constMaskJobDetailsFavCrShowMode = getParameterValue("0", "MASK_JOBDETAILS_FAVOURED_COURIER_SHOW_MODE", "0"); if (($cscIdPayer != "") && ($cscIdPayer == CSC_ID_PAYER_CASH || $cscIdPayer == "-1" )) : // Job is cashpayer one => Get id of the cashpayer $tmpSqlquery = "SELECT DISTINCT cscr.cr_id, cr.cr_sid, cr.vht_id, cr.cr_eid" . " FROM " . $dbh_jb . " AS jb, costcenter AS csc, customercourier AS cscr, courier AS cr" . " WHERE jb.jb_id = '" . $job_id . "' AND" . " jb.csc_id_payer_cash = csc.csc_id AND" . " csc.cs_id = cscr.cs_id AND" . " cscr.cr_id = cr.cr_id AND" . " cscr.cscr_relation = '1'" . " ORDER BY cscr.cscr_sort"; // . " cr.vht_id >= '" . $jbVhtId . "' AND" $cscIdPayer = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "csc_id_payer_cash"); else : // Job is an invoice one $tmpSqlquery = "SELECT DISTINCT cscr.cr_id, cr.cr_sid, cr.vht_id, cr.cr_eid" . " FROM " . $dbh_trs . " AS trs, costcenter AS csc, customercourier AS cscr, courier AS cr" . " WHERE trs.jb_id = '" . $job_id . "' AND" . " trs.csc_id = csc.csc_id AND" . " csc.cs_id = cscr.cs_id AND" . " cscr.cr_id = cr.cr_id AND" . " cscr.cscr_relation = '1'" . " ORDER BY cscr.cscr_sort"; // . " cr.vht_id >= '" . $jbVhtId . "' AND" endif; $result = $db->query($tmpSqlquery); if (DB::isError($result)) die ("$PHP_SELF 5: {$tmpSqlquery} " . $result->getMessage() . ": " . $tmpSqlquery); $jobFavouredCouriersMatchingVehicle = ""; $jobFavouredCouriersNotMatchingVehicle = ""; $tmpCount1 = 0; $tmpCount2 = 0; while ($row = $result->fetch_assoc()): if ($row["vht_id"] >= $jbVhtId) : if ($constMaskJobDetailsFavCrShowMode == "1") : $jobFavouredCouriersMatchingVehicle .= $row["cr_eid"] . " (" . $row["cr_sid"] . ")   "; $tmpCount1++; if ($tmpCount1 == "3") : $tmpCount1 = 0; // $jobFavouredCouriersMatchingVehicle .= "
   "; $jobFavouredCouriersMatchingVehicle .= " \n"; endif; else : $jobFavouredCouriersMatchingVehicle .= $row["cr_sid"] . "   "; endif; else : if ($constMaskJobDetailsFavCrShowMode == "1") : $tmpCount2++; if ($tmpCount2 == "3") : $tmpCount2 = 0; // $jobFavouredCouriersNotMatchingVehicle .= "
   "; $jobFavouredCouriersNotMatchingVehicle .= " \n"; endif; $jobFavouredCouriersNotMatchingVehicle .= $row["cr_eid"] . " (" . $row["cr_sid"] . ")   "; else : $jobFavouredCouriersNotMatchingVehicle .= $row["cr_sid"] . "   "; endif; endif; endwhile; $result->free(); endif; $jobFavouredCouriers = "" . getLngt("EINGETRAGENE BEVORZUGTE KURIERE:") . "\n" . "" . getLngt("Mit passenden Fahrzeugen:") . "   " . $jobFavouredCouriersMatchingVehicle . "\n" . "" . "Restliche:" . "   " . $jobFavouredCouriersNotMatchingVehicle . "\n"; // --- SEND MAIL --------------- if ($job_status == "2" || $mailTextJobStatus != "") : $mailsend = ""; $mailsendStatus = "   "; if ($f_act == "mailsend") : if (checkEmailFormat($f_email)) : if ($automailer == "0") : include_once ('../include/email/htmlMimeMail.php'); endif; $mailObj = new htmlMimeMail(); $mailtext = ""; $mailtext .= ""; $mailtext .= "

"; $mailtext .= "
" . getLngt("Sehr geehrte Damen und Herren,") . "

"; if ($mailTextJobStatus == "1") : $mailtext .= "
" . getLngt("Die Abholung der Ware erfolgte.") . "
"; elseif ($mailTextJobStatus == "8" || $mailTextJobStatus == "9") : $mailtext .= "
" . getLngt("Ihr Transportauftrag befindet sich in der Vermittlung.") . "
"; else : $mailtext .= "
" . getLngt("Ihr Transportauftrag wurde ausgeführt.") . "
"; endif; $mailtext .= "
" . getLngt("Anbei übersenden wir Ihnen die Auftragsdaten.") . "

"; // Special usage for requesting state of the customer service if ($job_status == "2") : $mailSuccessRequest = getParameterValue("0", "MAIL_SUCCESS_REQUEST", $currentHqId); if ($mailSuccessRequest != "") : // Only if a mail success request does exist in the database (line above) then check if it is enabled for the payer of the job $csJbstatusmailEmp = getFieldValueFromId("customer","cs_id",$csIdPayer,"cs_jbstatusmail_emp"); if ($csJbstatusmailEmp == "1") : // Get the user data of the current employee of the job $job_usr_id = getFieldValueFromId($dbh_jb,"jb_id",$job_id,"emp_id"); if ($job_usr_id != "") : $tmpFields = getFieldsValueFromId("user", "usr_id", $job_usr_id, array("usr_firstname","usr_name","usr_phone","usr_email")); if ($tmpFields[0] != "" && $tmpFields[1] != "" && $tmpFields[2] != "" && $tmpFields[3] != "") : $mailtext .= "
" . getLngt($mailSuccessRequest) . "
"; $mailtext .= "
" . $tmpFields[0] . " " . $tmpFields[1] . "
"; $mailtext .= "
" . getLngt("Telefon") . ": " . $tmpFields[2] . "
"; $mailtext .= "
" . getLngt("Email") . ": " . $tmpFields[3] . "

"; endif; endif; endif; endif; endif; $mailtext .= "
" . getLngt("Mit freundlichem Gruß,") . "
"; $mailSalutationText = getParameterValue("0", "MAIL_SALUTATION_TEXT", $currentHqId); $mailtext .= "
" . getLngt($mailSalutationText) . "

"; // LOGO $logoName = getParameterValue("0", "IMG_LOGO_NAME", $currentHqId); $logoHeight = getParameterValue("0", "IMG_LOGO_HEIGHT", $currentHqId); $logoWidth = getParameterValue("0", "IMG_LOGO_WIDTH", $currentHqId); if ($logoName != "" && $logoHeight != "" && $logoWidth != "") : $mailtext .= "


"; endif; // Transport date or current date $mailJobDate = getParameterValue("0", "MAIL_JOBDATE", "0"); if ($mailJobDate == "1") : $mailtext .= "
" . getLngt("Transportdatum:") . " " . formatOutput($job_ordertime, "datetime", 4) . "


"; else : $mailtext .= "
" . getLngt("Transportdatum:") . " " . getDateTime(5) . "


"; endif; $mailtext .= "
"; $mailtext .= "" . getLngt("AUFTRAG:") . "
"; $mailtext .= "" . $jobentry . "

"; $mailtext .= "
     "; if ($courierentry != "" && $mailTextJobStatus != "0" && $mailTextJobStatus != "8" && $mailTextJobStatus != "9") : $mailtext .= "" . getLngt("TRANSPORTEUR:") . "
"; $mailtext .= "" . $courierentry . "

"; endif; $mailtext .= "
"; if ($tourentry != "") : $mailtext .= "" . getLngt("TOUR:") . "
"; $mailtext .= "" . $tourentry . "

"; endif; if ($jobcosts != "") : $csJbstatusmailPrice = getFieldValueFromId("customer","cs_id",$csIdPayer,"cs_jbstatusmail_price"); if ($csJbstatusmailPrice == "1") : $mailtext .= "" . getLngt("KOSTEN:") . "
"; $mailtext .= "" . $jobcosts . "

"; endif; endif; $mailtext .= ""; $mailObj->setHtml($mailtext, null, "./"); // $mailObj->setHtml($mailtext); // Set From address $mailObj->setFrom(MAIL_SENDER_ADDRESS); // Set Cc address $mailCcAddress = getParameterValue("0", "MAIL_CC_ADDRESS", $currentHqId); if ($mailCcAddress == "" || !checkEmailFormat($mailCcAddress)) : $mailCcAddress = MAIL_CC_ADDRESS; endif; if ($mailCcAddress != "" && checkEmailFormat($mailCcAddress)) : $mailObj->setCc($mailCcAddress); endif; // Set Bcc address $mailBccAddress = getParameterValue("0", "MAIL_BCC_ADDRESS", $currentHqId); if ($mailBccAddress == "" || !checkEmailFormat($mailBccAddress)) : $mailBccAddress = MAIL_BCC_ADDRESS; endif; if ($mailBccAddress != "" && checkEmailFormat($mailBccAddress)) : $mailObj->setBcc($mailBccAddress); endif; if ($mailTextJobStatus == "1") : $mailObj->setSubject(getLngt("Transportauftrag") . " " . $job_id . " : " . getLngt("Die Abholung erfolgte!")); elseif ($mailTextJobStatus == "8" || $mailTextJobStatus == "9") : $mailObj->setSubject(getLngt("Transportauftrag") . " " . $job_id . " " . getLngt("ist in der Vermittlung!")); else : $mailObj->setSubject(getLngt("Transportauftrag") . " " . $job_id . " " . getLngt("ist erledigt!")); endif; // Generate PDF if enabled for customer $csJbstatusmailPdf = getFieldValueFromId("customer","cs_id",$csIdPayer,"cs_jbstatusmail_pdf"); if ($csJbstatusmailPdf == "1") : $tmpPdfPath = "../temp/pdf/"; $includePDFGeneric = "1"; $f_act = "generatePDFJob"; $storeAsFile = "1"; $jbId = $job_id; $pdfFile = "Auftrag_" . $job_id . ".pdf"; include_once ("../admin/pdf_generic.php"); if (file_exists($tmpPdfPath . $pdfFile)) : $attachment = $mailObj->getFile($tmpPdfPath . $pdfFile); $mailObj->addAttachment($attachment, $pdfFile, 'application/pdf'); endif; endif; $mailResult = $mailObj->send(array($f_email), 'smtp'); // Using PEAR alternative // $conf = prepareSendMailPear("smtp.1und1.com","m34847762-7","%CdGm%",$f_email,"Transportauftrag " . $job_id . " erledigt!","votian","support@assecutor.de",$mailtext,"html"); // $mail_object =& Mail::factory("smtp", $conf[0]); // if ($mail_object->send($conf[1], $conf[2], $conf[3])) : if ($mailResult) : $mailsendStatus = getLngt("Die Nachricht wurde versandt!"); // Write logdata into log database writeToLogDB("22",$currentHqId,$job_id,$currentSessionUsrId,"","","",$f_email); else : $mailsendStatus = getLngt("Die Nachricht konnte nicht gesendet werden!"); // Write logdata into log database writeToLogDB("23",$currentHqId,$job_id,$currentSessionUsrId,"","","",$f_email); endif; // $mailObj->free(); $mailObj = NULL; // Remove stored temporary images on the filesystem $tmpSignPath = "../temp/signs/"; $imgFilenamesLen = count($imgFilenames); if (SIGNS_PATH != "") : $tmpSignPath = SIGNS_PATH; endif; for ($im = 0; $im < $imgFilenamesLen; $im++) : if (file_exists($tmpSignPath . $imgFilenames[$im])) : unlink($tmpSignPath . $imgFilenames[$im]); endif; endfor; // Remove stored temporary pdf documents on the filesystem if (file_exists($tmpPdfPath . $pdfFile)) : unlink($tmpPdfPath . $pdfFile); endif; else : $mailsendStatus = getLngt("Die eingegebene Emailadresse ist syntaktisch nicht korrekt!"); endif; endif; if ($automailer == "0") : $mailsend .= "
\n"; $mailsend .= getLngt("Mailadresse:") . "  "; $mailsend .= "   "; $mailsend .= "
"; // $mailsend .= ""; $mailsend .= defineButtonType10(getLngt("Erledigungsmail senden"), "action_sendmail", "mailsend();", "150"); $mailsend .= "

" . $mailsendStatus . "
"; endif; endif; // --- BOOK JOB (Finalize) --------------- // --- CHANGE COURIER (If job is finished and not exported) --------------- if ($automailer == "0" && $job_id != "") : $bookjob = ""; $bookjobStatus = "   "; if ($f_act == "bookjob") : if ($f_crvh_sid_book != "") : // Get cr_id from SID $cr_id_book = getFieldValueFromId("couriervehicle", "crvh_sid", $f_crvh_sid_book, "cr_id"); // Get real vht_id to store in job in contrast to requested vht_id $vht_id_book = getFieldValueFromId("couriervehicle", "crvh_sid", $f_crvh_sid_book, "vht_id"); // Set the current timestamp to store the data $currentTime = getDateTime("0"); if ($cr_id_book != "") : $bookJobTime = $currentTime; $cr_hq_id_book = getFieldValueFromId("courier", "cr_id", $cr_id_book, "hq_id"); // Get ordertime of the job if requested to store the value into jb_finishtime if ($f_jb_finishtime4booking == "1") : $bookJobTime = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "jb_ordertime"); if ($bookJobTime == "") : $bookJobTime = $currentTime; endif; endif; if ($job_id_parent == "" || $job_id_parent == "0") : // Only jobs not having sub-jobs if ($job_status != "2") : // Update and finalize job updateStmt($dbh_jb, "jb_id", $job_id, array("cr_id", $cr_id_book, "hq_id_exec", $cr_hq_id_book, "jb_status", "2", "cr_sid", $f_crvh_sid_book, "vht_id_real", $vht_id_book, "jb_finishtime", $bookJobTime, "jb_booktime", $currentTime), "(hq_id = '" . $currentHqId . "')"); $bookjobStatus = getLngt("Der Auftrag wurde abgeschlossen!"); // Update available time according to finishing by PDA if ($jobCourierId == $cr_id_book && substr($job_ordertime, 0, 10) == substr($currentTime, 0, 10)) : updateStmt("courier", "cr_id", $cr_id_book, array("cr_availabletime", $currentTime), "(hq_id = '" . $currentHqId . "')"); $bookjobStatus .= " " . getLngt("Der Transporteur verlor seine Rankingposition!"); endif; // Write logdata into log database writeToLogDB("5",$currentHqId,$job_id,$currentSessionUsrId,$cr_id_book,$f_crvh_sid_book,"",""); else : if ($job_export_time == "" || $job_export_time == "0000-00-00 00:00:00") : // Activate this ONLY for changing the vehicle of the current courier of the job to avoid booking of other couriers! // if ($jobCourierId == $cr_id_book) : // Update finalized (not exported) job only with vehicle number // updateStmt($dbh_jb, "jb_id", $job_id, array("cr_sid", $f_crvh_sid_book), "(hq_id = '" . $currentHqId . "')"); updateStmt($dbh_jb, "jb_id", $job_id, array("cr_id", $cr_id_book, "cr_sid", $f_crvh_sid_book, "vht_id_real", $vht_id_book), "(hq_id = '" . $currentHqId . "')"); $bookjobStatus = getLngt("Die Fahrzeugnummer wurde geändert!"); // Write logdata into log database writeToLogDB("21",$currentHqId,$job_id,$currentSessionUsrId,$cr_id_book,$f_crvh_sid_book,"",""); // else : // $bookjobStatus = getLngt("Achtung! Das eingegebene Fahrzeug stammt nicht von dem Transporteur der Tour!"); // endif; else: $bookjobStatus = getLngt("Der Auftrag wurde schon exportiert! Eine Änderung ist daher nicht möglich!"); endif; endif; else: $bookjobStatus = getLngt("Der Auftrag hat Unteraufträge! Eine Änderung ist daher nicht möglich!"); endif; else : $bookjobStatus = getLngt("Die gewählte Fahrzeugnummer konnte keinem Kurier zugeordnet werden!"); endif; else: $bookjobStatus = getLngt("Der Auftrag konnte nicht verbucht werden! Geben Sie bitte einen Transporteur an!"); endif; endif; // ONLY show if job is not exported if ($automailer == "0" && ($job_export_time == "" || $job_export_time == "0000-00-00 00:00:00") && $takeRealJobData) : $bookjobButtonText = getLngt("Auftrag abschließen"); if ($job_status == "2") : $bookjobButtonText = getLngt("Fahrzeug ändern"); endif; $bookjob .= "
\n"; $bookjob .= "\n"; $bookjob .= "  
\n"; $bookjob .= defineButtonType10($bookjobButtonText, "action_book", "bookjob();", "150", "left", "3"); $bookjob .= "
\n"; // Select "current time" (default) or "finish time" to finalize the job if ($job_status != "2") : $bookjob .= " " . getLngt("Akt. Tagesdatum"); $bookjob .= " " . getLngt("Auftragsdatum"); endif; $bookjob .= "

" . $bookjobStatus . ""; $bookjob .= "
\n"; endif; endif; // --- CHANGE COURIER ONLY FOR RESERVATIONS --------------- if ($automailer == "0" && ($job_id != "" && $job_status == "8" && $job_reserv == "1")) : $changeCourier = ""; $changeCourierStatus = "   "; if ($f_act == "changeCourierOrder") : if ($f_crvh_sid_order != "") : // Get cr_id from SID $cr_id_order = getFieldValueFromId("couriervehicle", "crvh_sid", $f_crvh_sid_order, "cr_id"); // Get real vht_id to store in job in contrast to requested vht_id $vht_id_order = getFieldValueFromId("couriervehicle", "crvh_sid", $f_crvh_sid_order, "vht_id"); // Set the current timestamp to store the data $currentTime = getDateTime("0"); if ($cr_id_order != "") : // Check if courier has to be set permanent for future jobs if ($f_crvh_sid_order_permanent == "1") : updateStmt($dbh_jb, "jb_id", $job_id, array("cr_id_order", $cr_id_order, "cr_sid", $f_crvh_sid_order, "vht_id_real", $vht_id_order, "cr_id_permanent", $f_crvh_sid_order), "(hq_id = '" . $currentHqId . "')"); // Write logdata into log database writeToLogDB("18",$currentHqId,$job_id,$currentSessionUsrId,$cr_id_order,$f_crvh_sid_order,"",$f_crvh_sid_order); else : updateStmt($dbh_jb, "jb_id", $job_id, array("cr_id_order", $cr_id_order, "cr_sid", $f_crvh_sid_order, "vht_id_real", $vht_id_order), "(hq_id = '" . $currentHqId . "')"); // Write logdata into log database writeToLogDB("17",$currentHqId,$job_id,$currentSessionUsrId,$cr_id_order,$f_crvh_sid_order,"",$f_crvh_sid_order); endif; $changeCourierStatus = getLngt("Die Anforderung wurde geändert!"); else : // Remove courier if ($f_crvh_sid_order == "0") : // Check if courier has to be set permanent for future jobs if ($f_crvh_sid_order_permanent == "1") : updateStmt($dbh_jb, "jb_id", $job_id, array("cr_id_order", "", "cr_sid", "", "cr_id_permanent", "", "vht_id_real", "0"), "(hq_id = '" . $currentHqId . "')"); // Write logdata into log database writeToLogDB("20",$currentHqId,$job_id,$currentSessionUsrId,"","","",""); else : updateStmt($dbh_jb, "jb_id", $job_id, array("cr_id_order", "", "cr_sid", "", "vht_id_real", "0"), "(hq_id = '" . $currentHqId . "')"); // Write logdata into log database writeToLogDB("19",$currentHqId,$job_id,$currentSessionUsrId,"","","",""); endif; else : $changeCourierStatus = getLngt("Die gewählte Fahrzeugnummer konnte keinem Kurier zugeordnet werden!"); endif; endif; else: $changeCourierStatus = getLngt("Die Anforderung konnte nicht zugeteilt werden! Geben Sie bitte ein Fahrzeug an!"); endif; endif; $changeCourier .= "\n"; $changeCourier .= ""; $changeCourier .= "
"; $changeCourier .= " " . getLngt("Permanente Anforderung") . "\n"; $changeCourier .= "

" . $changeCourierStatus . ""; endif; // --- MODIFY/REMOVE TOURNAME --------------- if ($automailer == "0" && $job_id != "") : $modifyTourname = ""; $modifyTournameStatus = "   "; $f_tourname = trim($f_tourname); if ($f_act == "modifyTourname") : if ($f_tourname != "") : if (!(existsEntry($dbh_jb, array("jb_tourname", $f_tourname, "csc_id_payer", $cscIdPayer)) || existsEntry($dbh_jb, array("jb_tourname", $f_tourname, "csc_id_payer_cash", $cscIdPayer)))): // Update job with new tourname updateStmt($dbh_jb, "jb_id", $job_id, array("jb_tourname", $f_tourname), "(hq_id = '" . $currentHqId . "')"); $modifyTournameStatus = getLngt("Der Tourname wurde geändert!"); // Write logdata into log database writeToLogDB("15",$currentHqId,$job_id,$currentSessionUsrId,"","","",$f_tourname); else : $modifyTournameStatus = getLngt("Der Tourname existiert schon! Bitte wählen Sie einen anderen!"); endif; else : // Remove tourname from job updateStmt($dbh_jb, "jb_id", $job_id, array("jb_tourname", ""), "(hq_id = '" . $currentHqId . "')"); $modifyTournameStatus = getLngt("Der Tourname wurde gelöscht!"); // Write logdata into log database writeToLogDB("16",$currentHqId,$job_id,$currentSessionUsrId,"","","",""); endif; $job_tourname = $f_tourname; endif; $modifyTourname .= "
Tourname:  "; $modifyTourname .= "   
"; $modifyTourname .= defineButtonType10(getLngt("Tourname modifizieren"), "action_ready", "changeTourname();", "180", "left", "3"); $modifyTourname .= "


" . $modifyTournameStatus . "
"; endif; // --- SWITCH JOB "COMPLETE" <=> "INCOMPLETE" IF JOB IS NOT EXPORTED --------------- if ($automailer == "0" && $job_id != "" && ($job_export_time == "" || $job_export_time == "0000-00-00 00:00:00") && $takeRealJobData) : $completeJob = ""; $completeJobStatus = ""; if ($f_act == "completeJob") : if ($f_jb_incomplete != "" && ($f_jb_incomplete == "0" || $f_jb_incomplete == "1")) : if ($job_id_parent == "" || $job_id_parent == "0") : // Only jobs not having sub-jobs // Update job with new status jb_incomplete updateStmt($dbh_jb, "jb_id", $job_id, array("jb_incomplete", $f_jb_incomplete), "(hq_id = '" . $currentHqId . "' AND (ISNULL(jb_export_time)) OR jb_export_time = '0000-00-00 00:00:00')"); $job_incomplete = $f_jb_incomplete; // Write logdata into log database writeToLogDB(($f_jb_incomplete == "1" ? "14" : "13"),$currentHqId,$job_id,$currentSessionUsrId,"","","",""); endif; endif; endif; if ($job_incomplete == "1") : $completeJobStatus .= "" . getLngt("UNFERTIG!") . ""; else : $completeJobStatus .= "" . getLngt("FERTIG!") . ""; endif; $completeJob .= ""; $completeJob .= "
" . getLngt("Buchhaltungsstatus des Auftrags:") . " " . $completeJobStatus . "   
\n"; $completeJob .= defineButtonType10(getLngt("Auf ") . ($job_incomplete == "1" ? getLngt("fertig") : getLngt("unfertig")) . getLngt(" setzen"), "action_ready", "changeComplete();", "150", "left", "3"); endif; // --- INVOICE TEXT --------------- /* if ($job_id != "") : if ($f_act == "changeInvoiceText") : updateStmt($dbh_jb, "jb_id", $job_id, array("jb_invtext", $f_jb_invtext_new), "(hq_id = '" . $currentHqId . "')"); endif; endif; */ $f_jb_invtext = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "jb_invtext"); $jobinvoicetext = getLngt("(Vorläufiger) Rechnungstext:") . "
"; $jobinvoicetext .= "
\n"; // $jobinvoicetext .= "\n"; // --- INTERNAL REMARK --------------- if ($automailer == "0") : if ($job_id != "") : if ($f_act == "changeInternalRemark") : updateStmt($dbh_jb, "jb_id", $job_id, array("jb_freetext_3", $f_jb_freetext_3_new), "(hq_id = '" . $currentHqId . "')"); endif; endif; $f_jb_freetext_3 = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "jb_freetext_3"); $jobinternalremark = getLngt("Interne Bemerkung:") . "
"; $jobinternalremark .= "
\n"; $jobinternalremark .= defineButtonType10(getLngt("Interne Bemerkung speichern"), "action_save", "changeInternalRemark();", "220", "left", "3"); endif; // --- COURIER REMARK --------------- if ($automailer == "0") : $f_jb_cr_remark = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "jb_cr_remark"); $jobcourierremark = getLngt("Anmerkungen Transporteur:") . "
"; $jobcourierremark .= "
\n"; endif; // --- SUB-JOBS --------------- if ($automailer == "0" && $job_id != "") : $listOfSubjobs = ""; if (getCountOfTable($dbh_jb, "jb_id_parent = '" . $job_id . "'") > 0) : // $tmpSqlquery = "SELECT jb.jb_id AS jb_id_sub" // . " FROM " . $dbh_jb . " AS jb" // . " WHERE jb.jb_id_parent = '" . $job_id . "'" // . " ORDER BY jb.jb_id"; $tmpSqlquery = "SELECT jb.jb_id AS jb_id_sub, jb.jb_totalprice AS business_volume, cr.cr_eid, usr.usr_name" . " FROM " . $dbh_jb . " AS jb LEFT JOIN courier AS cr ON jb.cr_id = cr.cr_id" . " LEFT JOIN user AS usr ON cr.usr_id = usr.usr_id" . " WHERE jb.jb_id_parent = '" . $job_id . "'" . " ORDER BY jb.jb_id"; $result = $db->query($tmpSqlquery); if (DB::isError($result)) die ("$PHP_SELF 5: {$tmpSqlquery} " . $result->getMessage() . ": " . $sqlquery); // Generate list with header $titleArray = array(getLngt("Auftrag "), getLngt("Preis "), getLngt("ExtID "), getLngt("Name")); $fieldArray = array("jb_id_sub", "business_volume", "cr_eid", "usr_name"); $aligns = "l,r,l,l"; $alignArray = spliti(",",$aligns); $alignTitles = "left"; $widths = "30"; $widthArray = spliti(",",$widths); $summationField = ""; $mode = "1"; // Output from DB-RESULT $sortDBField = ""; // Used in following include-file for sorting per column; include ("../include/inc_list_defineoutput.inc.php"); $listOfSubjobs .= "" . getLngt("UNTERAUFTRÄGE:") . "\n"; $listOfSubjobs .= $tableHeader . $tableBody; $result->free(); endif; endif; ?> <?php echo $pageTitel ?>
>
     


     




          
TOUR: