* * 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"); 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, ".MAIN_DB_PREFIX."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 ""; } elseif ($don->statut == 3) { 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][id\">Formulaire]-"; 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$"); ?>