From 3656c7e33607360321b684cac6754e3dee889658 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sat, 28 Dec 2002 18:12:22 +0000 Subject: [PATCH] . --- htdocs/adherents/edit.php | 170 +++++++++ htdocs/adherents/fiche.php | 329 ++++++++++++++++++ htdocs/adherents/index.php | 74 ++++ htdocs/adherents/index.php3 | 70 ---- .../adherents/{pre.inc.php3 => pre.inc.php} | 25 +- 5 files changed, 590 insertions(+), 78 deletions(-) create mode 100644 htdocs/adherents/edit.php create mode 100644 htdocs/adherents/fiche.php create mode 100644 htdocs/adherents/index.php delete mode 100644 htdocs/adherents/index.php3 rename htdocs/adherents/{pre.inc.php3 => pre.inc.php} (69%) diff --git a/htdocs/adherents/edit.php b/htdocs/adherents/edit.php new file mode 100644 index 00000000000..3814ab7f672 --- /dev/null +++ b/htdocs/adherents/edit.php @@ -0,0 +1,170 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("./pre.inc.php"); +require("../../don.class.php"); +require("../../paiement.class.php"); + +$db = new Db(); + + +if ($action == 'update') +{ + + if ($amount > 0) + { + + $don = new Don($db); + + $don->id = $HTTP_POST_VARS["rowid"]; + $don->prenom = $prenom; + $don->nom = $nom; + $don->statut = $HTTP_POST_VARS["statutid"]; + $don->societe = $societe; + $don->adresse = $adresse; + $don->amount = $amount; + $don->cp = $cp; + $don->ville = $ville; + $don->email = $email; + $don->date = mktime(12, 0 , 0, $remonth, $reday, $reyear); + $don->note = $note; + $don->pays = $pays; + $don->public = $public; + $don->projetid = $projetid; + $don->commentaire = $HTTP_POST_VARS["comment"]; + $don->modepaiementid = $modepaiement; + + if ($don->update($user->id) ) + { + Header("Location: fiche.php?rowid=$don->id&action=edit"); + } + } + else + { + print "Erreur"; + $action = "create"; + } +} + + +llxHeader(); + + +if ($rowid) +{ + + $don = new Don($db); + $don->id = $rowid; + $don->fetch($rowid); + + $sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber"; + $sql .= " FROM societe as s, llx_facture as f WHERE f.fk_soc = s.idp"; + $sql .= " AND f.rowid = $facid"; + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows(); + if ($num) { + $obj = $db->fetch_object( 0); + + $total = $obj->total; + } + } + print_titre("Saisir un don"); + print "
"; + print ''; + + print ""; + print ""; + + print ""; + + print ''; + + print ""; + + print "\n"; + + print "\n"; + + print "\n"; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + print "
Date du don"; + print_date_select($don->date); + print "Commentaires :
'; + print '
Statut du don"; + + $listst[0] = "Promesse à valider"; + $listst[1] = "Promesse validée"; + $listst[2] = "Don payé"; + $listst[3] = "Don encaissé"; + + + $sel = new Form($db); + $sel->select_array("statutid",$listst,$don->statut); + + print "
Mode de paiement\n"; + + $paiement = new Paiement($db); + + $paiement->select("modepaiement","", $don->modepaiementid); + + print "
Projet\n"; + + $prj = new ProjetDon($db); + $listeprj = $prj->liste_array(); + + $sel = new Form($db); + $sel->select_array("projetid",$listeprj,$don->projetid); + + + print "
"; + print "
Don public
"; + print "
Prénom
Nom
Societe
Adresse'; + print '
CP Ville
Pays
Email
Montant euros
\n"; + +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php new file mode 100644 index 00000000000..a5ed52d0f05 --- /dev/null +++ b/htdocs/adherents/fiche.php @@ -0,0 +1,329 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("./pre.inc.php"); +require("../../don.class.php"); +require("../../paiement.class.php"); + +$db = new Db(); + +if ($action == 'add') +{ + + if ($amount > 0) + { + + $don = new Don($db); + + $don->prenom = $prenom; + $don->nom = $nom; + $don->societe = $societe; + $don->adresse = $adresse; + $don->amount = $amount; + $don->cp = $cp; + $don->ville = $ville; + $don->email = $email; + $don->date = mktime(12, 0 , 0, $remonth, $reday, $reyear); + $don->note = $note; + $don->pays = $pays; + $don->public = $public; + $don->projetid = $projetid; + $don->commentaire = $HTTP_POST_VARS["comment"]; + $don->modepaiementid = $modepaiement; + + if ($don->create($user->id) ) + { + Header("Location: index.php"); + } + } + else + { + print "Erreur"; + $action = "create"; + } +} + +if ($action == 'delete') +{ + $don = new Don($db); + $don->delete($rowid); + Header("Location: liste.php?statut=0"); +} +if ($action == 'commentaire') +{ + $don = new Don($db); + $don->set_commentaire($rowid,$HTTP_POST_VARS["commentaire"]); + $action = "edit"; +} +if ($action == 'valid_promesse') +{ + $don = new Don($db); + if ($don->valid_promesse($rowid, $user->id)) + { + Header("Location: liste.php?statut=0"); + } +} +if ($action == 'set_paye') +{ + $don = new Don($db); + if ($don->set_paye($rowid, $modepaiement)) + { + Header("Location: liste.php?statut=1"); + } +} +if ($action == 'set_encaisse') +{ + $don = new Don($db); + if ($don->set_encaisse($rowid)) + { + Header("Location: liste.php?statut=2"); + } +} + + + +llxHeader(); + +/* ************************************************************************** */ +/* */ +/* Création d'une fiche don */ +/* */ +/* ************************************************************************** */ + + +if ($action == 'create') { + + $sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber"; + $sql .= " FROM societe as s, llx_facture as f WHERE f.fk_soc = s.idp"; + $sql .= " AND f.rowid = $facid"; + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows(); + if ($num) { + $obj = $db->fetch_object( 0); + + $total = $obj->total; + } + } + print_titre("Saisir un don"); + print "
"; + print ''; + + print ""; + + print ""; + + print '"; + print "\n"; + + print "\n"; + + print "\n"; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + print "
Date du don"; + print_date_select(); + print "Commentaires :
'; + print "
Mode de paiement\n"; + + $paiement = new Paiement($db); + + $paiement->select("modepaiement","crédit"); + + print "
Projet
"; + print "
Don public
"; + print "
Prénom
Nom
Societe
Adresse'; + print '
CP Ville
Pays
Email
Montant euros
\n"; + + +} +/* ************************************************************************** */ +/* */ +/* Edition de la fiche don */ +/* */ +/* ************************************************************************** */ +if ($rowid > 0 && $action == 'edit') +{ + + $don = new Don($db); + $don->id = $rowid; + $don->fetch($rowid); + + print_titre("Traitement du don"); + print "
"; + print ''; + + print ""; + + print ''; + + if ($don->statut == 1) + { + print "\n"; + } + + if ($don->statut > 1) + { + print "\n"; + } + + print ''; + + print "\n"; + + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print "
Date du don"; + print strftime("%d %B %Y",$don->date); + print "Commentaires :
'; + print nl2br($don->commentaire).'
Mode de paiement"; + $paiement = new Paiement($db); + $paiement->select("modepaiement","crédit", $don->modepaiementid); + print "
Mode de paiement"; + print $don->modepaiement; + print "
Projet'.$don->projet.'
Don public"; + + print $yn[$don->public]; + print "
Prénom'.$don->prenom.' 
Nom'.$don->nom.' 
Société'.$don->societe.' 
Adresse'.nl2br($don->adresse).' 
CP Ville'.$don->cp.' '.$don->ville.' 
Pays'.$don->pays.' 
Email'.$don->email.' 
Montant'.price($don->amount).' euros
\n"; + + + print "

"; + + /* + * Case 1 + */ + + print ''; + + /* + * Case 2 + */ + + if ($don->statut == 1 && $resteapayer > 0) + { + print ""; + } + elseif ($don->statut == 0) + { + print ""; + } + else + { + print ""; + } + /* + * Case 3 + */ + if ($don->statut == 1 && abs($resteapayer == 0) && $don->paye == 0) + { + print ""; + } + else + { + print ""; + } + /* + * Case 4 + */ + if ($don->statut == 0) + { + print ""; + } + elseif ($don->statut == 2) + { + print ""; + } + else + { + print ""; + } + + print "
[Editer][Emettre un paiement][id&action=valid_promesse\">Valider la promesse]-"; + + print ''; + print ''; + + print ''; + + print "-[id&action=delete\">Supprimer][id&action=set_encaisse\">Encaisser]-

"; +/* ************************************************************************** */ +/* */ +/* Commentaire */ +/* */ +/* ************************************************************************** */ + + print "

"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
Commentaires
'; + +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php new file mode 100644 index 00000000000..0602fd5b712 --- /dev/null +++ b/htdocs/adherents/index.php @@ -0,0 +1,74 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (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 + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("./pre.inc.php"); + +llxHeader(); + +$db = new Db(); + + +$sql = "SELECT sum(d.amount) as somme , d.fk_statut FROM llx_don as d GROUP BY d.fk_statut"; + +$result = $db->query($sql); + +if ($result) +{ + $num = $db->num_rows(); + $i = 0; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + + $somme[$objp->fk_statut] = $objp->somme; + $i++; + } + $db->free(); +} + +print_barre_liste("Dons", $page, $PHP_SELF); + +print ''; +print ''; +print ""; +print ""; +print "\n"; + +$var=True; + +for ($i = 0 ; $i < 4 ; $i++) +{ + $var=!$var; + print ""; + print ''; + print ''; + $total += $somme[$i]; + print ""; +} +print ''; +print "
 Somme
'.$libelle[$i].''.price($somme[$i]).'
Total'.price($total).'
"; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/adherents/index.php3 b/htdocs/adherents/index.php3 deleted file mode 100644 index 6b4e29813a3..00000000000 --- a/htdocs/adherents/index.php3 +++ /dev/null @@ -1,70 +0,0 @@ - - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (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 - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ - * - */ -require("./pre.inc.php3"); -require("../contact.class.php3"); - - -llxHeader(); -$db = new Db(); -if ($sortorder == "") -{ - $sortorder="ASC"; -} -if ($sortfield == "") -{ - $sortfield="nom"; -} - -print_titre("Liste des adherents"); - - -$ds=ldap_connect("localhost"); - -if ($ds) -{ - print "Connected"; - // bind with appropriate dn to give update access - $r=ldap_bind($ds,"cn=admin,dc=rodo,dc=lan", "gnu8lx"); - - - // prepare data - $info["cn"]="John Jones"; - $info["sn"]="Jones"; - $info["mail"]="jonj@here.and.now"; - $info["objectclass"]="person"; - - // add data to directory - // $r=ldap_add($ds, "cn=John Jones, o=Adherents, c=FR", $info); - - - ldap_close($ds); -} -else -{ - echo "Unable to connect to LDAP server"; -} - - -$db->close(); - -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/adherents/pre.inc.php3 b/htdocs/adherents/pre.inc.php similarity index 69% rename from htdocs/adherents/pre.inc.php3 rename to htdocs/adherents/pre.inc.php index cb0f2baf6bd..3aea22e3c4e 100644 --- a/htdocs/adherents/pre.inc.php3 +++ b/htdocs/adherents/pre.inc.php @@ -1,8 +1,5 @@ - * - * $Id$ - * $Source$ +/* Copyright (C) 2001-2002 Rodolphe Quiedeville * * 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 @@ -18,10 +15,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * $Id$ + * $Source$ + * */ -require("../main.inc.php3"); +require("../../main.inc.php3"); +require("../../projetdon.class.php"); -function llxHeader($head = "", $urlp = "") { +$libelle[0] = "Promesses non validées"; +$libelle[1] = "Promesses validées"; +$libelle[2] = "Dons payés"; +$libelle[3] = "Dons encaissés"; + +function llxHeader($head = "") { global $user, $conf; @@ -33,10 +39,13 @@ function llxHeader($head = "", $urlp = "") { $menu = new Menu(); - $menu->add("/adherents/", "Adherents"); + $menu->add("/compta/dons/","Dons"); + $menu->add_submenu("fiche.php?action=create","Saisir un don"); + + $menu->add("/compta/bank/index.php3","Bank"); left_menu($menu->liste); + } - ?>