Merge pull request #12476 from ptibogxiv/patch-280
NEW add total of value in product stat
This commit is contained in:
commit
373420edc0
@ -1127,7 +1127,20 @@ class DolGraph
|
|||||||
$this->stringtoshow .= '</script>'."\n";
|
$this->stringtoshow .= '</script>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output HTML string to total value
|
||||||
|
*
|
||||||
|
* @return string HTML string to total value
|
||||||
|
*/
|
||||||
|
public function total()
|
||||||
|
{
|
||||||
|
$value = 0;
|
||||||
|
foreach($this->data as $valarray) // Loop on each x
|
||||||
|
{
|
||||||
|
$value += $valarray[1];
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output HTML string to show graph
|
* Output HTML string to show graph
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -351,6 +352,7 @@ if ($result || empty($id))
|
|||||||
$url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.$object->entity.'&file='.urlencode($graphfiles[$key]['file']);
|
$url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.$object->entity.'&file='.urlencode($graphfiles[$key]['file']);
|
||||||
$px->draw($dir."/".$graphfiles[$key]['file'], $url);
|
$px->draw($dir."/".$graphfiles[$key]['file'], $url);
|
||||||
|
|
||||||
|
$graphfiles[$key]['total'] = $px->total();
|
||||||
$graphfiles[$key]['output'] = $px->show();
|
$graphfiles[$key]['output'] = $px->show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -405,7 +407,7 @@ if ($result || empty($id))
|
|||||||
// Label
|
// Label
|
||||||
print '<tr class="liste_titre"><td>';
|
print '<tr class="liste_titre"><td>';
|
||||||
print $graphfiles[$key]['label'];
|
print $graphfiles[$key]['label'];
|
||||||
print '</td>';
|
print ' ('.$graphfiles[$key]['total'].')</td>';
|
||||||
print '<td align="right">'.$linktoregenerate.'</td>';
|
print '<td align="right">'.$linktoregenerate.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
// Image
|
// Image
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user