72 global $user, $langs, $conf;
73 $langs->loadLangs(array(
"boxes",
"members"));
77 include_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent.class.php';
78 require_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent_type.class.php';
79 $memberstatic =
new Adherent($this->db);
82 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleMembersSubscriptionsByYear", $max));
84 if ($user->hasRight(
'adherent',
'lire')) {
93 $sql =
"SELECT c.subscription, c.dateadh as dateh";
94 $sql .=
" FROM " . MAIN_DB_PREFIX .
"adherent as d, " . MAIN_DB_PREFIX .
"subscription as c";
95 $sql .=
" WHERE d.entity IN (" .
getEntity(
'adherent') .
")";
96 $sql .=
" AND d.rowid = c.fk_adherent";
99 $result = $this->db->query($sql);
101 $num = $this->db->num_rows($result);
104 $objp = $this->db->fetch_object($result);
106 $Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
107 $Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
108 $tot += $objp->subscription;
115 $this->info_box_contents[$line][] = array(
117 'text' => $langs->trans(
"Year"),
119 $this->info_box_contents[$line][] = array(
120 'td' =>
'class="right"',
121 'text' => $langs->trans(
"Subscriptions"),
123 $this->info_box_contents[$line][] = array(
124 'td' =>
'class="right"',
125 'text' => $langs->trans(
"AmountTotal"),
127 $this->info_box_contents[$line][] = array(
128 'td' =>
'class="right"',
129 'text' => $langs->trans(
"AmountAverage"),
136 foreach ($Total as $key => $value) {
144 $this->info_box_contents[$line][] = array(
145 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
148 $this->info_box_contents[$line][] = array(
149 'td' =>
'class="right"',
152 $this->info_box_contents[$line][] = array(
153 'td' =>
'class="right"',
156 $this->info_box_contents[$line][] = array(
157 'td' =>
'class="right"',
163 $this->info_box_contents[$line][] = array(
164 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
165 'text' =>
'<a href="./subscription/list.php?date_select='.$key.
'">'.$key.
'</a>',
168 $this->info_box_contents[$line][] = array(
169 'td' =>
'class="right"',
170 'text' => $Number[$key],
172 $this->info_box_contents[$line][] = array(
173 'td' =>
'class="nowraponall right amount"',
174 'text' =>
price($value),
176 $this->info_box_contents[$line][] = array(
177 'td' =>
'class="nowraponall right amount"',
184 $this->info_box_contents[$line][0] = array(
185 'td' =>
'colspan="4" class="center"',
186 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"NoRecordedMembers").
'</span>',
189 $this->info_box_contents[$line][] = array(
190 'tr' =>
'class="liste_total"',
191 'td' =>
'class="liste_total"',
192 'text' => $langs->trans(
"Total"),
194 $this->info_box_contents[$line][] = array(
195 'td' =>
'class="liste_total right"',
198 $this->info_box_contents[$line][] = array(
199 'td' =>
'class="liste_total nowraponall right amount"',
200 'text' =>
price($tot),
202 $this->info_box_contents[$line][] = array(
203 'td' =>
'class="liste_total nowraponall right amount"',
208 $this->info_box_contents[0][0] = array(
211 'text' => ($this->db->error() .
' sql=' . $sql),
215 $this->info_box_contents[0][0] = array(
216 'td' =>
'class="nohover left"',
217 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'