0) : $tdStyle = " style=\"width:110px; vertical-align:top\""; $retOutput .= ""; $retOutput .= ""; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; $retOutput .= " "; $retOutput .= ""; $taxFactor = 1.19; $lfdCustomer = 0; $lfdRemCompareString = ""; for ($i = 0; $i < $jbArrayLen; $i++) : $jobData["tourarticle"] = array(); // Init because of iteration $jbId = $jbArray[$i]["jb_id"]; $jbIdParent = $jbArray[$i]["jb_id_parent"]; getDBData("tourarticle", $jbId); $jbTratArray = $jobData["tourarticle"][2]; $jbTratArrayLen = count($jbTratArray); // Check for displaying price $jbPayedPrice = getOneStmt("SELECT SUM(jbp_price) AS price FROM jobpayment WHERE jb_id = '" . $jbId . "'", "price"); // Net price if ($jbPayedPrice == "") : $jbPayedPrice = 0; endif; $jbPayedPrice *= $taxFactor; $jbTotalprice = getFieldValueFromId("job", "jb_id", $jbId, "jb_totalprice"); // Net price if ($jbTotalprice == "") : $jbTotalprice = 0; endif; $jbTotalprice *= $taxFactor; // Gross price $jbPriceDiff = 0; if (is_numeric($jbTotalprice) && is_numeric($jbPayedPrice)) : $jbPriceDiff = ($jbTotalprice - $jbPayedPrice); endif; // Display clock time from day time interval the ordertime is in (e.g. $ecoDayClockTimes[] = array("08:00:00", "11:59:59")) $parDaytimesComputationMode = getParameterValue("0", "MASK_DISPOSITION_DAYTIMES_COMPUTATION_MODE", "0"); if ($parDaytimesComputationMode == "1") : $jbDayTimeMtMappedValue = getDaytimeTimeInterval($jbArray[$i]["jb_ordertime"], $jbArray[$i]["cs_id"]); elseif ($parDaytimesComputationMode == "2") : $jbDayTimeMtMappedValue = getFieldValueFromClause("phoenix.genericdatacontainer","gdc_content","gdc_obj_type = 'jb' AND gdc_obj_id = '" . $jbId . "' AND gdc_gen_fieldname = 'timewindow_name'"); else : $intervalArray = getComputedTimeInterval($jbArray[$i]["jb_ordertime"], $jbArray[$i]["cs_id"]); if (count($intervalArray) > 0) : $jbDayTimeMtMappedValue = $intervalArray[0] . " - " . $intervalArray[1]; else : $jbDayTimeMtMappedValue = getDaytimeTimeInterval($jbArray[$i]["jb_ordertime"], $jbArray[$i]["cs_id"]); endif; endif; // Define computed time interval /* if ($jbOrderTime != "") : // Compute time interval to be sent to the end customer $intervalArray = getComputedTimeInterval($jbOrderTime, $csId); if (count($intervalArray) > 0) : $jbDayTimeMtMappedValue = substr($jbFreetext1,0,10) . " [" . $intervalArray[0] . " - " . $intervalArray[1] . "]"; endif; endif; */ $jbIdOut = $jbId . "/1"; if ($jbIdParent != "" && is_numeric($jbIdParent) && $jbIdParent > 0): $jbIdOut = $jbIdParent . "/2"; endif; // Check for "Lfd" of the customer $lfdCompareString = strtolower($jbArray[$i]["tr2_comp"] . eregPhoneNo($jbArray[$i]["tr2_phone"])); if ($lfdRemCompareString != $lfdCompareString) : $lfdRemCompareString = $lfdCompareString; $lfdCustomer++; endif; $retOutput .= ""; $retOutput .= " " . getLngt("Auftrag") . ""; // $retOutput .= " "; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; $retOutput .= " " . getLngt("Kunde") . " [#" . $lfdCustomer . "]"; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; $retOutput .= " " . getLngt("Adresse") . ""; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; $retOutput .= "  "; $retOutput .= " "; $retOutput .= ""; // Get Remark (tr2_remark) $tr2Remark = getFieldValueFromClause("tour","tr_remark","jb_id = '" . $jbId . "' AND tr_sort = '2'"); $tr2Remark = nl2br($tr2Remark); $retOutput .= ""; $retOutput .= " " . getLngt("Service") . ""; // $retOutput .= " "; // Get requested services $jbServices = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'service' AND mt_sort >= '2'", "", "mt_sort", ""); $jbServiceNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'service' AND mt_sort >= '2'", "mt_sort", "mt_sort", ""); $jbServicesLen = count($jbServices); // Iterate array $jbServiceText = ""; for ($j = 0; $j < $jbServicesLen; $j++) : (int)$jbServiceMode = pow(2,$jbServices[$j]); if (($jbArray[$i]["jb_service"] & $jbServiceMode) == $jbServiceMode) : if ($jbServiceText != "") : $jbServiceText .= ", "; endif; $jbServiceText .= "" . getLngt($jbServiceNames[$jbServices[$j]]) . ""; endif; endfor; if ($jbServiceText == "") : if (($jbArray[$i]["jb_service"] & 1) == 1) : $jbServiceText = "" . getLngt("Lieferung") . ""; if ($tr2Remark != "") : $tr2Remark = "" . $jbServiceText . "
" . $tr2Remark; else : $tr2Remark = $jbServiceText; endif; endif; if (($jbArray[$i]["jb_service"] & 2) == 2) : $jbServiceText = "" . getLngt("Montage") . ""; if ($tr2Remark != "") : $tr2Remark = $jbServiceText . "
" . $tr2Remark; else : $tr2Remark = $jbServiceText; endif; endif; else : if ($tr2Remark != "") : $tr2Remark = $jbServiceText . "
" . $tr2Remark; else : $tr2Remark = $jbServiceText; endif; endif; $retOutput .= "
"; $retOutput .= ""; $retOutput .= ""; $retOutput .= " " . getLngt("Ware") . ""; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; $retOutput .= " "; $retOutput .= ""; endfor; $retOutput .= "

" . getLngt("Fahrzeug") . "  " . $crvhSid . "        " . formatOutput($currDay,"datetime","4") . "

____________________________________________________________________________________________________

" . $jbId . "        [" . getLngt("Plantermin") . ": " . substr(formatOutput($jbArray[$i]["jb_ordertime"],"datetime","13"), 0, 5) . " " . getLngt("Uhr") . "]" . $jbIdOut . "        [" . getLngt("Zeitraum") . ": " . $jbDayTimeMtMappedValue . "]
" . $jbArray[$i]["tr2_comp"] . "        [" . getLngt("Telefon") . ": " . $jbArray[$i]["tr2_phone"] . "]
" . $jbArray[$i]["ad2_street"] . " " . $jbArray[$i]["tr2_hsno"] . (trim($jbArray[$i]["tr2_floor"]) != "" ? "   [" . getLngt("Etage") . ": " . $jbArray[$i]["tr2_floor"] : "") . "] " . "" . "
" . $jbArray[$i]["ad2_zipcode"] . " " . $jbArray[$i]["ad2_city"] . "
" . splitText($tr2Remark, "1", 70) . "" . $tr2Remark . "
"; $retOutput .= " "; $retOutput .= " "; // if ($jbTratArrayLen > 0) : $sumOfTratPackingPieces = 0; for ($j = 0; $j < $jbTratArrayLen; $j++) : $retOutput .= " "; // !!!! ATTENTION trat_serialno => trat_name, trat_remark => trat_description !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // $retOutput .= " "; $retOutput .= " "; // $retOutput .= " "; $retOutput .= " "; $retOutput .= " "; $retOutput .= " "; // $retOutput .= " "; $retOutput .= " "; $sumOfTratPackingPieces += $jbTratArray[$j]["trat_packingpieces"]; endfor; $retOutput .= " "; endif; // Check for additional article info in GDC $gdcContentJbAddedInfo = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = 'jb' AND gdc_obj_id = '" . $jbId . "' AND gdc_gen_fieldname = 'jb_addinfo'"); if ($gdcContentJbAddedInfo) : $retOutput .= " "; $retOutput .= " "; $retOutput .= " "; endif; // Display price if not have been payed if (is_numeric($jbPriceDiff) && $jbPriceDiff > 0) : $retOutput .= " "; endif; // Customer sign $retOutput .= " "; $retOutput .= " "; $retOutput .= " "; $retOutput .= " "; $retOutput .= "
" . getLngt("Beschreibung") . " " . getLngt("Artikel") . " " . getLngt("Menge") . " " . getLngt("Packstücke") . " 
" . getLngt("Preis") . " 
" . substr($jbTratArray[$j]["trat_description"], 0, 50) . "" . substr($jbTratArray[$j]["trat_remark"], 0, 50) . "" . $jbTratArray[$j]["trat_name"] . "" . $jbTratArray[$j]["trat_serialno"] . "" . $jbTratArray[$j]["trat_quantity"] . "" . $jbTratArray[$j]["trat_packingpieces"] . "" . $jbTratArray[$j]["trat_price"] . "
" . getLngt("Gesamtanzahl Packstücke") . " : " . $sumOfTratPackingPieces . "

" . $gdcContentJbAddedInfo . "
" . getLngt("Inkasso kassieren") . " : € " . number_format(round($jbPriceDiff, 2), 2, ",", ".") . "



_________________________________________
" . getLngt("Kundenunterschrift") . "
"; $retOutput .= "
____________________________________________________________________________________________________

"; endif; endif; return $retOutput; } // Gets the cartage note with all jobs for a specified vehicle and day // Needed for special output of the data (e.g. HTML) ONLY function getServiceCartageNote ($crvhId, $currDay, $jbStatus, $mode) { global $jobData; $retOutput = ""; if ($crvhId != "" && is_numeric($crvhId) && $currDay != "") : if ($jbStatus == "") : $jbStatus = ""; endif; if ($mode == "") : $mode = ""; endif; $crvhSid = getFieldValueFromId("couriervehicle", "crvh_id", $crvhId, "crvh_sid"); if ($jbStatus == "9") : // Get job data from all jobs defined in table "vehicledisposition" $jbArray = getVehicleJobList($crvhId, $currDay, ""); elseif ($jbStatus == "1") : $jbArray = getVehicleJobList ($crvhId, $currDay, "", "1"); else : // Get job data from all jobs having the same "cr_id" in job and "jb_status = 1" $jbArray_01 = getVehicleJobList($crvhId, $currDay, "", "0", " jb.jb_status IN ('9','0') AND jb.jb_offer = '0' AND "); $jbArray_02 = getVehicleJobList ($crvhId, $currDay, "", "1"); $jbArray = array_merge($jbArray_01, $jbArray_02); endif; $jbArrayLen = count($jbArray); if ($jbArrayLen > 0) : // $tdStyle = " style=\"width:110px; vertical-align:top;\""; $tdStyle = "width:110px; vertical-align:top;"; $retOutput .= ""; $retOutput .= ""; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; $retOutput .= " "; $retOutput .= ""; $taxFactor = 1.19; $lfdCustomer = 0; $lfdRemCompareString = ""; for ($i = 0; $i < $jbArrayLen; $i++) : $jobData["tourarticle"] = array(); // Init because of iteration $jbId = $jbArray[$i]["jb_id"]; $jbIdParent = $jbArray[$i]["jb_id_parent"]; // Internal remark from GDC $jbIdInternalRemark = getFieldValueFromClause("genericdatacontainer","gdc_content","gdc_obj_type = 'jb' AND gdc_gen_fieldname = 'internal_remark' AND gdc_obj_id = '" . $jbId . "'"); // Get stock name $stkId = getFieldValueFromId("articleitem", "ati_serialno", $jbArray[$i]["tr2_comp"], "stk_id"); $stkName = getFieldValueFromId("stock", "stk_id", $stkId, "stk_name"); getDBData("tourarticle", $jbId); $jbTratArray = $jobData["tourarticle"][2]; $jbTratArrayLen = count($jbTratArray); // Check for displaying price $jbPayedPrice = getOneStmt("SELECT SUM(jbp_price) AS price FROM jobpayment WHERE jb_id = '" . $jbId . "'", "price"); // Net price if ($jbPayedPrice == "") : $jbPayedPrice = 0; endif; $jbPayedPrice *= $taxFactor; $jbTotalprice = getFieldValueFromId("job", "jb_id", $jbId, "jb_totalprice"); // Net price if ($jbTotalprice == "") : $jbTotalprice = 0; endif; $jbTotalprice *= $taxFactor; // Gross price $jbPriceDiff = 0; if (is_numeric($jbTotalprice) && is_numeric($jbPayedPrice)) : $jbPriceDiff = ($jbTotalprice - $jbPayedPrice); endif; // Display clock time from day time interval the ordertime is in (e.g. $ecoDayClockTimes[] = array("08:00:00", "11:59:59")) $parDaytimesComputationMode = getParameterValue("0", "MASK_DISPOSITION_DAYTIMES_COMPUTATION_MODE", "0"); if ($parDaytimesComputationMode == "1") : $jbDayTimeMtMappedValue = getDaytimeTimeInterval($jbArray[$i]["jb_ordertime"], $jbArray[$i]["cs_id"]); elseif ($parDaytimesComputationMode == "2") : $jbDayTimeMtMappedValue = getFieldValueFromClause("phoenix.genericdatacontainer","gdc_content","gdc_obj_type = 'jb' AND gdc_obj_id = '" . $jbId . "' AND gdc_gen_fieldname = 'timewindow_name'"); else : $intervalArray = getComputedTimeInterval($jbArray[$i]["jb_ordertime"], $jbArray[$i]["cs_id"]); if (count($intervalArray) > 0) : $jbDayTimeMtMappedValue = $intervalArray[0] . " - " . $intervalArray[1]; else : $jbDayTimeMtMappedValue = getDaytimeTimeInterval($jbArray[$i]["jb_ordertime"], $jbArray[$i]["cs_id"]); endif; endif; // Define computed time interval /* if ($jbOrderTime != "") : // Compute time interval to be sent to the end customer $intervalArray = getComputedTimeInterval($jbOrderTime, $csId); if (count($intervalArray) > 0) : $jbDayTimeMtMappedValue = substr($jbFreetext1,0,10) . " [" . $intervalArray[0] . " - " . $intervalArray[1] . "]"; endif; endif; $jbIdOut = $jbId . "/1"; if ($jbIdParent != "" && is_numeric($jbIdParent) && $jbIdParent > 0): $jbIdOut = $jbIdParent . "/2"; endif; */ $jbIdOut = $jbId; // Check for "Lfd" of the customer $lfdCompareString = strtolower($jbArray[$i]["tr2_comp"] . eregPhoneNo($jbArray[$i]["tr2_phone"])); if ($lfdRemCompareString != $lfdCompareString) : $lfdRemCompareString = $lfdCompareString; $lfdCustomer++; endif; // $retOutput .= ""; // $retOutput .= " "; // $retOutput .= " "; // $retOutput .= ""; $retOutput .= ""; $retOutput .= " "; $retOutput .= " "; // . "   [# " . $jbIdOut . "]" $retOutput .= ""; // $retOutput .= ""; // $retOutput .= " "; // $retOutput .= " "; // $retOutput .= ""; $tr2Person = $jbArray[$i]["tr2_person"]; $tr2PersonArray = getKeyValueArrayFromString($tr2Person); $tr2PersonKeyArray = array_keys($tr2PersonArray); $tr2PersonKeyArrayLen = count($tr2PersonKeyArray); // Because of different names....!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :-/ // $tmpMappingHopperNames = array("BEK" => "BEK", "MEK" => "MEK", "H02" => "H1", "H05" => "H3", "H10" => "H2", "H1" => "H02", "H2" => "H10", "H3" => "H05"); $tmpMappingHopperNames = array("H02" => "H1", "H05" => "H3", "H10" => "H2"); for ($k = 0; $k < $tr2PersonKeyArrayLen; $k++) : if ($tmpMappingHopperNames[$tr2PersonKeyArray[$k]] != "") : $tr2PersonArray[$tmpMappingHopperNames[$tr2PersonKeyArray[$k]]] = $tr2PersonArray[$tr2PersonKeyArray[$k]]; unset($tr2PersonArray[$tr2PersonKeyArray[$k]]); endif; endfor; $tr2PersonKeyArray = array_keys($tr2PersonArray); $tr2Person = implode(",", $tr2PersonKeyArray); // Get Remark (tr2_remark) $tr2Remark = getFieldValueFromClause("tour","tr_remark","jb_id = '" . $jbId . "' AND tr_sort = '2'"); // $tr2Remark = nl2br($tr2Remark); // Check für remark contains if (substr($tr2Remark, 0, 6) == "[TEXT]") : $tr2Remark = "" . substr($tr2Remark, 6) . ""; else : $tr2RemarkArray = getKeyValueArrayFromString($tr2Remark,"|",":"); $tr2RemarkKeyArray = array_keys($tr2RemarkArray); $tr2RemarkKeyArrayLen = count($tr2RemarkKeyArray); $tr2Remark = ""; // Init $tmpCrLfArray = array(2,5,6,7,8,9,10); for ($k = 0; $k < $tr2RemarkKeyArrayLen; $k++) : $tmpKey = $tr2RemarkKeyArray[$k]; $tmpValue = trim($tr2RemarkArray[$tr2RemarkKeyArray[$k]]); if ($tmpValue != "") : $tmpInArr1 = in_array($k, $tmpCrLfArray); // Line feed? $tmpInArr2 = in_array($tmpKey, $tr2PersonKeyArray); // Mark critical object computed by system $tr2Remark .= ($tr2Remark != "" ? ($tmpInArr1 ? "
" : " | ") : "") . ($tmpInArr2 ? "" : "") . $tmpKey . ": " . $tmpValue . ($tmpInArr2 ? "" : ""); endif; endfor; endif; // Get critical objects by service unit messages $tr2CsFreetext = getFieldValueFromClause("tour","tr_cs_freetext","jb_id = '" . $jbId . "' AND tr_sort = '2'"); // $tr2Remark = str_replace("|", "
", trim($tr2Remark)); $retOutput .= ""; $retOutput .= " "; // Get requested services $jbServices = getColVectorFromDB2ArrayByClause("metatype", "mt_sort", "mt_type = 'service' AND mt_sort >= '2'", "", "mt_sort", ""); $jbServiceNames = getColVectorFromDB2ArrayByClause("metatype", "mt_value", "mt_type = 'service' AND mt_sort >= '2'", "mt_sort", "mt_sort", ""); $jbServicesLen = count($jbServices); // Iterate array $jbServiceText = ""; for ($j = 0; $j < $jbServicesLen; $j++) : (int)$jbServiceMode = pow(2,$jbServices[$j]); if (($jbArray[$i]["jb_service"] & $jbServiceMode) == $jbServiceMode) : if ($jbServiceText != "") : $jbServiceText .= ", "; endif; $jbServiceText .= "" . getLngt($jbServiceNames[$jbServices[$j]]) . ""; endif; endfor; if ($jbServiceText == "") : if (($jbArray[$i]["jb_service"] & 1) == 1 && $tr2Person != "") : $jbServiceText .= "" . getLngt("Austausch") . "" . " " . $tr2Person . "
"; endif; if (($jbArray[$i]["jb_service"] & 2) == 2 && $tr2CsFreetext != "") : $jbServiceText .= "" . getLngt("Wartung") . "" . " " . $tr2CsFreetext . "
"; endif; if ($tr2Remark != "") : $tr2Remark = $jbServiceText . $tr2Remark; else : $tr2Remark = $jbServiceText; endif; else : if ($tr2Remark != "") : $tr2Remark = $jbServiceText . " " . $tr2Person . "
" . $tr2Remark; else : $tr2Remark = $jbServiceText; endif; endif; $retOutput .= " "; $retOutput .= ""; /* $retOutput .= ""; $retOutput .= " "; $retOutput .= " "; $retOutput .= ""; */ $retOutput .= ""; $retOutput .= " "; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; $retOutput .= " "; $retOutput .= ""; endfor; $retOutput .= "

" . getLngt("Fahrzeug") . "  " . $crvhSid . "        " . formatOutput($currDay,"datetime","4") . "

____________________________________________________________________________________________________

" . getLngt("Auftrag") . "" . $jbIdOut . "
" . getLngt("Servicestelle") . " " . $jbArray[$i]["tr2_comp"] . "" . " - " . $stkName . "  (" . $jbArray[$i]["tr2_comp2"] . ")
" . getLngt("Adresse") . "" . $jbArray[$i]["ad2_street"] . " " . $jbArray[$i]["tr2_hsno"] . ", " . $jbArray[$i]["ad2_zipcode"] . " " . $jbArray[$i]["ad2_city"] . "
" . getLngt("Service") . "" . $tr2Remark . "
" . getLngt("Posten") . ""; $retOutput .= " "; $retOutput .= " "; // if ($jbTratArrayLen > 0) : $sumOfTratPackingPieces = 0; for ($j = 0; $j < $jbTratArrayLen; $j++) : $retOutput .= " "; // !!!! ATTENTION trat_serialno => trat_name, trat_remark => trat_description !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // $retOutput .= " "; $retOutput .= " "; // $retOutput .= " "; $retOutput .= " "; $retOutput .= " "; $retOutput .= " "; // $retOutput .= " "; $retOutput .= " "; $sumOfTratPackingPieces += $jbTratArray[$j]["trat_packingpieces"]; endfor; $retOutput .= " "; endif; // Check for additional article info in GDC $gdcContentJbAddedInfo = getFieldValueFromClause("genericdatacontainer", "gdc_content", "gdc_obj_type = 'jb' AND gdc_obj_id = '" . $jbId . "' AND gdc_gen_fieldname = 'jb_addinfo'"); if ($gdcContentJbAddedInfo) : $retOutput .= " "; $retOutput .= " "; $retOutput .= " "; endif; // Display price if not have been payed if (is_numeric($jbPriceDiff) && $jbPriceDiff > 0) : $retOutput .= " "; endif; $retOutput .= " "; $retOutput .= " "; $retOutput .= " "; $retOutput .= " "; $retOutput .= "
" . getLngt("Beschreibung") . " " . getLngt("Artikel") . " " . getLngt("Menge") . " " . getLngt("Packstücke") . " 
" . getLngt("Preis") . " 
" . substr($jbTratArray[$j]["trat_description"], 0, 50) . "" . substr($jbTratArray[$j]["trat_remark"], 0, 50) . "" . $jbTratArray[$j]["trat_name"] . "" . $jbTratArray[$j]["trat_serialno"] . "" . $jbTratArray[$j]["trat_quantity"] . "" . $jbTratArray[$j]["trat_packingpieces"] . "" . $jbTratArray[$j]["trat_price"] . "
" . getLngt("Gesamtanzahl Packstücke") . " : " . $sumOfTratPackingPieces . "

" . $gdcContentJbAddedInfo . "
" . getLngt("Inkasso kassieren") . " : € " . number_format(round($jbPriceDiff, 2), 2, ",", ".") . "



_________________________________________
" . getLngt("Wartungsnotiz") . "
"; $retOutput .= "
" . getLngt("Notizen") . "" . $jbIdInternalRemark . "
____________________________________________________________________________________________________

"; endif; endif; return $retOutput; } // Gets the delivery statistic for a specified vehicle and day function getDeliveryStatistic ($crvhId, $currDay, $mode = "") { global $db, $PHP_SELF, $hq_id; $retOutput = ""; if ($crvhId != "" && is_numeric($crvhId)) : $crvhSid = getFieldValueFromId("couriervehicle", "crvh_id", $crvhId, "crvh_sid"); if ($jbStatus == "") : $jbStatus = "2"; endif; $serviceValue = "1"; $count = 0; $timeArray = array(); if ($mode == "1") : // Each single job $sqlquery = "SELECT jb.jb_id, jb.jb_timeunits, (UNIX_TIMESTAMP(tr.tr_finishtime)-UNIX_TIMESTAMP(jb.jb_ordertime)) AS time" . " FROM couriervehicle AS crvh, job AS jb, tour AS tr" . " WHERE crvh.crvh_id = '" . $crvhId . "' AND" . " jb.cr_sid = crvh.crvh_sid AND" . " jb.jb_status = '" . $jbStatus . "' AND" . " (isnull(jb.jb_storno) OR jb.jb_storno = '0' OR jb.jb_storno = '1' OR jb.jb_storno = '3') AND" . " tr.jb_id = jb.jb_id AND" . " tr.tr_sort = '2' AND" . " ((NOT ISNULL(jb.jb_ordertime)) AND jb.jb_ordertime != '0000-00-00 00:00:00') AND" . " ((NOT ISNULL(tr.tr_finishtime)) AND tr.tr_finishtime != '0000-00-00 00:00:00') AND" . " (jb.jb_service & " . $serviceValue . " = " . $serviceValue . ")" . " GOUP BY LEFT(jb.jb_ordertime,7)" . " ORDER BY jb.jb_ordertime"; $result = $db->query($sqlquery); while ($row = $result->fetch_assoc()): $timeArray[$count]["val1"] = $row["jb_id"]; $timeArray[$count]["val2"] = $row["jb_timeunits"]; $timeArray[$count]["val3"] = secondsToDate($row["time"], "%h " . getLngt("Std.") . ", %i " . getLngt("Min.") . " %s " . getLngt("Sek.")); $timeArray[$count]["val4"] = ""; if ($row["time"] > 0 && $row["timeunits"] > 0) : $timeUnitsInSeconds = ($row["timeunits"] * 600); // A single time unit equals 10 minutes, one minute has 60 seconds => Factor = 10 * 60 = 600 $timeArray[$count]["val4"] = round(($row["time"] / $timeUnitsInSeconds), 2); endif; $count++; endwhile; $result->free(); $outTextStatistic = getLngt("Auslieferstatistik pro Auftrag"); $outTextColspan = "4"; $outTextColumn_1 = getLngt("Auftrag"); $outWidthColumn_1 = " width=\"100\" "; $outAlignColumn_1 = " align=\"center\" "; $outTextColumn_2 = getLngt("Zeiteinheiten"); $outWidthColumn_2 = " width=\"150\" "; $outAlignColumn_2 = " align=\"center\" "; $outTextColumn_3 = getLngt("Benötigte Zeit"); $outWidthColumn_3 = " width=\"250\" "; $outAlignColumn_3 = " align=\"center\" "; $outTextColumn_4 = getLngt("Verhältnis"); $outWidthColumn_4 = " width=\"100\" "; $outAlignColumn_4 = " align=\"center\" "; else : // Summation per month // $sqlquery = "SELECT LEFT(jb.jb_ordertime,7) AS month, SUM(jb.jb_timeunits) AS timeunits, SUM(UNIX_TIMESTAMP(tr.tr_finishtime)-UNIX_TIMESTAMP(jb.jb_ordertime)) AS time" // $sqlquery = "SELECT LEFT(jb.jb_ordertime,7) AS month, SUM(jb.jb_timeunits) AS timeunits, SUM(UNIX_TIMESTAMP(tr.tr_finishtime)-UNIX_TIMESTAMP(STR_TO_DATE(LEFT(gdc_arr_tour.gdc_content,14),'%Y%m%d%h%i%s'))) AS time" $sqlquery = "SELECT LEFT(jb.jb_ordertime,7) AS month, SUM(jb.jb_timeunits) AS timeunits, SUM(UNIX_TIMESTAMP(tr.tr_modify)-UNIX_TIMESTAMP(STR_TO_DATE(LEFT(gdc_arr_tour.gdc_content,14),'%Y%m%d%h%i%s'))) AS time" . " FROM couriervehicle AS crvh, job AS jb, tour AS tr LEFT JOIN genericdatacontainer AS gdc_arr_tour ON gdc_arr_tour.gdc_obj_id = tr.tr_id AND gdc_arr_tour.gdc_obj_type = 'tr' AND gdc_arr_tour.gdc_gen_fieldname = 'arr_tour'" . " WHERE crvh.crvh_id = '" . $crvhId . "' AND" . " jb.cr_sid = crvh.crvh_sid AND" . " jb.jb_status = '" . $jbStatus . "' AND" . " (isnull(jb.jb_storno) OR jb.jb_storno = '0' OR jb.jb_storno = '1' OR jb.jb_storno = '3') AND" . " tr.jb_id = jb.jb_id AND" . " tr.tr_sort = '2' AND" . " (NOT ISNULL(tr.tr_sign)) AND" . " ((NOT ISNULL(jb.jb_ordertime)) AND jb.jb_ordertime != '0000-00-00 00:00:00') AND" . " ((NOT ISNULL(tr.tr_finishtime)) AND tr.tr_finishtime != '0000-00-00 00:00:00') AND" . " gdc_arr_tour.gdc_content != '' AND" . " (jb.jb_service & " . $serviceValue . " = " . $serviceValue . ")" . " GROUP BY LEFT(jb.jb_ordertime,7)" . " ORDER BY LEFT(jb.jb_ordertime,7)"; // echo $sqlquery; die(); $result = $db->query($sqlquery); while ($row = $result->fetch_assoc()): $timeArray[$count]["val1"] = $row["month"]; $timeArray[$count]["val2"] = $row["timeunits"]; $timeArray[$count]["val3"] = secondsToDate($row["time"], "%a " . getLngt("Tage") . ", %h " . getLngt("Std.") . ", %i " . getLngt("Min.") . " %s " . getLngt("Sek.")); $timeArray[$count]["val4"] = ""; if ($row["time"] > 0 && $row["timeunits"] > 0) : $timeUnitsInSeconds = ($row["timeunits"] * 600); // A single time unit equals 10 minutes, one minute has 60 seconds => Factor = 10 * 60 = 600 $timeArray[$count]["val4"] = round(($row["time"] / $timeUnitsInSeconds), 2); endif; $count++; endwhile; $result->free(); $outTextStatistic = getLngt("Auslieferstatistik pro Monat"); $outTextColspan = "3"; $outTextColumn_1 = getLngt("Monat"); $outWidthColumn_1 = " width=\"100\" "; $outAlignColumn_1 = " align=\"center\" "; $outTextColumn_2 = getLngt("Summe Zeiteinheiten"); $outWidthColumn_2 = " width=\"150\" "; $outAlignColumn_2 = " align=\"center\" "; $outTextColumn_3 = getLngt("Summe benötigter Zeit"); $outWidthColumn_3 = " width=\"250\" "; $outAlignColumn_3 = " align=\"center\" "; $outTextColumn_4 = getLngt("Verhältnis"); $outWidthColumn_4 = " width=\"100\" "; $outAlignColumn_4 = " align=\"center\" "; endif; $timeArrayLen = count($timeArray); if ($timeArrayLen > 0) : $tdStyle = " style=\"width:100px; vertical-align:top\""; $retOutput .= ""; $retOutput .= ""; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; $retOutput .= " " . $outTextColumn_1 . ""; $retOutput .= " " . $outTextColumn_2 . ""; $retOutput .= " " . $outTextColumn_3 . ""; $retOutput .= " " . $outTextColumn_4 . ""; $retOutput .= ""; for ($i = 0; $i < $timeArrayLen; $i++) : $retOutput .= ""; $retOutput .= " " . $timeArray[$i]["val1"] . ""; $retOutput .= " " . $timeArray[$i]["val2"] . ""; $retOutput .= " " . $timeArray[$i]["val3"] . ""; $retOutput .= " " . $timeArray[$i]["val4"] . ""; $retOutput .= ""; endfor; $retOutput .= "

" . getLngt("Fahrzeug") . "  " . $crvhSid . "        " . $outTextStatistic . "

____________________________________________________________________________________________________

"; endif; endif; return $retOutput; } // Get the station output function getStationData ($jbId, $trSort) { global $jobData, $hq_id, $usr_id, $emp_id; $retOutput = ""; getDBData("job", $jbId); getDBData("tour", $jbId); getDBData("tourarticle", $jbId); getDBData("gdc_jb", $jbId); getDBData("gdc_jb_tr", $jbId); // print_r($jobData); die(); if (is_array($jobData)) : $absoluteSystemPath = getAbsoluteSystemPath(); // Get invoice address of the current customer $csInvAddress = array(); if ($csId != "" && is_numeric($csId) && $csId > 0) : $csId = getFieldValueFromId("costcenter", "csc_id", $jobData["job"]["csc_id_payer"], "cs_id"); $csInvAddress = getAddress($csId, "costcenteraddress", "2"); endif; // Scan event messages // $scanMessage = $jobData["gdc_jb"]["gdc_tr_finished_content"][$tmpFieldName]; // Generate sign image if ($jobData["tour"][$trSort]["tr_sign"] != "") : $rawCoord = splitRawCoordinates($jobData["tour"][$trSort]["tr_sign"]); $maxCoord = checkMaxCoordinates($rawCoord); $tmpSignPath = "/temp/signs/"; $imgFilename = "tr_sign_" . $jbId . "_" . $trSort . ".png"; $im = createSignImage($rawCoord); if (!file_exists(".." . $tmpSignPath . $imgFilename)) : imagepng($im, ".." . $tmpSignPath . $imgFilename); endif; endif; $tdStyle = " style=\"vertical-align:top\""; $retOutput .= ""; // TOP $logoExtName = ""; $logoExtHeight = ""; $logoExtWidth = ""; if ($hq_id != "" && is_numeric($hq_id) && $hq_id > 0) : $cmpId = getFieldValueFromId("headquarters", "hq_id", $hq_id, "cmp_id"); if ($cmpId != "" && is_numeric($cmpId) && $cmpId > 0) : $logoExtName = getFieldValueFromId("company", "cmp_id", $cmpId, "cmp_logo"); $logoExtHeight = getFieldValueFromId("company", "cmp_id", $cmpId, "cmp_logo_height"); $logoExtWidth = getFieldValueFromId("company", "cmp_id", $cmpId, "cmp_logo_width"); endif; endif; $retOutput .= ""; $retOutput .= " "; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; // LINKE SEITE $retOutput .= " "; // RECHTE SEITE $retOutput .= " "; $retOutput .= ""; // BOTTOM $retOutput .= ""; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; // BOTTOM // $retOutput .= ""; // $retOutput .= " "; // $retOutput .= ""; // Sign $retOutput .= ""; $retOutput .= " "; $retOutput .= "

Unterschriftsfeld          

"; $retOutput .= "




" . getLngt("Abliefernachweis") . "

____________________________________________________________________________________________________

" . getLngt("Auftrag") . "


"; $retOutput .= " "; // Empfänger $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Empfänger") . ":"; $retOutput .= " "; $retOutput .= " "; $retOutput .= $jobData["tour"][$trSort]["tr_comp"] . "
" . ($jobData["tour"][$trSort]["tr_cs_freetext"] != "" ? $jobData["tour"][$trSort]["tr_cs_freetext"] : "") . "
" . ($jobData["tour"][$trSort]["tr_comp2"] != "" ? $jobData["tour"][$trSort]["tr_comp2"] : "") . "
" . ($jobData["tour"][$trSort]["tr_phone"] != "" ? $jobData["tour"][$trSort]["tr_phone"] : "") . "
"; $retOutput .= $jobData["tour"][$trSort]["ad_street"] . " " . $jobData["tour"][$trSort]["tr_hsno"] . "
" . $jobData["tour"][$trSort]["ad_zipcode"] . " " . $jobData["tour"][$trSort]["ad_city"] . "

"; $retOutput .= " "; $retOutput .= "
"; // Anspechpartner $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Anspechpartner") . ":  "; $retOutput .= " "; $retOutput .= " "; $retOutput .= $jobData["tour"][$trSort]["tr_person"] . "

"; $retOutput .= " "; $retOutput .= "
"; // Absender $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Absender") . ":"; $retOutput .= " "; $retOutput .= " "; if (count($csInvAddress) > 0) : // Rechnungsadresse $retOutput .= $csInvAddress["comp"] . "
" . $csInvAddress["street"] . " " . $csInvAddress["hsno"] . "
" . $csInvAddress["zipcode"] . " " . $csInvAddress["city"] . "

"; else : // Abhol-/Lieferadresse $retOutput .= $jobData["tour"]["1"]["tr_comp"] . "
" . $jobData["tour"]["1"][$jbId]["ad_street"] . " " . $jobData["tour"]["1"][$jbId]["tr_hsno"] . "
" . $jobData["tour"]["1"][$jbId]["ad_zipcode"] . " " . $jobData["tour"]["1"][$jbId]["ad_city"] . "

"; endif; $retOutput .= " "; $retOutput .= "
"; $retOutput .= "
"; $retOutput .= "
"; $retOutput .= " "; // Ladedatum $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Datum") . ":"; $retOutput .= " "; $retOutput .= " "; $retOutput .= substr($jobData["job"]["jb_ordertime"],8,2) . "." . substr($jobData["job"]["jb_ordertime"],5,2) . "." . substr($jobData["job"]["jb_ordertime"],0,4) . "

"; $retOutput .= " "; $retOutput .= "
"; // Lieferscheinnr. $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Lieferscheinnr.") . ":  "; $retOutput .= " "; $retOutput .= " "; if ($jobData["gdc"]["jb"][$jbId][$trSort . "_info_2"]["gdc_content"] != "") : $retOutput .= $jobData["gdc"]["jb"][$jbId][$trSort . "_info_2"]["gdc_content"] . "

"; else : $retOutput .= $jobData["tour"][$trSort]["tr_commission_no"] . "

"; endif; $retOutput .= " "; $retOutput .= "
"; // Auftragsnr. $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Auftragsnr.") . ":"; $retOutput .= " "; $retOutput .= " "; if ($jobData["gdc"]["jb"][$jbId][$trSort . "_info_0"]["gdc_content"] != "") : $retOutput .= $jobData["gdc"]["jb"][$jbId][$trSort . "_info_0"]["gdc_content"] . "
"; else : $retOutput .= $jobData["job"]["jb_id"] . "
"; endif; $retOutput .= " "; $retOutput .= "
"; // Kundennrnr. if ($jobData["gdc"]["jb"][$jbId][$trSort . "_info_1"]["gdc_content"] != "") : $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Kundennr.") . ":"; $retOutput .= " "; $retOutput .= " "; $retOutput .= $jobData["gdc"]["jb"][$jbId][$trSort . "_info_1"]["gdc_content"] . "


"; $retOutput .= " "; $retOutput .= "
"; endif; /* // Pakete $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Pakete") . ":"; $retOutput .= " "; $retOutput .= " "; $retOutput .= $jobData["tourarticle"][$trSort]["trat_packingpieces"] . "
"; $retOutput .= " "; $retOutput .= "
"; // Paletten $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Paletten") . ":"; $retOutput .= " "; $retOutput .= " "; $retOutput .= $jobData["tour"][$trSort]["trat_remark"] . "
"; $retOutput .= " "; $retOutput .= "
"; // Gewicht $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Gewicht") . ":"; $retOutput .= " "; $retOutput .= " "; $retOutput .= number_format(round($jobData["tour"][$trSort]["trat_weight"],2), 2, ",", ".") . " kg
"; $retOutput .= " "; $retOutput .= "
"; // Scan-Event $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Scan-Event") . ":"; $retOutput .= " "; $retOutput .= " "; $retOutput .= $scanMessage . "

"; $retOutput .= " "; $retOutput .= "
"; */ $retOutput .= "
"; $retOutput .= "

" . getLngt("Auslieferung") . "



"; $retOutput .= " "; // Sendungsstatus $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Sendungsstatus") . ":  "; $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Komplette Auslieferung") . "

"; $retOutput .= " "; $retOutput .= "
"; // Auslieferdatum $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Erfolgte am") . ":"; $retOutput .= " "; $retOutput .= " "; if ($jobData["tour"][$trSort]["tr_finishtime"] != "") : $retOutput .= substr($jobData["tour"][$trSort]["tr_finishtime"],8,2) . "." . substr($jobData["tour"][$trSort]["tr_finishtime"],5,2) . "." . substr($jobData["tour"][$trSort]["tr_finishtime"],0,4) . " " . substr($jobData["tour"][$trSort]["tr_finishtime"],11,2) . ":" . substr($jobData["tour"][$trSort]["tr_finishtime"],14,2); endif; $retOutput .= "

"; $retOutput .= " "; $retOutput .= "
"; // Empfänger $retOutput .= " "; $retOutput .= " "; $retOutput .= getLngt("Empfänger") . ":"; $retOutput .= " "; $retOutput .= " "; $retOutput .= ($jobData["tour"][$trSort]["tr_signname"] != "" ? $jobData["tour"][$trSort]["tr_signname"] : getLngt("Keine Klartextangabe")) . "

"; $retOutput .= " "; $retOutput .= "
"; $retOutput .= "
"; $retOutput .= "


"; $retOutput .= " "; $retOutput .= " "; $retOutput .= " "; $retOutput .= "
"; $retOutput .= " "; $retOutput .= "
"; $retOutput .= " "; $retOutput .= ""; $retOutput .= ""; endif; return $retOutput; } // * END : Special functions for output ONLY !!!! * // ************************************************************************************************************************************* $output = ""; if ($functionName != "") : if (function_exists($functionName)) : cronWriteToFile($logFile, "CALLED_FUNC_EXIST=YES|"); // Get number of arguments of requested function $fct = new ReflectionFunction($functionName); $numOfFunctionArguments = $fct->getNumberOfRequiredParameters(); $argumentArray = array(); for ($i = 1; $i <= $numOfFunctionArguments; $i++) : array_push($argumentArray, ${("par_" . pad($i, 2))}); endfor; // Call function ang get HTML output $output = call_user_func_array($functionName, $argumentArray); else : cronWriteToFile($logFile, "CALLED_FUNC_EXIST=NO|"); endif; endif; // Generate and send mail if requested if (($f_act == "calculatePDF" || $f_act == "calculateAndSendMailPDF") && $output != "") : cronWriteToFile($logFile, "PDF_OP_START=YES|"); // Generate PDF document $fileNameTarget = generatePDF($output, $title, "0", "1", "", "", ""); // Send mail with attached (generated) PDF document if ($f_act == "calculateAndSendMailPDF") : cronWriteToFile($logFile, "MAIL_OP_START=YES|"); $mailSent = sendPDFMail($hqId, $output, $title, $mailToAddresses, $fileNameTarget, $mailSubject, $mailText, $mailAttachedFileType, $mailCcAddresses, $mailBccAddresses, $mailSenderAddress, $parKeyForLogFile, $objId, $cascadingObjType); if ($mailSent) : $statusMessage = "Die Mail wurde generiert!"; cronWriteToFile($logFile, "MAIL_GENERATED=YES|"); if ($isCron) : $system_result = "MAIL_SENT"; endif; else : $statusMessage = "ACHTUNG: Die Mail wurde NICHT generiert!"; cronWriteToFile($logFile, "MAIL_GENERATED=NO|"); if ($isCron) : $system_result = "MAIL_NOT_SENT"; endif; endif; else : cronWriteToFile($logFile, "MAIL_OP_START=NO|"); endif; else : cronWriteToFile($logFile, "PDF_OP_START=NO|"); endif; endif; // $automode cronWriteToFile($logFile, "LOG=END|"); ?>