";
echo "hashFolder = " . $hashFolder . "
";
echo "f_act = " . $f_act . "
";
echo "requestMode = " . $requestMode . "
";
echo "f_sort = " . $f_sort . "
";
echo "f_stat_export = " . $f_stat_export . "
";
echo "day_from = " . $day_from . "
";
echo "month_from = " . $month_from . "
";
echo "year_from = " . $year_from . "
";
echo "day_to = " . $day_to . "
";
echo "month_to = " . $month_to . "
";
echo "year_to = " . $year_to . "
";
endif;
if ($debugLog) :
writeToFile($logFile, $currentTime . " ----------------------------------------------------------------------------------- ");
writeToFile($logFile, $currentTime . " - " . "isCron = " . $isCron);
writeToFile($logFile, $currentTime . " - " . "hashFolder = " . $hashFolder);
writeToFile($logFile, $currentTime . " - " . "f_act = " . $f_act);
writeToFile($logFile, $currentTime . " - " . "requestMode = " . $requestMode);
writeToFile($logFile, $currentTime . " - " . "f_sort = " . $f_sort);
writeToFile($logFile, $currentTime . " - " . "f_stat_export = " . $f_stat_export);
writeToFile($logFile, $currentTime . " - " . "day_from = " . $day_from);
writeToFile($logFile, $currentTime . " - " . "month_from = " . $month_from);
writeToFile($logFile, $currentTime . " - " . "year_from = " . $year_from);
writeToFile($logFile, $currentTime . " - " . "day_to = " . $day_to);
writeToFile($logFile, $currentTime . " - " . "month_to = " . $month_to);
writeToFile($logFile, $currentTime . " - " . "year_to = " . $year_to);
endif;
$pageTitel = getLngt("AUFSTELLUNGEN");
$authCheck = FALSE;
$maxLimitOfRowsDisplayed = 1000;
$currentTime = getDateTime("0");
$currentDate = getDateTime("3");
$currentMonth = getDateTime("month");
if ($requestMode == "101") :
$pageTitel = getLngt("GELDBETRAGSHISTORIE");
if ($isCron) :
$authCheck = TRUE;
else :
$authCheck = authCheckEmployeeRights($emp_id, "0");
endif;
// Parameters
$limitOfRowsDisplayed = getParameterValue("0", "MASK_STAT_ILLT_ROWS_DISPLAYED_101", "0"); // For limitation of the rows displayed
if ($limitOfRowsDisplayed == "" || !is_numeric($limitOfRowsDisplayed)) : $limitOfRowsDisplayed = getParameterValue("0", "MASK_STAT_ILLT_ROWS_DISPLAYED", "0"); endif;
if ($limitOfRowsDisplayed == "" || !is_numeric($limitOfRowsDisplayed)) : $limitOfRowsDisplayed = 10000; endif;
// Get the cs_id if "g_cs_eid" does exist
if ($g_cs_eid != "") :
$cs_id = getFieldValueFromId("customer", "cs_eid", $g_cs_eid, "cs_id");
elseif ($g_csc_id != "") :
$cs_id = getFieldValueFromId("costcenter", "csc_id", $g_csc_id, "cs_id");
$g_cs_eid = getFieldValueFromId("customer", "cs_id", $cs_id, "cs_eid");
endif;
// Statistic values of the customer
/*
if ($cs_id != "") :
// Statistic business volume from 01.01. of the current year to the current day
$tmpFromDate = getDateTime("year") . "-01-01";
$tmpToDate = getDateTime("3");
$statisticValueCurrentYear = getCsStatistic ($rpObjId, $tmpFromDate, $tmpToDate);
// Year before in the same interval
$tmpFromDate = getDateTime("lastyear") . "-01-01";
$tmpToDate = getDateTime("date_lastyear");
$statisticValueLastYear = getCsStatistic ($rpObjId, $tmpFromDate, $tmpToDate);
// Year before complete
$tmpFromDate = getDateTime("lastyear") . "-01-01";
$tmpToDate = getDateTime("lastyear") . "-12-31";
$statisticValueLastYearComplete = getCsStatistic ($rpObjId, $tmpFromDate, $tmpToDate);
endif;
*/
if ($month_from == "" || $year_from == "") :
$month_from = getDateTime("month");
$year_from = getDateTime("year");
endif;
if ($year_from == "" || $month_from == "" || $day_from == "" || $year_to == "" || $month_to == "" || $day_to == "") :
// Default monthly like frontend
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . "01";
$toDateRange = $year_from . "-" . pad($month_from,2) . "-" . $calMonthDays[($month_from - 1)];
else :
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . pad($day_from,2);
$toDateRange = $year_to . "-" . pad($month_to,2) . "-" . pad($day_to,2);
endif;
elseif ($requestMode == "102") :
$pageTitel = getLngt("KASSETTENBEWEGUNGEN");
if ($isCron) :
$authCheck = TRUE;
else :
$authCheck = authCheckEmployeeRights($emp_id, "0");
endif;
// Parameters
$limitOfRowsDisplayed = getParameterValue("0", "MASK_STAT_ILLT_ROWS_DISPLAYED_102", "0"); // For limitation of the rows displayed
if ($limitOfRowsDisplayed == "" || !is_numeric($limitOfRowsDisplayed)) : $limitOfRowsDisplayed = 10000; endif;
if ($month_from == "" || $year_from == "") :
$month_from = getDateTime("month");
$year_from = getDateTime("year");
endif;
if ($year_from == "" || $month_from == "" || $day_from == "" || $year_to == "" || $month_to == "" || $day_to == "") :
// Default monthly like frontend
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . "01";
$toDateRange = $year_from . "-" . pad($month_from,2) . "-" . $calMonthDays[($month_from - 1)];
else :
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . pad($day_from,2);
$toDateRange = $year_to . "-" . pad($month_to,2) . "-" . pad($day_to,2);
endif;
elseif ($requestMode == "103") :
$pageTitel = getLngt("ALARMSTATUS");
if ($isCron) :
$authCheck = TRUE;
else :
$authCheck = authCheckEmployeeRights($emp_id, "0");
endif;
// Parameters
$limitOfRowsDisplayed = getParameterValue("0", "MASK_STAT_ILLT_ROWS_DISPLAYED_103", "0"); // For limitation of the rows displayed
if ($limitOfRowsDisplayed == "" || !is_numeric($limitOfRowsDisplayed)) : $limitOfRowsDisplayed = 10000; endif;
if ($month_from == "" || $year_from == "") :
$month_from = getDateTime("month");
$year_from = getDateTime("year");
endif;
if ($year_from == "" || $month_from == "" || $day_from == "" || $year_to == "" || $month_to == "" || $day_to == "") :
// Default monthly like frontend
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . "01";
$toDateRange = $year_from . "-" . pad($month_from,2) . "-" . $calMonthDays[($month_from - 1)];
else :
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . pad($day_from,2);
$toDateRange = $year_to . "-" . pad($month_to,2) . "-" . pad($day_to,2);
endif;
elseif ($requestMode == "104") :
$pageTitel = getLngt("Abgeholte Kassetten");
if ($isCron) :
$authCheck = TRUE;
else :
$authCheck = authCheckEmployeeRights($emp_id, "0");
endif;
// Parameters
$limitOfRowsDisplayed = getParameterValue("0", "MASK_STAT_ILLT_ROWS_DISPLAYED_104", "0"); // For limitation of the rows displayed
if ($limitOfRowsDisplayed == "" || !is_numeric($limitOfRowsDisplayed)) : $limitOfRowsDisplayed = 10000; endif;
if ($year_from == "" || $month_from == "" || $day_from == "") :
$day_from = getDateTime("day");
$month_from = getDateTime("month");
$year_from = getDateTime("year");
endif;
if ($year_from == "" || $month_from == "" || $day_from == "" || $year_to == "" || $month_to == "" || $day_to == "") :
// Default monthly like frontend
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . "01";
$toDateRange = $year_from . "-" . pad($month_from,2) . "-" . $calMonthDays[($month_from - 1)];
else :
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . pad($day_from,2);
$toDateRange = $year_to . "-" . pad($month_to,2) . "-" . pad($day_to,2);
endif;
elseif ($requestMode == "105") :
// .............
elseif ($requestMode == "199") :
// .............
else :
if ($day_from == "" || $month_from == "" || $year_from == "" ||
$day_to == "" || $month_to == "" || $year_to == "") :
if ($currentMonth >= 7) :
$fromDateRange = getDateTime("year") . "-07-01";
else :
$fromDateRange = getDateTime("year") . "-01-01";
endif;
$toDateRange = $currentDate;
$day_from = getDateTime("day");
$month_from = getDateTime("month");
$year_from = getDateTime("year");
$day_to = getDateTime("day");
$month_to = getDateTime("month");
$year_to = getDateTime("year");
else :
$fromDateRange = $year_from . "-" . pad($month_from,2) . "-" . pad($day_from,2);
$toDateRange = $year_to . "-" . pad($month_to,2) . "-" . pad($day_to,2);
endif;
endif;
// $fromDateRange .= " 00:00:00";
// $toDateRange .= " 23:59:59";
if (!$isCron) :
include ("../admin/menu.php");
endif;
include_once ("../include/html.inc.php");
include_once ("../include/inc_stock.inc.php");
getCurrentScript(__FILE__);
// if (!$isCron && (!$authCheck || !authCheckEmployeeRights($emp_id, "16"))) : gotoReferer("1"); endif;
// Mandator filter (related here to the USER !!!)
if ($f_hq_id == "") : $f_hq_id = array(); endif;
if (count($f_hq_id) == 0) : array_push($f_hq_id, $hq_id); endif;
if ($f_sort == "") : $f_sort = "0"; endif; // ORDER BY column "$fieldArray[$f_sort]"
if ($limitOfRowsDisplayed == "") : $limitOfRowsDisplayed = $maxLimitOfRowsDisplayed; endif;
$f_text = trim($f_text); // Text of an entry
$output = "";
// Export report statistic data as CSV file
if ($f_stat_export == "" || count($f_stat_export) == 0) : $f_stat_export = false; else: $f_stat_export = true; endif;
// Get the array for formatting the database-values for the output according to the defined type
$outputFormatField = defineOutputFormats();
if ($debug) :
echo "fromDateRange = " . $fromDateRange . "
";
echo "toDateRange = " . $toDateRange . "
";
endif;
if ($debugLog) :
writeToFile($logFile, $currentTime . " - " . "fromDateRange = " . $fromDateRange);
writeToFile($logFile, $currentTime . " - " . "toDateRange = " . $toDateRange);
endif;
if ($f_act == "execute" && $requestMode != "") :
$f_act = ""; // Init
$orderByClause = "";
if ($requestMode == "101") :
// Generate list with header
$titleArray = array(getLngt("Serienr."),getLngt("Datum"),getLngt("BEK"),getLngt("MEK"),getLngt("H1"),getLngt("H2"),getLngt("H3"));
$fieldArray = array("atih_serialno","atih_data_04","atih_data_05","atih_data_06","atih_data_07","atih_data_08","atih_data_09");
$aligns = "l,l,r,r,r,r,r";
$widths = "120,100,80,80,80,80,80";
if ($f_sort != "" && is_numeric($f_sort)) :
$orderByClause = "atih." . $fieldArray[$f_sort];
if ($orderByClause == "atih.atih_serialno") :
$orderByClause .= ", LEFT(atih.atih_data_04,10) ";
endif;
endif;
if ($orderByClause == "") :
$orderByClause = " atih.atih_serialno, LEFT(atih.atih_data_04,10) ";
endif;
// Automatendaten
// $sqlquery = "SELECT CONCAT(atih.atih_serialno,';',LEFT(atih.atih_data_04,10),';',atih.atih_data_05,';',atih.atih_data_06,';',atih.atih_data_07,';',atih.atih_data_08,';',atih.atih_data_09)"
$sqlquery = "SELECT atih.atih_serialno, LEFT(atih.atih_data_04,10) AS atih_data_04, atih.atih_data_05, atih.atih_data_06, atih.atih_data_07, atih.atih_data_08, atih.atih_data_09"
. " FROM"
. " phoenix_log.articleitemhistory AS atih,"
. " phoenix.article AS at"
. " WHERE "
. " LEFT(atih.atih_data_04,10) >= '" . $fromDateRange . "' AND"
. " LEFT(atih.atih_data_04,10) <= '" . $toDateRange . "' AND"
. " atih.at_id = at.at_id AND"
. " at.at_group LIKE '%,1,%'"
. " ORDER BY " . $orderByClause
. (!$f_stat_export ? " LIMIT 0," . $limitOfRowsDisplayed : "");
elseif ($requestMode == "102") :
// Generate list with header
$titleArray = array(getLngt("Lfd."),getLngt("Datum"),getLngt("Serienr."),getLngt("Typ"),getLngt("Quelle"),getLngt("Ziel"),getLngt("Zusatz"));
$fieldArray = array("stkmv_id","stkmv_datetime","stkmv_serialno","at_match","stk_name_from","stk_name_to","stkmv_tan");
$aligns = "r,c,l,l,l,l,l";
$widths = "40,100,80,40,150,150,150";
$whereClause = " LEFT(stkmv.stkmv_datetime,10) >= '" . $fromDateRange . "' AND"
. " LEFT(stkmv.stkmv_datetime,10) <= '" . $toDateRange . "'";
if ($f_sort != "" && is_numeric($f_sort)) :
$orderByClause = $fieldArray[$f_sort];
endif;
if ($orderByClause == "") :
$orderByClause = " stkmv.stkmv_id ";
endif;
$sqlquery = getStmtStockJournal($whereClause, $orderByClause, $limitOfRowsDisplayed);
elseif ($requestMode == "103") :
$postParserField = "usr_id_kill";
$postParserField2 = "utc_kill";
$postParserField3 = "calling_usr_id";
// Generate list with header
$titleArray = array(getLngt("Zeitpunkt"),getLngt("Auslöst durch"),getLngt("Fahrzeug"),getLngt("Beendendet durch"),getLngt("Beendigungszeit"));
$fieldArray = array("bo_createtime", $postParserField3, "usr_name", $postParserField, $postParserField2);
$aligns = "l,l,l,l,l";
$widths = "100,120,120,120,100";
if ($f_sort != "" && is_numeric($f_sort)) :
$orderByClause = "b2b." . $fieldArray[$f_sort];
if ($orderByClause == "usr.usr_firstname" || $orderByClause == "usr.usr_name" || $orderByClause == "crvh.crvh_vh_sign") :
$orderByClause .= ", LEFT(b2b.bo_createtime,10) ";
endif;
endif;
if ($orderByClause == "") :
$orderByClause = " b2b.bo_createtime ";
endif;
// Alarmdaten
$sqlquery = "SELECT b2b.bo_createtime, usr.usr_firstname, usr.usr_name, crvh.crvh_vh_sign, b2b.bo_obj_data AS " . $postParserField
. ", b2b.bo_obj_data AS " . $postParserField2 . ", b2b.bo_obj_data AS " . $postParserField3
. " FROM"
. " phoenix_log.b2b_objects AS b2b,"
. " phoenix.courier AS cr,"
. " phoenix.couriervehicle AS crvh,"
. " phoenix.user AS usr"
. " WHERE "
. " bo_ext_id1 = cr.usr_id AND"
. " cr.cr_id = crvh.cr_id AND"
. " cr.usr_id = usr.usr_id AND"
. " bo_type = 333 AND"
. " LEFT(b2b.bo_createtime,10) >= '" . $fromDateRange . "' AND"
. " LEFT(b2b.bo_createtime,10) <= '" . $toDateRange . "'"
. " ORDER BY " . $orderByClause
. (!$f_stat_export ? " LIMIT 0," . $limitOfRowsDisplayed : "");
elseif ($requestMode == "104") :
// Generate list with header
$titleArray = array(getLngt("Fahrzeug"),getLngt("Automatennummer"),getLngt("Standort"),getLngt("Kassettencode"),getLngt("Betrag"),getLngt("Belegdatum"),getLngt("Belegzeit"),getLngt("Annahmezeit"));
// Abgeholte Kassetten
$sqlquery = "SELECT b2b.bo_id, b2b.bo_createtime, b2b.bo_obj_data, usr.usr_firstname, usr.usr_name"
. " FROM"
. " phoenix_log.b2b_objects AS b2b,"
. " phoenix.courier AS cr,"
. " phoenix.user AS usr"
. " WHERE "
. " bo_ext_id1 = cr.cr_id AND"
. " cr.usr_id = usr.usr_id AND"
. " bo_type IN (221,222) AND"
. " LEFT(b2b.bo_createtime,10) >= '" . $fromDateRange . "' AND"
. " LEFT(b2b.bo_createtime,10) <= '" . $toDateRange . "'"
. " ORDER BY bo_id"
. (!$f_stat_export ? " LIMIT 0," . $limitOfRowsDisplayed : "");
endif;
// echo $sqlquery . "
";
$result = $db->query($sqlquery);
if (DB::isError($result)) die ("$PHP_SELF: " . $result->getMessage());
// Special output for some categories or generic output per standard list by default
if ($requestMode == "104") :
$csvHeader = implode(",", $titleArray);
$csvHeaderLen = strlen($csvHeader);
$csvData = "";
$outputLinesArray = array();
$outputLinesArray[] = $csvHeader;
while ($row = $result->fetch_assoc()):
$boId = $row["bo_id"];
$boCreatetime = $row["bo_createtime"];
$usrFirstname = $row["usr_firstname"];
$usrName = $row["usr_name"];
$boObjData = $row["bo_obj_data"];
// Remove headline from DB content in "bo_obj_data"
$boObjData = substr($boObjData, $csvHeaderLen + 1);
$outputLinesArray[] = $boObjData;
// Aggregate contents in "bo_obj_data"
$csvData .= $boObjData . "\n";
endwhile;
$csvData = $csvHeader . "\n" . $csvData;
$csvDataOutHTML = str_replace("\n", "
", $csvData);
$output = $csvDataOutHTML;
else :
// DEFAULT OUTPUT STANDARD LIST
$alignArray = explode(",",$aligns);
$alignTitles = "center";
$widthArray = explode(",",$widths);
$summationField = "";
$mode = "1"; // Output from DB-RESULT
$fieldSortArray = $fieldArray;
$sortDBField = "YES"; // Used in following include-file for sorting per column;
// $javaScriptFunctionNameForSort = "finishPageStatisticIlltSort";
$javaScriptFunctionNameForSort = "";
if (!$f_stat_export) :
include ("../include/inc_list_defineoutput.inc.php");
// Post parsing if necessary
if ($postParserField != "") :
$tableBody = postParseExport($tableBody, $postParserField);
endif;
if ($postParserField2 != "") :
$tableBody = postParseExport($tableBody, $postParserField2, "postparser2");
endif;
if ($postParserField3 != "") :
$tableBody = postParseExport($tableBody, $postParserField3, "postparser3");
endif;
$output = $tableHeader . $tableBody;
else :
$output = "