if [[ "$1" = "--no-club" ]]
then
echo "Ne prendra pas en compte les clubs."
- cond=" AND NOT club"
+ cond=" AND NOT type = 'club'"
fi
if [[ "$1" = "--club" ]]
then
echo "Ne prendra en compte que les clubs."
- cond=" AND club"
+ cond=" AND type = 'club'"
fi
-for i in 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013
+for i in 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
do
echo "En $i :"
- # Bon, le grep est pourri, mais la version de bde de egrep fait de la merde
- psql bde -c "SELECT sum(solde) FROM adherents adh,inscriptions ins WHERE adh.numcbde=ins.adherent AND annee=$i AND solde<0${cond};" | grep \\.
- psql bde -c "SELECT sum(solde) FROM adherents adh,inscriptions ins WHERE adh.numcbde=ins.adherent AND annee=$i AND solde>0${cond};" | grep \\.
+ psql note -c "SELECT sum(solde) FROM comptes c, adhesions a WHERE c.idbde = a.idbde AND a.annee = $i AND solde < 0${cond};" | grep -v ligne | grep -E '[0-9]'
+ psql note -c "SELECT sum(solde) FROM comptes c, adhesions a WHERE c.idbde = a.idbde AND a.annee = $i AND solde > 0${cond};" | grep -v ligne | grep -E '[0-9]'
done