Files
votianng/html/tools/cron_export_HTM.php
2026-03-29 10:34:57 +02:00

75 lines
3.9 KiB
PHP

<?php
/*=======================================================================
*
* cron_export.php
*
=======================================================================*/
include_once ("../include/mcglobal.inc.php");
include_once ("../include/ftp.inc.php");
if ($argv[1] == "acapella7890") :
// Error reporting
error_reporting(E_ERROR | E_WARNING | E_PARSE);
$path = getAbsoluteSystemPath();
$passwd = "acapella7890";
$logFile = $path . "/log/sys_auto_export.log";
$emptyArgument = "\"\"";
$fileNamePrefix = substr(getDateTime("6"), 0, 12); // Format: "YmdHi"
if ($argv[2] == "today") :
$toDay = getDateTime("day");
$toMonth = getDateTime("month");
$toYear = getDateTime("year");
else :
$toDay = getDateTime("day_yesterday");
$toMonth = getDateTime("month_yesterday");
$toYear = getDateTime("year_yesterday");
endif;
// Arguments
// $hq_id $usr_id $dummy_01 $f_act $f_exp_category $f_delimiter $f_parname $f_parname_export $f_fileName $day_to $month_to $year_to $f_cs_eid_filter $f_jbp_filter $specialJbPayment $jbpc_id
$exportPars = array();
$exportPars["HTM_HTHH_ABR_01"] = array("1020","18086","_","export","8","|","RETRANS Fuhrlohn","RETRANS Fuhrlohn",substr($fileNamePrefix,0,-2) . "01" . ".101.abr",$toDay,$toMonth,$toYear,"HTHH67218",$emptyArgument,"","");
$exportPars["HTM_HTHH_ABR_02"] = array("1020","18086","_","export","8","|","RETRANS Fuhrlohn","RETRANS Fuhrlohn",substr($fileNamePrefix,0,-2) . "02" . ".101.abr",$toDay,$toMonth,$toYear,"HTHH65989",$emptyArgument,"","");
$exportPars["HTM_HTHH_ABR_03"] = array("1020","18086","_","export","8","|","RETRANS Fuhrlohn","RETRANS Fuhrlohn",substr($fileNamePrefix,0,-2) . "03" . ".101.abr",$toDay,$toMonth,$toYear,"HTHH69600",$emptyArgument,"","");
$exportPars["HTM_HTHH_ABR_04"] = array("1020","18086","_","export","8","|","RETRANS Fuhrlohn","RETRANS Fuhrlohn",substr($fileNamePrefix,0,-2) . "04" . ".101.abr",$toDay,$toMonth,$toYear,"HTHH72289",$emptyArgument,"","");
$exportPars["HTM_WAST_ABR_01"] = array("1111","18091","_","export","8","|","RETRANS Fuhrlohn","RETRANS Fuhrlohn",substr($fileNamePrefix,0,-2) . "01" . ".144.abr",$toDay,$toMonth,$toYear,"WAST10783",$emptyArgument,"","");
$exportPars["HTM_WAST_ABR_02"] = array("1111","18091","_","export","8","|","RETRANS Fuhrlohn","RETRANS Fuhrlohn",substr($fileNamePrefix,0,-2) . "02" . ".144.abr",$toDay,$toMonth,$toYear,"WAST10972",$emptyArgument,"","");
$exportParsKeys = array_keys($exportPars);
$exportParsKeysLen = count($exportParsKeys);
if ($exportParsKeysLen != "" && is_numeric($exportParsKeysLen)) :
// Exports
for ($i = 0; $i < $exportParsKeysLen; $i++) :
list($hq_id,$usr_id,$dummy_01,$f_act,$f_exp_category,$f_delimiter,$f_parname,$f_parname_export,$f_fileName,
$day_to,$month_to,$year_to,$f_cs_eid_filter,$f_jbp_filter,$specialJbPayment,$jbpc_id) = $exportPars[$exportParsKeys[$i]];
$cmd = "php " . $path . "/export/export.php " . $passwd . " " . $hq_id . " " . $usr_id . " " . $dummy_01 . " " . $f_act . " " . $f_exp_category . " " . "\"" . $f_delimiter. "\"" . " "
. "\"" . $f_parname . "\"" . " " . "\"" . $f_parname_export . "\"" . " " . "\"" . $f_fileName . "\"" . " " . $day_to . " " . $month_to . " " . $year_to . " "
. $f_cs_eid_filter . " " . $f_jbp_filter . " " . $specialJbPayment . " " . $jbpc_id;
//echo $exportParsKeys[$i] . ":\n";
//echo $cmd . "\n\n\n";
$cmdOutput = null;
exec($cmd, $cmdOutput);
// list($errNo, $errDesc) = $cmdOutput;
$currentTime = getDateTime("0");
writeToFile($logFile, "OP=AUTO_EXPORT|DATETIME=" . $currentTime . "|CUST=" . $exportParsKeys[$i]);
sleep(5); // Avoid too many tasks
endfor;
endif;
endif;
?>