* * 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("./contrat.class.php"); require("../facture.class.php"); llxHeader(); $mesg = ''; /* * Sécurité accés client */ if ($user->societe_id > 0) { $action = ''; $socid = $user->societe_id; } if ($action == 'add') { $contrat = new Contrat($db); $id = $product->create($user); $action = ''; } if ($HTTP_POST_VARS["action"] == 'miseenservice') { $contrat = new Contrat($db); $contrat->id = $id; $contrat->fetch($id); $contrat->mise_en_service($user, mktime($HTTP_POST_VARS["rehour"], $HTTP_POST_VARS["remin"], 0, $HTTP_POST_VARS["remonth"], $HTTP_POST_VARS["reday"], $HTTP_POST_VARS["reyear"]), $HTTP_POST_VARS["duration"] ); } if ($action == 'cloture') { $contrat = new Contrat($db); $contrat->id = $id; $contrat->cloture($user); } if ($action == 'update' && $cancel <> 'Annuler') { $product = new Product($db); $product->ref = $HTTP_POST_VARS["ref"]; $product->libelle = $HTTP_POST_VARS["libelle"]; $product->price = $HTTP_POST_VARS["price"]; $product->tva_tx = $HTTP_POST_VARS["tva_tx"]; $product->description = $HTTP_POST_VARS["desc"]; $product->envente = $HTTP_POST_VARS["statut"]; $product->duration_value = $HTTP_POST_VARS["duration_value"]; $product->duration_unit = $HTTP_POST_VARS["duration_unit"]; if ( $product->update($id, $user)) { $action = ''; $mesg = 'Fiche mise à jour'; } else { $action = 'edit'; $mesg = 'Fiche non mise à jour !' . "
" . $product->mesg_error; } } /* * * */ $html = new Form($db); if ($action == 'create') { print "
\n"; print "\n"; print ''."\n"; print '
Nouveau '.$types[$type].'

'."\n"; print ''; print ""; print ''; print ''; print ''; print ''; print ""; if ($type == 1) { print ''; } print ''; print '
Référence
Libellé
Prix de vente
Taux TVA'; print $html->select_tva("tva_tx"); print ' %
Description"; print '
Durée'; print 'jour '; print 'semaine '; print 'mois '; print 'année'; print '
 
'; print '
'; } else { if ($id) { $contrat = new Contrat($db); $result = $contrat->fetch($id); if ( $result ) { print_fiche_titre('Fiche contrat : '.$contrat->id, $mesg); print ''; print ""; print ''; print ''; if ($contrat->factureid) { print ''; print ''; } else { print ''; } if ($request == 'miseenservice') { print ''; print ''; print ''; print ''; print ''; } if ($contrat->enservice > 0) { print ""; $contrat->user_service->fetch(); print ''; print '"; $contrat->user_cloture->fetch(); print ''; } print "
Service'.$contrat->product->label_url.''; if ($contrat->enservice) { print "En service"; } else { print "Ce contrat n'est pas en service"; } print '
Société'.$contrat->societe->nom_url.'FactureFactureSociété'.$contrat->societe->nom_url.'
Mis en service'; print $html->select_date('','re',1,1); print " "; print '
Mis en service".strftime("%A %e %B %Y à %H:%M",$contrat->mise_en_service); print "par'.$contrat->user_service->fullname.'
Fin de validité'.strftime("%A %e %B %Y à %H:%M",$contrat->date_fin_validite); } if ($contrat->enservice == 2) { print "
Cloturé".strftime("%A %e %B %Y à %H:%M",$contrat->date_cloture)."par'.$contrat->user_cloture->fullname.'
"; } } else { print "Error"; } } /* ************************************************************************** */ /* */ /* Barre d'action */ /* */ /* ************************************************************************** */ print '
'; print ''; if ($contrat->enservice) { print ''; } else { print ''; } print ''; print ''; if ($contrat->enservice == 1) { print ''; } else { print ''; } print '
--[Mise en service]--[Clôturer]-

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