getOne("SELECT cr_id FROM couriervehicle WHERE crvh_sid = '" . $sel_cr_sid . "'");
check_daterange();
// Get the year of the begin of history data
$dbhistory = getDBNames(0);
// $logoIds <=> (3 = Annahme [Default], 6 = Automatisch vermittelt, 7 = Manuell vermittelt, 8 = Automatisch entzogen, 11 = Abgelehnt [Default])
function crHistory ($crId, $logoIds = array(), $fromDateRange = "", $toDateRange = "", $limitOfRowsDisplayed = "4000") {
global $db, $dbh_log, $PHP_SELF, $hq_id;
$pageTitle = getLngt("TRANSPORTEURSHISTORIE");
$debug = false;
if ($debug):
echo "crId = " . $crId . "
";
print_r($logoIds); echo "
";
endif;
$outPut = "";
if (isset($crId) && is_numeric($crId) && $crId > 0 && is_array($logoIds)) :
$outputFormatField = defineOutputFormats();
if (count($logoIds) == 0) : $logoIds = array(3,6,7,8,11,35,37,86); endif; // [3,11] [3,6,7,8,11] [3,6,7,8,11,35,37,86]
if ($fromDateRange == "") : $fromDateRange = getDateTime("date_firstday_currentmonth_lastyear") . " 00:00:00"; endif;
if ($toDateRange == "") : $toDateRange = getDateTime("0"); endif;
if ($debug):
echo "fromDateRange = " . $fromDateRange . "
";
echo "toDateRange = " . $toDateRange . "
";
print_r($logoIds); echo "
";
endif;
// From table "log"
$fieldClause = getDBFields("logoperation") . "," . getDBFields("log") . "," . getDBFields("user") . " ";
$fromClause = "phoenix_log.logoperation AS logo, phoenix_log." . $dbh_log . " AS log " .
"LEFT JOIN phoenix.user AS usr ON log.usr_id = usr.usr_id ";
// $whereClause = "log.cr_id = '" . $crId . "' AND log.hq_id = '" . $hq_id . "' AND log.logo_id = logo.logo_id AND ";
$whereClause = "log.cr_id = '" . $crId . "' AND log.logo_id = logo.logo_id AND ";
$whereClause .= "log.log_createtime >= '" . $fromDateRange . "' AND log.log_createtime <= '" . $toDateRange . "'";
$whereClause .= " AND logo.logo_id IN (" . implode(",", $logoIds) . ")";
$orderByClause = "log.log_createtime LIMIT 0," . $limitOfRowsDisplayed;
$sqlquery = generateStatement($fieldClause,$fromClause,$whereClause,$orderByClause);
if ($debug):
echo $sqlquery . "
";
endif;
// Send request to database
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Generate list with header
$titleArray = array(getLngt("Vorgang") . " ",getLngt("Zeitpunkt") . " ",getLngt("Auftrag") . " ",getLngt("Fahrzeug") . " ",getLngt("Name") . " ",getLngt("Vorname") . " ",getLngt("Telefon") . " ",getLngt("Details"));
$fieldArray = array("logo_op_shortname","log_createtime","jb_id","cr_sid","usr_name","usr_firstname","usr_phone","logo_description");
$aligns = "l,c,c,c,l,l,l,l";
$alignArray = spliti(",",$aligns);
$alignTitles = "center";
$widths = "330,130,50,50,150,150,80,200";
$widthArray = spliti(",",$widths);
$summationField = "";
$postParserField = "logo_description";
$mode = "1"; // Output from DB-RESULT
$sortDBField = ""; // Used in following include-file for sorting per column;
include ("../include/inc_list_defineoutput.inc.php");
$result->free();
// Courier data
$crSid = getFieldValueFromId("courier", "cr_id", $crId, "cr_sid");
$crUsrId = getFieldValueFromId("courier", "cr_id", $crId, "usr_id");
$tmpFields = getFieldsValueFromId("user","usr_id",$crUsrId,array("usr_firstname","usr_name"));
$crUsrFirstname = $tmpFields[0];
$crUsrName = $tmpFields[1];
// Post parsing if necessary
if ($postParserField != "") :
// $tableBody = postParseCrHistory($tableBody, $crSid);
$tableBody = postParseCrHistory($tableBody, $crSid, false);
endif;
$outPut .= "