2002-04-30 12:51:35 +02:00
< ? PHP
2004-02-08 12:53:42 +01:00
/* Copyright ( C ) 2001 - 2004 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
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 ;
}
2004-02-16 18:15:26 +01:00
if ( $HTTP_POST_VARS [ " action " ] == 'add' or $HTTP_POST_VARS [ " action " ] == 'update' )
2002-12-12 22:04:06 +01:00
{
2002-04-30 12:51:35 +02:00
$soc = new Societe ( $db );
2004-02-16 18:15:26 +01:00
$soc -> nom = $HTTP_POST_VARS [ " nom " ];
$soc -> adresse = $HTTP_POST_VARS [ " adresse " ];
$soc -> cp = $HTTP_POST_VARS [ " cp " ];
$soc -> ville = $HTTP_POST_VARS [ " ville " ];
2004-02-17 10:59:06 +01:00
$soc -> pays_id = $HTTP_POST_VARS [ " pays_id " ];
2004-02-16 18:15:26 +01:00
$soc -> departement_id = $HTTP_POST_VARS [ " departement_id " ];
$soc -> tel = $HTTP_POST_VARS [ " tel " ];
$soc -> fax = $HTTP_POST_VARS [ " fax " ];
$soc -> url = ereg_replace ( " http:// " , " " , $HTTP_POST_VARS [ " 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 " ];
2004-02-04 20:15:31 +01:00
2004-02-09 10:21:43 +01:00
$soc -> forme_juridique_id = $HTTP_POST_VARS [ " forme_juridique_id " ];
2004-02-16 18:15:26 +01:00
$soc -> effectif_id = $HTTP_POST_VARS [ " effectif_id " ];
$soc -> client = $HTTP_POST_VARS [ " client " ];
$soc -> fournisseur = $HTTP_POST_VARS [ " fournisseur " ];
2002-04-30 12:51:35 +02:00
2004-02-16 18:15:26 +01:00
if ( $HTTP_POST_VARS [ " action " ] == 'update' )
{
$soc -> update ( $socid );
}
if ( $HTTP_POST_VARS [ " action " ] == 'add' )
{
$socid = $soc -> create ();
}
2002-04-30 12:51:35 +02:00
}
/*
*
*
*/
2004-02-05 16:10:03 +01:00
llxHeader ();
2004-02-16 18:15:26 +01:00
$form = new Form ( $db );
2002-04-30 12:51:35 +02:00
2002-12-12 22:04:06 +01:00
if ( $action == 'create' )
{
2004-02-09 10:21:43 +01:00
$soc = new Societe ( $db );
2004-02-07 19:48:33 +01:00
print '<div class="titre">Nouvelle soci<63> t<EFBFBD> (prospect, client, fournisseur)</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
2004-02-05 16:10:03 +01: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>' ;
2004-02-16 18:15:26 +01:00
print '<tr><td>CP</td><td><input size="6" type="text" name="cp"> ' ;
print 'Ville <input type="text" name="ville"></td>' ;
print '<td>D<> partement</td><td>' ;
print $form -> select_departement ( 0 );
print '</td></tr>' ;
2002-04-30 12:51:35 +02:00
2004-02-17 10:59:06 +01:00
print '<tr><td>Pays</td><td colspan="3">' ;
print $form -> select_pays ( $soc -> pays_id );
print '</td></tr>' ;
2004-02-05 16:10:03 +01:00
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
2004-02-05 16:10:03 +01: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>' ;
2004-02-09 10:21:43 +01:00
print '<tr><td>Forme juridique</td><td colspan="3">' ;
2004-02-16 18:15:26 +01:00
print $form -> select_array ( " forme_juridique_id " , $soc -> forme_juridique_array (), $soc -> forme_juridique , 0 , 1 );
2004-02-09 10:21:43 +01:00
print '</td></tr>' ;
print '<tr><td>Effectif</td><td colspan="3">' ;
2004-02-16 18:15:26 +01:00
print $form -> select_array ( " effectif_id " , $soc -> effectif_array (), $soc -> effectif_id );
2004-02-09 10:21:43 +01:00
print '</td></tr>' ;
2004-02-05 16:10:03 +01:00
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>' ;
2004-02-07 19:48:33 +01:00
print '<tr><td>Prospect / Client</td><td><select name="client">' ;
print '<option value="2" SELECTED>Prospect' ;
print '<option value="1">Client' ;
print '<option value="0">Ni client, ni prospect' ;
2004-02-05 16:10:03 +01:00
print '</select></td>' ;
2002-04-30 12:51:35 +02:00
2004-02-05 16:10:03 +01:00
print '<td>Fournisseur</td><td><select name="fournisseur">' ;
2003-01-28 18:55:40 +01:00
print_oui_non ( $soc -> fournisseur );
2004-02-05 16:10:03 +01:00
print '</select></td></tr>' ;
2002-04-30 12:51:35 +02:00
2004-02-05 16:10:03 +01: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
2003-06-25 00:18:10 +02:00
if ( $socid )
{
$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">' ;
2003-06-25 00:18:10 +02:00
print '<input type="hidden" name="action" value="update">' ;
2004-02-04 20:15:31 +01:00
print '<table class="border" width="100%" cellpadding="3" cellspacing="0">' ;
2004-02-16 18:15:26 +01:00
print '<tr><td>Nom</td><td colspan="3"><input type="text" size="40" name="nom" value="' . $soc -> nom . '"></td></tr>' ;
2004-02-08 12:53:42 +01:00
print '<tr><td valign="top">Adresse</td><td colspan="3"><textarea name="adresse" cols="30" rows="3" wrap="soft">' ;
2003-06-25 00:18:10 +02:00
print $soc -> adresse ;
print '</textarea></td></tr>' ;
2004-02-16 18:15:26 +01:00
print '<tr><td>CP</td><td><input size="6" type="text" name="cp" value="' . $soc -> cp . '"> ' ;
print 'Ville <input type="text" name="ville" value="' . $soc -> ville . '"></td>' ;
print '<td>D<> partement</td><td>' ;
print $form -> select_departement ( $soc -> departement_id );
print '</td></tr>' ;
2004-02-17 10:59:06 +01:00
print '<tr><td>Pays</td><td colspan="3">' ;
print $form -> select_pays ( $soc -> pays_id );
print '</td></tr>' ;
2004-02-04 20:15:31 +01:00
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>' ;
2004-02-14 19:31:00 +01:00
print '<tr><td>Web</td><td colspan="3">http://<input type="text" name="url" size="40" value="' . $soc -> url . '"></td></tr>' ;
2003-06-25 00:18:10 +02:00
2004-02-04 20:15:31 +01:00
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>' ;
2004-02-09 10:21:43 +01:00
print '<tr><td>Forme juridique</td><td colspan="3">' ;
$html = new Form ( $db );
print $html -> select_array ( " forme_juridique_id " , $soc -> forme_juridique_array (), $soc -> forme_juridique_id , 0 , 1 );
print '</td></tr>' ;
print '<tr><td>Effectif</td><td colspan="3">' ;
print $html -> select_array ( " effectif_id " , $soc -> effectif_array (), $soc -> effectif_id );
print '</td></tr>' ;
2004-02-04 20:15:31 +01:00
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 . '">' ;
2004-02-08 13:18:00 +01:00
2004-02-04 20:15:31 +01:00
print '</td></tr>' ;
2004-02-07 19:48:33 +01:00
print '<tr><td>Prospect / Client</td><td><select name="client">' ;
if ( $soc -> client == 2 )
{
2004-02-08 13:18:00 +01:00
print '<option value="2" SELECTED>Prospect</option>' ;
print '<option value="1">Client</option>' ;
print '<option value="0">Ni client, ni prospect</option>' ;
2004-02-07 19:48:33 +01:00
}
2004-02-08 13:18:00 +01:00
elseif ( $soc -> client == 1 )
2004-02-07 19:48:33 +01:00
{
2004-02-08 13:18:00 +01:00
print '<option value="2">Prospect</option>' ;
print '<option value="1" SELECTED>Client</option>' ;
print '<option value="0">Ni client, ni prospect</option>' ;
2004-02-07 19:48:33 +01:00
}
else
{
2004-02-08 13:18:00 +01:00
print '<option value="2">Prospect</option>' ;
print '<option value="1">Client</option>' ;
print '<option value="0" SELECTED>Ni client, ni prospect</option>' ;
2004-02-07 19:48:33 +01:00
}
2004-02-08 13:18:00 +01:00
print '</select></td>' ;
2004-02-07 19:48:33 +01:00
print '<td>Fournisseur</td><td><select name="fournisseur">' ;
2003-06-25 00:18:10 +02:00
print_oui_non ( $soc -> fournisseur );
print '</select>' ;
print '</td></tr>' ;
2004-02-08 12:53:42 +01:00
print '<tr><td align="center" colspan="4"><input type="submit" value="Mettre <20> jour"></td></tr>' ;
2003-06-25 00:18:10 +02:00
print '</table>' ;
print '</form>' ;
2004-02-08 13:18:00 +01:00
print 'Astuce : Vous pouvez v<> rifier le num<75> ro de TVA intra communautaire 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' ;
2003-06-25 00:18:10 +02:00
}
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 );
2004-02-05 16:10:03 +01:00
2004-02-08 12:53:42 +01:00
$head [ 0 ][ 0 ] = 'soc.php?socid=' . $soc -> id ;
$head [ 0 ][ 1 ] = " Fiche soci<63> t<EFBFBD> " ;
$h = 1 ;
2004-02-07 19:48:33 +01:00
if ( $soc -> client == 1 )
{
2004-02-08 12:53:42 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/comm/fiche.php?socid=' . $soc -> id ;
$head [ $h ][ 1 ] = 'Fiche client' ;
$h ++ ;
2004-02-07 19:48:33 +01:00
}
2004-02-08 12:53:42 +01:00
2004-02-07 19:48:33 +01:00
if ( $soc -> client == 2 )
2004-02-05 16:10:03 +01:00
{
2004-02-08 12:53:42 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/comm/prospect/fiche.php?id=' . $soc -> id ;
$head [ $h ][ 1 ] = 'Fiche prospect' ;
$h ++ ;
2004-02-05 16:10:03 +01:00
}
if ( $soc -> fournisseur )
{
2004-02-08 12:53:42 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/fourn/fiche.php?socid=' . $soc -> id ;
$head [ $h ][ 1 ] = 'Fiche fournisseur' ;
$h ++ ;
}
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/socnote.php?socid=' . $soc -> id ;
$head [ $h ][ 1 ] = 'Note' ;
$h ++ ;
if ( $user -> societe_id == 0 )
{
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/docsoc.php?socid=' . $soc -> id ;
$head [ $h ][ 1 ] = 'Documents' ;
$h ++ ;
2004-02-05 16:10:03 +01:00
}
2004-02-07 19:48:33 +01:00
2004-02-08 12:53:42 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/notify/fiche.php?socid=' . $soc -> id ;
$head [ $h ][ 1 ] = 'Notifications' ;
2004-02-07 19:48:33 +01:00
2004-02-08 12:53:42 +01:00
dolibarr_fiche_head ( $head , 0 );
/*
*
*/
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>' ;
2004-02-09 10:21:43 +01:00
print '<tr><td valign="top">Adresse</td><td colspan="3">' . nl2br ( $soc -> adresse ) . ' ' ;
2004-02-17 10:59:06 +01:00
print '<br>' . $soc -> cp . ' ' . $soc -> ville . '<br>' . $soc -> pays . '</td></tr>' ;
2003-09-12 16:08:02 +02:00
2004-02-16 18:15:26 +01:00
print '<tr><td>T<> l<EFBFBD> phone</td><td>' . dolibarr_print_phone ( $soc -> tel ) . '</td>' ;
print '<td>Fax</td><td>' . dolibarr_print_phone ( $soc -> fax ) . '</td></tr>' ;
2004-02-14 18:08:57 +01:00
print '<tr><td>Web</td><td colspan="3">' ;
if ( $soc -> url ) { print '<a href="http://' . $soc -> url . '">http://' . $soc -> url . '</a>' ; }
print '</td></tr>' ;
2003-09-12 02:20:56 +02:00
2004-02-05 16:10:03 +01:00
print '<tr><td>Siren</td><td><a target="_blank" href="http://www.societe.com/cgi-bin/recherche?rncs=' . $soc -> siren . '">' . $soc -> siren . '</a> </td>' ;
2003-10-12 16:55:30 +02:00
2004-02-05 16:10:03 +01:00
print '<td>Siret</td><td>' . $soc -> siret . '</td></tr>' ;
2004-02-09 10:21:43 +01:00
2004-02-05 16:10:03 +01:00
print '<tr><td>Ape</td><td>' . $soc -> ape . '</td>' ;
print '<td>Capital</td><td>' . $soc -> capital . ' ' . MAIN_MONNAIE . '</td></tr>' ;
2004-02-04 20:15:31 +01:00
2004-02-09 10:21:43 +01:00
print '<tr><td>Forme juridique</td><td colspan="3">' . $soc -> forme_juridique . '</td></tr>' ;
print '<tr><td>Effectif</td><td colspan="3">' . $soc -> effectif . '</td></tr>' ;
2004-02-04 20:15:31 +01:00
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>' ;
2004-02-05 16:10:03 +01:00
print '<br></div>' ;
2003-06-10 14:18:29 +02:00
/*
*
2004-02-09 10:21:43 +01:00
*/
2004-02-05 16:10:03 +01:00
print '<div class="tabsAction">' ;
print '<a class="tabAction" href="soc.php?socid=' . $socid . '&action=edit">Editer</a>' ;
2003-06-10 14:18:29 +02:00
2004-02-05 16:10:03 +01:00
print '<a class="tabAction" href="./contact/fiche.php?socid=' . $socid . '&action=create">Ajouter un contact</a>' ;
2004-02-03 20:05:59 +01:00
2004-02-05 16:10:03 +01:00
print '<a class="tabAction" href="societe/notify/fiche.php?socid=' . $socid . '">Notifications</a>' ;
print '</div>' ;
2003-06-10 14:18:29 +02:00
/*
*
*/
2002-04-30 12:51:35 +02:00
}
$db -> close ();
llxFooter ( " <em>Dernière modification $Date $ révision $Revision $ </em> " );
?>