* Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2010 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"); if ($conf->facture->enabled) require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); if ($conf->facture->enabled) require_once(DOL_DOCUMENT_ROOT."/compta/facture/facture-rec.class.php"); if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); if ($conf->fournisseur->enabled) require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.facture.class.php"); if ($conf->fournisseur->enabled) require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.commande.class.php"); if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); if ($conf->agenda->enabled) require_once(DOL_DOCUMENT_ROOT."/actioncomm.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"); // Security check $projectid=''; $ref=''; if (isset($_GET["id"])) { $projectid=$_GET["id"]; } if (isset($_GET["ref"])) { $ref=$_GET["ref"]; } if ($projectid == '' && $ref == '') accessforbidden(); // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'projet', $projectid); /* * View */ llxHeader("",$langs->trans("Referers"),"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"); $form = new Form($db); $userstatic=new User($db); $project = new Project($db); $project->fetch($_GET["id"],$_GET["ref"]); $project->societe->fetch($project->societe->id); // To verify role of users $userAccess = $project->restrictedProjectArea($user); $head=project_prepare_head($project); dol_fiche_head($head, 'element', $langs->trans("Project"),0,'project'); print ''; print ''; print ''; print ''; // Visibility print ''; // Statut print ''; print '
'.$langs->trans("Ref").''; print $form->showrefnav($project,'ref','',1,'ref','ref'); print '
'.$langs->trans("Label").''.$project->title.'
'.$langs->trans("Company").''; if (! empty($project->societe->id)) print $project->societe->getNomUrl(1); else print ' '; print '
'.$langs->trans("Visibility").''; if ($project->public) print $langs->trans('SharedProject'); else print $langs->trans('PrivateProject'); print '
'.$langs->trans("Status").''.$project->getLibStatut(4).'
'; 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), 'invoice_predefined'=>array( 'title'=>"ListPredefinedInvoicesAssociatedProject", 'class'=>'FactureRec', '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), 'contract'=>array( 'title'=>"ListContractAssociatedProject", 'class'=>'Contrat', 'test'=>$conf->contrat->enabled), 'agenda'=>array( 'title'=>"ListActionsAssociatedProject", 'class'=>'ActionComm', 'disableamount'=>1, 'test'=>$conf->agenda->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 ''; if (empty($value['disableamount'])) print ''; print ''; print ''; $elementarray = $project->get_element_list($key); if (sizeof($elementarray)>0 && is_array($elementarray)) { $var=true; $total = 0; for ($i = 0; $ifetch($elementarray[$i]); $var=!$var; print ""; // Ref print "\n"; // Date $date=$element->date; if (empty($date)) $date=$element->datep; if (empty($date)) $date=$element->date_contrat; print ''; // Amount if (empty($value['disableamount'])) print ''; // Status print ''; print ''; $total = $total + $element->total_ht; } print ''; if (empty($value['disableamount'])) print ''; print ''; print ''; } print "
'.$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("Amount").''.$langs->trans("Status").'
"; print $element->getNomUrl(1); print "'.dol_print_date($date,'day').''.(isset($element->total_ht)?price($element->total_ht):' ').''.$element->getLibStatut(5).'
'.$langs->trans("Number").': '.$i.''.$langs->trans("TotalHT").' : '.price($total).' 
"; /* * Barre d'action */ print '
'; if ($project->societe->prospect || $project->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 ($project->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 '
'; } } $db->close(); llxFooter('$Date$ - $Revision$'); ?>