|
@@ -1,8 +1,8 @@
|
|
|
<?php
|
|
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
- * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
|
|
- * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
- * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
|
|
+ * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
|
|
+ * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
+ * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
|
|
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
|
|
* Copyright (C) 2021 Frédéric France <frederic.france@netlgic.fr>
|
|
|
*
|
|
@@ -82,6 +82,7 @@ print load_fiche_titre($langs->trans("MembersArea"), $resultboxes['selectboxlist
|
|
|
$MembersValidated = array();
|
|
|
$MembersToValidate = array();
|
|
|
$MembersUpToDate = array();
|
|
|
+$MembersExcluded = array();
|
|
|
$MembersResiliated = array();
|
|
|
|
|
|
$AdherentType = array();
|
|
@@ -116,6 +117,9 @@ if ($result) {
|
|
|
if ($objp->statut == 1) {
|
|
|
$MembersValidated[$objp->rowid] = $objp->somme;
|
|
|
}
|
|
|
+ if ($objp->statut == -2) {
|
|
|
+ $MembersExcluded[$objp->rowid] = $objp->somme;
|
|
|
+ }
|
|
|
if ($objp->statut == 0) {
|
|
|
$MembersResiliated[$objp->rowid] = $objp->somme;
|
|
|
}
|
|
@@ -195,9 +199,10 @@ if ($conf->use_javascript_ajax) {
|
|
|
|
|
|
$SumToValidate = 0;
|
|
|
$SumValidated = 0;
|
|
|
-
|
|
|
$SumUpToDate = 0;
|
|
|
$SumResiliated = 0;
|
|
|
+ $SumExcluded = 0;
|
|
|
+
|
|
|
$total = 0;
|
|
|
$dataval = array();
|
|
|
$i = 0;
|
|
@@ -205,17 +210,21 @@ if ($conf->use_javascript_ajax) {
|
|
|
$dataval['draft'][] = array($i, isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0);
|
|
|
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0);
|
|
|
$dataval['uptodate'][] = array($i, isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0);
|
|
|
+ $dataval['excluded'][] = array($i, isset($MembersExcluded[$key]) ? $MembersExcluded[$key] : 0);
|
|
|
$dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
|
|
|
+
|
|
|
$SumToValidate += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0;
|
|
|
$SumValidated += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0;
|
|
|
$SumUpToDate += isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0;
|
|
|
+ $SumExcluded += isset($MembersExcluded[$key]) ? $MembersExcluded [$key] : 0;
|
|
|
$SumResiliated += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
|
|
|
$i++;
|
|
|
}
|
|
|
- $total = $SumToValidate + $SumValidated + $SumUpToDate + $SumResiliated;
|
|
|
+ $total = $SumToValidate + $SumValidated + $SumUpToDate + $SumExcluded + $SumResiliated;
|
|
|
$dataseries = array();
|
|
|
$dataseries[] = array($langs->transnoentitiesnoconv("OutOfDate"), round($SumValidated));
|
|
|
$dataseries[] = array($langs->transnoentitiesnoconv("UpToDate"), round($SumUpToDate));
|
|
|
+ $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), round($SumExcluded));
|
|
|
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SumResiliated));
|
|
|
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SumToValidate));
|
|
|
|
|
@@ -224,7 +233,7 @@ if ($conf->use_javascript_ajax) {
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
|
|
$dolgraph = new DolGraph();
|
|
|
$dolgraph->SetData($dataseries);
|
|
|
- $dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, $badgeStatus6, '-'.$badgeStatus0));
|
|
|
+ $dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, '-'.$badgeStatus8, $badgeStatus6, '-'.$badgeStatus0));
|
|
|
$dolgraph->setShowLegend(2);
|
|
|
$dolgraph->setShowPercent(1);
|
|
|
$dolgraph->SetType(array('pie'));
|
|
@@ -234,7 +243,7 @@ if ($conf->use_javascript_ajax) {
|
|
|
|
|
|
$boxgraph .= '</td></tr>';
|
|
|
$boxgraph .= '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
|
|
|
- $boxgraph .= $SumToValidate + $SumValidated + $SumUpToDate + $SumResiliated;
|
|
|
+ $boxgraph .= $SumToValidate + $SumValidated + $SumUpToDate + $SumExcluded + $SumResiliated;
|
|
|
$boxgraph .= '</td></tr>';
|
|
|
$boxgraph .= '</table>';
|
|
|
$boxgraph .= '</div>';
|
|
@@ -251,250 +260,12 @@ print '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
|
|
|
print $searchbox;
|
|
|
print $boxgraph;
|
|
|
|
|
|
-// List of subscription by year
|
|
|
-$Total = array();
|
|
|
-$Number = array();
|
|
|
-$tot = 0;
|
|
|
-$numb = 0;
|
|
|
-
|
|
|
-$sql = "SELECT c.subscription, c.dateadh as dateh";
|
|
|
-$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
|
|
|
-$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
|
|
|
-$sql .= " AND d.rowid = c.fk_adherent";
|
|
|
-
|
|
|
-
|
|
|
-$result = $db->query($sql);
|
|
|
-if ($result) {
|
|
|
- $num = $db->num_rows($result);
|
|
|
- $i = 0;
|
|
|
- while ($i < $num) {
|
|
|
- $objp = $db->fetch_object($result);
|
|
|
- $year = dol_print_date($db->jdate($objp->dateh), "%Y");
|
|
|
- $Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
|
|
|
- $Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
|
|
|
- $tot += $objp->subscription;
|
|
|
- $numb += 1;
|
|
|
- $i++;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-print '<div class="div-table-responsive-no-min">';
|
|
|
-print '<table class="noborder centpercent">';
|
|
|
-print '<tr class="liste_titre">';
|
|
|
-print '<th>'.$langs->trans("Year").'</th>';
|
|
|
-print '<th class="right">'.$langs->trans("Subscriptions").'</th>';
|
|
|
-print '<th class="right">'.$langs->trans("AmountTotal").'</th>';
|
|
|
-print '<th class="right">'.$langs->trans("AmountAverage").'</th>';
|
|
|
-print "</tr>\n";
|
|
|
-
|
|
|
-krsort($Total);
|
|
|
-$i = 0;
|
|
|
-foreach ($Total as $key=>$value) {
|
|
|
- if ($i >= 8) {
|
|
|
- print '<tr class="oddeven">';
|
|
|
- print "<td>...</td>";
|
|
|
- print "<td class=\"right\"></td>";
|
|
|
- print "<td class=\"right\"></td>";
|
|
|
- print "<td class=\"right\"></td>";
|
|
|
- print "</tr>\n";
|
|
|
- break;
|
|
|
- }
|
|
|
- print '<tr class="oddeven">';
|
|
|
- print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
|
|
|
- print "<td class=\"right\">".$Number[$key]."</td>";
|
|
|
- print "<td class=\"right\">".price($value)."</td>";
|
|
|
- print "<td class=\"right\">".price(price2num($value / $Number[$key], 'MT'))."</td>";
|
|
|
- print "</tr>\n";
|
|
|
- $i++;
|
|
|
-}
|
|
|
-
|
|
|
-// Total
|
|
|
-print '<tr class="liste_total">';
|
|
|
-print '<td>'.$langs->trans("Total").'</td>';
|
|
|
-print "<td class=\"right\">".$numb."</td>";
|
|
|
-print '<td class="right">'.price($tot)."</td>";
|
|
|
-print "<td class=\"right\">".price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT'))."</td>";
|
|
|
-print "</tr>\n";
|
|
|
-print "</table></div>";
|
|
|
-
|
|
|
-print "<br>\n";
|
|
|
-
|
|
|
print $resultboxes['boxlista'];
|
|
|
|
|
|
print '</div>'."\n";
|
|
|
|
|
|
print '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
|
|
|
|
|
|
-/*
|
|
|
- * Latest modified members
|
|
|
- */
|
|
|
-$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
|
|
-
|
|
|
-$sql = "SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
|
|
-$sql .= " a.gender, a.email, a.photo, a.morphy,";
|
|
|
-$sql .= " a.tms as datem, a.datefin as date_end_subscription,";
|
|
|
-$sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription";
|
|
|
-$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
|
|
|
-$sql .= " WHERE a.entity IN (".getEntity('adherent').")";
|
|
|
-$sql .= " AND a.fk_adherent_type = ta.rowid";
|
|
|
-$sql .= $db->order("a.tms", "DESC");
|
|
|
-$sql .= $db->plimit($max, 0);
|
|
|
-
|
|
|
-$resql = $db->query($sql);
|
|
|
-if ($resql) {
|
|
|
- print '<div class="div-table-responsive-no-min">';
|
|
|
- print '<table class="noborder centpercent">';
|
|
|
- print '<tr class="liste_titre">';
|
|
|
- print '<th colspan="4">'.$langs->trans("LastMembersModified", $max).'</th></tr>';
|
|
|
-
|
|
|
- $num = $db->num_rows($resql);
|
|
|
- if ($num) {
|
|
|
- $i = 0;
|
|
|
- while ($i < $num) {
|
|
|
- $obj = $db->fetch_object($resql);
|
|
|
-
|
|
|
- $staticmember->id = $obj->rowid;
|
|
|
- $staticmember->ref = $obj->rowid;
|
|
|
- $staticmember->lastname = $obj->lastname;
|
|
|
- $staticmember->firstname = $obj->firstname;
|
|
|
- $staticmember->gender = $obj->gender;
|
|
|
- $staticmember->email = $obj->email;
|
|
|
- $staticmember->photo = $obj->photo;
|
|
|
- $staticmember->morphy = $obj->morphy;
|
|
|
- $staticmember->statut = $obj->status;
|
|
|
- $staticmember->need_subscription = $obj->need_subscription;
|
|
|
- $staticmember->datefin = $db->jdate($obj->date_end_subscription);
|
|
|
- if (!empty($obj->fk_soc)) {
|
|
|
- $staticmember->fk_soc = $obj->fk_soc;
|
|
|
- $staticmember->fetch_thirdparty();
|
|
|
- $staticmember->name = $staticmember->thirdparty->name;
|
|
|
- } else {
|
|
|
- $staticmember->name = $obj->company;
|
|
|
- }
|
|
|
-
|
|
|
- $statictype->id = $obj->typeid;
|
|
|
- $statictype->label = $obj->label;
|
|
|
- $statictype->subscription = $obj->need_subscription;
|
|
|
-
|
|
|
- print '<tr class="oddeven">';
|
|
|
- print '<td class="nowraponall">'.$staticmember->getNomUrl(-1, 32).'</td>';
|
|
|
- print '<td>'.$statictype->getNomUrl(1, 32).'</td>';
|
|
|
- print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>';
|
|
|
- print '<td class="right">'.$staticmember->getLibStatut(3).'</td>';
|
|
|
- print '</tr>';
|
|
|
- $i++;
|
|
|
- }
|
|
|
- }
|
|
|
- print "</table></div>";
|
|
|
- print "<br>";
|
|
|
-} else {
|
|
|
- dol_print_error($db);
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-/*
|
|
|
- * Last modified subscriptions
|
|
|
- */
|
|
|
-$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
|
|
-
|
|
|
-$sql = "SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
|
|
-$sql .= " a.gender, a.email, a.photo, a.morphy,";
|
|
|
-$sql .= " a.datefin as date_end_subscription,";
|
|
|
-$sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription,";
|
|
|
-$sql .= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription";
|
|
|
-$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta, ".MAIN_DB_PREFIX."subscription as c";
|
|
|
-$sql .= " WHERE a.entity IN (".getEntity('adherent').")";
|
|
|
-$sql .= " AND a.fk_adherent_type = ta.rowid";
|
|
|
-$sql .= " AND c.fk_adherent = a.rowid";
|
|
|
-$sql .= $db->order("c.tms", "DESC");
|
|
|
-$sql .= $db->plimit($max, 0);
|
|
|
-
|
|
|
-$resql = $db->query($sql);
|
|
|
-if ($resql) {
|
|
|
- print '<div class="div-table-responsive-no-min">';
|
|
|
- print '<table class="noborder centpercent">';
|
|
|
- print '<tr class="liste_titre">';
|
|
|
- print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified", $max).'</th></tr>';
|
|
|
-
|
|
|
- $num = $db->num_rows($resql);
|
|
|
- if ($num) {
|
|
|
- $i = 0;
|
|
|
- while ($i < $num) {
|
|
|
- $obj = $db->fetch_object($resql);
|
|
|
-
|
|
|
- $staticmember->id = $obj->rowid;
|
|
|
- $staticmember->ref = $obj->rowid;
|
|
|
- $staticmember->lastname = $obj->lastname;
|
|
|
- $staticmember->firstname = $obj->firstname;
|
|
|
- $staticmember->gender = $obj->gender;
|
|
|
- $staticmember->email = $obj->email;
|
|
|
- $staticmember->photo = $obj->photo;
|
|
|
- $staticmember->morphy = $obj->morphy;
|
|
|
- $staticmember->statut = $obj->status;
|
|
|
- $staticmember->need_subscription = $obj->need_subscription;
|
|
|
- $staticmember->datefin = $db->jdate($obj->date_end_subscription);
|
|
|
- if (!empty($obj->fk_soc)) {
|
|
|
- $staticmember->fk_soc = $obj->fk_soc;
|
|
|
- $staticmember->fetch_thirdparty();
|
|
|
- $staticmember->name = $staticmember->thirdparty->name;
|
|
|
- } else {
|
|
|
- $staticmember->name = $obj->company;
|
|
|
- }
|
|
|
-
|
|
|
- $subscriptionstatic->id = $obj->cid;
|
|
|
- $subscriptionstatic->ref = $obj->cid;
|
|
|
-
|
|
|
- print '<tr class="oddeven">';
|
|
|
- print '<td class="nowraponall">'.$subscriptionstatic->getNomUrl(1).'</td>';
|
|
|
- print '<td class="nowraponall">'.$staticmember->getNomUrl(-1, 32, 'subscription').'</td>';
|
|
|
- print '<td class="nowraponall">'.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).'</td>';
|
|
|
- print '<td class="right">'.price($obj->subscription).'</td>';
|
|
|
- //print '<td class="right">'.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
|
|
|
- print '<td class="right nowraponall">'.dol_print_date($db->jdate($obj->datem ? $obj->datem : $obj->datec), 'dayhour').'</td>';
|
|
|
- print '</tr>';
|
|
|
- $i++;
|
|
|
- }
|
|
|
- }
|
|
|
- print "</table></div>";
|
|
|
- print "<br>";
|
|
|
-} else {
|
|
|
- dol_print_error($db);
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-// Summary of members by type
|
|
|
-print '<div class="div-table-responsive-no-min">';
|
|
|
-print '<table class="noborder centpercent">';
|
|
|
-print '<tr class="liste_titre">';
|
|
|
-print '<th>'.$langs->trans("MembersTypes").'</th>';
|
|
|
-print '<th class=right>'.$langs->trans("MembersStatusToValid").'</th>';
|
|
|
-print '<th class=right>'.$langs->trans("OutOfDate").'</th>';
|
|
|
-print '<th class=right>'.$langs->trans("UpToDate").'</th>';
|
|
|
-print '<th class=right>'.$langs->trans("MembersStatusResiliated").'</th>';
|
|
|
-print "</tr>\n";
|
|
|
-
|
|
|
-foreach ($AdherentType as $key => $adhtype) {
|
|
|
- print '<tr class="oddeven">';
|
|
|
- print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
|
|
|
- print '<td class="right">'.(isset($MembersToValidate[$key]) && $MembersToValidate[$key] > 0 ? $MembersToValidate[$key] : '').' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>';
|
|
|
- print '<td class="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).'</td>';
|
|
|
- print '<td class="right">'.(isset($MembersUpToDate[$key]) && $MembersUpToDate[$key] > 0 ? $MembersUpToDate[$key] : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).'</td>';
|
|
|
- print '<td class="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '').' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'</td>';
|
|
|
- print "</tr>\n";
|
|
|
-}
|
|
|
-print '<tr class="liste_total">';
|
|
|
-print '<td class="liste_total">'.$langs->trans("Total").'</td>';
|
|
|
-print '<td class="liste_total right">'.$SumToValidate.' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>';
|
|
|
-print '<td class="liste_total right">'.$SumValidated.' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).'</td>';
|
|
|
-print '<td class="liste_total right">'.$SumUpToDate.' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).'</td>';
|
|
|
-print '<td class="liste_total right">'.$SumResiliated.' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'</td>';
|
|
|
-print '</tr>';
|
|
|
-
|
|
|
-print "</table>\n";
|
|
|
-print "</div>";
|
|
|
-
|
|
|
-print '<br>';
|
|
|
-
|
|
|
print $resultboxes['boxlistb'];
|
|
|
|
|
|
print '</div>'."\n";
|