2004-10-19 20:58:50 +02:00
|
|
|
<?php
|
2002-12-30 16:13:28 +01:00
|
|
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2004-07-31 15:34:32 +02:00
|
|
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
2009-03-09 11:27:21 +01:00
|
|
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
2002-12-30 16:13:28 +01:00
|
|
|
*
|
|
|
|
|
* 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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2002-12-30 16:13:28 +01:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2011-08-01 00:21:57 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2002-12-30 16:13:28 +01:00
|
|
|
*/
|
2004-08-14 14:37:59 +02:00
|
|
|
|
2005-04-02 22:36:17 +02:00
|
|
|
/**
|
2008-08-17 23:50:27 +02:00
|
|
|
* \file htdocs/adherents/cotisations.php
|
2009-10-10 18:00:35 +02:00
|
|
|
* \ingroup member
|
2008-08-17 23:50:27 +02:00
|
|
|
* \brief Page de consultation et insertion d'une cotisation
|
|
|
|
|
*/
|
2004-08-14 14:37:59 +02:00
|
|
|
|
2012-08-22 23:24:21 +02:00
|
|
|
require '../main.inc.php';
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
2005-01-12 21:53:29 +01:00
|
|
|
|
2010-05-02 19:05:07 +02:00
|
|
|
$langs->load("members");
|
2007-05-28 15:14:50 +02:00
|
|
|
|
2005-08-11 20:24:58 +02:00
|
|
|
$filter=$_GET["filter"];
|
|
|
|
|
$statut=isset($_GET["statut"])?$_GET["statut"]:1;
|
2002-12-30 16:13:28 +01:00
|
|
|
|
2010-11-20 14:08:44 +01:00
|
|
|
$sortfield = GETPOST("sortfield",'alpha');
|
|
|
|
|
$sortorder = GETPOST("sortorder",'alpha');
|
|
|
|
|
$page = GETPOST("page",'int');
|
2005-08-11 20:24:58 +02:00
|
|
|
if ($page == -1) { $page = 0 ; }
|
|
|
|
|
$offset = $conf->liste_limit * $page ;
|
|
|
|
|
$pageprev = $page - 1;
|
|
|
|
|
$pagenext = $page + 1;
|
2010-11-20 14:08:44 +01:00
|
|
|
if (! $sortorder) { $sortorder="DESC"; }
|
|
|
|
|
if (! $sortfield) { $sortfield="c.dateadh"; }
|
2005-01-12 21:53:29 +01:00
|
|
|
|
2007-05-28 15:14:50 +02:00
|
|
|
$msg='';
|
2005-08-11 20:24:58 +02:00
|
|
|
$date_select=isset($_GET["date_select"])?$_GET["date_select"]:$_POST["date_select"];
|
2002-12-30 16:13:28 +01:00
|
|
|
|
2013-01-10 08:27:12 +01:00
|
|
|
// Security check
|
|
|
|
|
$result=restrictedArea($user,'adherent','','','cotisation');
|
2007-06-01 23:27:51 +02:00
|
|
|
|
2002-12-30 16:13:28 +01:00
|
|
|
|
2007-05-28 15:14:50 +02:00
|
|
|
/*
|
2010-08-29 17:25:39 +02:00
|
|
|
* Actions
|
|
|
|
|
*/
|
2005-01-12 21:53:29 +01:00
|
|
|
|
|
|
|
|
|
2006-03-18 01:06:55 +01:00
|
|
|
/*
|
2009-08-12 14:59:14 +02:00
|
|
|
* View
|
2006-03-18 01:06:55 +01:00
|
|
|
*/
|
2002-12-30 16:13:28 +01:00
|
|
|
|
2009-08-12 14:59:14 +02:00
|
|
|
llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
2002-12-30 16:13:28 +01:00
|
|
|
|
2007-05-28 15:14:50 +02:00
|
|
|
if ($msg) print $msg.'<br>';
|
2002-12-30 16:13:28 +01:00
|
|
|
|
2005-08-11 20:24:58 +02:00
|
|
|
// Liste des cotisations
|
2013-02-23 15:26:39 +01:00
|
|
|
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe,";
|
2007-09-09 12:43:26 +02:00
|
|
|
$sql.= " c.rowid as crowid, c.cotisation,";
|
2010-04-20 21:00:17 +02:00
|
|
|
$sql.= " c.dateadh,";
|
|
|
|
|
$sql.= " c.datef,";
|
2007-09-09 12:43:26 +02:00
|
|
|
$sql.= " c.fk_bank as bank, c.note,";
|
2005-08-11 20:24:58 +02:00
|
|
|
$sql.= " b.fk_account";
|
|
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
|
|
|
|
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid";
|
|
|
|
|
$sql.= " WHERE d.rowid = c.fk_adherent";
|
2006-11-26 19:24:53 +01:00
|
|
|
if (isset($date_select) && $date_select != '')
|
2005-09-06 18:47:39 +02:00
|
|
|
{
|
2010-08-29 17:25:39 +02:00
|
|
|
$sql.= " AND dateadh LIKE '$date_select%'";
|
2003-02-28 18:18:04 +01:00
|
|
|
}
|
2010-04-20 21:00:17 +02:00
|
|
|
$sql.= $db->order($sortfield,$sortorder);
|
2006-11-26 19:24:53 +01:00
|
|
|
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
2002-12-30 16:13:28 +01:00
|
|
|
|
|
|
|
|
$result = $db->query($sql);
|
2009-03-09 11:27:21 +01:00
|
|
|
if ($result)
|
2002-12-30 16:13:28 +01:00
|
|
|
{
|
2005-09-06 18:47:39 +02:00
|
|
|
$num = $db->num_rows($result);
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
2009-03-09 11:27:21 +01:00
|
|
|
$title=$langs->trans("ListOfSubscriptions");
|
|
|
|
|
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
|
2013-07-10 23:57:18 +02:00
|
|
|
|
|
|
|
|
$param="";
|
2006-11-26 19:24:53 +01:00
|
|
|
$param.="&statut=$statut&date_select=$date_select";
|
2010-08-29 17:25:39 +02:00
|
|
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num);
|
2006-11-26 19:24:53 +01:00
|
|
|
|
|
|
|
|
|
2005-09-06 18:47:39 +02:00
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
|
|
|
|
|
print '<tr class="liste_titre">';
|
2007-11-11 16:55:45 +01:00
|
|
|
print_liste_field_titre($langs->trans("Ref"),"cotisations.php","c.rowid",$param,"","",$sortfield,$sortorder);
|
2013-02-23 11:11:33 +01:00
|
|
|
print_liste_field_titre($langs->trans("Name"),"cotisations.php","d.lastname",$param,"","",$sortfield,$sortorder);
|
2008-08-17 23:50:27 +02:00
|
|
|
print_liste_field_titre($langs->trans("Login"),"cotisations.php","d.login",$param,"","",$sortfield,$sortorder);
|
2007-11-11 16:55:45 +01:00
|
|
|
print_liste_field_titre($langs->trans("Label"),"cotisations.php","c.note",$param,"",'align="left"',$sortfield,$sortorder);
|
2012-09-15 10:01:35 +02:00
|
|
|
if (! empty($conf->banque->enabled))
|
2002-12-30 16:13:28 +01:00
|
|
|
{
|
2010-08-29 17:25:39 +02:00
|
|
|
print_liste_field_titre($langs->trans("Account"),"cotisations.php","b.fk_account",$pram,"","",$sortfield,$sortorder);
|
2005-09-06 18:47:39 +02:00
|
|
|
}
|
2007-11-11 16:55:45 +01:00
|
|
|
print_liste_field_titre($langs->trans("Date"),"cotisations.php","c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
|
|
|
|
|
print_liste_field_titre($langs->trans("DateEnd"),"cotisations.php","c.datef",$param,"",'align="center"',$sortfield,$sortorder);
|
|
|
|
|
print_liste_field_titre($langs->trans("Amount"),"cotisations.php","c.cotisation",$param,"",'align="right"',$sortfield,$sortorder);
|
2005-09-06 18:47:39 +02:00
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2010-08-29 17:25:39 +02:00
|
|
|
// Static objects
|
2007-05-28 15:14:50 +02:00
|
|
|
$cotisation=new Cotisation($db);
|
|
|
|
|
$adherent=new Adherent($db);
|
|
|
|
|
$accountstatic=new Account($db);
|
|
|
|
|
|
2010-08-29 17:25:39 +02:00
|
|
|
$var=true;
|
2005-09-06 18:47:39 +02:00
|
|
|
$total=0;
|
2006-11-26 19:24:53 +01:00
|
|
|
while ($i < $num && $i < $conf->liste_limit)
|
2005-09-06 18:47:39 +02:00
|
|
|
{
|
|
|
|
|
$objp = $db->fetch_object($result);
|
2007-08-27 13:46:24 +02:00
|
|
|
$total+=$objp->cotisation;
|
2005-09-06 18:47:39 +02:00
|
|
|
|
2006-11-26 19:24:53 +01:00
|
|
|
$cotisation->ref=$objp->crowid;
|
|
|
|
|
$cotisation->id=$objp->crowid;
|
|
|
|
|
|
2012-01-30 10:22:50 +01:00
|
|
|
$adherent->lastname=$objp->lastname;
|
|
|
|
|
$adherent->firstname=$objp->firstname;
|
|
|
|
|
$adherent->ref=$adherent->getFullName($langs);
|
2006-11-26 19:24:53 +01:00
|
|
|
$adherent->id=$objp->rowid;
|
2008-08-17 23:50:27 +02:00
|
|
|
$adherent->login=$objp->login;
|
2006-11-26 19:24:53 +01:00
|
|
|
|
2005-09-06 18:47:39 +02:00
|
|
|
$var=!$var;
|
2007-05-28 15:14:50 +02:00
|
|
|
|
2012-09-15 11:21:22 +02:00
|
|
|
if ($allowinsertbankafter && ! $objp->fk_account && ! empty($conf->banque->enabled) && $objp->cotisation)
|
2010-08-29 17:25:39 +02:00
|
|
|
{
|
|
|
|
|
print "<form method=\"post\" action=\"cotisations.php\">";
|
|
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
|
|
|
}
|
2013-06-20 09:18:12 +02:00
|
|
|
print "<tr ".$bc[$var].">";
|
2009-03-09 11:27:21 +01:00
|
|
|
|
2010-08-29 17:25:39 +02:00
|
|
|
// Ref
|
|
|
|
|
print '<td>'.$cotisation->getNomUrl(1).'</td>';
|
|
|
|
|
|
2013-02-23 11:11:33 +01:00
|
|
|
// Lastname
|
2010-08-29 17:25:39 +02:00
|
|
|
print '<td>'.$adherent->getNomUrl(1).'</td>';
|
|
|
|
|
|
|
|
|
|
// Login
|
|
|
|
|
print '<td>'.$adherent->login.'</td>';
|
|
|
|
|
|
|
|
|
|
// Libelle
|
|
|
|
|
print '<td>';
|
|
|
|
|
print dol_trunc($objp->note,32);
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
|
|
|
|
// Banque
|
2012-09-15 10:01:35 +02:00
|
|
|
if (! empty($conf->banque->enabled))
|
2005-08-11 20:24:58 +02:00
|
|
|
{
|
2005-09-06 18:47:39 +02:00
|
|
|
if ($objp->fk_account)
|
|
|
|
|
{
|
2006-12-20 02:15:21 +01:00
|
|
|
$accountstatic->id=$objp->fk_account;
|
|
|
|
|
$accountstatic->fetch($objp->fk_account);
|
|
|
|
|
//$accountstatic->label=$objp->label;
|
|
|
|
|
print '<td>'.$accountstatic->getNomUrl(1).'</td>';
|
2005-09-06 18:47:39 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-08-29 17:25:39 +02:00
|
|
|
print "<td>";
|
2007-12-14 10:35:15 +01:00
|
|
|
if ($allowinsertbankafter && $objp->cotisation)
|
2010-08-29 17:25:39 +02:00
|
|
|
{
|
|
|
|
|
print '<input type="hidden" name="action" value="2bank">';
|
|
|
|
|
print '<input type="hidden" name="rowid" value="'.$objp->crowid.'">';
|
2011-11-08 10:18:45 +01:00
|
|
|
$form->select_comptes('','accountid',0,'',1);
|
2010-08-29 17:25:39 +02:00
|
|
|
print '<br>';
|
2011-11-08 10:18:45 +01:00
|
|
|
$form->select_types_paiements('','paymenttypeid');
|
2010-08-29 17:25:39 +02:00
|
|
|
print '<input name="num_chq" type="text" class="flat" size="5">';
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
print ' ';
|
|
|
|
|
}
|
|
|
|
|
print "</td>\n";
|
2005-09-06 18:47:39 +02:00
|
|
|
}
|
2005-08-11 20:24:58 +02:00
|
|
|
}
|
2007-09-09 12:43:26 +02:00
|
|
|
|
2010-08-29 17:25:39 +02:00
|
|
|
// Date start
|
|
|
|
|
print '<td align="center">'.dol_print_date($db->jdate($objp->dateadh),'day')."</td>\n";
|
2009-03-09 11:27:21 +01:00
|
|
|
|
2010-08-29 17:25:39 +02:00
|
|
|
// Date end
|
|
|
|
|
print '<td align="center">'.dol_print_date($db->jdate($objp->datef),'day')."</td>\n";
|
2007-09-09 12:43:26 +02:00
|
|
|
|
2010-08-29 17:25:39 +02:00
|
|
|
// Price
|
|
|
|
|
print '<td align="right">'.price($objp->cotisation).'</td>';
|
2009-03-09 11:27:21 +01:00
|
|
|
|
2005-09-06 18:47:39 +02:00
|
|
|
print "</tr>";
|
2012-09-15 11:21:22 +02:00
|
|
|
if ($allowinsertbankafter && ! $objp->fk_account && ! empty($conf->banque->enabled) && $objp->cotisation)
|
2010-08-29 17:25:39 +02:00
|
|
|
{
|
|
|
|
|
print "</form>\n";
|
|
|
|
|
}
|
|
|
|
|
$i++;
|
2002-12-30 16:13:28 +01:00
|
|
|
}
|
2005-09-06 18:47:39 +02:00
|
|
|
|
2008-11-11 20:49:46 +01:00
|
|
|
// Total
|
2005-09-06 18:47:39 +02:00
|
|
|
$var=!$var;
|
|
|
|
|
print '<tr class="liste_total">';
|
|
|
|
|
print "<td>".$langs->trans("Total")."</td>\n";
|
|
|
|
|
print "<td align=\"right\"> </td>\n";
|
2006-11-26 19:24:53 +01:00
|
|
|
print "<td align=\"right\"> </td>\n";
|
2007-09-09 12:43:26 +02:00
|
|
|
print "<td align=\"right\"> </td>\n";
|
2012-09-15 10:01:35 +02:00
|
|
|
if (! empty($conf->banque->enabled))
|
2006-03-18 01:06:55 +01:00
|
|
|
{
|
2010-08-29 17:25:39 +02:00
|
|
|
print '<td> </td>';
|
2006-03-18 01:06:55 +01:00
|
|
|
}
|
2007-05-28 15:14:50 +02:00
|
|
|
print '<td> </td>';
|
2008-11-11 20:49:46 +01:00
|
|
|
print '<td> </td>';
|
|
|
|
|
print "<td align=\"right\">".price($total)."</td>\n";
|
2005-09-06 18:47:39 +02:00
|
|
|
print "</tr>\n";
|
2009-03-09 11:27:21 +01:00
|
|
|
|
2005-09-06 18:47:39 +02:00
|
|
|
print "</table>";
|
|
|
|
|
print "<br>\n";
|
2003-02-28 18:18:04 +01:00
|
|
|
|
2003-03-03 12:33:35 +01:00
|
|
|
|
2002-12-30 16:13:28 +01:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-08-29 17:25:39 +02:00
|
|
|
dol_print_error($db);
|
2002-12-30 16:13:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$db->close();
|
|
|
|
|
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2002-12-30 16:13:28 +01:00
|
|
|
?>
|