dolibarr/htdocs/soc.php

259 lines
9.3 KiB
PHP
Raw Normal View History

2002-04-30 12:51:35 +02:00
<?PHP
2003-10-08 16:57:09 +02:00
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2004-02-02 04:23:46 +01:00
* Copyright (C) 2003 Brian Fraval <brian@fraval.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
2003-10-08 16:57:09 +02:00
*
2002-04-30 12:51:35 +02:00
* 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.
*
2002-05-29 17:18:01 +02:00
* $Id$
* $Source$
*
2002-04-30 12:51:35 +02:00
*/
2003-09-11 22:18:51 +02:00
require("pre.inc.php");
2002-04-30 12:51:35 +02:00
2002-05-10 14:28:10 +02:00
2003-06-30 17:55:14 +02:00
/*
* S<EFBFBD>curit<EFBFBD> acc<EFBFBD>s client
*/
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
2002-12-12 22:04:06 +01:00
if ($action == 'add')
{
2002-04-30 12:51:35 +02:00
$soc = new Societe($db);
$soc->nom = $nom;
2002-12-12 22:04:06 +01:00
$soc->adresse = $adresse;
$soc->cp = $cp;
$soc->ville = $ville;
$soc->tel = $tel;
$soc->fax = $fax;
$soc->url = ereg_replace( "http://", "", $url );
2002-12-12 22:04:06 +01:00
$soc->siren = $siren;
2002-04-30 12:51:35 +02:00
$soc->siret = $HTTP_POST_VARS["siret"];
$soc->ape = $HTTP_POST_VARS["ape"];
$soc->capital = $HTTP_POST_VARS["capital"];
$soc->tva_intra = $HTTP_POST_VARS["tva_intra_code"] . $HTTP_POST_VARS["tva_intra_num"];
2003-01-28 18:55:40 +01:00
$soc->client = $client;
$soc->fournisseur = $fournisseur;
2002-04-30 12:51:35 +02:00
$socid = $soc->create();
}
2002-12-12 22:04:06 +01:00
if ($action == 'update')
{
2002-04-30 12:51:35 +02:00
$soc = new Societe($db);
$soc->nom = $nom;
2002-05-04 01:01:45 +02:00
$soc->adresse = $adresse;
$soc->cp = $cp;
$soc->ville = $ville;
2002-04-30 12:51:35 +02:00
$soc->tel = $tel;
$soc->fax = $fax;
$soc->url = ereg_replace( "http://", "", $url );
$soc->siren = $HTTP_POST_VARS["siren"];
$soc->siret = $HTTP_POST_VARS["siret"];
$soc->ape = $HTTP_POST_VARS["ape"];
$soc->capital = $HTTP_POST_VARS["capital"];
$soc->tva_intra = $HTTP_POST_VARS["tva_intra_code"] . $HTTP_POST_VARS["tva_intra_num"];
2002-05-29 17:28:31 +02:00
$soc->client = $client;
$soc->fournisseur = $fournisseur;
2002-04-30 12:51:35 +02:00
$soc->update($socid);
}
/*
*
*
*/
llxHeader();
2002-04-30 12:51:35 +02:00
2002-12-12 22:04:06 +01:00
if ($action == 'create')
{
print '<div class="titre">Nouvelle soci<63>t<EFBFBD> (prospect, client, fournisseur, partenaire...)</div><br>';
2003-09-11 22:18:51 +02:00
print '<form action="soc.php" method="post">';
2002-04-30 12:51:35 +02:00
print '<input type="hidden" name="action" value="add">';
2002-12-12 22:04:06 +01:00
print '<input type="hidden" name="fournisseur" value="0">';
2002-04-30 12:51:35 +02:00
print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
print '<tr><td>Nom</td><td colspan="3"><input type="text" name="nom"></td></tr>';
print '<tr><td>Adresse</td><td colspan="3"><textarea name="adresse" cols="30" rows="3" wrap="soft"></textarea></td></tr>';
print '<tr><td>CP</td><td colspan="3"><input size="6" type="text" name="cp">&nbsp;';
2002-04-30 12:51:35 +02:00
print 'Ville&nbsp;<input type="text" name="ville"></td></tr>';
print '<tr><td>T<>l<EFBFBD>phone</td><td><input type="text" name="tel"></td>';
print '<td>Fax</td><td><input type="text" name="fax"></td></tr>';
print '<tr><td>Web</td><td colspan="3">http://<input size="40" type="text" name="url"></td></tr>';
print '<tr><td>Siren</td><td><input type="text" name="siren"></td>';
2002-04-30 12:51:35 +02:00
print '<td>Siret</td><td><input type="text" name="siret" size="15" maxlength="14" value="'.$soc->siret.'"></td></tr>';
print '<tr><td>Ape</td><td><input type="text" name="ape" size="5" maxlength="4" value="'.$soc->ape.'"></td>';
print '<td>Capital</td><td><input type="text" name="capital" size="10" value="'.$soc->capital.'"> '.MAIN_MONNAIE.'</td></tr>';
print '<tr><td colspan="2">Num<75>ro de TVA Intracommunautaire</td><td colspan="2">';
print '<input type="text" name="tva_intra_code" size="3" maxlength="2" value="'.$soc->tva_intra_code.'">';
print '<input type="text" name="tva_intra_num" size="18" maxlength="18" value="'.$soc->tva_intra_num.'">';
print '<br>Vous pouvez v<>rifier ce num<75>ro sur le <a href="http://europa.eu.int/comm/taxation_customs/vies/fr/vieshome.htm" target="_blank">site</a> de la commission europ<6F>enne';
print '</td></tr>';
2002-04-30 12:51:35 +02:00
2003-09-16 07:21:31 +02:00
print '<tr><td>Client</td><td><select name="client">';
2003-01-28 18:55:40 +01:00
print_oui_non($soc->client);
print '</select></td>';
2002-04-30 12:51:35 +02:00
print '<td>Fournisseur</td><td><select name="fournisseur">';
2003-01-28 18:55:40 +01:00
print_oui_non($soc->fournisseur);
print '</select></td></tr>';
2002-04-30 12:51:35 +02:00
print '<tr><td colspan="4" align="center"><input type="submit" value="Ajouter"></td></tr>';
2002-04-30 12:51:35 +02:00
print '</table>';
print '</form>';
2002-12-12 22:04:06 +01:00
}
elseif ($action == 'edit')
{
2002-12-30 22:07:11 +01:00
print_titre("Edition de la soci<63>t<EFBFBD>");
2002-04-30 12:51:35 +02:00
if ($socid)
{
2002-05-29 17:18:01 +02:00
$soc = new Societe($db);
$soc->id = $socid;
$soc->fetch($socid);
2003-09-11 22:18:51 +02:00
print '<form action="soc.php?socid='.$socid.'" method="post">';
print '<input type="hidden" name="action" value="update">';
print '<table class="border" width="100%" cellpadding="3" cellspacing="0">';
2003-09-16 07:21:31 +02:00
print '<tr><td>Nom</td><td><input type="text" name="nom" value="'.$soc->nom.'"></td></tr>';
print '<tr><td valign="top">Adresse</td><td><textarea name="adresse" cols="30" rows="3" wrap="soft">';
print $soc->adresse;
print '</textarea></td></tr>';
2003-09-16 07:21:31 +02:00
print '<tr><td>CP</td><td><input size="6" type="text" name="cp" value="'.$soc->cp.'">&nbsp;';
print 'Ville&nbsp;<input type="text" name="ville" value="'.$soc->ville.'"></td></tr>';
print '<tr><td>T<>l<EFBFBD>phone</td><td><input type="text" name="tel" value="'.$soc->tel.'"></td>';
print '<td>Fax</td><td><input type="text" name="fax" value="'.$soc->fax.'"></td></tr>';
print '<tr><td>Web</td><td colspan="3">http://<input type="text" name="url" size="40" value="'.$soc->url.'"></td></tr>';
print '<tr><td>Siren</td><td><input type="text" name="siren" size="10" maxlength="9" value="'.$soc->siren.'"></td>';
print '<td>Siret</td><td><input type="text" name="siret" size="15" maxlength="14" value="'.$soc->siret.'"></td></tr>';
print '<tr><td>Ape</td><td><input type="text" name="ape" size="5" maxlength="4" value="'.$soc->ape.'"></td>';
print '<td>Capital</td><td><input type="text" name="capital" size="10" value="'.$soc->capital.'"> '.MAIN_MONNAIE.'</td></tr>';
print '<tr><td colspan="2">Num<75>ro de TVA Intracommunautaire</td><td colspan="2">';
print '<input type="text" name="tva_intra_code" size="3" maxlength="2" value="'.$soc->tva_intra_code.'">';
print '<input type="text" name="tva_intra_num" size="18" maxlength="18" value="'.$soc->tva_intra_num.'">';
print '<br>Vous pouvez v<>rifier ce num<75>ro sur le <a href="http://europa.eu.int/comm/taxation_customs/vies/fr/vieshome.htm" target="_blank">site</a> de la commission europ<6F>enne';
print '</td></tr>';
2003-09-16 07:21:31 +02:00
print '<tr><td>Client</td><td><select name="client">';
print_oui_non($soc->client);
print '</select>';
2003-09-16 07:21:31 +02:00
print '<tr><td>Fournisseur</td><td><select name="fournisseur">';
print_oui_non($soc->fournisseur);
print '</select>';
print '</td></tr>';
2003-09-16 07:21:31 +02:00
print '<tr><td align="center" colspan="2"><input type="submit" value="Mettre <20> jour"></td></tr>';
print '</table>';
print '</form>';
}
2003-10-12 16:55:30 +02:00
}
else
{
2003-09-12 16:08:02 +02:00
$soc = new Societe($db);
$soc->id = $socid;
$soc->fetch($socid);
print '<div class="tabs">';
print '<a href="soc.php?socid='.$_GET["socid"].'" id="active" class="tab">Fiche soci<63>t<EFBFBD></a>';
if ($soc->client)
{
print '<a class="tab" href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$socid.'">Fiche commerciale</a>';
}
if ($soc->fournisseur)
{
print '<a class="tab" href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid.'">Fiche fournisseur</a>';
}
2003-09-12 16:08:02 +02:00
print '</div>';
print '<div class="tabBar"><br>';
2003-10-12 16:55:30 +02:00
print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
2003-10-12 22:26:34 +02:00
print '<tr><td width="20%">Nom</td><td width="80%" colspan="3">'.$soc->nom.'</td></tr>';
2003-10-12 16:55:30 +02:00
print '<tr><td valign="top">Adresse</td><td colspan="3">'.nl2br($soc->adresse).'&nbsp;</td></tr>';
print '<tr><td>CP</td><td colspan="3">'.$soc->cp.'&nbsp;'.$soc->ville.'</td></tr>';
2003-09-12 16:08:02 +02:00
2003-10-12 16:55:30 +02:00
print '<tr><td>Tel</td><td>'.$soc->tel.'</td>';
print '<td>Fax</td><td>'.$soc->fax.'</td></tr>';
print '<tr><td>Web</td><td colspan="3"><a href="http://'.$soc->url.'">http://'.$soc->url.'</a></td></tr>';
2003-09-12 02:20:56 +02:00
print '<tr><td>Siren</td><td><a target="_blank" href="http://www.societe.com/cgi-bin/recherche?rncs='.$soc->siren.'">'.$soc->siren.'</a>&nbsp;</td>';
2003-10-12 16:55:30 +02:00
print '<td>Siret</td><td>'.$soc->siret.'</td></tr>';
print '<tr><td>Ape</td><td>'.$soc->ape.'</td>';
print '<td>Capital</td><td>'.$soc->capital.' '.MAIN_MONNAIE.'</td></tr>';
print '<tr><td colspan="2">Num<75>ro de TVA Intracommunautaire</td><td colspan="2">';
print $soc->tva_intra;
print '</td></tr>';
2002-04-30 12:51:35 +02:00
print '</table>';
print '<br></div>';
/*
*
*/
2003-09-12 02:20:56 +02:00
print '<div class="tabsAction">';
print '<a class="tabAction" href="soc.php?socid='.$socid.'&action=edit">Editer</a>';
print '<a class="tabAction" href="./contact/fiche.php?socid='.$socid.'&amp;action=create">Ajouter un contact</a>';
2004-02-03 20:05:59 +01:00
print '<a class="tabAction" href="societe/notify/fiche.php?socid='.$socid.'">Notifications</a>';
print '</div>';
/*
*
*/
2002-04-30 12:51:35 +02:00
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>