* Copyright (C) 2004 Laurent Destailleur * * 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$ * */ /*! \file htdocs/compta/dons/fiche.php \ingroup don \brief Page de fiche de don \version $Revision$ */ require("./pre.inc.php"); require("../../don.class.php"); require("../../paiement.class.php"); $mesg=""; if ($_POST["action"] == 'update') { if ($_POST["amount"] > 0) { $don = new Don($db); $don->id = $_POST["rowid"]; $don->fetch($_POST["rowid"]); $don->prenom = $_POST["prenom"]; $don->nom = $_POST["nom"]; $don->societe = $_POST["societe"]; $don->adresse = $_POST["adresse"]; $don->amount = $_POST["amount"]; $don->cp = $_POST["cp"]; $don->ville = $_POST["ville"]; $don->email = $_POST["email"]; $don->date = mktime(12, 0 , 0, $remonth, $reday, $reyear); $don->note = $_POST["note"]; $don->pays = $_POST["pays"]; $don->public = $_POST["public"]; $don->projetid = $_POST["projetid"]; $don->commentaire = $_POST["comment"]; $don->modepaiementid = $_POST["modepaiement"]; if ($don->update($user->id) ) { Header("Location: index.php"); } } else { $mesg="Montant non défini"; } } if ($_POST["action"] == 'add') { if ($_POST["amount"] > 0) { $don = new Don($db); $don->prenom = $_POST["prenom"]; $don->nom = $_POST["nom"]; $don->societe = $_POST["societe"]; $don->adresse = $_POST["adresse"]; $don->amount = $_POST["amount"]; $don->cp = $_POST["cp"]; $don->ville = $_POST["ville"]; $don->email = $_POST["email"]; $don->date = mktime(12, 0 , 0, $remonth, $reday, $reyear); $don->note = $_POST["note"]; $don->pays = $_POST["pays"]; $don->public = $_POST["public"]; $don->projetid = $_POST["projetid"]; $don->commentaire = $_POST["comment"]; $don->modepaiementid = $_POST["modepaiement"]; if ($don->create($user->id) ) { Header("Location: index.php"); } } else { $mesg="Montant non défini"; $_GET["action"] = "create"; } } if ($_GET["action"] == 'delete') { $don = new Don($db); $don->delete($_GET["rowid"]); Header("Location: liste.php"); } if ($_POST["action"] == 'commentaire') { $don = new Don($db); $don->set_commentaire($_POST["rowid"],$_POST["commentaire"]); $_GET["rowid"] = $_POST["rowid"]; } if ($_GET["action"] == 'valid_promesse') { $don = new Don($db); if ($don->valid_promesse($_GET["rowid"], $user->id)) { Header("Location: liste.php"); } } if ($_GET["action"] == 'set_payed') { $don = new Don($db); if ($don->set_paye($_GET["rowid"], $modepaiement)) { Header("Location: liste.php"); } } if ($_GET["action"] == 'set_encaisse') { $don = new Don($db); if ($don->set_encaisse($_GET["rowid"])) { Header("Location: liste.php"); } } llxHeader(); /* ************************************************************************** */ /* */ /* Création d'une fiche don */ /* */ /* ************************************************************************** */ if ($_GET["action"] == 'create') { print_titre("Saisir un don"); print '
'; print ''; print ''; print "".''; print '"; print "\n"; print "\n"; print "\n"; $langs->load("companies"); print "".''; print "".''; print "".''; print "".''; print "".''; print "".''; print "".''; print "".''; print "".''; print "
Date du don'; print_date_select(); print ''.$langs->trans("Comments").' :
'; print "
Mode de paiement\n"; $paiement = new Paiement($db); $paiement->select("modepaiement","crédit"); print "
".$langs->trans("Project")."
"; print "
Don public
"; print "
'.$langs->trans("Company").'
'.$langs->trans("Firstname").'
'.$langs->trans("LastName").'
'.$langs->trans("Address").''; print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").'
'.$langs->trans("Country").'
'.$langs->trans("EMail").'
'.$langs->trans("Amount").' euros
\n"; print "
\n"; } /* ************************************************************ */ /* */ /* Fiche don en mode edition */ /* */ /* ************************************************************ */ if ($_GET["rowid"] && $_GET["action"] == 'edit') { $don = new Don($db); $don->id = $_GET["rowid"]; $don->fetch($_GET["rowid"]); print_titre("Traitement du don"); print '
'; print ''; print ''; print ''; print "".''; print '"; print "\n"; print "\n"; $langs->load("companies"); print "".''; print "".''; print "".''; print "".''; print "".''; print "".''; print "".''; print "".''; print "\n"; print "".''; print "
Date du don'; print_date_select($don->date); print ''.$langs->trans("Comments").' :
'; print "
".$langs->trans("Project")."
"; print "
Don public
"; print "
'.$langs->trans("Company").'
'.$langs->trans("Firstname").'
'.$langs->trans("LastName").'
'.$langs->trans("Address").''; print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").'
'.$langs->trans("Country").'
'.$langs->trans("EMail").'
'.$langs->trans("Amount").' euros
Mode de paiement\n"; $paiement = new Paiement($db); $paiement->select("modepaiement","crédit"); print "
\n"; print "
\n"; } /* ************************************************************ */ /* */ /* Fiche don en mode visu */ /* */ /* ************************************************************ */ if ($_GET["rowid"] && $_GET["action"] != 'edit') { $don = new Don($db); $don->id = $_GET["rowid"]; $don->fetch($_GET["rowid"]); print_titre("Traitement du don"); print "
"; print ''; print ""; print ''; print "".''; print "\n"; print "".''; print "".''; print "".''; print "".''; print "".''; print "".''; print "".''; print "".''; if ($don->statut == 1) { print "\n"; } else { print "\n"; } print "
Date du don"; print strftime("%d %B %Y",$don->date); print "'.$langs->trans("Comments").' :
'; print nl2br($don->commentaire).'
Projet'.$don->projet.'
Don public"; print $yn[$don->public]; print "
'.$langs->trans("Company").''.$don->societe.'
'.$langs->trans("Firstname").''.$don->prenom.'
'.$langs->trans("LastName").''.$don->nom.'
'.$langs->trans("Address").''.nl2br($don->adresse).'
'.$langs->trans("Zip").' / '.$langs->trans("Town").''.$don->cp.' '.$don->ville.'
'.$langs->trans("Country").''.$don->pays.'
'.$langs->trans("EMail").''.$don->email.'
'.$langs->trans("Amount").''.price($don->amount).' euros
Mode de paiement"; $paiement = new Paiement($db); $paiement->select("modepaiement","crédit", $don->modepaiementid); print "
Mode de paiement"; print $don->modepaiement; print "
\n"; print "
\n"; /* * Barre d'actions * */ print '
'; print ''.$langs->trans('Edit').''; if ($don->statut == 1 && $resteapayer > 0) { print "Emettre un paiement"; } if ($don->statut == 0) { print "id&action=valid_promesse\">Valider la promesse"; } if ($don->statut == 3) { print "id\">Formulaire"; } if ($don->statut == 1 && abs($resteapayer == 0) && $don->paye == 0) { print "id&action=set_payed\">Classé payé"; } if ($don->statut == 0) { print "id&action=delete\">".$langs->trans("Delete").""; } if ($don->statut == 2) { print "id&action=set_encaisse\">Encaisser"; } print "

"; } $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>