"0") : $crEid = getFieldValueFromId("courier","usr_id",$usr_id,"cr_eid"); // $crEid = "STB283531"; endif; $constListBgCol1 = "#AAAAFF"; $constListBgCol2 = "#AAAAFF"; $constListBgCol3 = "#CCCCFF"; $constListBgCol4 = "#CCCCFF"; if ($f_act == "") : $f_act = ""; endif; if ($stmNumber == "") : $stmNumber = "0"; endif; if ($f_showDateAndTime == "") : $f_showDateAndTime = "0"; endif; // Show the clock time fields [default "NO"] // Check ranges of time. All fields have to be set if ($f_showDateAndTime == "0" || $hour_from == "" || $minute_from == "" || $hour_to == "" || $minute_to == "") : $hour_from = "00"; $minute_from = "00"; $hour_to = "23"; $minute_to = "59"; $f_showDateAndTime == "0"; endif; $hour_from = pad($hour_from,2); $minute_from = pad($minute_from,2); $hour_to = pad($hour_to,2); $minute_to = pad($minute_to,2); // Time range $fromTimeRange = " " . $hour_from . ":" . $minute_from . ":00"; $toTimeRange = " " . $hour_to . ":" . $minute_to . ":59"; // Check ranges of date. All fields have to be set if ($day_from == "" || $month_from == "" || $year_from == "" || $day_to == "" || $month_to == "" || $year_to == "") : // Initialize date-ranges to the current date $fromDateRange = getDateTime("3") . $fromTimeRange; $toDateRange = getDateTime("3") . $toTimeRange; $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) . $fromTimeRange; $toDateRange = $year_to . "-" . pad($month_to,2) . "-" . pad($day_to,2) . $toTimeRange; endif; /* echo "year_from: " . $year_from . "
"; // Get the year of the begin of history data $dbhistory = getDBNames($dbhistory, $year_from); echo "dbhistory: " . $dbhistory . "
"; $remDbHistory = $dbhistory; $constYearOfBeginHistory = getParameterValue("0", "STATISTIC_YEAR_OF_BEGIN_HISTORY", "0"); if ($dbhistory == "1" || !is_numeric($constYearOfBeginHistory) || $constYearOfBeginHistory >= getDateTime("year")) : $constYearOfBeginHistory = ""; endif; echo "constYearOfBeginHistory: " . $constYearOfBeginHistory . "
"; echo "dbh_jb: " . $dbh_jb . "
"; */ // Get the year of the begin of history data $dbhistory = "0"; // echo "dbhistory: " . $dbhistory . "
"; $dbhistory = getDBNames($dbhistory, $year_from); // echo "dbhistory: " . $dbhistory . "
"; $constYearOfBeginHistory = getParameterValue("0", "STATISTIC_YEAR_OF_BEGIN_HISTORY", "0"); if ($dbhistory == "0" && is_numeric($constYearOfBeginHistory) && $year_from <= $constYearOfBeginHistory) : $dbhistory = "1"; $dbhistory = getDBNames($dbhistory, $year_from); endif; $remDbHistory = $dbhistory; // echo "year_from: " . $year_from . "
"; // echo "dbhistory: " . $dbhistory . "
"; // echo "constYearOfBeginHistory: " . $constYearOfBeginHistory . "
"; // echo "dbh_jb: " . $dbh_jb . "
"; // Converts matrix (2-dim-array) to vector (1-dim-array) e.g. like "csv-lines" function specialConvertAssociativeMatrixToTable ($matrix, $typeArr = array(), $alignArr =array(), $noDisplayTableTag = "", $cssTable = "", $cssTr = "", $cssTd = "") { global $constListBgCol1,$constListBgCol2,$constListBgCol3,$constListBgCol4; $retValue = ""; if (is_array($matrix)) : if ($noDisplayTableTag != "1") : $retValue .= "\n"; endif; $matrixKeys = array_keys($matrix); $matrixKeysLen = count($matrixKeys); for ($i = 0; $i < $matrixKeysLen; $i++) : $retValue .= "\n"; $colArray = $matrix[$matrixKeys[$i]]; $colArrayKeys = array_keys($colArray); $colArrayKeysLen = count($colArrayKeys); for ($j = 0; $j < $colArrayKeysLen; $j++) : $val = $colArray[$colArrayKeys[$j]]; switch($typeArr[$j]) { // case "integer" : $val = round($val,0); case "float" : $val = number_format(round($val,2), 2, ",", "."); case "varchar" : $val = trim($val); default : $val = trim($val); }; if ($cssTd != "") : // $cellColor = getListColor($i, $j); $cellColor = getListColorGeneric($i, $j, $constListBgCol1, $constListBgCol2, $constListBgCol3, $constListBgCol4); if ($cellColor != "") : $cssTd .= "background-color:" . $cellColor . ";"; endif; $cssTd .= "text-align:" . setAlign($alignArr[$j]) . ";"; $retValue .= "\n"; else : $retValue .= $val; // Content in $colArray[$j] is like " .... " endif; endfor; $retValue .= "\n"; endfor; if ($noDisplayTableTag != "1") : $retValue .= "
\n"; $retValue .= $val; $retValue .= "
\n"; endif; endif; return $retValue; } function statisticSetGlobalParameterArray () { global $aligns, $f_statusMode, $f_dateMode, $f_showDateAndTime, $f_crvh_sid, $f_direction_sort; global $f_filter, $f_filter2, $f_filter3, $f_filter4, $f_filter5, $f_filter6, $f_filter7, $f_filter8, $f_filter9, $f_filter10; global $f_price_formular, $f_filter_a, $f_filter_interval, $g_crvh_filter, $f_mode_statistic, $f_filter_calc, $f_service, $f_servicetype, $f_jb_service, $f_split_jb_services, $f_jb_specifics; global $f_cs_meta, $f_cr_meta, $f_cr_parent, $f_cr_pda_actions, $f_show_invoice_address, $f_show_delivery_address, $summationField, $summationField2, $uniqueSearchFields; global $hour_from, $minute_from, $hour_to, $minute_to, $fromTimeRange, $toTimeRange, $f_cmp_new_date, $f_cs_become_cs_date, $f_net_gross; global $f_group, $f_groupLen, $f_staticGroup, $f_staticGroupLen, $f_priceMode; $globalParArray = array($aligns, $f_statusMode, $f_dateMode, $f_showDateAndTime, $f_crvh_sid, $f_direction_sort, $f_filter, $f_filter2, $f_filter3, $f_filter4, $f_filter5, $f_filter6, $f_filter7, $f_filter8, $f_filter9, $f_filter10, $f_price_formular, $f_filter_a, $f_filter_interval, $g_crvh_filter, $f_mode_statistic, $f_filter_calc, $f_service, $f_servicetype, $f_jb_service, $f_split_jb_services, $f_jb_specifics, $f_cs_meta, $f_cr_meta, $f_cr_parent, $f_cr_pda_actions, $f_show_invoice_address, $f_show_delivery_address, $summationField, $summationField2, $uniqueSearchFields, $hour_from, $minute_from, $hour_to, $minute_to, $fromTimeRange, $toTimeRange, $f_cmp_new_date, $f_cs_become_cs_date, $f_net_gross, $f_group, $f_groupLen, $f_staticGroup, $f_staticGroupLen, $f_priceMode); return $globalParArray; } if ($hasAccess && $crEid != "" && $f_act = "calculate" && $stmNumber != "" && is_numeric($stmNumber) && $stmNumber > 0) : // Mode in $argv[2] // $mode = trim ($argv[2]); $mode = "Nutzungsverhalten"; $currencySymbol = "€"; // Init system parameter $path = "../temp/download/"; // Init global parameter for script $aligns = ""; $f_statusMode = "1"; // Finished jobs $f_dateMode = "2"; // "creating date", "booking date", "finish date" [default], "export date", "order_date" // $f_showDateAndTime = "0"; // Clock time restriction (0 = none) $f_crvh_sid = ""; // Filter for special vehicle SID $f_direction_sort = "0"; // ORDER BY ASC or DESC" $f_filter = "0"; // Filter (Split for vehicletype, start zipcode, etc.) $f_filter2 = "0"; // Filter (Split for "Aufträge und Gutschriften") (0 = none) $f_filter3 = "0"; // Filter (Split for "Fahrzeugkategorie" ["jb_type"]) (0 = none) $f_filter4 = "0"; // Filter (Split for headquarters) (0 = none) $f_filter5 = "0"; // Filter (Split for branches) (0 = none) $f_filter6 = "0"; // Filter (Split for carriers [ONLY customer statistics]) (0 = none) $f_filter7 = "0"; // Filter (Split for vehicles) (0 = none) $f_filter8 = "0"; // Filter (Split for employees) (0 = none) $f_filter9 = "0"; // Filter (Split for job types ["jb_type"]) (0 = none) $f_filter10 = "0"; // Filter (Split for costcenter ["csc_id_payer" / "csc_id_related"]) (0 = none) $f_price_formular = "0"; // Computation of the price (0 = jb_totalprice) $f_filter_a = "0"; // Subfilter to $f_filter (Kind of vehicletype [Requested or real]) (0 = none) $f_filter_interval = "0"; // Filter (Split for time intervals) (0 = none) $g_crvh_filter = ""; // Vehicle filter ("" = default) $f_mode_statistic = "0"; // Normal statistic (0 = default, 1 = calculator) $f_filter_calc = "0"; // (0 = none) $f_service = "0"; // Service for "service statistic" (0 = none) $f_servicetype = "0"; // Servicetype for "service statistic" (0 = none) $f_jb_service = array(); // Job service array as filter (empty array = default) $f_split_jb_services = "0"; // Filter (Split for job services) (0 = none) $f_jb_specifics = array(); // Job specifics used as filter (empty array = default) $f_cs_meta = "0"; // Filter (Split for sub customers ["meta-customer"]) (0 = none) $f_cr_meta = "1"; // Filter (Split for driver) (0 = none) $f_cr_parent = "2"; // Every courier or driver OR cumulation by parent ("" = default) $f_cr_pda_actions = "0"; // Filter for courier action statistics (absolute/relative per job) (0 = none) $f_show_invoice_address = "0"; $f_show_delivery_address = "0"; $summationField = ""; $summationField2 = ""; $uniqueSearchFields = array(); $f_cmp_new_date = ""; // Filter (Only new data set since date) $f_cs_become_cs_date = ""; // Filter (Only new customers since date) $f_net_gross = "0"; $f_group = array(); $f_groupLen = 0; $f_staticGroup = array(); $f_staticGroupLen = 0; $f_priceMode = 0; $f_editCsMode = 0; $station_based_group_field = ""; $csEid = ""; $orderByClause = "cr.cr_eid"; $f_category = "2"; $f_hq_id = array($hq_id); /* // Init system parameter $path = "../temp/download/"; $f_secretFileName = "stat_cr_" . str_replace("-","",getDateTime("date_yesterday_currentmonth_currentyear")) . ".csv"; $matrix = array(); // array("","Monat Vorjahr","Vormonat","Aktueller Monat IST","Aktueller Monat SOLL") $output = ""; // Remove potential existing file if (file_exists($path . $f_secretFileName)) : unlink($path . $f_secretFileName); endif; */ $globalParArray = statisticSetGlobalParameterArray(); $tmpStmNumber = $stmNumber; if ($stmNumber >= "1000" && $stmNumber <= "1999") : $tmpStmNumber = "1000"; endif; $idArrayLen = getCategoryDBFields($tmpStmNumber); $retArray = getStatistic($globalParArray, $stmNumber, $fromDateRange, $toDateRange, $csEid, $crEid, $orderByClause); $rowArray = $retArray[0]; // Statistic data $tdStyle = "border:1px solid #7777FF; border-collapse:collapse; background-color:#CCCCFF; padding: 5px;"; $outTable = ""; $outTable .= ""; $outTable .= " "; $outTable .= " "; $outTable .= " "; $outTable .= " "; $outTable .= " "; $outTable .= ""; $outTable .= specialConvertAssociativeMatrixToTable($rowArray, array("varchar","varchar","varchar","integer","float"), array("l","l","l","r","r"), "1", "", "", $tdStyle); $outTable .= "
" . getLngt("Transporteur") . "" . getLngt("Vorname") . "" . getLngt("Nachname") . "" . getLngt("Auftragsanzahl") . "" . getLngt("Umsatz") . "
"; /* // **** Send CSV file per mail **** $mailObj = new htmlMimeMail(); $mailCssFontType = "Calibri, Arial, Verdana, Helvetica, sans-serif"; $mailtext = ""; $mailtext .= ""; $mailtext .= "

"; $mailtext .= $output; $mailtext .= "

"; $mailSubject = strtoupper($mode) . "- UND AUFTRAGSDATENÜBERSICHT GFL für den Monat " . substr(getDateTime("date_yesterday_currentmonth_currentyear"),0,7); $mailObj->setSubject($mailSubject); $mailObj->setHtml($mailtext, null, "./"); // $mailSenderAddress = getParameterValue("0", "MAIL_SENDER_ADDRESS", "0"); // if ($mailSenderAddress != "" && checkEmailFormat($mailSenderAddress)) : $mailSenderAddress = "hb.transport@hansetrans.de"; // endif; $mailObj->setFrom($mailSenderAddress); $mailCcAddress = getParameterValue("0", "MAIL_CC_ADDRESS", "0"); if ($mailCcAddress != "" && checkEmailFormat($mailCcAddress)) : $mailObj->setCc($mailCcAddress); endif; $mailBccAddress = getParameterValue("0", "MAIL_BCC_ADDRESS", "0"); if ($mailBccAddress != "" && checkEmailFormat($mailBccAddress)) : $mailObj->setBcc($mailBccAddress); endif; if (file_exists($path . $f_secretFileName)) : $attachment = $mailObj->getFile($path . $f_secretFileName); $mailObj->addAttachment($attachment, $f_secretFileName, 'text/csv'); endif; $mailResult = $mailObj->send(array("mail-cron@assecutor.de","ca@hansetrans.de","sascha.engel@hansetrans.de"), 'smtp'); // $mailResult = $mailObj->send(array("mv@assecutor.de"), 'smtp'); if ($mailResult) : // $mailsendStatus = getLngt("Die Nachricht wurde versandt!"); // Write logdata into log database // writeToLogDB("22",$currentHqId,$job_id,$currentSessionUsrId,"","","",$f_email . "|STATION"); else : // $mailsendStatus = getLngt("Die Nachricht konnte nicht gesendet werden!"); // Write logdata into log database // writeToLogDB("23",$currentHqId,$job_id,$currentSessionUsrId,"","","",$f_email . "|STATION"); endif; $mailObj = NULL; if (file_exists($path . $f_secretFileName)) : unlink($path . $f_secretFileName); endif; // OUTPUT if (!$autoMode) : echo $mailtext; endif; */ endif; // Javascript-function as template only for categorie depending on date-filter (not status-filter) // $onLoadCall = "displayStatusMessage();"; $onLoadCall = ""; $js_date = ""; $js_date .= "\n"; $js_date .= "\n"; $js_date .= "\n"; if ($noStatisticMenu == "") : $onLoadCall .= "initForm();"; endif; if ($fileOutput) : $onLoadCall .= "downloadFile();"; endif; ?> <?php echo getLngt("STATISTIK"); ?>
>:
>:
\n"; $categoryFilter .= "\n"; $categoryFilter .= "\n"; $categoryFilter .= "  bis:\n"; $categoryFilter .= "\n"; $categoryFilter .= "\n"; $categoryFilter .= "\n"; $categoryFilter .= " 
"; echo $categoryFilter; ?>
|"; $categoryFilter .= "Mit"; $categoryFilter .= "Einschränkung auf Zeitintervall von:\n"; $categoryFilter .= "\n"; $categoryFilter .= "\n"; $categoryFilter .= "Uhr  bis:\n"; $categoryFilter .= "\n"; $categoryFilter .= "\n"; $categoryFilter .= "Uhr]\n"; echo $categoryFilter; endif; ?>
>