diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index dbbb444a1f7..e329a2440dc 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -54,7 +54,24 @@ $offset = $conf->liste_limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; - +$sql = "SELECT c.cotisation, ".$db->pdate("c.dateadh")." as dateadh"; +$sql .= " FROM llx_adherent as d, llx_cotisation as c"; +$sql .= " WHERE d.rowid = c.fk_adherent"; +if(isset($date_select) && $date_select != ''){ + $sql .= " AND dateadh LIKE '$date_select%'"; +} +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows(); + $i = 0; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $Total[strftime("%Y",$objp->dateadh)]+=price($objp->cotisation); + $i++; + } +} $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, c.cotisation, ".$db->pdate("c.dateadh")." as dateadh"; $sql .= " FROM llx_adherent as d, llx_cotisation as c"; $sql .= " WHERE d.rowid = c.fk_adherent"; @@ -70,6 +87,19 @@ if ($result) $i = 0; print_barre_liste("Liste des cotisations", $page, $PHP_SELF, "&statut=$statut"); + + print "\n"; + print ''; + print ""; + print ""; + // print ""; + print "\n"; + foreach ($Total as $key=>$value){ + $var=!$var; + print "\n"; + } + print "
AnneeMontantPrenom Nom / Société
$key".price($value)."

\n"; + print ""; print ''; @@ -87,7 +117,7 @@ if ($result) print ""; print "\n"; print ''; - $Total[strftime("%Y",$objp->dateadh)]+=price($objp->cotisation); + //$Total[strftime("%Y",$objp->dateadh)]+=price($objp->cotisation); $total+=price($objp->cotisation); print "\n"; print ""; @@ -102,17 +132,7 @@ if ($result) print "
rowid&action=edit\">".strftime("%d %B %Y",$objp->dateadh)."'.price($objp->cotisation).'rowid&action=edit\">".stripslashes($objp->prenom)." ".stripslashes($objp->nom)." / ".stripslashes($objp->societe)."
"; print "
\n"; - print "\n"; - print ''; - print ""; - print ""; - // print ""; - print "\n"; - foreach ($Total as $key=>$value){ - $var=!$var; - print "\n"; - } - print "
AnneeMontantPrenom Nom / Société
$key".price($value)."
"; + } else {