* Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2008 Regis Houssin * * 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. */ /** \file htdocs/projet/element.php \ingroup projet facture \brief Page des elements par projet \version $Id$ */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); $langs->load("projects"); $langs->load("companies"); $langs->load("suppliers"); if ($conf->facture->enabled) $langs->load("bills"); if ($conf->commande->enabled) $langs->load("orders"); if ($conf->propal->enabled) $langs->load("propal"); // Sécurité accés client $projetid=''; if ($_GET["id"]) { $projetid=$_GET["id"]; } if ($projetid == '') accessforbidden(); // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'projet', $projetid); /* * View */ llxHeader("",$langs->trans("Referers")); $projet = new Project($db); $projet->fetch($_GET["id"]); $projet->societe->fetch($projet->societe->id); $head=project_prepare_head($projet); dolibarr_fiche_head($head, 'element', $langs->trans("Project")); print ''; print ''; print ''; print ''; print '
'.$langs->trans("Ref").''.$projet->ref.'
'.$langs->trans("Label").''.$projet->title.'
'.$langs->trans("Company").''.$projet->societe->getNomUrl(1,'compta').'
'; print ''; /* * Factures */ $listofreferent=array( 'propal'=>array( 'title'=>"ListProposalsAssociatedProject", 'class'=>'Propal', 'test'=>$conf->propal->enabled), 'order'=>array( 'title'=>"ListOrdersAssociatedProject", 'class'=>'Commande', 'test'=>$conf->commande->enabled), 'invoice'=>array( 'title'=>"ListInvoicesAssociatedProject", 'class'=>'Facture', 'test'=>$conf->facture->enabled), 'order_supplier'=>array( 'title'=>"ListSupplierOrdersAssociatedProject", 'class'=>'CommandeFournisseur', 'test'=>$conf->fournisseur->enabled), 'invoice_supplier'=>array( 'title'=>"ListSupplierInvoicesAssociatedProject", 'class'=>'FactureFournisseur', 'test'=>$conf->fournisseur->enabled) ); foreach ($listofreferent as $key => $value) { $title=$value['title']; $class=$value['class']; $qualified=$value['test']; if ($qualified) { print '
'; print_titre($langs->trans($title)); print ''; print ''; print ''; print ''; print ''; print ''; $elementarray = $projet->get_element_list($key); if (sizeof($elementarray)>0 && is_array($elementarray)) { $var=true; $total = 0; for ($i = 0; $ifetch($elementarray[$i]); $var=!$var; print ""; print "\n"; $date=$element->date; if (empty($date)) $date=$element->datep; print ''; print ''; print ''; $total = $total + $element->total_ht; } print ''; print ''; print ''; } print "
'.$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("Amount").'
"; print $element->getNomUrl(1); print "'.dolibarr_print_date($date,'day').''.price($element->total_ht).'
'.$i.' '.$langs->trans("Bills").''.$langs->trans("TotalHT").' : '.price($total).'
"; /* * Barre d'action */ print '
'; if ($projet->societe->prospect || $projet->societe->client) { if ($key == 'propal' && $conf->propal->enabled && $user->rights->propale->creer) { print ''.$langs->trans("AddProp").''; } if ($key == 'order' && $conf->commande->enabled && $user->rights->commande->creer) { print ''.$langs->trans("AddCustomerOrder").''; } if ($key == 'invoice' && $conf->facture->enabled && $user->rights->facture->creer) { print ''.$langs->trans("AddCustomerInvoice").''; } } if ($projet->societe->fournisseur) { if ($key == 'order_supplier' && $conf->fournisseur->enabled && $user->rights->fournisseur->commande->creer) { print ''.$langs->trans("AddSupplierInvoice").''; } if ($key == 'invoice_supplier' && $conf->fournisseur->enabled && $user->rights->fournisseur->facture->creer) { print ''.$langs->trans("AddSupplierOrder").''; } } print '
'; } } // Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent print '
'; print '
'; $db->close(); llxFooter('$Date$ - $Revision$'); ?>