* Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * * 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/comm/propal.php \ingroup propale \brief Page liste des propales (vision commercial) */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/propale/modules_propale.php"); require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php"); $user->getrights('propale'); $langs->load('companies'); $langs->load('propal'); $langs->load('compta'); $langs->load('bills'); $langs->load('orders'); $langs->load('products'); if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php'); if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php'); require_once(DOL_DOCUMENT_ROOT.'/propal.class.php'); require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); $sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"]; if (isset($_GET["msg"])) { $mesg=urldecode($_GET["mesg"]); } $year=isset($_GET["year"])?$_GET["year"]:""; $month=isset($_GET["month"])?$_GET["month"]:""; // Sécurité accés client $socid=''; if ($_GET["socid"]) { $socid=$_GET["socid"]; } if ($user->societe_id > 0) { $action = ''; $socid = $user->societe_id; } if (!$user->rights->propale->lire) accessforbidden(); if ($_GET['propalid'] > 0) { $propal = new Propal($db); $result=$propal->fetch($_GET['propalid']); if (! $result > 0) { dolibarr_print_error($db,$propal->error); exit; } // Protection restriction commercial if ($user->societe_id > 0) { // Si externe, on autorise que ses propres infos if ($propal->socid <> $user->societe_id) accessforbidden(); } else if (!$user->rights->commercial->client->voir) { // Si interne et pas les droits de voir tous les clients, on autorise que si liés $sql = "SELECT sc.fk_soc"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE sc.fk_soc = ".$propal->socid." AND sc.fk_user = ".$user->id; if ( $db->query($sql) ) { if ( $db->num_rows() == 0) { accessforbidden(); } } } // Fin de Protection restriction commercial } // Nombre de ligne pour choix de produit/service prédéfinis $NBLINES=4; $form=new Form($db); /******************************************************************************/ /* Actions */ /******************************************************************************/ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes') { if ($user->rights->propale->supprimer) { $propal = new Propal($db, 0, $_GET['propalid']); $propal->fetch($_GET['propalid']); $propal->delete($user); $propalid = 0; $brouillon = 1; } Header('Location: '.$_SERVER["PHP_SELF"]); exit; } if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) { if ($user->rights->propale->creer) { $propal = new Propal($db); $propal->fetch($_GET['propalid']); $result=$propal->delete_product($_GET['ligne']); if ($_REQUEST['lang_id']) { $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); } Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET['propalid']); exit; } if ($_POST['action'] == 'confirm_validate' && $_POST['confirm'] == 'yes') { if ($user->rights->propale->valider) { $propal = new Propal($db); $propal->fetch($_GET['propalid']); $result=$propal->update_price($_GET['propalid']); if ($_REQUEST['lang_id']) { $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); $result=$propal->valid($user); } Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET['propalid']); exit; } if ($_POST['action'] == 'setecheance') { $propal = new Propal($db); $propal->fetch($_GET['propalid']); $result=$propal->set_echeance($user,dolibarr_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); if ($result < 0) dolibarr_print_error($db,$propal->error); } if ($_POST['action'] == 'setdate_livraison') { $propal = new Propal($db); $propal->fetch($_GET['propalid']); $result=$propal->set_date_livraison($user,dolibarr_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); if ($result < 0) dolibarr_print_error($db,$propal->error); } if ($_POST['action'] == 'setdeliveryadress' && $user->rights->propale->creer) { $propal = new Propal($db); $propal->fetch($_GET['propalid']); $result=$propal->set_adresse_livraison($user,$_POST['adresse_livraison_id']); if ($result < 0) dolibarr_print_error($db,$propal->error); } // Positionne ref client if ($_POST['action'] == 'set_ref_client' && $user->rights->propale->creer) { $propal = new Propal($db); $propal->fetch($_GET['propalid']); $propal->set_ref_client($user, $_POST['ref_client']); } /* * Creation propale */ if ($_POST['action'] == 'add' && $user->rights->propale->creer) { $propal = new Propal($db); $propal->socid=$_POST['socid']; $propal->fetch_client(); $db->begin(); // Si on a selectionné une propal à copier, on réalise la copie if($_POST['createmode']=='copy' && $_POST['copie_propal']) { if ($propal->fetch($_POST['copie_propal']) > 0) { $propal->datep = dolibarr_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $propal->date_livraison = dolibarr_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']); $propal->adresse_livraison_id = $_POST['adresse_livraison_id']; $propal->duree_validite = $_POST['duree_validite']; $propal->cond_reglement_id = $_POST['cond_reglement_id']; $propal->mode_reglement_id = $_POST['mode_reglement_id']; $propal->remise_percent = $_POST['remise_percent']; $propal->remise_absolue = $_POST['remise_absolue']; $propal->socid = $_POST['socid']; $propal->contactid = $_POST['contactidp']; $propal->projetidp = $_POST['projetidp']; $propal->modelpdf = $_POST['model']; $propal->author = $user->id; $propal->note = $_POST['note']; $propal->ref = $_POST['ref']; $propal->statut = 0; $id = $propal->create_from(); } else { $mesg = '
'.$langs->trans("ErrorFailedToCopyProposal",$_POST['copie_propal']).'
'; } } else { $propal->datep = dolibarr_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $propal->date_livraison = dolibarr_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']); $propal->adresse_livraison_id = $_POST['adresse_livraison_id']; $propal->duree_validite = $_POST['duree_validite']; $propal->cond_reglement_id = $_POST['cond_reglement_id']; $propal->mode_reglement_id = $_POST['mode_reglement_id']; $propal->contactid = $_POST['contactidp']; $propal->projetidp = $_POST['projetidp']; $propal->modelpdf = $_POST['model']; $propal->author = $user->id; $propal->note = $_POST['note']; $propal->ref_client = $_POST['ref_client']; $propal->ref = $_POST['ref']; for ($i = 1 ; $i <= $conf->global->PROPALE_NEW_FORM_NB_PRODUCT ; $i++) { if ($_POST['idprod'.$i]) { $xid = 'idprod'.$i; $xqty = 'qty'.$i; $xremise = 'remise'.$i; $propal->add_product($_POST[$xid],$_POST[$xqty],$_POST[$xremise]); } } $id = $propal->create(); } if ($id > 0) { $error=0; // Insertion contact par defaut si défini if ($_POST["contactidp"]) { $result=$propal->add_contact($_POST["contactidp"],'CUSTOMER','external'); if ($result > 0) { $error=0; } else { $mesg = '
'.$langs->trans("ErrorFailedToAddContact").'
'; $error=1; } } if (! $error) { $db->commit(); // Generation document PDF if ($_REQUEST['lang_id']) { $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } propale_pdf_create($db, $id, $_REQUEST['model'], $outputlangs); dolibarr_syslog('Redirect to '.$_SERVER["PHP_SELF"].'?propalid='.$id); Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$id); exit; } else { $db->rollback(); } } else { dolibarr_print_error($db,$propal->error); $db->rollback(); exit; } } /* * Cloture de la propale */ if ($_POST['action'] == 'setstatut' && $user->rights->propale->cloturer) { if (! $_POST['cancel']) { $propal = new Propal($db); $propal->fetch($_GET['propalid']); // prevent browser refresh from closing proposal several times if ($propal->statut==1) { $propal->cloture($user, $_POST['statut'], $_POST['note']); } } } /* * Envoi de la propale par mail */ if ($_POST['action'] == 'send') { $langs->load('mails'); $propal= new Propal($db); if ( $propal->fetch($_POST['propalid']) ) { $propalref = sanitize_string($propal->ref); $file = $conf->propal->dir_output . '/' . $propalref . '/' . $propalref . '.pdf'; if (is_readable($file)) { $propal->fetch_client(); if ($_POST['sendto']) { // Le destinataire a été fourni via le champ libre $sendto = $_POST['sendto']; $sendtoid = 0; } elseif ($_POST['receiver']) { // Le destinataire a été fourni via la liste déroulante if ($_POST['receiver'] < 0) // Id du tiers { $sendto = $propal->client->email; $sendtoid = 0; } else // Id du contact { $sendto = $propal->client->contact_get_email($_POST['receiver']); $sendtoid = $_POST['receiver']; } } if (strlen($sendto)) { $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $message = $_POST['message']; $sendtocc = $_POST['sendtocc']; $deliveryreceipt = $_POST['deliveryreceipt']; if ($_POST['action'] == 'send') { $subject = $_POST['subject']; if($subject == '') { $subject = $langs->trans('Propal').' '.$propal->ref; } $actiontypeid=3; $actionmsg ='Mail envoyé par '.$from.' à '.$sendto.'.
'; if ($message) { $actionmsg.='Texte utilisé dans le corps du message:
'; $actionmsg.=$message; } $actionmsg2='Envoi Propal par mail'; } $filepath[0] = $file; $filename[0] = $propal->ref.'.pdf'; $mimetype[0] = 'application/pdf'; if ($_FILES['addedfile']['tmp_name']) { $filepath[1] = $_FILES['addedfile']['tmp_name']; $filename[1] = $_FILES['addedfile']['name']; $mimetype[1] = $_FILES['addedfile']['type']; } // Envoi de la propal $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); if ($mailfile->error) { $mesg='
'.$mailfile->error.'
'; } else { $result=$mailfile->sendfile(); if ($result) { $mesg='
'.$langs->trans('MailSuccessfulySent',$from,$sendto).'.
'; // Insertion action require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php'); $actioncomm = new ActionComm($db); $actioncomm->type_id = $actiontypeid; $actioncomm->label = $actionmsg2; $actioncomm->note = $actionmsg; $actioncomm->date = time(); // L'action est faite maintenant $actioncomm->percent = 100; $actioncomm->contact = new Contact($db,$sendtoid); $actioncomm->societe = new Societe($db,$propal->socid); $actioncomm->user = $user; // User qui a fait l'action $actioncomm->propalrowid = $propal->id; $ret=$actioncomm->add($user); // User qui saisit l'action if ($ret < 0) { dolibarr_print_error($db); } else { // Renvoie sur la fiche Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&msg='.urlencode($mesg)); exit; } } else { $langs->load("other"); $mesg='
'; if ($mailfile->error) { $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); $mesg.='
'.$mailfile->error; } else { $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; } $mesg.='
'; } } } else { $langs->load("other"); $mesg='
'.$langs->trans('ErrorMailRecipientIsEmpty').' !
'; dolibarr_syslog('Recipient email is empty'); } } else { $langs->load("other"); $mesg='
'.$langs->trans('ErrorCantReadFile',$file).'
'; dolibarr_syslog('Failed to read file: '.$file); } } else { $langs->load("other"); $mesg='
'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Invoice")).'
'; dolibarr_syslog('Impossible de lire les données de la facture. Le fichier facture n\'a peut-être pas été généré.'); } } if ($_GET['action'] == 'commande') { /* * Cloture de la propale */ $propal = new Propal($db); $propal->fetch($propalid); $propal->create_commande($user); } if ($_GET['action'] == 'modif' && $user->rights->propale->creer) { /* * Repasse la propale en mode brouillon */ $propal = new Propal($db); $propal->fetch($_GET['propalid']); $propal->set_draft($user->id); } if ($_POST['action'] == "setabsolutediscount" && $user->rights->propale->creer) { if ($_POST["remise_id"]) { $propal = new Propal($db); $propal->id=$_GET['propalid']; $ret=$propal->fetch($_GET['propalid']); if ($ret > 0) { $propal->insert_discount($_POST["remise_id"]); if ($result < 0) { $mesg='
'.$propal->error.'
'; } } else { dolibarr_print_error($db,$propal->error); } } } /* * Ajout d'une ligne produit dans la propale */ if ($_POST['action'] == "addligne" && $user->rights->propale->creer) { if ($_POST['qty'] && (($_POST['np_price']!=0 && $_POST['np_desc']) || $_POST['idprod'])) { $propal = new Propal($db); $ret=$propal->fetch($_POST['propalid']); $soc = new Societe($db, $propal->socid); $soc->fetch($propal->socid); // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $txtva par celui du produit if ($_POST['idprod']) { $prod = new Product($db, $_POST['idprod']); $prod->fetch($_POST['idprod']); // multiprix if ($conf->global->PRODUIT_MULTIPRICES == 1) { $pu = $prod->multiprices[$soc->price_level]; } else { $pu=$prod->price; } // La description de la ligne est celle saisie ou // celle du produit si (non saisi + PRODUIT_CHANGE_PROD_DESC défini) // \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on $desc=$_POST['np_desc']; if (! $desc && $conf->global->PRODUIT_CHANGE_PROD_DESC) { $desc = $prod->description; } $tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx); } else { $pu=$_POST['np_price']; $tva_tx=$_POST['np_tva_tx']; $desc=$_POST['np_desc']; } $propal->addline( $_POST['propalid'], $desc, $pu, $_POST['qty'], $tva_tx, $_POST['idprod'], $_POST['remise_percent'] ); if ($_REQUEST['lang_id']) { $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); } } /* * Mise à jour d'une ligne dans la propale */ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST["save"] == $langs->trans("Save")) { $propal = new Propal($db); if (! $propal->fetch($_POST['propalid']) > 0) dolibarr_print_error($db); $result = $propal->updateline($_POST['ligne'], $_POST['subprice'], $_POST['qty'], $_POST['remise_percent'], $_POST['tva_tx'], $_POST['desc']); if ($_REQUEST['lang_id']) { $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); } /* * Generation doc (depuis lien ou depuis cartouche doc) */ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer) { $propal = new Propal($db); $propal->fetch($_GET['propalid']); if ($_REQUEST['model']) { $propal->set_pdf_model($user, $_REQUEST['model']); } if ($_REQUEST['lang_id']) { $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } $result=propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); if ($result <= 0) { dolibarr_print_error($db,$result); exit; } else { Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'#builddoc'); exit; } } if ($_GET['action'] == 'del_ligne' && $user->rights->propale->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE) { /* * Supprime une ligne produit dans la propale */ $propal = new Propal($db); $propal->fetch($_GET['propalid']); $propal->delete_product($_GET['ligne']); if ($_REQUEST['lang_id']) { $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); } if ($_POST['action'] == 'classin') { $propal = new Propal($db); $propal->fetch($_GET['propalid']); $propal->set_project($user, $_POST['projetidp']); } // Conditions de règlement if ($_POST["action"] == 'setconditions') { $propal = new Propal($db); $propal->fetch($_REQUEST['propalid']); $result = $propal->cond_reglement($_POST['cond_reglement_id']); $_GET['propalid']=$_REQUEST['propalid']; } if ($_REQUEST['action'] == 'setremisepercent' && $user->rights->propale->creer) { $propal = new Propal($db); $propal->fetch($_REQUEST['propalid']); $result = $propal->set_remise_percent($user, $_POST['remise_percent']); $_GET['propalid']=$_REQUEST['propalid']; } if ($_REQUEST['action'] == 'setremiseabsolue' && $user->rights->propale->creer) { $propal = new Propal($db); $propal->fetch($_REQUEST['propalid']); $result = $propal->set_remise_absolue($user, $_POST['remise_absolue']); $_GET['propalid']=$_REQUEST['propalid']; } // Mode de règlement if ($_POST["action"] == 'setmode') { $propal = new Propal($db); $propal->fetch($_REQUEST['propalid']); $result = $propal->mode_reglement($_POST['mode_reglement_id']); $_GET['propalid']=$_REQUEST['propalid']; } /* * Ordonnancement des lignes */ if ($_GET['action'] == 'up' && $user->rights->propale->creer) { $propal = new Propal($db, '', $_GET["propalid"]); $propal->fetch($_GET['propalid']); $propal->line_up($_GET['rowid']); if ($_REQUEST['lang_id']) { $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET["propalid"].'#'.$_GET['rowid']); } if ($_GET['action'] == 'down' && $user->rights->propale->creer) { $propal = new Propal($db, '', $_GET["propalid"]); $propal->fetch($_GET['propalid']); $propal->line_down($_GET['rowid']); if ($_REQUEST['lang_id']) { $outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs"); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs); Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET["propalid"].'#'.$_GET['rowid']); exit; } /* * Affichage page */ llxHeader('',$langs->trans('Proposal'),'Proposition'); $html = new Form($db); if ($_GET['propalid'] > 0) { /* * Affichage fiche propal en mode visu * */ if ($mesg) print "$mesg
"; $societe = new Societe($db); $societe->fetch($propal->socid); $head = propal_prepare_head($propal); dolibarr_fiche_head($head, 'comm', $langs->trans('Proposal')); /* * Confirmation de la suppression de la propale */ if ($_GET['action'] == 'delete') { $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete'); print '
'; } /* * Confirmation de la suppression d'une ligne produit */ if ($_GET['action'] == 'delete_product_line' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) { $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); print '
'; } /* * Confirmation de la validation de la propale */ if ($_GET['action'] == 'validate') { $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('ValidateProp'), $langs->trans('ConfirmValidateProp'), 'confirm_validate'); print '
'; } /* * Fiche propal * */ print ''; // Ref print ''; // Ref client print ''; print ''; $rowspan=8; // Société print ''; print ''; // Ligne info remises tiers print ''; // Dates print ''; if ($conf->projet->enabled) $rowspan++; if ($conf->expedition->enabled) { if ($conf->global->PROPALE_ADD_SHIPPING_DATE) $rowspan++; if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) $rowspan++; } // Notes print ''; print ''; // Date fin propal print ''; print ''; print ''; // date de livraison (conditonné sur PROPALE_ADD_SHIPPING_DATE car carac à // gérer par les commandes et non les propal if ($conf->expedition->enabled) { if ($conf->global->PROPALE_ADD_SHIPPING_DATE) { print ''; print ''; } // adresse de livraison if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) { print ''; } } // Conditions et modes de réglement print ''; print ''; // Mode paiement print ''; print ''; // Projet if ($conf->projet->enabled) { $langs->load("projects"); print ''; } else { if ($propal->statut == 0 && $user->rights->propale->creer) { if ($_GET['action'] != 'classer' && $propal->brouillon) print ''; print '
'.$langs->trans('Ref').''.$propal->ref_url.'
'; print ''; if ($_GET['action'] != 'refclient' && $propal->brouillon) print ''; print '
'; print $langs->trans('RefCustomer').''; print ''.img_edit($langs->trans('Edit')).'
'; print '
'; if ($user->rights->propale->creer && $_GET['action'] == 'refclient') { print '
'; print ''; print ''; print ' '; print '
'; } else { print $propal->ref_client; } print '
'.$langs->trans('Company').''.$societe->getNomUrl(1).'
'.$langs->trans('Discounts').''; if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client); else print $langs->trans("CompanyHasNoRelativeDiscount"); $absolute_discount=$societe->getCurrentDiscount(); print '. '; if ($absolute_discount) { if ($propal->statut > 0) { print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie)); } else { print '
'; print $html->form_remise_dispo($_SERVER["PHP_SELF"].'?propalid='.$propal->id,0,'remise_id',$societe->id,$absolute_discount); } } else print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; print '
'.$langs->trans('Date').''; print dolibarr_print_date($propal->date,'%a %d %B %Y'); print ''.$langs->trans('NotePublic').' :
'. nl2br($propal->note_public).'
'; print ''; if ($_GET['action'] != 'editecheance' && $propal->brouillon) print ''; print '
'; print $langs->trans('DateEndPropal'); print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; print '
'; if ($propal->brouillon && $_GET['action'] == 'editecheance') { print '
'; print ''; $html->select_date($propal->fin_validite,'ech','','','',"editecheance"); print ''; print '
'; } else { if ($propal->fin_validite) { print dolibarr_print_date($propal->fin_validite,'%a %d %B %Y'); if ($propal->statut == 1 && $propal->fin_validite < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); } else { print ' '; } } print '
'; print ''; if ($_GET['action'] != 'editdate_livraison' && $propal->brouillon) print ''; print '
'; print $langs->trans('DateDelivery'); print 'id.'">'.img_edit($langs->trans('SetDateLivraison'),1).'
'; print '
'; if ($_GET['action'] == 'editdate_livraison') { print '
'; print ''; $html->select_date($propal->date_livraison,'liv_','','','',"editdate_livraison"); print ''; print '
'; } else { print dolibarr_print_date($propal->date_livraison,'%a %d %B %Y'); } print '
'; print ''; if ($_GET['action'] != 'editdelivery_adress' && $propal->brouillon) print ''; print '
'; print $langs->trans('DeliveryAddress'); print 'socid.'&propalid='.$propal->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
'; print '
'; if ($_GET['action'] == 'editdelivery_adress') { $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','propal',$propal->id); } else { $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->adresse_livraison_id,$_GET['socid'],'none','propal',$propal->id); } print '
'; print ''; if ($_GET['action'] != 'editconditions' && $propal->brouillon) print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; print '
'; if ($_GET['action'] == 'editconditions') { $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->cond_reglement_id,'cond_reglement_id'); } else { $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->cond_reglement_id,'none'); } print '
'; print ''; if ($_GET['action'] != 'editmode' && $propal->brouillon) print ''; print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; print '
'; if ($_GET['action'] == 'editmode') { $html->form_modes_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->mode_reglement_id,'mode_reglement_id'); } else { $html->form_modes_reglement($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->mode_reglement_id,'none'); } print '
'; print ''; $numprojet = $societe->has_projects(); if (! $numprojet) { print '
'; print $langs->trans('Project').'
'; print '
'; print $langs->trans("NoProject").''; print 'id.'&action=create>'.$langs->trans('AddProject').''; print ''.img_edit($langs->trans('SetProject')).'
'; print ''; if ($_GET['action'] == 'classer') { $form->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socid, $propal->projetidp, 'projetidp'); } else { $form->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socid, $propal->projetidp, 'none'); } print ''; } else { if (!empty($propal->projetidp)) { print ''; print ''; $proj = new Project($db); $proj->fetch($propal->projetidp); print ''; print $proj->title; print ''; print ''; } else { print ''; print ' '; } } } print ''; } // Amount HT print ''.$langs->trans('AmountHT').''; print ''.price($propal->total_ht).''; print ''.$langs->trans("Currency".$conf->monnaie).''; // Amount VAT print ''.$langs->trans('AmountVAT').''; print ''.price($propal->total_tva).''; print ''.$langs->trans("Currency".$conf->monnaie).''; // Amount TTC print ''.$langs->trans('AmountTTC').''; print ''.price($propal->total_ttc).''; print ''.$langs->trans("Currency".$conf->monnaie).''; // Statut print ''.$langs->trans('Status').''.$propal->getLibStatut(4).''; print '
'; /* * Lignes de propale */ print ''; $sql = 'SELECT pt.rowid, pt.description, pt.price, pt.fk_product, pt.fk_remise_except,'; $sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,'; $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid,'; $sql.= ' p.description as product_desc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid'; $sql.= ' WHERE pt.fk_propal = '.$propal->id; $sql.= ' ORDER BY pt.rang ASC, pt.rowid'; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; $total = 0; if ($num) { print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; } $var=true; while ($i < $num) { $objp = $db->fetch_object($resql); $var=!$var; // Ligne en mode visu if ($_GET['action'] != 'editline' || $_GET['ligne'] != $objp->rowid) { print ''; if ($objp->fk_product > 0) { print ''; } else { print '\n"; } print ''; print '\n"; // Qty print ''; if ($objp->remise_percent > 0) { print '\n"; } else { print ''; } print '\n"; // Icone d'edition et suppression if ($propal->statut == 0 && $user->rights->propale->creer) { print ''; if ($conf->global->PRODUIT_CONFIRM_DELETE_LINE) { print ''; print ''; } else { print ''; } print ''; } // Ligne en mode update if ($propal->statut == 0 && $_GET["action"] == 'editline' && $user->rights->propale->creer && $_GET["ligne"] == $objp->rowid) { print 'rowid.'" method="post">'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '' . "\n"; /* if ($conf->service->enabled) { print ""; print ''; print '' . "\n"; } */ print "\n"; } $total = $total + ($objp->qty * $objp->price); $i++; } $db->free($resql); } else { dolibarr_print_error($db); } /* * Ajouter une ligne */ if ($propal->statut == 0 && $user->rights->propale->creer && $_GET["action"] <> 'editline') { print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; // Ajout produit produits/services personalisés print ''; print ''; print ''; $var=true; print '\n"; print ''; print '\n"; print ''; print ''; print ''; print ''; print ''; print ''; // Ajout de produits/services prédéfinis if ($conf->produit->enabled) { print ''; print ''; print ''; $var=!$var; print ''; print ''; print ''; print ''; print ''; print ''."\n"; print ''; } } print '
'.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('Qty').''.$langs->trans('ReductionShort').''.$langs->trans('AmountHT').'   
'; print ''; // ancre pour retourner sur la ligne print ''; if ($objp->fk_product_type==1) print img_object($langs->trans('ShowService'),'service'); else print img_object($langs->trans('ShowProduct'),'product'); print ' '.$objp->ref.''; print ' - '.nl2br($objp->product); // \todo Ne faut-il pas rendre $conf->global->PRODUIT_CHANGE_PROD_DESC toujours a on if ($conf->global->PRODUIT_DESC_IN_FORM && !$conf->global->PRODUIT_CHANGE_PROD_DESC) { print '
'.nl2br($objp->product_desc); } if ($objp->date_start && $objp->date_end) { print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')'; } if ($objp->date_start && ! $objp->date_end) { print ' (A partir du '.dolibarr_print_date($objp->date_start).')'; } if (! $objp->date_start && $objp->date_end) { print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')'; } print ($objp->description && $objp->description!=$objp->product)?'
'.stripslashes(nl2br($objp->description)):''; print '
'; print ''; // ancre pour retourner sur la ligne if (($objp->info_bits & 2) == 2) { print ''; print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount"); print ''; if ($objp->description) { if ($objp->description == '(CREDIT_NOTE)') { $discount=new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); print ' - '.$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); } else { print ' - '.nl2br($objp->description); } } } else { print nl2br($objp->description); if ($objp->date_start && $objp->date_end) { print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')'; } if ($objp->date_start && ! $objp->date_end) { print ' (A partir du '.dolibarr_print_date($objp->date_start).')'; } if (! $objp->date_start && $objp->date_end) { print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')'; } } print "'.$objp->tva_tx.'%'.price($objp->subprice)."'; if (($objp->info_bits & 2) != 2) { print $objp->qty; } else print ' '; print ''.$objp->remise_percent."% '.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)."'; if (($objp->info_bits & 2) == 2) { // Ligne remise prédéfinie, on permet pas modif } else { print 'rowid.'#'.$objp->rowid.'">'; print img_edit(); print ''; } print 'rowid.'">'; } else { print 'rowid.'">'; } print img_delete(); print ''; if ($i > 0) { print 'rowid.'">'; print img_up(); print ''; } if ($i < $num-1) { print 'rowid.'">'; print img_down(); print ''; } print ' 
'; print ''; // ancre pour retourner sur la ligne if ($objp->fk_product > 0) { print ''; if ($objp->fk_product_type==1) print img_object($langs->trans('ShowService'),'service'); else print img_object($langs->trans('ShowProduct'),'product'); print ' '.$objp->ref.''; print ' - '.nl2br($objp->product); print '
'; } // éditeur wysiwyg if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS) { require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('desc',$objp->description,164,'dolibarr_details'); $doleditor->Create(); } else { print ''; } print '
'; if($societe->tva_assuj == "0") print '0'; else print $html->select_tva("tva_tx",$objp->tva_tx,$mysoc,$societe); print ''; if (($objp->info_bits & 2) != 2) { print ''; } else print ' '; print ''; if (($objp->info_bits & 2) != 2) { print '%'; } else print ' '; print ''; print '
Si produit de type service à durée limitée: Du '; print $html->select_date($objp->date_start,"date_start",0,0,$objp->date_start?0:1); print ' au '; print $html->select_date($objp->date_end,"date_end",0,0,$objp->date_end?0:1); print '
'; print ''; // ancre print $langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('Qty').''.$langs->trans('ReductionShort').'    
'; if($societe->tva_assuj == "0") { print '0'; } else { $html->select_tva('np_tva_tx', $conf->defaulttx, $mysoc, $societe); } print "%
'; // multiprix if($conf->global->PRODUIT_MULTIPRICES == 1) { $html->select_produits('','idprod','',$conf->produit->limit_size,$societe->price_level); } else { $html->select_produits('','idprod','',$conf->produit->limit_size); } if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '
'; print ''; print '
 %'; print '
'; print ''; print "\n"; /* * Formulaire cloture (signé ou non) */ if ($_GET['action'] == 'statut') { print '
'; print ''; print ''; print ''; print ''; print '
'.$langs->trans('Note').'
'.$langs->trans("CloseAs").''; print ''; print ''; print '
'; print ''; print '   '; print '
'; } /* * Boutons Actions */ print '
'; if ($_GET['action'] != 'statut') { // Valid if ($propal->statut == 0) { if ($user->rights->propale->valider && $propal->total_ttc > 0) { print ''.$langs->trans('Validate').''; } } // Save if ($propal->statut == 1) { if ($user->rights->propale->creer) { print ''.$langs->trans('Edit').''; } } // Build PDF if ($user->rights->propale->creer) { if ($propal->statut < 2) { print ''.$langs->trans("BuildPDF").''; } else { print ''.$langs->trans("RebuildPDF").''; } } // Send if ($propal->statut == 1) { if ($user->rights->propale->envoyer) { $propref = sanitize_string($propal->ref); $file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf'; if (file_exists($file)) { print ''.$langs->trans('SendByMail').''; } } } // Close if ($propal->statut != 0) { if ($propal->statut == 1 && $user->rights->propale->cloturer) { print ''.$langs->trans('Close').''; } } // Delete if ($propal->statut == 0) { if ($user->rights->propale->supprimer) { print ''.$langs->trans('Delete').''; } } } print '
'; print "
\n"; print '
'; print ''; // ancre /* * Documents générés */ $filename=sanitize_string($propal->ref); $filedir=$conf->propal->dir_output . "/" . sanitize_string($propal->ref); $urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id; $genallowed=$user->rights->propale->creer; $delallowed=$user->rights->propale->supprimer; $var=true; $somethingshown=$html->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); /* * Commandes rattachées */ if($conf->commande->enabled) { $propal->loadOrders(); $coms = $propal->commandes; if (sizeof($coms) > 0) { if ($somethingshown) { print '
'; $somethingshown=1; } print_titre($langs->trans('RelatedOrders')); print ''; print ''; print ''; print ''; print ''; print ''; print ''; $var=true; for ($i = 0 ; $i < sizeof($coms) ; $i++) { $var=!$var; print '\n"; print ''; print ''; print ''; print "\n"; } print '
'.$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("Price").''.$langs->trans("Status").'
'; print ''.img_object($langs->trans("ShowOrder"),"order").' '.$coms[$i]->ref."'.dolibarr_print_date($coms[$i]->date).''.$coms[$i]->total_ttc.''.$coms[$i]->getLibStatut(3).'
'; } } print '
'; /* * Liste des actions propres à la propal */ $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ; $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql .= ' WHERE a.propalrowid = '.$propal->id ; if ($socid) $sql .= ' AND a.fk_soc = '.$socid; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); if ($num) { print_titre($langs->trans('ActionsOnPropal')); $i = 0; $total = 0; $var=true; print ''; print ''; print "\n"; while ($i < $num) { $objp = $db->fetch_object($resql); $var=!$var; print ''; print ''; print '\n"; print ''; $authoract = new User($db); $authoract->id = $objp->fk_user_author; $authoract->fetch(''); print ''; print "\n"; $i++; } print '
'.$langs->trans('Ref').''.$langs->trans('Date').''.$langs->trans('Action').''.$langs->trans('By').'
'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.''.dolibarr_print_date($objp->da)."'.stripslashes($objp->label).''.$authoract->login.'
'; } } else { dolibarr_print_error($db); } print '
'; /* * Action presend * */ if ($_GET['action'] == 'presend') { print '
'; print_titre($langs->trans('SendPropalByMail')); $liste[0]=" "; foreach ($societe->thirdparty_and_contact_email_array() as $key=>$value) { $liste[$key]=$value; } // Créé l'objet formulaire mail include_once('../html.formmail.class.php'); $formmail = new FormMail($db); $formmail->fromname = $user->fullname; $formmail->frommail = $user->email; $formmail->withfrom=1; $formmail->withto=$liste; $formmail->withcc=1; $formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__'); $formmail->withfile=1; $formmail->withbody=1; $formmail->withdeliveryreceipt=1; // Tableau des substitutions $formmail->substit['__PROPREF__']=$propal->ref; // Tableau des paramètres complémentaires $formmail->param['action']='send'; $formmail->param['models']='propal_send'; $formmail->param['propalid']=$propal->id; $formmail->param['returnurl']=DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id; $formmail->show_form(); print '
'; } } else { /**************************************************************************** * * * Mode Liste des propales * * * ****************************************************************************/ $sortorder=$_GET['sortorder']; $sortfield=$_GET['sortfield']; $page=$_GET['page']; $viewstatut=$_GET['viewstatut']; if (! $sortfield) $sortfield='p.datep'; if (! $sortorder) $sortorder='DESC'; $limit = $conf->liste_limit; $offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; $sql = 'SELECT s.nom, s.idp, s.client, '; $sql.= 'p.rowid as propalid, p.price, p.ref, p.fk_statut, '.$db->pdate('p.datep').' as dp,'.$db->pdate('p.fin_validite').' as dfv'; if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p'; if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal'; $sql.= ' WHERE p.fk_soc = s.idp'; if (!$user->rights->commercial->client->voir && !$socid) //restriction { $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; } if (!empty($_GET['search_ref'])) { $sql .= " AND p.ref LIKE '%".addslashes($_GET['search_ref'])."%'"; } if (!empty($_GET['search_societe'])) { $sql .= " AND s.nom LIKE '%".addslashes($_GET['search_societe'])."%'"; } if (!empty($_GET['search_montant_ht'])) { $sql .= " AND p.price='".addslashes($_GET['search_montant_ht'])."'"; } if ($sall) $sql.= " AND (s.nom like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%' OR pd.description like '%".addslashes($sall)."%')"; if ($socid) $sql .= ' AND s.idp = '.$socid; if ($_GET['viewstatut'] <> '') { $sql .= ' AND p.fk_statut in ('.$_GET['viewstatut'].')'; } if ($month > 0) { $sql .= " AND date_format(p.datep, '%Y-%m') = '$year-$month'"; } if ($year > 0) { $sql .= " AND date_format(p.datep, '%Y') = $year"; } if (strlen($_POST['sf_ref']) > 0) { $sql .= " AND p.ref like '%".addslashes($_POST["sf_ref"]) . "%'"; } $sql .= ' ORDER BY '.$sortfield.' '.$sortorder.', p.ref DESC'; $sql .= $db->plimit($limit + 1,$offset); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); print_barre_liste($langs->trans('ListOfProposals'), $page,'propal.php','&socid='.$socid.'&viewstatut='.$viewstatut,$sortfield,$sortorder,'',$num); $i = 0; print ''; print ''; print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','','&socid='.$socid.'&viewstatut='.$viewstatut,'',$sortfield); print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','','&socid='.$socid.'&viewstatut='.$viewstatut,'',$sortfield); print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="center"',$sortfield); print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="center"',$sortfield); print_liste_field_titre($langs->trans('Price'),$_SERVER["PHP_SELF"],'p.price','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="right"',$sortfield); print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','','&socid='.$socid.'&viewstatut='.$viewstatut,'align="right"',$sortfield); print "\n"; // Lignes des champs de filtre print ''; print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; print ''; $var=true; while ($i < min($num,$limit)) { $objp = $db->fetch_object($result); $now = time(); $var=!$var; print ''; print '\n"; if ($objp->client == 1) { $url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objp->idp; } else { $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$objp->idp; } // Société print ''; // Date propale print '\n"; // Date fin validite if ($objp->dfv) { print ''; } else { print ''; } print '\n"; $propal=New Propal($db); print '\n"; print "\n"; $total = $total + $objp->price; $subtotal = $subtotal + $objp->price; $i++; } print '
'; print ''; print ''; print ''; print ' '; print ''; print ''; print '
'.img_object($langs->trans('ShowPropal'),'propal').' '.$objp->ref."'.img_object($langs->trans('ShowCompany'),'company').' '.$objp->nom.''; $y = strftime('%Y',$objp->dp); $m = strftime('%m',$objp->dp); print strftime('%d',$objp->dp)."\n"; print ' '; print dolibarr_print_date($objp->dp,'%b')."\n"; print ' '; print strftime('%Y',$objp->dp)."'.dolibarr_print_date($objp->dfv); if ($objp->fk_statut == 1 && $objp->dfv < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); print ' '.price($objp->price)."'.$propal->LibStatut($objp->fk_statut,5)."
'; $db->free($result); } else { dolibarr_print_error($db); } } $db->close(); llxFooter('$Date$ - $Revision$'); ?>