NEW : Statistic page donation (#28463)
* v1 statistic page don * add link * fix phpstan * fix * fix * Update index.php --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
74ecd5c660
commit
595d735fee
4 changed files with 185 additions and 97 deletions
|
|
@ -1547,6 +1547,7 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen
|
|||
$newmenu->add("/don/card.php?leftmenu=donations&action=create", $langs->trans("NewDonation"), 1, $user->hasRight('don', 'creer'));
|
||||
$newmenu->add("/don/list.php?leftmenu=donations", $langs->trans("List"), 1, $user->hasRight('don', 'lire'));
|
||||
$newmenu->add("/don/paiement/list.php?leftmenu=donations", $langs->trans("Payments"), 1, $user->hasRight('don', 'lire'));
|
||||
$newmenu->add("/don/stats/index.php", $langs->trans("Statistics"), 1, $user->hasRight('don', 'lire'));
|
||||
}
|
||||
// if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->hasRight('don', 'lire'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php';
|
|||
include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage donations statistics
|
||||
*/
|
||||
|
|
@ -57,6 +56,10 @@ class DonationStats extends Stats
|
|||
*/
|
||||
public $where;
|
||||
|
||||
/**
|
||||
* @var string JOIN
|
||||
*/
|
||||
public $join;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -65,8 +68,10 @@ class DonationStats extends Stats
|
|||
* @param int $socid Id third party for filter
|
||||
* @param string $mode Option (not used)
|
||||
* @param int $userid Id user for filter (creation user)
|
||||
* @param int $typentid Id of type of third party for filter
|
||||
* @param int $status Status of donation for filter
|
||||
*/
|
||||
public function __construct($db, $socid, $mode, $userid = 0)
|
||||
public function __construct($db, $socid, $mode, $userid = 0, $typentid = 0, $status = 4)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
|
@ -76,17 +81,31 @@ class DonationStats extends Stats
|
|||
$this->socid = ($socid > 0 ? $socid : 0);
|
||||
$this->userid = $userid;
|
||||
$this->cachefilesuffix = $mode;
|
||||
$this->join = '';
|
||||
|
||||
if ($status == 0 || $status == 1 || $status == 2) {
|
||||
$this->where = ' d.fk_statut IN ('.$db->sanitize($status).')';
|
||||
} elseif ($status == 3) {
|
||||
$this->where = ' d.fk_statut IN (-1)';
|
||||
} elseif ($status == 4) {
|
||||
$this->where = ' d.fk_statut >= 0';
|
||||
}
|
||||
|
||||
$object = new Don($this->db);
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as d";
|
||||
//$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
//$this->field='weight'; // Warning, unit of weight is NOT USED AND MUST BE
|
||||
$this->where .= " d.fk_statut > 0"; // Not draft and not cancelled
|
||||
|
||||
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
|
||||
if ($socid !== "-1" && $socid > 0) {
|
||||
$this->where .= " AND d.fk_soc = ".((int) $socid);
|
||||
}
|
||||
|
||||
$this->where .= " AND d.entity = ".$conf->entity;
|
||||
if ($this->userid > 0) {
|
||||
$this->where .= ' WHERE c.fk_user_author = '.((int) $this->userid);
|
||||
$this->where .= ' AND d.fk_user_author = '.((int) $this->userid);
|
||||
}
|
||||
|
||||
if ($typentid) {
|
||||
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = d.fk_soc';
|
||||
$this->where .= ' AND s.fk_typent = '.((int) $typentid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,13 +120,13 @@ class DonationStats extends Stats
|
|||
{
|
||||
$sql = "SELECT date_format(d.datedon,'%m') as dm, COUNT(*) as nb";
|
||||
$sql .= " FROM ".$this->from;
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE d.datedon BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res = $this->_getNbByMonth($year, $sql, $format);
|
||||
return $res;
|
||||
return $this->_getNbByMonth($year, $sql, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -120,6 +139,7 @@ class DonationStats extends Stats
|
|||
{
|
||||
$sql = "SELECT date_format(d.datedon,'%Y') as dm, COUNT(*) as nb, SUM(d.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
|
@ -138,6 +158,7 @@ class DonationStats extends Stats
|
|||
{
|
||||
$sql = "SELECT date_format(d.datedon,'%m') as dm, sum(d.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".dolSqlDateFilter('d.datedon', 0, 0, (int) $year, 1);
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
|
|
@ -156,6 +177,7 @@ class DonationStats extends Stats
|
|||
{
|
||||
$sql = "SELECT date_format(d.datedon,'%m') as dm, avg(d.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".dolSqlDateFilter('d.datedon', 0, 0, (int) $year, 1);
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
|
|
@ -173,6 +195,7 @@ class DonationStats extends Stats
|
|||
{
|
||||
$sql = "SELECT date_format(d.datedon,'%Y') as year, COUNT(*) as nb, SUM(d.".$this->field.") as total, AVG(".$this->field.") as avg";
|
||||
$sql .= " FROM ".$this->from;
|
||||
$sql .= $this->join;
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY year";
|
||||
$sql .= $this->db->order('year', 'DESC');
|
||||
|
|
|
|||
|
|
@ -29,10 +29,16 @@ require '../../main.inc.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/donstats.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
if (isModEnabled('category')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
}
|
||||
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
|
||||
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs("donations");
|
||||
|
||||
$userid = GETPOSTINT('userid');
|
||||
$socid = GETPOSTINT('socid');
|
||||
// Security check
|
||||
|
|
@ -41,44 +47,44 @@ if ($user->socid > 0) {
|
|||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$status = GETPOSTINT('status');
|
||||
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
|
||||
$typent_id = GETPOSTINT('typent_id');
|
||||
$year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear;
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
|
||||
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
|
||||
$endyear = $year;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "other", "sendings"));
|
||||
$mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
|
||||
$custcats = GETPOST('custcats', 'array');
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'don');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$title = $langs->trans("DonationsStatistics");
|
||||
llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-donation page-stats');
|
||||
$formcompany = new FormCompany($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("DonationsStatistics"), $mesg);
|
||||
llxHeader();
|
||||
|
||||
$dir = $conf->don->dir_temp;
|
||||
|
||||
print load_fiche_titre($langs->trans("DonationsStatistics"), '', 'donation');
|
||||
|
||||
dol_mkdir($dir);
|
||||
|
||||
$stats = new DonationStats($db, $socid, '', ($userid > 0 ? $userid : 0));
|
||||
$stats = new DonationStats($db, $socid, '', ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($status > 0 ? $status : 4));
|
||||
|
||||
if (is_array($custcats) && !empty($custcats)) {
|
||||
$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cat ON (d.fk_soc = cat.fk_soc)';
|
||||
$stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $custcats)).')';
|
||||
}
|
||||
|
||||
// Build graphic number of object
|
||||
$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
|
||||
//var_dump($data);exit;
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
|
||||
if (!$user->hasRight('societe', 'client', 'voir')) {
|
||||
$filenamenb = $dir.'/donationnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
} else {
|
||||
$filenamenb = $dir.'/donationnbinyear-'.$year.'.png';
|
||||
}
|
||||
$filenamenb = $dir."/salariesnbinyear-".$year.".png";
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=donationStats&file=donationinyear-'.$year.'.png';
|
||||
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
|
|
@ -99,11 +105,67 @@ if (!$mesg) {
|
|||
$px1->SetShading(3);
|
||||
$px1->SetHorizTickIncrement(1);
|
||||
$px1->mode = 'depth';
|
||||
$px1->SetTitle($langs->trans("NumberOfDonationsByMonth"));
|
||||
$px1->SetTitle($langs->trans("NumberByMonth"));
|
||||
|
||||
$px1->draw($filenamenb, $fileurlnb);
|
||||
}
|
||||
|
||||
$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
$filenameamount = $dir."/donationamount-".$year.".png";
|
||||
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=donationStats&file=donationamoutinyear-'.$year.'.png';
|
||||
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (!$mesg) {
|
||||
$px2->SetData($data);
|
||||
$i=$startyear;$legend=array();
|
||||
while ($i <= $endyear) {
|
||||
$legend[]=$i;
|
||||
$i++;
|
||||
}
|
||||
$px2->SetLegend($legend);
|
||||
$px2->SetMaxValue($px2->GetCeilMaxValue());
|
||||
$px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
|
||||
$px2->SetWidth($WIDTH);
|
||||
$px2->SetHeight($HEIGHT);
|
||||
$px2->SetYLabel($langs->trans("Amount"));
|
||||
$px2->SetShading(3);
|
||||
$px2->SetHorizTickIncrement(1);
|
||||
$px2->mode='depth';
|
||||
$px2->SetTitle($langs->trans("AmountTotal"));
|
||||
|
||||
$px2->draw($filenameamount, $fileurlamount);
|
||||
}
|
||||
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
$filename_avg = $dir."/donationaverage-".$year.".png";
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=donationStats&file=donationaverageinyear-'.$year.'.png';
|
||||
|
||||
$px3 = new DolGraph();
|
||||
$mesg = $px3->isGraphKo();
|
||||
if (!$mesg) {
|
||||
$px3->SetData($data);
|
||||
$i = $startyear;
|
||||
$legend = array();
|
||||
while ($i <= $endyear) {
|
||||
$legend[] = $i;
|
||||
$i++;
|
||||
}
|
||||
$px3->SetLegend($legend);
|
||||
$px3->SetYLabel($langs->trans("AmountAverage"));
|
||||
$px3->SetMaxValue($px3->GetCeilMaxValue());
|
||||
$px3->SetMinValue($px3->GetFloorMinValue());
|
||||
$px3->SetWidth($WIDTH);
|
||||
$px3->SetHeight($HEIGHT);
|
||||
$px3->SetShading(3);
|
||||
$px3->SetHorizTickIncrement(1);
|
||||
$px3->mode = 'depth';
|
||||
$px3->SetTitle($langs->trans("AmountAverage"));
|
||||
|
||||
$px3->draw($filename_avg, $fileurl_avg);
|
||||
}
|
||||
|
||||
// Show array
|
||||
$data = $stats->getAllByYear();
|
||||
|
|
@ -133,33 +195,62 @@ print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
|
|||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
|
||||
// Company
|
||||
print '<tr><td class="left">'.$langs->trans("ThirdParty").'</td><td class="left">';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||
print $form->select_company($socid, 'socid', '', 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300', '');
|
||||
if (empty(!$conf->global->DONATION_USE_THIRDPARTIES)) {
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||
print $form->select_company($socid, 'socid', '', 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300', '');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// ThirdParty Type
|
||||
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
|
||||
$sortparam_typent = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT);
|
||||
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
|
||||
if ($user->admin) {
|
||||
print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Category
|
||||
if (isModEnabled('category')) {
|
||||
$cat_type = Categorie::TYPE_CUSTOMER;
|
||||
$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer"));
|
||||
print '<tr><td>'.$cat_label.'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories($cat_type, null, 'parent', null, null, 1);
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"');
|
||||
print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// User
|
||||
print '<tr><td class="left">'.$langs->trans("CreatedBy").'</td><td class="left">';
|
||||
print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
|
||||
print img_picto('', 'user', 'class="pictofixedwidth"');
|
||||
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||
$liststatus = array(
|
||||
'2' => $langs->trans("DonationStatusPaid"),
|
||||
'0' => $langs->trans("DonationStatusPromiseNotValidated"),
|
||||
'1' => $langs->trans("DonationStatusPromiseValidated"),
|
||||
'3' => $langs->trans("Canceled")
|
||||
);
|
||||
print $form->selectarray('status', $liststatus, 4, 1);
|
||||
|
||||
// Year
|
||||
print '<tr><td class="left">'.$langs->trans("Year").'</td><td class="left">';
|
||||
if (!in_array($year, $arrayyears)) {
|
||||
$arrayyears[$year] = $year;
|
||||
}
|
||||
if (!in_array($nowyear, $arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="center" colspan="2"><input type="submit" name="submit" class="button small" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
|
@ -167,33 +258,46 @@ print '</form>';
|
|||
print '<br><br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="border centpercent">';
|
||||
print '<tr height="24">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre" height="24">';
|
||||
print '<td class="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td class="right">'.$langs->trans("NbOfDonations").'</td>';
|
||||
/*print '<td class="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td class="center">'.$langs->trans("AmountAverage").'</td>';*/
|
||||
print '<td class="right">%</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td class="right">%</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td class="right">%</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear = 0;
|
||||
foreach ($data as $val) {
|
||||
$year = $val['year'];
|
||||
while (!empty($year) && $oldyear > $year + 1) { // If we have empty year
|
||||
while (!empty($year) && $oldyear > $year + 1) {
|
||||
$oldyear--;
|
||||
print '<tr height="24">';
|
||||
print '<tr class="oddeven" height="24">';
|
||||
print '<td class="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'">'.$oldyear.'</a></td>';
|
||||
|
||||
print '<td class="right">0</td>';
|
||||
/*print '<td class="right">0</td>';
|
||||
print '<td class="right">0</td>';*/
|
||||
print '<td class="right"></td>';
|
||||
print '<td class="right amount">0</td>';
|
||||
print '<td class="right"></td>';
|
||||
print '<td class="right amount">0</td>';
|
||||
print '<td class="right"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '<tr height="24">';
|
||||
print '<td class="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'">'.$year.'</a></td>';
|
||||
$greennb = (empty($val['nb_diff']) || $val['nb_diff'] >= 0);
|
||||
$greentotal = (empty($val['total_diff']) || $val['total_diff'] >= 0);
|
||||
$greenavg = (empty($val['avg_diff']) || $val['avg_diff'] >= 0);
|
||||
|
||||
print '<tr class="oddeven" height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>';
|
||||
print '<td class="right">'.$val['nb'].'</td>';
|
||||
/*print '<td class="right">'.price(price2num($val['total'],'MT'),1).'</td>';
|
||||
print '<td class="right">'.price(price2num($val['avg'],'MT'),1).'</td>';*/
|
||||
print '<td class="right opacitylow" style="'.($greennb ? 'color: green;' : 'color: red;').'">'.(!empty($val['nb_diff']) && $val['nb_diff'] < 0 ? '' : '+').round(!empty($val['nb_diff']) ? $val['nb_diff'] : 0).'%</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num($val['total'], 'MT'), 1).'</span></td>';
|
||||
print '<td class="right opacitylow" style="'.($greentotal ? 'color: green;' : 'color: red;').'">'.( !empty($val['total_diff']) && $val['total_diff'] < 0 ? '' : '+').round(!empty($val['total_diff']) ? $val['total_diff'] : 0).'%</td>';
|
||||
print '<td class="right"><span class="amount">'.price(price2num($val['avg'], 'MT'), 1).'</span></td>';
|
||||
print '<td class="right opacitylow" style="'.($greenavg ? 'color: green;' : 'color: red;').'">'.(!empty($val['avg_diff']) && $val['avg_diff'] < 0 ? '' : '+').round(!empty($val['avg_diff']) ? $val['avg_diff'] : 0).'%</td>';
|
||||
print '</tr>';
|
||||
$oldyear = $year;
|
||||
}
|
||||
|
|
@ -201,10 +305,8 @@ foreach ($data as $val) {
|
|||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
|
||||
|
||||
// Show graphs
|
||||
print '<table class="border centpercent"><tr class="pair nohover"><td class="center">';
|
||||
if ($mesg) {
|
||||
|
|
@ -212,55 +314,16 @@ if ($mesg) {
|
|||
} else {
|
||||
print $px1->show();
|
||||
print "<br>\n";
|
||||
/*print $px2->show();
|
||||
print $px2->show();
|
||||
print "<br>\n";
|
||||
print $px3->show();*/
|
||||
print $px3->show();
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</div></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
|
||||
// TODO USe code similar to commande/stats/index.php instead of this one.
|
||||
/*
|
||||
print '<table class="border centpercent">';
|
||||
print '<tr><td class="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td width="40%" class="center">'.$langs->trans("NbOfSendings").'</td></tr>';
|
||||
|
||||
$sql = "SELECT count(*) as nb, date_format(date_expedition,'%Y') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expedition";
|
||||
$sql.= " WHERE fk_statut > 0";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$nbproduct = $row[0];
|
||||
$year = $row[1];
|
||||
print "<tr>";
|
||||
print '<td class="center"><a href="month.php?year='.$year.'">'.$year.'</a></td><td class="center">'.$nbproduct.'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
print '</table>';
|
||||
*/
|
||||
|
||||
print '<br>';
|
||||
print '<i>'.$langs->trans("StatsOnDonationsOnlyValidated").'</i>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
|
|
|||
|
|
@ -35,3 +35,4 @@ DonationPayments=Donation payments
|
|||
DonationValidated=Donation %s validated
|
||||
DonationUseThirdparties=Use the address of an existing thirdparty as the address of the donor
|
||||
DonationsStatistics=Donation's statistics
|
||||
NbOfDonations=Number of donations
|
||||
|
|
|
|||
Loading…
Reference in a new issue