38'@phan-var-force array<string,array<string,float>> $totalamountlifetime';
39'@phan-var-force array<string,array<string,float>> $totalhtamountlifetime';
40'@phan-var-force int $error';
41global $foundoldformat, $firstrecorddate, $error;
45 print
"Error, template page ".basename(__FILE__).
" can't be called with no conf defined.";
49$firstrecorddatearray = array();
50if (!empty($search_end) && $search_end > 0) {
51 $dateend = $search_end;
58$sql =
"SELECT action, module_source, object_format, MIN(date_creation) as datemin, SUM(amounts_taxexcl) as sumamounts_taxexcl, SUM(amounts) as sumamounts";
59$sql .=
" FROM ".MAIN_DB_PREFIX.
"blockedlog";
60$sql .=
" WHERE entity = ".((int)
$conf->entity);
62$sql .=
" AND action IN ('BILL_VALIDATE', 'PAYMENT_CUSTOMER_CREATE', 'PAYMENT_CUSTOMER_DELETE')";
64 $sql .=
" AND date_creation < '".$db->idate($dateend).
"'";
66if (empty($includebeforev2)) {
67 $sql .=
" AND object_format >= 'V2'";
69$sql .=
" GROUP BY action, module_source, object_format";
71$resql =
$db->query($sql);
73 while ($obj =
$db->fetch_object($resql)) {
75 if (!empty($firstrecorddatearray[$obj->action][$obj->module_source])) {
76 $firstrecorddatearray[$obj->action] = min($firstrecorddatearray[$obj->action][$obj->module_source],
$db->jdate($obj->datemin,
'gmt'));
78 $firstrecorddatearray[$obj->action] =
$db->jdate($obj->datemin,
'gmt');
81 if (!empty($firstrecorddate)) {
82 $firstrecorddate = min($firstrecorddate,
$db->jdate($obj->datemin,
'gmt'));
84 $firstrecorddate =
$db->jdate($obj->datemin,
'gmt');
87 if (!isset($totalamountlifetime[$obj->action][$obj->module_source])) {
88 $totalamountlifetime[$obj->action][$obj->module_source] = 0;
90 if (!isset($totalhtamountlifetime[$obj->action][$obj->module_source])) {
91 $totalhtamountlifetime[$obj->action][$obj->module_source] = 0;
95 $totalamountlifetime[$obj->action][$obj->module_source] += $obj->sumamounts;
98 if (empty($obj->object_format) || $obj->object_format ===
'V1') {
101 $totalhtamountlifetime[$obj->action][$obj->module_source] += $obj->sumamounts_taxexcl;
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.