mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-18 23:41:28 +01:00
186 lines
5.1 KiB
PHP
186 lines
5.1 KiB
PHP
<?PHP
|
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
|
|
*
|
|
* 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("../contact.class.php");
|
|
|
|
llxHeader();
|
|
$socid = $_GET["socid"];
|
|
/*
|
|
* Sécurité accés client
|
|
*/
|
|
if ($user->societe_id > 0)
|
|
{
|
|
$action = '';
|
|
$socid = $user->societe_id;
|
|
}
|
|
/*
|
|
*
|
|
* Mode fiche
|
|
*
|
|
*
|
|
*/
|
|
$societe = new Societe($db);
|
|
|
|
if ( $societe->fetch($socid) )
|
|
{
|
|
$head[0][0] = 'soc.php?socid='.$societe->id;
|
|
$head[0][1] = "Fiche société";
|
|
$h = 1;
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id;
|
|
$head[$h][1] = 'Fiche Fournisseur';
|
|
$a = $h;
|
|
$h++;
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/product/liste.php?type=0&fourn_id='.$societe->id;
|
|
$head[$h][1] = 'Produits';
|
|
$h++;
|
|
|
|
dolibarr_fiche_head($head, $a);
|
|
|
|
print_titre("Fiche fournisseur : $societe->nom");
|
|
|
|
/*
|
|
*
|
|
*
|
|
*/
|
|
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="1">';
|
|
print '<tr><td valign="top" width="50%">';
|
|
/*
|
|
*
|
|
*/
|
|
print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
|
|
print '<tr><td>Tél</td><td>'.$societe->tel.' </td><td>fax</td><td>'.$societe->fax.' </td></tr>';
|
|
print '<tr><td>Adresse</td><td colspan="3">'.nl2br($societe->address).'<br>'.$societe->cp.' '.$societe->ville.'</td></tr>';
|
|
|
|
print '</table>';
|
|
/*
|
|
*
|
|
*/
|
|
print '</td><td valign="top" width="50%">';
|
|
/*
|
|
*
|
|
* Liste des factures associées
|
|
*
|
|
*/
|
|
$sql = "SELECT p.rowid,p.libelle,p.facnumber,".$db->pdate("p.datef")." as df";
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as p WHERE p.fk_soc = $societe->id";
|
|
$sql .= " ORDER BY p.datef DESC LIMIT 0,4";
|
|
if ( $db->query($sql) )
|
|
{
|
|
print '<table class="noborder" cellspacing="0" width="100%" cellpadding="1">';
|
|
$i = 0 ;
|
|
$num = $db->num_rows();
|
|
if ($num > 0)
|
|
{
|
|
print '<tr class="liste_titre">';
|
|
print "<td colspan=\"2\"><a href=\"facture/index.php?socid=$societe->id\">liste des factures</td></tr>";
|
|
}
|
|
while ($i < $num && $i < 5)
|
|
{
|
|
$obj = $db->fetch_object( $i);
|
|
$tag = !$tag;
|
|
print "<tr $bc[$tag]>";
|
|
print '<td>';
|
|
print '<a href="facture/fiche.php?facid='.$obj->rowid.'">';
|
|
print img_file();
|
|
print $obj->facnumber.'</a> '.$obj->libelle.'</td>';
|
|
print "<td align=\"right\">".strftime("%d %b %Y", $obj->df) ."</td></tr>";
|
|
$i++;
|
|
}
|
|
$db->free();
|
|
print "</table>";
|
|
}
|
|
else
|
|
{
|
|
print $db->error();
|
|
}
|
|
|
|
/*
|
|
*
|
|
*
|
|
*/
|
|
print '</td></tr>';
|
|
print '</table>' . "<br>\n";
|
|
|
|
|
|
/*
|
|
*
|
|
* Liste des contacts
|
|
*
|
|
*/
|
|
print '<table class="border" cellspacing="0" cellpadding="2" width="100%">';
|
|
|
|
print "<tr><td><b>Prénom Nom</b></td>";
|
|
print '<td><b>Poste</b></td><td><b>Tél</b></td>';
|
|
print "<td><b>Fax</b></td><td><b>Email</b></td>";
|
|
print "<td><a href=\"people.php?socid=$societe->id&action=addcontact\">Ajouter</a></td></tr>";
|
|
|
|
$sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note";
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p WHERE p.fk_soc = $societe->id ORDER by p.datec";
|
|
$result = $db->query($sql);
|
|
$i = 0 ; $num = $db->num_rows(); $tag = True;
|
|
while ($i < $num)
|
|
{
|
|
$obj = $db->fetch_object( $i);
|
|
if ($tag)
|
|
{
|
|
print "<tr bgcolor=\"e0e0e0\">";
|
|
}
|
|
else
|
|
{
|
|
print "<tr>";
|
|
}
|
|
print "<td>$obj->firstname $obj->name";
|
|
if ($obj->note)
|
|
{
|
|
print "<br><b>".nl2br($obj->note);
|
|
}
|
|
print "</td>";
|
|
print "<td>$obj->poste </td>";
|
|
print '<td><a href="actioncomm.php?action=create&actionid=1&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->phone.'</a> </td>';
|
|
print '<td><a href="actioncomm.php?action=create&actionid=2&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->fax.'</a> </td>';
|
|
print '<td><a href="actioncomm.php?action=create&actionid=4&contactid='.$obj->idp.'&socid='.$societe->id.'">'.$obj->email.'</a> </td>';
|
|
print "<td><a href=\"people.php?socid=$societe->id&action=editcontact&contactid=$obj->idp\">Modifier</a></td>";
|
|
print "</tr>\n";
|
|
$i++;
|
|
$tag = !$tag;
|
|
}
|
|
print "</table></div>";
|
|
/*
|
|
*
|
|
*/
|
|
print '<div class="tabsAction">';
|
|
print '<a class="tabAction" href="facture/fiche.php?action=create&socid='.$societe->id.'">Nouvelle Facture</a>';
|
|
print '</div>';
|
|
|
|
}
|
|
else
|
|
{
|
|
print "Erreur";
|
|
}
|
|
$db->close();
|
|
|
|
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
|
?>
|