getOne("SELECT jb_id FROM tourservice WHERE jb_id = " . $job_id . " AND trs_srvt_name = 'z'") == $job_id && $db->getOne("SELECT jb_id FROM phoenix_log.route WHERE jb_id = " . $job_id) == $job_id) : $jobcosts .= "
" . getLngt("Route der PZM-Preisberechnung") . "\n"; endif; endif; endif; endif; // Check for documents associated to the job if ($job_id != "") : // Get path for courier documents (type "JB") if ($importPath == "") : $importPath = getFieldValueFromId("mandator","md_id",$md_id,"md_doc_path"); endif; $importPath = getPathForObjectData($importPath, "JB"); // Get number of documents for the current customer $jbNumOfFiles = getNumOfFilesByFilterInFolder($importPath, $job_id . "_", "1"); endif; // --- 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 --------------- // Allow sending mail regarding jb_status = 1 if ($automailer == "0" && $mailTextJobStatus == "") : // Pay attention if ($job_status == "1") : $maskExtendJbStatusPickup = getParameterValue("0", "MASK_MAIL_JOB_STATE_PICKUP", $currentHqId); if ($maskExtendJbStatusPickup == "1") : $mailTextJobStatus = "1"; endif; endif; if ($job_status == "9") : $maskExtendJbStatusPickup = getParameterValue("0", "MASK_MAIL_JOB_STATE_DISPOSITION", $currentHqId); if ($maskExtendJbStatusPickup == "1") : $mailTextJobStatus = "9"; endif; endif; endif; if ($job_status == "2" || $mailTextJobStatus != "") : $mailsend = ""; $mailsendStatus = "   "; if ($f_act == "mailsend") : if (checkEmailFormat($f_email)) : // Check language by customer parameter $csLanguageMail = getParameterValue("0", "JOBDETAILS_EMAIL_LANGUAGE_" . $csIdPayer, "0"); if ($csLanguageMail == "") : $csLanguageMail = "0"; endif; $remLanguageSelected = ""; if ($takeRealJobData && $csLanguageMail != "" && $languageSelected != $csLanguageMail) : $remLanguageSelected = $languageSelected; $languageSelected = $csLanguageMail; getLanguage(__FILE__); $currentJobParameterState = getJobSnapshot($job_id); endif; // It is necessary to (re)create sign images if mail is based on historic data $imgFilenames = array(); if (!$takeRealJobData) : $tmpSqlquery = "SELECT tr.tr_sign, tr.tr_sort" . " FROM " . $dbh_tr . " AS tr" . " WHERE tr.jb_id = '" . $job_id . "'" . " ORDER BY tr.tr_sort"; $result = $db->query($tmpSqlquery); if (DB::isError($result)) die ("$PHP_SELF 5: {$tmpSqlquery} " . $result->getMessage() . ": " . $tmpSqlquery); $tmpSignPath = "../temp/signs/"; if (SIGNS_PATH != "") : $tmpSignPath = SIGNS_PATH; endif; while ($row = $result->fetch_assoc()): $rawCoord = splitRawCoordinates ($row["tr_sign"]); $maxCoord = checkMaxCoordinates($rawCoord); $imgFilename = $tmpSignPath . $job_id . "_" . $row["tr_sort"] . ".png"; $imgFilenames[] = $imgFilename; $im = createSignImage($rawCoord); imagepng ($im, $imgFilename); endwhile; $result->free(); endif; if ($automailer == "0") : include_once ('../include/email/htmlMimeMail.php'); endif; $mailObj = new htmlMimeMail(); $mailCssFontType = getParameterValue("0", "MAIL_CSS_FONT_TYPE", $currentHqId); if ($mailCssFontType == "") : $mailCssFontType = "Verdana, Arial, Helvetica, sans-serif"; endif; $mailtext = ""; $mailtext .= ""; $mailtext .= "

"; // BEGIN Job data $jobtext = ""; // Definition of the output place of the job data $mailJobData = getParameterValue("0", "MAIL_JOBDATA", "0"); if ($mailJobData == "") : $mailJobData = "0"; endif; // Transport date or current date $mailJobDate = getParameterValue("0", "MAIL_JOBDATE", "0"); if ($mailJobDate == "1") : $jobtext .= "
" . getLngt("Transportdatum:") . " " . formatOutput($job_ordertime, "datetime", 4) . "
"; else : $jobtext .= "
" . getLngt("Transportdatum:") . " " . getDateTime(5) . "
"; endif; $jobtext .= "
"; $jobtext .= "
"; $jobtext .= "" . getLngt("AUFTRAG:") . "
"; $jobtext .= "" . $jobentry . "

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

"; endif; $jobtext .= "
"; if ($tourentry != "") : $jobtext .= "" . getLngt("TOUR:") . "
"; // Insert existing photos for EXPORTED JOBS ONLY // ATTENTION: Dirty code for keepimg compatibility !!!! // The special of $tourentry with the photos will be removed and added again with generated photos // Start photos // Get position of text for the photos $jbExportTime = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "jb_export_time"); if ($jbExportTime != "" && $jbExportTime != "NULL" && $jbExportTime != "0000-00-00 00:00:00" && $jbExportTime != "9999-12-31 23:59:59") : $tmpPos = strpos($tourentry, "Abliefernachweis Foto"); if (!($tmpPos === FALSE)) : // Get positions of the last "" before and the first "" after the text for photos // Tag before the text $tmpStrBefore = substr($tourentry,0,$tmpPos); $tmpPosBefore = strrpos($tmpStrBefore, ""); // !!!! // Tag after the text $tmpStrAfter = substr($tourentry,$tmpPos); $tmpPosAfter = strrpos($tmpStrAfter, ""); // !!!! $tmpPosAfter += $tmpPos; // !!!! // Substring to be replaced $strToBeReplaced = substr($tourentry,$tmpPosBefore, $tmpPosAfter); // Generate photos // Get parameter to check photos are activated or not $constMaskStationsPodPhoto = getParameterValue("0", "MASK_JOBDETAILS_STATIONS_POD_PHOTOS", $currentHqId); if ($constMaskStationsPodPhoto == "") : $constMaskStationsPodPhoto = getParameterValue("0", "MASK_JOBDETAILS_STATIONS_POD_PHOTOS", "0"); endif; // Check for overriding parameter for station photo(s) by job configuration $trPhotos = array(); if ($constMaskStationsPodPhoto != "1") : // Check for mandatory photos $jbTrIds = getColVectorFromDB2ArrayByClause("tour", "tr_id", "jb_id = '" . $job_id . "'", "", "", ""); if (count($jbTrIds) > 0) : // Get required photo configuration for each station of the job into associative array // ($trPhotos[$trId] = "min|max" [e.g. $trPhotos[1234567] = "1|2" <=> at least 1 an max. 2 photos for station 1234567]) $trPhotos = getColVectorFromDB2ArrayByClause("genericdatacontainer", "gdc_content", "gdc_obj_type = 'tr' AND gdc_obj_id IN (" . implode(",", $jbTrIds) . ") AND gdc_gen_fieldname = 'tr_photo'", "gdc_obj_id", "", ""); endif; // if (count($trPhotos) > 0) : $constMaskStationsPodPhoto = "1"; // endif; endif; if ($constMaskStationsPodPhoto == "1") : // Replace all occurrences of tag content with special content $tmpStrTd = "| |"; $strToBeReplaced = str_replace(" ",$tmpStrTd,$strToBeReplaced); // Iterate all stations $numOfStations = count($jbTrIds); for ($s = 0; $s < $numOfStations; $s++) : $tagPhoto = getStationPhotos($jbTrIds[$s], "mailsend"); $tmpPos = strpos($strToBeReplaced, $tmpStrTd); $strToBeReplaced = substr($strToBeReplaced,0,$tmpPos) . $tagPhoto . substr($strToBeReplaced,$tmpPos + strlen($tmpStrTd)); endfor; // Finally replace $strToBeReplaced in $tourentry $tourentry = substr($tourentry,0,$tmpPosBefore) . $strToBeReplaced . substr($tourentry,$tmpPosAfter); endif; endif; endif; // End photos $jobtext .= "" . $tourentry . "

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

"; endif; endif; // END Job data $mailCssFontClass = getParameterValue("0", "MAIL_CSS_FONT_CLASS", $currentHqId); if ($mailCssFontClass == "") : $mailCssFontClass = "f8bp1"; endif; $mailPreSalutationText = getParameterValue("0", "MAIL_PRE_SALUTATION_TEXT", $currentHqId); if ($mailPreSalutationText == "") : $mailPreSalutationText = getLngt("Sehr geehrte Damen und Herren,"); endif; if ($mailTextJobStatus == "OFFER") : // $mailPreSalutationText = getParameterValue("0", "MAIL_PRE_SALUTATION_TEXT_OFFER", $currentHqId); // if ($mailPreSalutationText == "") : $mailPreSalutationText = getParameterValue("0", "MAIL_PRE_SALUTATION_TEXT_OFFER", "0"); endif; // if ($mailPreSalutationText == "") : $tmpJbOrderer = getFieldValueFromId("job","jb_id",$job_id,"jb_orderer"); if ($tmpJbOrderer != "") : $mailPreSalutationText = getLngt("Sehr geehrte/r") . " " . $tmpJbOrderer . ","; endif; $mailPreSalutationText .= "
" . getLngt("vielen Dank für Ihre Anfrage und das damit entgegengebrachte Vertrauen.") . "
" . getLngt("Gerne bieten wir Ihnen auf Basis der von Ihnen übermittelten Informationen, folgendes an:"); // endif; elseif ($mailTextJobStatus == "OFFER_CHANGE") : // $mailPreSalutationText = getParameterValue("0", "MAIL_PRE_SALUTATION_TEXT_OFFER_CHANGE", $currentHqId); // if ($mailPreSalutationText == "") : $mailPreSalutationText = getParameterValue("0", "MAIL_PRE_SALUTATION_TEXT_OFFER_CHANGE", "0"); endif; // if ($mailPreSalutationText == "") : $tmpJbOrderer = getFieldValueFromId("job","jb_id",$job_id,"jb_orderer"); if ($tmpJbOrderer != "") : $mailPreSalutationText = getLngt("Sehr geehrte/r") . " " . $tmpJbOrderer . ","; endif; $mailPreSalutationText .= "
" . getLngt("vielen Dank für Ihre Anfrage und das damit entgegengebrachte Vertrauen.") . "
" . getLngt("Gerne bieten wir Ihnen auf Basis der von Ihnen übermittelten Informationen, folgendes an:"); // endif; endif; $mailtext .= "
" . $mailPreSalutationText . "
"; $mailtext .= "
"; if ($mailTextJobStatus == "1") : $mailTextPickup = getParameterValue("0", "MAIL_TEXT_PICKUP", $currentHqId); if ($mailTextPickup == "") : $mailTextPickup = getLngt("Die Abholung der Ware erfolgte."); endif; $mailtext .= "
" . $mailTextPickup . "
"; elseif ($mailTextJobStatus == "8" || $mailTextJobStatus == "9") : $mailTextDisposition = getParameterValue("0", "MAIL_TEXT_DISPOSITION", $currentHqId); if ($mailTextDisposition == "") : $mailTextDisposition = getLngt("Ihr Transportauftrag befindet sich in der Vermittlung."); endif; $mailtext .= "
" . $mailTextDisposition . "
"; elseif ($mailTextJobStatus == "ALL") : $mailTextDisposition = getParameterValue("0", "MAIL_TEXT_ALL_STATIONS", $currentHqId); if ($mailTextDisposition == "") : $mailTextDisposition = getLngt("Die") . " " . $tour_sort . ". " . getLngt("Station Ihres Auftrags wurde erledigt."); endif; $mailtext .= "
" . $mailTextDisposition . "
"; elseif ($mailTextJobStatus == "CHANGE") : $mailTextDisposition = getParameterValue("0", "MAIL_TEXT_CHANGE", $currentHqId); if ($mailTextDisposition == "") : $mailTextDisposition = "Ihr Transportauftrag wurde geändert."; endif; $mailtext .= "
" . getLngt($mailTextDisposition) . "
"; elseif ($mailTextJobStatus == "OFFER") : $mailTextDisposition = getParameterValue("0", "MAIL_TEXT_OFFER", $currentHqId); if ($mailTextDisposition == "") : $mailTextDisposition = "Ihr Angebot."; endif; $mailtext .= "
" . getLngt($mailTextDisposition) . "
"; elseif ($mailTextJobStatus == "OFFER_CHANGE") : $mailTextDisposition = getParameterValue("0", "MAIL_TEXT_OFFER_CHANGE", $currentHqId); if ($mailTextDisposition == "") : $mailTextDisposition = "Ihr Angebot wurde geändert."; endif; $mailtext .= "
" . getLngt($mailTextDisposition) . "
"; else : $mailTextCompletion = getParameterValue("0", "MAIL_TEXT_COMPLETION", $currentHqId); if ($mailTextCompletion == "") : $mailTextCompletion = "Ihr Transportauftrag wurde ausgeführt."; endif; $mailtext .= "
" . getLngt($mailTextCompletion) . "
"; // Extended text $mailTextCompletion2 = getParameterValue("0", "MAIL_TEXT_COMPLETION_2", $currentHqId); if ($mailTextCompletion2 != "") : $mailtext .= "
"; $mailtext .= "
" . getLngt($mailTextCompletion2) . "
"; $mailTextCompletion3 = getParameterValue("0", "MAIL_TEXT_COMPLETION_3", $currentHqId); if ($mailTextCompletion3 != "") : $mailtext .= "
" . getLngt($mailTextCompletion3) . "
"; $mailTextCompletion4 = getParameterValue("0", "MAIL_TEXT_COMPLETION_4", $currentHqId); if ($mailTextCompletion4 != "") : $mailtext .= "
" . getLngt($mailTextCompletion4) . "
"; $mailTextCompletion5 = getParameterValue("0", "MAIL_TEXT_COMPLETION_5", $currentHqId); if ($mailTextCompletion5 != "") : $mailtext .= "
" . getLngt($mailTextCompletion5) . "
"; endif; endif; endif; $mailtext .= "
"; endif; endif; // $mailtext .= "
"; $mailTextJobdata = getParameterValue("0", "MAIL_TEXT_JOBDATA", $currentHqId); if ($mailTextJobdata == "") : $mailTextJobdata = getLngt("Anbei übersenden wir Ihnen die Auftragsdaten."); endif; $mailtext .= "
" . $mailTextJobdata . "
"; $mailtext .= "
"; // Special usage for requesting state of the customer service $mailDisplayModeEmployeeData = getParameterValue("0", "MAIL_DISPLAY_MODE_EMPLOYEE_DATA", $currentHqId); if ($mailDisplayModeEmployeeData == "") : $mailDisplayModeEmployeeData = "0"; endif; 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 != "") : // Check user type. Display following data for headquarters users only! $job_usr_type = getFieldValueFromId("user","usr_id",$job_usr_id,"usr_type"); if ($job_usr_type == "1") : $mailEmployeeData = getFieldsValueFromId("user", "usr_id", $job_usr_id, array("usr_firstname","usr_name","usr_phone","usr_email","usr_fax")); if ($mailEmployeeData[0] == "" || $mailEmployeeData[1] == "" || $mailEmployeeData[2] == "" || $mailEmployeeData[3] == "") : $mailDisplayModeEmployeeData = ""; endif; if ($mailDisplayModeEmployeeData == "0") : $mailtext .= "
" . getLngt($mailSuccessRequest) . "
"; $mailtext .= "
" . $mailEmployeeData[0] . " " . $mailEmployeeData[1] . "
"; $mailtext .= "
" . getLngt("Telefon") . ": " . $mailEmployeeData[2] . "
"; // $mailtext .= "
" . getLngt("Fax") . ": " . $mailEmployeeData[4] . "
"; $mailtext .= "
" . getLngt("Email") . ": " . $mailEmployeeData[3] . "
"; $mailtext .= "
"; endif; endif; endif; endif; endif; else : $mailDisplayModeEmployeeData = ""; endif; // Recension (Google, etc.) if ($job_status == "2") : $mailTextRecension = getParameterValue("0", "MAIL_TEXT_RECENSION", $currentHqId); if ($mailTextRecension == "") : $mailTextRecension = getParameterValue("0", "MAIL_TEXT_RECENSION", "0"); endif; if ($mailTextRecension != "") : $mailtext .= "
" . $mailTextRecension . "
"; $mailtext .= "
"; endif; endif; if ($mailJobData == "1") : $mailtext .= "
"; $mailtext .= $jobtext; $mailtext .= "
"; endif; if ($mailDisplayModeEmployeeData == "1") : $mailtext .= "
" . $mailSuccessRequest . "
"; $mailtext .= "
"; endif; // Survey if ($job_status == "2") : $mailSurvey = getParameterValue("0", "MAIL_SURVEY", $currentHqId); if ($mailSurvey == "" || !is_numeric($mailSurvey)) : $mailSurvey = getParameterValue("0", "MAIL_SURVEY", "0"); endif; if ($mailSurvey != "" && is_numeric($mailSurvey)) : // Send survey link in mail if random number equals "1" only if (rand(1, $mailSurvey) == 1) : if (checkJobForSurvey($job_id, "15", "0")) : $mailTextSurvey = getParameterValue("0", "MAIL_TEXT_SURVEY", $currentHqId); if ($mailTextSurvey == "") : $mailTextSurvey = getLngt("Bitte machen Sie uns eine Freude und bewerten Sie uns"); endif; $mailTextSurvey2 = getParameterValue("0", "MAIL_TEXT_SURVEY2", $currentHqId); if ($mailTextSurvey2 == "") : $mailTextSurvey2 = getLngt("HIER"); endif; $mailTextSurvey3 = getParameterValue("0", "MAIL_TEXT_SURVEY3", $currentHqId); // if ($mailTextSurvey3 == "") : $mailTextSurvey3 = getLngt(""); endif; $mailLinkSurvey = getParameterValue("0", "MAIL_LINK_SURVEY", $currentHqId); if ($mailLinkSurvey == "") : $mailLinkSurvey = getParameterValue("0", "MAIL_LINK_SURVEY", "0"); endif; if ($mailLinkSurvey != "") : $jbCrypt = (((((((($job_id + $eca[0]) * 2) + $eca[1]) * 2) + $eca[2]) * 2) + $eca[3]) * 2) + $eca[4]; $mailTextSurvey = $mailTextSurvey . " " . "HASH\">" . getLngt($mailTextSurvey2) . "" . " " . getLngt($mailTextSurvey3); $mailTextSurvey = postParseMailtext($mailTextSurvey, "cs", $csIdPayer); $mailtext .= "
" . getLngt($mailTextSurvey) . "
"; $mailtext .= "
"; endif; endif; endif; endif; endif; // Conditions if ($mailTextJobStatus == "OFFER") : // $mailConditionText = getParameterValue("0", "MAIL_CONDITION_TEXT_OFFER", $currentHqId); // if ($mailConditionText == "") : $mailConditionText = getParameterValue("0", "MAIL_CONDITION_TEXT_OFFER", "0"); endif; // if ($mailConditionText == "") : $mailConditionText = getLngt("Unsere Preise verstehen sich zzgl. 19% MwSt. - exkl. kostenpflichtiger Servicezeit.") . "
" . getLngt("Zur Erfüllung der rechtlichen Verpflichtung werden die Anfragen, Angebote, Mails datenschutzkonform gelöscht.") . "
" . getLngt("Wenn Sie Änderungswünsche haben, oder ihre Bestellung auslösen möchten, melden Sie sich gerne per Antwort auf diese Mail") . "
" . getLngt("oder rufen Sie uns einfach unter Nennung der Angebotsnummer an."); // endif; $mailtext .= "
" . $mailConditionText . "
"; $mailtext .= "
"; elseif ($mailTextJobStatus == "OFFER_CHANGE") : // $mailConditionText = getParameterValue("0", "MAIL_CONDITION_TEXT_OFFER_CHANGE", $currentHqId); // if ($mailConditionText == "") : $mailConditionText = getParameterValue("0", "MAIL_CONDITION_TEXT_OFFER_CHANGE", "0"); endif; // if ($mailConditionText == "") : $mailConditionText = getLngt("Unsere Preise verstehen sich zzgl. 19% MwSt. - exkl. kostenpflichtiger Servicezeit.") . "
" . getLngt("Zur Erfüllung der rechtlichen Verpflichtung werden die Anfragen, Angebote, Mails datenschutzkonform gelöscht.") . "
" . getLngt("Wenn Sie Änderungswünsche haben, oder ihre Bestellung auslösen möchten, melden Sie sich gerne per Antwort auf diese Mail") . "
" . getLngt("oder rufen Sie uns einfach unter Nennung der Angebotsnummer an."); // endif; $mailtext .= "
" . $mailConditionText . "
"; $mailtext .= "
"; endif; // Current informations to customer $mailTextInfoByHq = ""; // Check for avoiding footer $csEmailNoFooter = getParameterValue("0", "JOBDETAILS_EMAIL_NO_FOOTER_" . $csIdPayer, "0"); if ($csEmailNoFooter != "1") : if (existsEntry("genericdatacontainer",array("gdc_obj_type","hq2cs","gdc_obj_id",$hq_id,"gdc_gen_fieldname","global_cs_email_info"))) : $mailTextInfoByHq = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'hq2cs' AND gdc_obj_id = '" . $currentHqId . "' AND gdc_gen_fieldname = 'global_cs_email_info'"); $mailTextInfoByHq = trim($mailTextInfoByHq); if ($mailTextInfoByHq != "") : $mailTextInfoByHq = nl2br($mailTextInfoByHq); $mailtext .= "
" . $mailTextInfoByHq . "
"; $mailtext .= "
"; endif; endif; endif; // Signature $mailTextRegards = getParameterValue("0", "MAIL_TEXT_REGARDS", $currentHqId); if ($mailTextRegards == "") : $mailTextRegards = getLngt("Mit freundlichem Gruß,"); endif; $mailtext .= "
" . $mailTextRegards . "
"; if ($mailDisplayModeEmployeeData == "1" && $mailEmployeeData[0] != "" && $mailEmployeeData[1] != "") : $mailtext .= "
"; $mailtext .= "
" . $mailEmployeeData[0] . " " . $mailEmployeeData[1] . "
"; else : $mailSalutationText = getParameterValue("0", "MAIL_SALUTATION_TEXT", $currentHqId); $mailtext .= "
" . getLngt($mailSalutationText) . "
"; endif; $mailtext .= "
"; // HOMEPAGE $mailFooterWebPage = getParameterValue("0", "MAIL_FOOTER_WEB_PAGE", $currentHqId); // 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 .= "
"; if ($mailFooterWebPage != "") : $mailtext .= "
"; else : $mailtext .= "
"; endif; $mailtext .= "
"; endif; $mailFooterEnabled = getParameterValue("0", "MAIL_FOOTER_ENABLED", $currentHqId); if ($mailFooterEnabled == "1") : $mailFooterAddress = getParameterValue("0", "MAIL_FOOTER_ADDRESS", $currentHqId); if ($mailFooterAddress != "") : $mailtext .= ""; $mailtext .= $mailFooterAddress; $mailtext .= "
"; $mailtext .= "
"; endif; $mailFooterContact = getParameterValue("0", "MAIL_FOOTER_CONTACT", $currentHqId); if ($mailFooterContact != "") : if ($mailDisplayModeEmployeeData == "1" && ($mailEmployeeData[2] != "" || $mailEmployeeData[3] != "" || $mailEmployeeData[4] != "")) : $mailtext .= ""; if ($mailEmployeeData[2] != "") : $mailtext .= ""; endif; if ($mailEmployeeData[4] != "") : $mailtext .= ""; endif; if ($mailEmployeeData[3] != "") : $mailtext .= ""; endif; // $mailFooterWebPage = getParameterValue("0", "MAIL_FOOTER_WEB_PAGE", $currentHqId); if ($mailFooterWebPage != "") : // $mailtext .= ""; $mailtext .= ""; endif; $mailtext .= "
" . getLngt("Telefon") . ": " . $mailEmployeeData[2] . "
" . getLngt("Fax") . ": " . $mailEmployeeData[4] . "
" . getLngt("Email") . ": " . $mailEmployeeData[3] . "
" . $mailFooterWebPage . "
" . $mailFooterWebPage . "
"; else : $mailtext .= ""; $mailtext .= $mailFooterContact; $mailtext .= "
"; endif; $mailtext .= "
"; endif; $mailFooterImpressum = getParameterValue("0", "MAIL_FOOTER_IMPRESSUM", $currentHqId); if ($mailFooterImpressum != "") : $mailtext .= ""; $mailtext .= $mailFooterImpressum; $mailtext .= "
"; $mailtext .= "
"; endif; $mailFooterResponsibility = getParameterValue("0", "MAIL_FOOTER_RESPONSIBILITY", $currentHqId); if ($mailFooterResponsibility == "") : $mailFooterResponsibility = getParameterValue("0", "MAIL_FOOTER_RESPONSIBILITY", "0"); endif; if ($mailFooterResponsibility != "") : $mailtext .= "
" . $mailFooterResponsibility . "
"; // Extended text $mailFooterResponsibility2 = getParameterValue("0", "MAIL_FOOTER_RESPONSIBILITY_2", $currentHqId); if ($mailFooterResponsibility2 == "") : $mailFooterResponsibility2 = getParameterValue("0", "MAIL_FOOTER_RESPONSIBILITY_2", "0"); endif; if ($mailFooterResponsibility2 != "") : $mailtext .= "
" . $mailFooterResponsibility2 . "
"; $mailFooterResponsibility3 = getParameterValue("0", "MAIL_FOOTER_RESPONSIBILITY_3", $currentHqId); if ($mailFooterResponsibility3 == "") : $mailFooterResponsibility3 = getParameterValue("0", "MAIL_FOOTER_RESPONSIBILITY_3", "0"); endif; if ($mailFooterResponsibility3 != "") : $mailtext .= "
" . $mailFooterResponsibility3 . "
"; $mailFooterResponsibility4 = getParameterValue("0", "MAIL_FOOTER_RESPONSIBILITY_4", $currentHqId); if ($mailFooterResponsibility4 == "") : $mailFooterResponsibility4 = getParameterValue("0", "MAIL_FOOTER_RESPONSIBILITY_4", "0"); endif; if ($mailFooterResponsibility4 != "") : $mailtext .= "
" . $mailFooterResponsibility4 . "
"; $mailFooterResponsibility5 = getParameterValue("0", "MAIL_FOOTER_RESPONSIBILITY_5", $currentHqId); if ($mailFooterResponsibility5 == "") : $mailFooterResponsibility5 = getParameterValue("0", "MAIL_FOOTER_RESPONSIBILITY_5", "0"); endif; if ($mailFooterResponsibility5 != "") : $mailtext .= "
" . $mailFooterResponsibility5 . "
"; endif; endif; endif; $mailtext .= "
"; endif; endif; $mailFooterThinkGreen = getParameterValue("0", "MAIL_FOOTER_THINK_GREEN", $currentHqId); if ($mailFooterThinkGreen != "") : $mailtext .= $mailFooterThinkGreen; $mailtext .= "
"; endif; $mailtext .= "
"; endif; // Mandatory email footer $mailFooterMandatory = getParameterValue("0", "MAIL_FOOTER_MANDATORY", $currentHqId); if ($mailFooterMandatory == "") : $mailFooterMandatory = getParameterValue("0", "MAIL_FOOTER_MANDATORY", "0"); endif; if ($mailFooterMandatory != "") : $mailtext .= "
"; $mailtext .= "
"; $mailtext .= " "; $mailtext .= " "; $mailtext .= "
" . $mailFooterMandatory . "
"; $mailtext .= "
"; $mailtext .= "
"; $mailtext .= "
"; endif; if ($mailJobData == "0") : $mailtext .= $jobtext; endif; $mailtext .= ""; $mailObj->setHtml($mailtext, null, "./"); // $mailObj->setHtml($mailtext); // Set From address $mailFromAddress = getParameterValue("0", "MAIL_SENDER_ADDRESS", $currentHqId); if ($mailFromAddress == "") : $mailFromAddress = MAIL_SENDER_ADDRESS; endif; $mailObj->setFrom($mailFromAddress); // 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!")); elseif ($mailTextJobStatus == "ALL") : $mailObj->setSubject(getLngt("Transportauftrag") . " " . $job_id . " : " . getLngt("Die") . " " . $tour_sort . ". " . getLngt("Station Ihres Auftrags wurde erledigt.")); elseif ($mailTextJobStatus == "CHANGE") : $mailObj->setSubject(getLngt("Transportauftrag") . " " . $job_id . " " . getLngt("wurde geändert!")); elseif ($mailTextJobStatus == "OFFER") : $mailObj->setSubject(getLngt("Ihre Transportanfrage / unser Angebot") . " " . $job_id); elseif ($mailTextJobStatus == "OFFER_CHANGE") : $mailObj->setSubject(getLngt("Ihre Transportanfrage / unser Angebot") . " " . $job_id . " " . getLngt("wurde geändert!")); else : $mailObj->setSubject(getLngt("Transportauftrag") . " " . $job_id . " " . getLngt("ist erledigt!")); endif; // Generate PDF if enabled for customer $tmpPdfPath = "../temp/pdf/"; $pdfFile = "Auftrag_" . $job_id . ".pdf"; $csJbstatusmailPdf = getFieldValueFromId("customer","cs_id",$csIdPayer,"cs_jbstatusmail_pdf"); if ($csJbstatusmailPdf == "1" && $job_status == "2") : $remAutomailer = $automailer; // Remember state $includePDFGeneric = "1"; $f_act = "generatePDFJob"; $storeAsFile = "1"; $jbId = $job_id; // include_once ("../admin/pdf_generic.php"); include ("../admin/pdf_generic.php"); if (file_exists($tmpPdfPath . $pdfFile)) : $attachment = $mailObj->getFile($tmpPdfPath . $pdfFile); $mailObj->addAttachment($attachment, $pdfFile, 'application/pdf'); endif; $automailer = $remAutomailer; endif; // Check for existence of more attachements if (isset($jbMailAttachements) && is_array($jbMailAttachements)) : $jbMailAttachementslen = count($jbMailAttachements); $tmpAttachement = array(); for ($at = 0; $at < $jbMailAttachementslen; $at++) : if ($jbMailAttachements[$at] != "") : $tmpAttachement[$at] = $mailObj->getFile($jbMailAttachements[$at][0]); $mailObj->addAttachment($tmpAttachement[$at], $jbMailAttachements[$at][1], 'application/pdf'); endif; endfor; endif; // Check for existence of embedded images /* if (isset($jbMailEmbeddedImages) && is_array($jbMailEmbeddedImages)) : $jbMailEmbeddedImageslen = count($jbMailEmbeddedImages); $tmpEmbeddedImages = array(); for ($ei = 0; $ei < $jbMailEmbeddedImageslen; $ei++) : if ($jbMailEmbeddedImages[$ei] != "") : $tmpEmbeddedImages[$ei] = $mailObj->getFile($jbMailEmbeddedImages[$ei][0]); $mailObj->addHtmlImage($tmpEmbeddedImages[$ei], $jbMailEmbeddedImages[$ei][1], 'image/jpeg'); endif; endfor; endif; */ $mailResult = false; $semaphorMailSent = true; $semaphorInsertedForMailSent = false; $jbMailAttachements = array(); // Reset attachement array (!!!!) /* if (isset($semaphorNewFunctionality) && $semaphorNewFunctionality == "1") : // ATTENTION: For compatibility regarding semaphore only !!!!!!!!!!!! **** REMOVE **** !!!!!!!!!!! if ($automailer == "1" && $semaphorKey != "") : $semaphorMailSent = false; $currentTime = getDateTime("0"); // Set semaphore to be LOCKED $res = updateStmt("phoenix_log.semaphor", "sp_obj_id", $job_id, array("sp_content", "LOCKED", "sp_createtime", $currentTime), "sp_obj_type = 'jb' AND sp_fieldname = '" . $semaphorKey . "' AND sp_content = ''"); if ($res > 0) : $semaphorMailSent = true; $semaphorInsertedForMailSent = true; endif; endif; endif; */ if ($semaphorMailSent) : // Send email $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,"","","","MAIL_STATE=SENT|MAIL_TO=" . $f_email); else : // In case of failure this process only, which successfully inserted the semaphore, is able to remove the semaphore for the next trial sending the mail for a new process /* if ($semaphorInsertedForMailSent) : $currentTime = getDateTime("0"); $res = updateStmt("phoenix_log.semaphor", "sp_obj_id", $job_id, array("sp_content", "", "sp_createtime", $currentTime), "sp_obj_type = 'jb' AND sp_fieldname = '" . $semaphorKey . "' AND sp_content = 'LOCKED'"); endif; */ $mailsendStatus = getLngt("Die Nachricht konnte nicht gesendet werden!"); // Write logdata into log database writeToLogDB("23",$currentHqId,$job_id,$currentSessionUsrId,"","","","MAIL_STATE=NOT SENT|MAIL_TO=" . $f_email); endif; 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; if ($remLanguageSelected != "") : $languageSelected = $remLanguageSelected; // Reset language of the customer getLanguage(__FILE__); $currentJobParameterState = getJobSnapshot($job_id); endif; else : $mailsendStatus = getLngt("Die eingegebene Emailadresse ist syntaktisch nicht korrekt!"); endif; endif; if ($automailer == "0" && $jobIsAllowedToBeModified) : $mailsend .= "
\n"; $mailsend .= getLngt("Mailadresse:") . "  "; $mailsend .= "   "; $mailsend .= "
"; // $mailsend .= ""; $mailsend .= defineButtonType10(getLngt("Auftragsmail 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; // Get "third country" state of the job regarding flag "jb_incomplete" // $jobThirdCountry = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = 'jb' AND gdc_obj_id = '" . $job_id . "' AND gdc_gen_fieldname = 'jb_third_country'"); if ($globalParUseRelatedCustomer == "1" || $job_id_parent == "" || $job_id_parent == "0") : // Either special mode of system usage OR only jobs not having sub-jobs if ($job_status != "2") : // Check current state of job is "taken" if ($job_status == "1") : $jbCrIdCurr = getFieldValueFromId("job", "jb_id", $job_id, "cr_id"); if (is_numeric($jbCrIdCurr) && $jbCrIdCurr > "0") : // Send command insertPDACommand($currentHqId, $jbCrIdCurr, "3", "1", $job_id, $currentTime, ""); endif; endif; // 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 . "')"); /* if ($jobThirdCountry == "1") : $job_incomplete = "1"; $f_jb_incomplete = ""; updateStmt($dbh_jb, "jb_id", $job_id, array("jb_incomplete", $job_incomplete), "(hq_id = '" . $currentHqId . "')"); endif; */ $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; // Update "vehicledisposition" and remove job updateStmt("vehicledisposition", "jb_id", $job_id, array("jb_id", "0")); // Write logdata into log database writeToLogDB("5",$currentHqId,$job_id,$currentSessionUsrId,$cr_id_book,$f_crvh_sid_book,"",""); // check whether there is something to do with jb_cr_price check_cr_agio($job_id); else : if ($job_export_time == "" || $job_export_time == "0000-00-00 00:00:00" || $job_export_time == "9999-12-31 23:59:59") : // 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) : // Not used here because job state is "finished" and not "taken" (!!!!) // if (is_numeric($jbCrIdCurr) && $jbCrIdCurr > "0") : // Send command // insertPDACommand($hq_id, $jbCrIdCurr, "3", "1", $job_id, $currentTime, ""); // insertPDACommand($hq_id, $jbCrIdCurr, "8", "1", $job_id, $currentTime, ""); // endif; // 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, "hq_id_exec", $cr_hq_id_book, "cr_sid", $f_crvh_sid_book, "vht_id_real", $vht_id_book), "(hq_id = '" . $currentHqId . "')"); /* if ($jobThirdCountry == "1") : $job_incomplete = "1"; $f_jb_incomplete = ""; updateStmt($dbh_jb, "jb_id", $job_id, array("jb_incomplete", $job_incomplete), "(hq_id = '" . $currentHqId . "')"); endif; */ $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,"",""); // check whether there is something to do with jb_cr_price check_cr_agio($job_id); // 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" || $job_export_time == "9999-12-31 23:59:59") && $takeRealJobData) : if ($jbAccessModeArr["1"]) : $bookjobButtonText = getLngt("Auftrag abschließen"); if ($job_status == "2") : $bookjobButtonText = getLngt("Fahrzeug ändern"); endif; $bookjob .= "
\n"; $bookjob .= "\n"; $bookjob .= "  \n"; $bookjob .= ""; $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; 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; if ($jobIsAllowedToBeModified || $globalParUseRelatedCustomer != 1) : $modifyTourname .= "
" . getLngt("Tourname") . ":  "; $modifyTourname .= "   
"; if ($jbAccessModeArr["1"]) : $modifyTourname .= defineButtonType10(getLngt("Tourname modifizieren"), "action_tourname", "changeTourname();", "180", "left", "3"); endif; $modifyTourname .= "


" . $modifyTournameStatus . "
"; endif; endif; // Change added installation value if ($f_act == "changeGDC_addMon") : if ($globalParUseRelatedCustomer == "1" && $jobHasAddedInstallation && $automailer == "0" && $job_id != "" && ($jobService & 2) == 2) : $f_jb_gdc_add_mon = trim($f_jb_gdc_add_mon); $f_jb_gdc_add_mon = str_replace (",", ".", $f_jb_gdc_add_mon); if ($f_jb_gdc_add_mon != "" && is_numeric($f_jb_gdc_add_mon) && $f_jbp_mode_add_mon != "" && is_numeric($f_jbp_mode_add_mon)) : // Update value in GDC // ATTENTION: Presently the row has to exist and a new row cannot be inserted !!!! updateStmt("genericdatacontainer", "gdc_obj_id", $job_id, array("gdc_content", $f_jb_gdc_add_mon), "gdc_obj_type = 'jb' AND gdc_gen_fieldname = 'jb_addmont'"); addmontEdit($job_id, $f_jbp_mode_add_mon); endif; endif; endif; // --- DISPLAY SCAN EVENTS --------------- $scanEventsHtml = ""; if ($globalParUseRelatedCustomer == 1 && $automailer == "0" && $job_id != "") : $scanEventsHtml = getScanEventsHtml($job_id); endif; // --- DISPLAY MANUAL EVENTS --------------- $manualEventsHtml = ""; if ($globalParUseRelatedCustomer == 1 && $automailer == "0" && $job_id != "") : $manualEventsHtml = getManualEventsHtml($job_id); endif; // --- DISPLAY TOURARTICLES --------------- // Display articles $outputTourarticle = ""; if ($globalParUseRelatedCustomer == "1" && $automailer == "0" && $job_id != "") : $outputTourarticle = getOutputJobTratArticleData($job_id); endif; // --- DISPLAY JOBCALCULATOR ENTRIES --------------- $outputJobcalculator = ""; if ($globalParUseRelatedCustomer == "1" && $automailer == "0" && $job_id != "") : $outputJobcalculator = getOutputJobCalculatorData($job_id); endif; // --- DISPLAY JOBPRICE ENTRIES --------------- $outputJobprice = ""; if ($globalParUseRelatedCustomer == "1" && $automailer == "0" && $job_id != "") : $outputJobprice = getOutputJobPriceData($job_id); endif; // Get possible payment methodes for customer or group if ($globalParUseRelatedCustomer == "1") : // Check job being a special service job $jobIsSpecialServiceJob = ""; if ($db->getOne("SELECT gdc_content FROM genericdatacontainer WHERE gdc_obj_type = 'jb' AND gdc_obj_id = '" . $job_id . "' AND gdc_gen_fieldname = 'jb_service_job'") == 1): $jobIsSpecialServiceJob = "1"; endif; // Check job being a special job payed by the carrier $jobIsPayedByCarrier = ""; if ($db->getOne("SELECT gdc_content FROM genericdatacontainer WHERE gdc_obj_type = 'jb' AND gdc_obj_id = '" . $job_id . "' AND gdc_gen_fieldname = 'jb_no_payment_job'") == 1): $jobIsPayedByCarrier = "1"; endif; // Get related customer and group $jbpCscId = getFieldValueFromId("job", "jb_id", $job_id, "csc_id_related"); $jbpCsId = getFieldValueFromId("costcenter", "csc_id", $jbpCscId, "cs_id"); $tmpJbpCsGrpId = getFieldValueFromId("customer","cs_id",$jbpCsId,"cs_group"); $jbpCsGrpIdArray = spliti(",", $tmpJbpCsGrpId); $jbpCsGrpIdArrayLen = count($jbpCsGrpIdArray); if ($jbpCsGrpIdArrayLen > 0) : $jbpCsGrpId = $jbpCsGrpIdArray[1]; // .... because of leading comma sign endif; if ($jbpCsId != "") : // Get payment types using cascading structure $mtPaymentTypes = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'payment_type' AND mt_objtype = 'cs' AND mt_objid = '" . $jbpCsId . "'", "mt_sort", "mt_sort", ""); if (count($mtPaymentTypes) == 0 && $jbpCsGrpId != "") : $mtPaymentTypes = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'payment_type' AND mt_objtype = 'grp' AND mt_objid = '" . $jbpCsGrpId . "'", "mt_sort", "mt_sort", ""); endif; if (count($mtPaymentTypes) == 0) : $mtPaymentTypes = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'payment_type' AND mt_objtype = '' AND mt_objid = '0'", "mt_sort", "mt_sort", ""); endif; // Get state of job being a service job and then get payment types for istallation booking if ($jobIsSpecialServiceJob == "1"): $paymentTypesRequested = getObjectBasedParameterValue("JOB_DETAILS_CAT_09_SERVICEJOB_JBPMODES_CS", $jbpCsId, $currentHqId); if ($paymentTypesRequested == "" && $jbpCsGrpId != "") : $paymentTypesRequested = getObjectBasedParameterValue("JOB_DETAILS_CAT_09_SERVICEJOB_JBPMODES_GRP", $jbpCsGrpId, $currentHqId); endif; else : $paymentTypesRequested = getObjectBasedParameterValue("JOB_DETAILS_CAT_09_JBPMODES_CS", $jbpCsId, $currentHqId); if ($paymentTypesRequested == "" && $jbpCsGrpId != "") : $paymentTypesRequested = getObjectBasedParameterValue("JOB_DETAILS_CAT_09_JBPMODES_GRP", $jbpCsGrpId, $currentHqId); endif; endif; endif; $paymentTypesRequested = spliti(",", $paymentTypesRequested); endif; // --- CHANGE ADDED INSTALLATION TIME IN GDC --------------- if ($globalParUseRelatedCustomer == "1" && $automailer == "0" && $job_id != "" && ($jobService & 2) == 2) : if ($jobHasAddedInstallation) : $changeGDC_addMon = "
" . getLngt("Zusätzliche Montagezeit") . "
"; // Try to get content from "gdc_content" $gdcContextAddMon = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = 'jb' AND gdc_gen_fieldname = 'jb_addmont' AND gdc_obj_id = '" . $job_id . "'"); $gdcContextAddMon = trim($gdcContextAddMon); if ($gdcContextAddMon == "") : // If "gdc_content" is empty, try to get content from "gdc_context" $gdcContextAddMon = getFieldValueFromClause("genericdatacontainer", "gdc_context", "gdc_obj_type = 'jb' AND gdc_gen_fieldname = 'jb_addmont' AND gdc_obj_id = '" . $job_id . "'"); $gdcContextAddMon = trim($gdcContextAddMon); endif; if ($jobIsAllowedToBeModified && $jobIsPayedByCarrier == "" && !$jobAddedInstallationIsExported) : $changeGDC_addMon .= "
   
"; $changeGDC_addMon .= "
\n"; if ($job_status == "2" && $jobCourierId != "" && $jobCourierId != "0") : $changeGDC_addMon .= defineButtonType10(getLngt("Service-Zeit ändern"), "action_gdc_add_mon", "changeGDC_addMon();", "200", "", ""); endif; $changeGDC_addMon .= "
"; endif; // ****************************************** // Get all payment rows associated to the added installation job if ($jobAddedInstallationId != "" && is_numeric($jobAddedInstallationId)) : $jbPaymentAddedInstallationArray = getPaymentsReceived($jobAddedInstallationId); $jbPaymentAddedInstallationArrayLen = count($jbPaymentAddedInstallationArray); // Display existing rows if ($jbPaymentAddedInstallationArrayLen > 0) : $changeGDC_addMon .= "
\n"; $changeGDC_addMon .= "\n"; $changeGDC_addMon .= "\n"; $changeGDC_addMon .= ""; for ($i = 0; $i < $jbPaymentAddedInstallationArrayLen; $i++) : // Get gross value from the stores net value $jobAddedInstallationJbpPriceGross = $jbPaymentAddedInstallationArray[$i][3] * $taxFactor; // **** START ************************ // PROPRIETÄR FÜR IKEA !!!!!!!! // True payment type in "jbp_tan" $jbpTanOut = ""; // if ($outJbpcId == "") : if ($jbpCsGrpId == "1" || $jbpCsGrpId == "11") : if (existsEntry("genericdatacontainer",array("gdc_obj_type","jb","gdc_gen_fieldname","acquisitiontime","gdc_obj_id",$job_id))) : if ($jbPaymentAddedInstallationArray[$i][2] == "18" || $jbPaymentAddedInstallationArray[$i][2] == "19") : if ($jbPaymentAddedInstallationArray[$i][10] != "" && is_numeric($jbPaymentAddedInstallationArray[$i][10])) : $jbpTanOut = " " . $mtPaymentTypes[$jbPaymentAddedInstallationArray[$i][10]]; endif; endif; endif; endif; // endif; // **** END ************************ $changeGDC_addMon .= "\n"; $changeGDC_addMon .= ""; $changeGDC_addMon .= "\n"; endfor; $changeGDC_addMon .= "
" . getLngt("Zahlungseingänge der Zusatzmontage") . "
" . getLngt("Zahlart") . "" . getLngt("Umsatz") . "" . getLngt("Eingangszeitpunkt") . "" . getLngt("Exportzeitpunkt") . "" . getLngt("Auftrag") . "
" . $mtPaymentTypes[$jbPaymentAddedInstallationArray[$i][2]] . $jbpTanOut . "  " . formatOutput($jobAddedInstallationJbpPriceGross, "float_rounded_2") . "  " . formatOutput($jbPaymentAddedInstallationArray[$i][4], "datetime", "1") . "  " . ($jbPaymentAddedInstallationArray[$i][5] != "0000-00-00 00:00:00" && $jbPaymentAddedInstallationArray[$i][5] != "" ? formatOutput($jbPaymentAddedInstallationArray[$i][5], "datetime", "1") : "") . "  " . $jbPaymentAddedInstallationArray[$i][8] . "  
\n"; $changeGDC_addMon .= "
\n"; $changeGDC_addMon .= "
"; endif; endif; // ****************************************** endif; endif; // --- CHANGE PAYMENT MODE (If job NOT is finished and NOT exported and there is NO payment export, too !!!!) --------------- $constJbpBookingEnabled = getParameterValue("0", "MASK_JOBDETAILS_JBP_BOOKING_ENABLED", $currentHqId); // [= "1"] <=> Enabled if ($globalParUseRelatedCustomer == "1" && $constJbpBookingEnabled == "1" && $automailer == "0" && $job_id != "") : $changePayment = ""; $changePaymentStatus = "   "; // Get changing mode by parameter for either ALL or SINGLE payment rows in "jobpayment" will be changable to another payment method $constJbpBookingMode = getParameterValue("0", "MASK_JOBDETAILS_JBP_PAYMENTMODE_SINGLE_BOOKING_ENABLED", $currentHqId); // [= "1"] <=> Single rows with if ($constJbpBookingMode == "") : $constJbpBookingMode = getParameterValue("0", "MASK_JOBDETAILS_JBP_PAYMENTMODE_SINGLE_BOOKING_ENABLED", "0"); endif; if ($f_act == "changePayment") : if ($f_jbp_mode != "" && is_numeric($f_jbp_mode)) : $f_jbp_price_rest = str_replace (",", ".", $f_jbp_price_rest); if ($f_jbp_price_rest != "" && $f_jbp_price_rest != 0) : if ($f_jbp_csc_id != "") : // Set the current timestamp to store the data $currentTime = getDateTime("0"); insertStmt($dbh_jbp, array("jb_id", $job_id, "tr_sort", "2", "csc_id", $f_jbp_csc_id, "jbp_mode", $f_jbp_mode, "jbp_price", $f_jbp_price_rest, "jbp_bookingtime", $currentTime)); // $jbp_id_new = getLastInsertId(); // Set job state to "complete" // if ($f_jbp_mode == "0") : // Check for existing added installation ("addmont") // if (!existsEntry("genericdatacontainer", array("gdc_obj_type", "jb", "gdc_gen_fieldname", "jb_addmont", "gdc_obj_id", $job_id, "gdc_content", ""))) : if (!$jobHasAddedInstallation) : updateStmt($dbh_jb, "jb_id", $job_id, array("jb_incomplete", "0")); $job_incomplete = "0"; $f_jb_incomplete = ""; endif; // endif; // Write logdata into log database // writeToLogDB("118",$currentHqId,$job_id,$currentSessionUsrId,"","","","JBP_MODE=" . $f_jbp_mode); else: $changePaymentStatus = getLngt("Für die Buchung ist kein Kunde definiert!"); endif; else: $changePaymentStatus = getLngt("Es ist kein Restbetrag vorhanden, der gebucht werden müsste!"); endif; else: $changePaymentStatus = getLngt("Es wurde keine Bezahlart angegeben!"); endif; endif; // ONLY show if job is not exported if ($automailer == "0" && $takeRealJobData) : // Get total business volume of the job $jbTotalBusinessVolume = getFieldValueFromId("job","jb_id",$job_id,"jb_totalprice"); $jbSalesTaxRate = getFieldValueFromId("job","jb_id",$job_id,"jb_sales_tax_rate"); $jbIncomplete = getFieldValueFromId("job","jb_id",$job_id,"jb_incomplete"); // Get all payment rows associated to the current job $jbPaymentArray = getPaymentsReceived($job_id); $jbPaymentArrayLen = count($jbPaymentArray); $sumOfPaymentVolume = 0; $restOfPaymentVolume = 0; // if ($jbPaymentArrayLen > 0) : // There is the case of no payment is done !!!! // Display existing rows $changePayment .= "
\n"; $changePayment .= "\n"; $changePayment .= "\n"; $changePayment .= ""; // array($row["tr_sort"], $row["csc_id"], $row["jbp_mode"], $row["jbp_price"], $row["jbp_bookingtime"], $row["jbp_export_time"]); for ($i = 0; $i < $jbPaymentArrayLen; $i++) : // Get gross value from the stores net value $jbpPriceGross = $jbPaymentArray[$i][3] * $taxFactor; // Collection number $outJbpcId = $jbPaymentArray[$i][9]; if ($outJbpcId == "0") : $outJbpcId = ""; endif; if ($outJbpcId != "") : $outJbpcId = "" . $outJbpcId . ""; endif; // **** START ************************ // PROPRIETÄR FÜR IKEA !!!!!!!! if ($outJbpcId == "") : if ($jbpCsGrpId == "1" || $jbpCsGrpId == "11") : if (existsEntry("genericdatacontainer",array("gdc_obj_type","jb","gdc_gen_fieldname","acquisitiontime","gdc_obj_id",$job_id))) : if ($jbPaymentArray[$i][2] == "18") : if ($f_act == "changeJbpTan") : updateStmt($dbh_jbp, "jb_id", $job_id, array("jbp_tan", $f_jbp_tan)); else : $f_jbp_tan = getFieldValueFromId($dbh_jbp, "jb_id", $job_id, "jbp_tan"); if ($f_jbp_tan == "") : $f_jbp_tan = 0; endif; endif; $outJbpcId .= "\n"; endif; endif; endif; endif; // **** END ************************ $changePayment .= "\n"; $changePayment .= ""; $changePayment .= "\n"; $sumOfPaymentVolume += $jbPaymentArray[$i][3]; endfor; // Get rest volume to be payed $restOfPaymentVolume = $jbTotalBusinessVolume - $sumOfPaymentVolume; // Net value => Gross value [For display only !!!!] $jbTotalBusinessVolumeGross = $jbTotalBusinessVolume * $taxFactor; $sumOfPaymentVolumeGross = $sumOfPaymentVolume * $taxFactor; $restOfPaymentVolumeGross = $restOfPaymentVolume * $taxFactor; $changePayment .= "\n"; $changePayment .= "
" . getLngt("Zahlungseingänge mit Zahlarten") . "
" . getLngt("Zahlart") . "" . getLngt("Umsatz") . "" . getLngt("Eingangszeitpunkt") . "" . getLngt("Exportzeitpunkt") . "" . getLngt("Counter-Umsatz") . "" . getLngt("Sammelnummer") . "
" . $mtPaymentTypes[$jbPaymentArray[$i][2]] . "  " . formatOutput($jbpPriceGross, "float_rounded_2") . "  " . formatOutput($jbPaymentArray[$i][4], "datetime", "1") . "  " . ($jbPaymentArray[$i][5] != "0000-00-00 00:00:00" && $jbPaymentArray[$i][5] != "" ? formatOutput($jbPaymentArray[$i][5], "datetime", "1") : "") . "  " . ($jbPaymentArray[$i][6] == "1" ? getLngt("Ja") : "") . "  " . $outJbpcId . "  
" . getLngt("Summe") . ":  " . formatOutput($sumOfPaymentVolumeGross, "float_rounded_2") . "  " . ($jbTotalBusinessVolumeGross != "" ? getLngt("von Bruttoauftragssumme") . " " . formatOutput($jbTotalBusinessVolumeGross, "float_rounded_2") . "  [" . getLngt("Rest") . ": " . formatOutput($restOfPaymentVolumeGross, "float_rounded_2") . "]" : "") . "
\n"; $changePayment .= "
\n"; // endif; if ($restOfPaymentVolume != 0 && $jobIsAllowedToBeModified && $jobIsNotExported && $jobIsPayedByCarrier == "") : $changePayment .= "
\n"; $changePayment .= "\n"; // Net value for internal representation $changePayment .= "\n"; $changePayment .= "\n"; $changePayment .= "  
\n"; $changePayment .= defineButtonType10(getLngt("Restsumme verbuchen"), "action_book_payment_rest", "changePaymentMethod();", "200", "left", "3"); $changePayment .= "
" . getLngt("[Bei Auswahl der Zahlart Bar wird der Auftrag abgeschlossen.]") . "
"; endif; $changePayment .= "
\n"; $changePayment .= "

" . $changePaymentStatus . ""; $changePayment .= "
\n"; endif; endif; // --- DISPLAY ARTICLE ACCEPTANCE DATA --------------- $outputArticleAcceptanceData = ""; if ($globalParUseRelatedCustomer == "1" && $automailer == "0" && $job_id != "") : $outputArticleAcceptanceData = getOutputArticleAcceptanceData($job_id); endif; // --- DISPLAY PHOTOS FROM MOBILE --------------- $outputPhotos = ""; if ($globalParUseRelatedCustomer == "1" && $automailer == "0" && $job_id != "") : // [1] B2B $filenameArray = getImagesFromB2bObjects($job_id, "../temp/photos/", "jb"); $filenameArrayLen = count($filenameArray); // [2] GDC $tmpPhotoFilenames = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = 'jb' AND gdc_obj_id = '" . $job_id . "' AND gdc_gen_fieldname = 'mobile_photos'"); // Display photos if ($tmpPhotoFilenames != "" || $filenameArrayLen > 0) : $tmpArrayLen = 0; if ($tmpPhotoFilenames != "") : $tmpPhotoFilenames = str_replace("|", "-,-", $tmpPhotoFilenames); if (!(strpos($tmpPhotoFilenames, "-,-") === FALSE)) : $tmpArray = spliti("-,-",$tmpPhotoFilenames); else : $tmpArray = array($tmpPhotoFilenames); endif; $tmpArrayLen = count($tmpArray); endif; if ($tmpArrayLen > 0 || $filenameArrayLen > 0) : $systemPath = ".."; $tmpImgHeight = 100; $tmpImgWidth = 133; $outputPhotos .= ""; $outputPhotos .= "\n"; $outputPhotos .= ""; // GDC for ($i = 0; $i < $tmpArrayLen; $i++) { $outputPhotos .= ""; if ((($i + 1) % 4) == 0 && $i < ($tmpArrayLen - 1)) : $outputPhotos .= ""; endif; } // B2B for ($i = 0; $i < $filenameArrayLen; $i++) { $outputPhotos .= ""; if ((($i + 1) % 4) == 0 && $i < ($tmpArrayLen - 1)) : $outputPhotos .= ""; endif; } $outputPhotos .= ""; $outputPhotos .= "
" . getLngt("Fotos der Endgeräte des Abnahmeprotokolls") . "
"; $outputPhotos .= ""; $outputPhotos .= "
"; $outputPhotos .= ""; $outputPhotos .= "


"; endif; endif; endif; // --- SWITCH JOB "COMPLETE" <=> "INCOMPLETE" IF JOB IS NOT EXPORTED --------------- $completeJob = ""; if ($automailer == "0" && $job_id != "" && ($job_export_time == "" || $job_export_time == "0000-00-00 00:00:00") && $takeRealJobData) : $completeJobStatus = ""; $completeJobMsg = ""; if ($f_act == "completeJob") : if ($f_jb_incomplete != "" && ($f_jb_incomplete == "0" || $f_jb_incomplete == "1")) : $doSwitchStatus = true; // Check abort conditions like not existing commission no. etc. if ($globalParUseRelatedCustomer != 1) : $constSwitchCompleteCheckCommNo = getParameterValue("0", "MASK_JOBDETAILS_BOOKJOB_COMMNO", $currentHqId); if ($constSwitchCompleteCheckCommNo == "1") : if ($f_jb_incomplete != "1") : // Only check status change from unready to ready $csNeedsCommissionNo = getFieldValueFromId("customer", "cs_id", $csIdPayer, "cs_commission_no"); $jbHasCommissionNo = getCountOfTable("tour", "jb_id = '" . $job_id . "' AND tr_commission_no != ''"); if ($csNeedsCommissionNo == "1" && $jbHasCommissionNo == 0) : $doSwitchStatus = false; $completeJobMsg = "" . getLngt("ACHTUNG: Die erforderliche Kommissionsnummer fehlt leider noch!") . ""; $statusMessage = $completeJobMsg; endif; endif; endif; endif; // Get "third country" state of the job regarding flag "jb_incomplete" if ($doSwitchStatus && $f_jb_incomplete == "0") : $jobThirdCountry = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = 'jb' AND gdc_obj_id = '" . $job_id . "' AND gdc_gen_fieldname = 'jb_third_country'"); if ($jobThirdCountry == "1") : $f_jb_incomplete = "1"; $job_incomplete = $f_jb_incomplete; $completeJobMsg = "" . getLngt("ACHTUNG: Der Auftrag ist ein Drittlandauftrag! Bitte den Status über die Auftragserfassung setzen") . ""; $statusMessage = $completeJobMsg; endif; endif; if ($doSwitchStatus) : if ($globalParUseRelatedCustomer == 1 || ($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,"","","",""); elseif ($job_id_parent == "-1") : if (getCountOfTable($dbh_jb, "jb_id_parent = '" . $job_id . "'") > 0) : $subJobIDs = array(); $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"; $result = $db->query($tmpSqlquery); if (DB::isError($result)) die ("$PHP_SELF 5: {$tmpSqlquery} " . $result->getMessage() . ": " . $sqlquery); // Iterate list of subjobs while ($row = $result->fetch_assoc()): $subJobIDs[] = $row["jb_id_sub"]; endwhile; $result->free(); $subJobIDsLen = count($subJobIDs); if ($subJobIDsLen > 0) : $tmpSqlquery = "SELECT jb.jb_id AS jb_id_sub" . " FROM " . $dbh_jb . " AS jb" . " WHERE jb.jb_id_parent IN (" . implode(",", $subJobIDs) . ")" . " ORDER BY jb.jb_id"; $result = $db->query($tmpSqlquery); if (DB::isError($result)) die ("$PHP_SELF 5: {$tmpSqlquery} " . $result->getMessage() . ": " . $sqlquery); while ($row = $result->fetch_assoc()): $subJobIDs[] = $row["jb_id_sub"]; endwhile; $result->free(); endif; $subJobIDsLen = count($subJobIDs); for ($i = 0; $i < $subJobIDsLen; $i++) : // Update subjob with new status jb_incomplete updateStmt($dbh_jb, "jb_id", $subJobIDs[$i], array("jb_incomplete", $f_jb_incomplete), "(hq_id = '" . $currentHqId . "' AND (ISNULL(jb_export_time)) OR jb_export_time = '0000-00-00 00:00:00')"); // Write logdata into log database writeToLogDB(($f_jb_incomplete == "1" ? "14" : "13"),$currentHqId,$subJobIDs[$i],$currentSessionUsrId,"","","",""); endfor; // Now update main 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; endif; endif; if ($job_incomplete == "1") : $completeJobStatus .= "" . getLngt("UNFERTIG!") . ""; else : $completeJobStatus .= "" . getLngt("FERTIG!") . ""; endif; if ($jobIsAllowedToBeModified && $jobIsNotExported) : $completeJob .= ""; $completeJob .= "
" . getLngt("Buchhaltungsstatus des Auftrags:") . " " . $completeJobStatus . "   
\n"; if ($jbAccessModeArr["1"]) : $completeJob .= defineButtonType10(getLngt("Auf ") . ($job_incomplete == "1" ? getLngt("fertig") : getLngt("unfertig")) . getLngt(" setzen"), "action_ready", "changeComplete();", "150", "left", "3"); endif; $completeJob .= "
" . $completeJobMsg . "
"; endif; 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"; // --- FREIGHT CHARGES TEXT --------------- $f_jb_cr_invtext = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "jb_invtext_cr"); $jobInvoiceCrText = "
" . getLngt("(Vorläufiger) Frachtvergütungstext:") . "
"; $jobInvoiceCrText .= "
\n"; // --- INTERNAL REMARK --------------- $jobinternalremark = ""; if ($automailer == "0") : if ($job_id != "") : if ($f_act == "changeInternalRemark") : $f_jb_freetext_3_new = str_replace("'", "\"", $f_jb_freetext_3_new); updateStmt($dbh_jb, "jb_id", $job_id, array("jb_freetext_3", $f_jb_freetext_3_new), "(hq_id = '" . $currentHqId . "')"); // Write logdata into log database writeToLogDB("200",$currentHqId,$job_id,$currentSessionUsrId,"","","","INTERNAL_REMARK=" . $f_jb_freetext_3_new); endif; endif; $f_jb_freetext_3 = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "jb_freetext_3"); $jobinternalremark .= "
" . getLngt("Interne Bemerkung:") . "
"; $jobinternalremark .= "
\n"; if ($jbAccessModeArr["1"]) : $jobinternalremark .= defineButtonType10(getLngt("Interne Bemerkung speichern"), "action_save", "changeInternalRemark();", "220", "left", "3"); endif; endif; // --- COURIER REMARK --------------- $jobcourierremark = ""; if ($automailer == "0") : $f_jb_cr_remark = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "jb_cr_remark"); $jobcourierremark .= "
" . getLngt("Anmerkungen Transporteur:") . "
"; $jobcourierremark .= "
\n"; endif; // --- CUSTOMER REMARK --------------- $jobcustomerremarktext = ""; if ($job_id != "") : $tmpSqlquery = "SELECT cmp.cmp_remark" . " FROM " . $dbh_jb . " AS jb, costcenter AS csc, customer AS cs, company AS cmp" . " WHERE jb.jb_id = '" . $job_id . "' AND jb.csc_id_payer = csc.csc_id AND csc.cs_id= cs.cs_id AND cs.cmp_id = cmp.cmp_id" . " ORDER BY jb.jb_id"; $result = $db->query($tmpSqlquery); if (DB::isError($result)) die ("$PHP_SELF 5: {$tmpSqlquery} " . $result->getMessage() . ": " . $sqlquery); $f_cmp_remark = ""; while ($row = $result->fetch_assoc()): $f_cmp_remark = $row["cmp_remark"]; endwhile; $result->free(); $jobcustomerremarktext .= "
" . getLngt("Bemerkung über Kunde:") . "
"; $jobcustomerremarktext .= "
\n"; endif; // --- JOB FREETEXT --------------- $jobfreetext1 = ""; if ($job_id != "") : $f_jb_freetext_1 = getFieldValueFromId($dbh_jb, "jb_id", $job_id, "jb_freetext_1"); $jobfreetext1 .= "
" . getLngt("Auftragsfreitext:") . "
"; $jobfreetext1 .= "
\n"; endif; // --- SUB-JOBS --------------- $listOfSubjobs = ""; if ($automailer == "0" && $job_id != "") : 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 = ""; $postParserField = "jb_id_sub"; $mode = "1"; // Output from DB-RESULT $sortDBField = ""; // Used in following include-file for sorting per column; include ("../include/inc_list_defineoutput.inc.php"); // Post parsing if necessary if ($postParserField != "") : $tableBody = substituteTagContent($tableBody, "", "", "[TAG_CONTENT]"); endif; $listOfSubjobs .= "\n"; $listOfSubjobs .= $tableHeader . $tableBody; $result->free(); endif; endif; // --- PARENT-JOB(S) --------------- $listOfParentJobs = ""; if ($automailer == "0" && $job_id != "") : $jbIdParent = getFieldValueFromId("job", "jb_id", $job_id, "jb_id_parent"); if ($jbIdParent != "" && is_numeric($jbIdParent) && $jbIdParent != "0") : $tmpSqlquery = "SELECT jb.jb_id AS jb_id_parent, 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 = '" . $jbIdParent . "'" . " 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_parent", "business_volume", "cr_eid", "usr_name"); $aligns = "l,r,l,l"; $alignArray = spliti(",",$aligns); $alignTitles = "left"; $widths = "30"; $widthArray = spliti(",",$widths); $summationField = ""; $postParserField = "jb_id_parent"; $mode = "1"; // Output from DB-RESULT $sortDBField = ""; // Used in following include-file for sorting per column; include ("../include/inc_list_defineoutput.inc.php"); // Post parsing if necessary if ($postParserField != "") : $tableBody = substituteTagContent($tableBody, "", "", "[TAG_CONTENT]"); endif; $listOfParentJobs .= "\n"; $listOfParentJobs .= $tableHeader . $tableBody; $result->free(); endif; endif; ?> .... as "actioncontainer" if ($isFirefox) : $actioncontainerDivPos = "style=\"position:fixed; top:0px; left:450; width:500px; height:700px; z-index:10; background-color:#AAAACC; border:grey 3px solid; box-shadow: 10px 20px 30px grey;\""; else : $actioncontainerDivPos = ""; ?> <?php echo $pageTitel ?>
>
" . getLngt("UNTERAUFTRÄGE:") . "
" . getLngt("HAUPTAUFTRAG:") . "
     




     




          
\n"; echo "" . getLngt("TOUR:") . ""; echo $tourentry; echo ""; endif; ?>
" . getLngt("Scan-Events") . "
" . htmlDivLineSpacer("10px") . $scanEventsHtml; echo $scanEventsHtml; endif; if ($manualEventsHtml != "") : $manualEventsHtml = "
" . getLngt("Manuelle Events") . "
" . htmlDivLineSpacer("10px") . $manualEventsHtml; echo $manualEventsHtml; endif; endif; ?>
>
>
>
 
\n"; echo htmlDivLineSpacer("5px"); endfor; ?>