query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
$i = 0;
while ($row = $result->fetch_assoc()):
$output .= "
\n";
$output .= "| " . ($i + 1) . " | \n";
$output .= "" . $row["csc_name"] . " | \n";
$output .= "" . $row["atih_serialno"] . " | \n";
$output .= "" . substr($row["atih_data_04"], 0, 10) . " | \n";
$output .= "" . number_format($row["atih_data_05"], 2, ",", "") . " | \n";
$output .= "" . $row["usr_name"] . ", " . $row["usr_firstname"] . " | \n";
$output .= "
\n";
$i++;
endwhile;
$result->free();
// Send mail if there is at least one forgotten safebag
if ($i > 0) :
$mailtext = ""
. ""
. "";
$headline = "";
$headline .= "";
$headline .= "| " . getLngt("Pos.") . " | ";
$headline .= " " . getLngt("Verkaufsstelle") . " | ";
$headline .= " " . getLngt("Safebag") . " | ";
$headline .= " " . getLngt("Datum") . " | ";
$headline .= " " . getLngt("Betrag") . " | ";
$headline .= " " . getLngt("Mitarbeiter") . " | ";
$headline .= "
";
$mailtext .= "";
$mailtext .= $headline;
$mailtext .= $output;
$mailtext .= "
";
$mailtext .= "";
// Generate PDF document
// $fileNameTarget = generatePDF($mailtext, $title, "0", "0", "", "", "");
// Send mail with attached (generated) PDF document
if (true) :
$mailSubject = $title;
if ($subject != "") :
$mailSubject = $subject;
endif;
$mailToAddresses = "ASSECUTOR-INFO@hochbahn.de";
// $mailToAddresses = "marcelo.juliao_de_seixas@hochbahn.de";
$mailAttachedFileType = "";
$mailCcAddresses = "";
$mailBccAddresses = "proj.hha@assecutor.de";
// $mailBccAddresses = "";
$mailSenderAddress = getParameterValue("0", "MAIL_SENDER_ADDRESS", $hqId);
if ($mailSenderAddress == "") :
$mailSenderAddress = "sys-op@assecutor.de";
endif;
// Generate mail (object)
$mailObj = new htmlMimeMail();
$mailObj->setFrom($mailSenderAddress);
if ($mailCcAddresses != "") :
$mailObj->setCc($mailCcAddresses);
endif;
if ($mailBccAddresses != "") :
$mailObj->setBcc($mailBccAddresses);
endif;
$mailObj->setSubject($mailSubject);
// Mail content
$mailObj->setHtml($mailtext, null, "./");
// $mailObj->setText($mailtext);
/*
if (file_exists($csvPathAndFile)) :
$attachment = $mailObj->getFile($csvPathAndFile);
$mailObj->addAttachment($attachment, $csvFile, 'text/csv');
endif;
*/
$mailResult = $mailObj->send(array($mailToAddresses), 'smtp');
// $mailResult = sendPDFMail($hqId, $mailtext, $title, $mailToAddresses, $fileNameTarget, $mailSubject, $mailText, $mailAttachedFileType, $mailCcAddresses, $mailBccAddresses, $mailSenderAddress, $parKeyForLogFile, $objId, $cascadingObjType);
if ($mailResult) :
$mailResultMsg = "OK";
else :
$mailResultMsg = "NOK";
endif;
$opState = $mailResultMsg;
endif;
endif;
else :
$opState = "ERR 101 : Unknown client IP!";
endif;
else :
// $opState = "ERR 100 : Authentication!";
endif;
// Append to log file
writeToFile($logFile, "datetime=" . $currentTime . "|IP=" . $currentClientIP . "|cr_id=" . $boExtId1 . "|day=" . $boExtId0 . "|bo_id=" . $boId . "|mail_result=" . $mailResultMsg . "|op_state=" . $opState);
// echo "OK";
// echo $opState;
?>