diff --git a/htdocs/compta/deplacement/deplacement.class.php b/htdocs/compta/deplacement/deplacement.class.php
new file mode 100644
index 00000000000..4b1e17ed04f
--- /dev/null
+++ b/htdocs/compta/deplacement/deplacement.class.php
@@ -0,0 +1,128 @@
+
+ *
+ * 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$
+ */
+
+class Deplacement
+{
+ var $db;
+ var $id;
+ var $user;
+ var $km;
+ var $note;
+
+ /*
+ * Initialistation automatique de la classe
+ */
+ Function Deplacement($DB)
+ {
+ $this->db = $DB;
+
+ return 1;
+ }
+ /*
+ *
+ */
+ Function create($user)
+ {
+ $sql = "INSERT INTO llx_deplacement (datec, fk_user_author) VALUES (now(), $user->id)";
+
+ $result = $this->db->query($sql);
+ if ($result)
+ {
+ $this->id = $this->db->last_insert_id();
+ if ( $this->update($user) )
+ {
+ return $this->id;
+ }
+ }
+ }
+ /*
+ *
+ */
+ Function update($user)
+ {
+ if (strlen($this->km)==0)
+ $this->km = 0;
+
+ $sql = "UPDATE llx_deplacement ";
+ $sql .= " SET km = $this->km";
+ $sql .= " , dated = '".$this->db->idate($this->date)."'";
+ $sql .= " , fk_user = $this->userid";
+ $sql .= " , fk_soc = $this->socid";
+ $sql .= " WHERE rowid = ".$this->id;
+
+ $result = $this->db->query($sql);
+ if ($result)
+ {
+ return 1;
+ }
+ else
+ {
+ print $this->db->error();
+ print "
".$sql;
+ return 0;
+ }
+ }
+ /*
+ *
+ */
+ Function fetch ($id)
+ {
+ $sql = "SELECT rowid, fk_user, km, fk_soc,".$this->db->pdate("dated")." as dated";
+ $sql .= " FROM llx_deplacement WHERE rowid = $id";
+
+ $result = $this->db->query($sql) ;
+
+ if ( $result )
+ {
+ $result = $this->db->fetch_array();
+
+ $this->id = $result["rowid"];
+ $this->date = $result["dated"];
+ $this->userid = $result["fk_user"];
+ $this->socid = $result["fk_soc"];
+ $this->km = $result["km"];
+ return 1;
+ }
+ }
+ /*
+ *
+ */
+ Function delete()
+ {
+ $sql = "DELETE FROM llx_deplacement WHERE rowid = $this->id)";
+
+ $result = $this->db->query($sql);
+ if ($result)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ /*
+ *
+ */
+
+}
+
+?>
diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php
new file mode 100644
index 00000000000..6106e40fa70
--- /dev/null
+++ b/htdocs/compta/deplacement/fiche.php
@@ -0,0 +1,186 @@
+
+ *
+ * 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");
+
+$mesg = '';
+
+if ($HTTP_POST_VARS["action"] == 'add' && $HTTP_POST_VARS["cancel"] <> 'Annuler')
+{
+ $deplacement = new Deplacement($db);
+
+ $deplacement->date = mktime(12, 1 , 1,
+ $HTTP_POST_VARS["remonth"],
+ $HTTP_POST_VARS["reday"],
+ $HTTP_POST_VARS["reyear"]);
+
+ $deplacement->km = $HTTP_POST_VARS["km"];
+ $deplacement->socid = $HTTP_POST_VARS["socid"];
+ $deplacement->userid = $user->id; //$HTTP_POST_VARS["km"];
+ $id = $deplacement->create($user);
+
+ if ($id > 0)
+ {
+ Header ( "Location: fiche.php?id=$id");
+ }
+ else
+ {
+ print "Error";
+ }
+}
+
+if ($HTTP_POST_VARS["action"] == 'update' && $HTTP_POST_VARS["cancel"] <> 'Annuler')
+{
+ $deplacement = new Deplacement($db);
+ $result = $deplacement->fetch($id);
+
+ $deplacement->date = mktime(12, 1 , 1,
+ $HTTP_POST_VARS["remonth"],
+ $HTTP_POST_VARS["reday"],
+ $HTTP_POST_VARS["reyear"]);
+
+ $deplacement->km = $HTTP_POST_VARS["km"];
+
+ $result = $deplacement->update($user);
+
+ if ($result > 0)
+ {
+ Header ( "Location: fiche.php?id=$id");
+ }
+ else
+ {
+ print "Error";
+ }
+}
+
+
+llxHeader();
+
+/*
+ *
+ *
+ */
+$html = new Form($db);
+if ($action == 'create')
+{
+ print "
';
+}
+else
+{
+ if ($id)
+ {
+ $deplacement = new Deplacement($db);
+ $result = $deplacement->fetch($id);
+
+ if ( $result )
+ {
+
+ if ($action == 'edit')
+ {
+ print_fiche_titre('Fiche déplacement : '.$product->ref, $mesg);
+
+ print "';
+ }
+ else
+ {
+ print_fiche_titre('Fiche déplacement : '.$product->ref, $mesg);
+
+ print '';
+
+ $soc = new Societe($db);
+ $soc->fetch($deplacement->socid);
+ print '| Personne | '.$user->fullname.' |
';
+ print '| Société visitée | '.$soc->nom_url.' |
';
+ print '| Date du déplacement | ';
+ print strftime("%A %d %B %Y",$deplacement->date);
+ print ' |
';
+
+ print '| Kilomètres | '.$deplacement->km.' |
';
+ print "
";
+ }
+
+ }
+ else
+ {
+ print "Error";
+ }
+ }
+}
+/* ************************************************************************** */
+/* */
+/* Barre d'action */
+/* */
+/* ************************************************************************** */
+
+print '
';
+print '| - | ';
+print '- | ';
+print '- | ';
+
+if ($action == 'create')
+{
+ print '- | ';
+}
+else
+{
+ print '[Editer] | ';
+}
+print '- | ';
+print '
';
+
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php
new file mode 100644
index 00000000000..26fac7c6fb6
--- /dev/null
+++ b/htdocs/compta/deplacement/index.php
@@ -0,0 +1,107 @@
+
+ *
+ * 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("../../tva.class.php3");
+
+/*
+ *
+ *
+ */
+/*
+ *
+ */
+
+llxHeader();
+
+/*
+ * Liste
+ *
+ */
+
+if ($sortorder == "")
+{
+ $sortorder="DESC";
+}
+if ($sortfield == "")
+{
+ $sortfield="d.dated";
+}
+
+if ($page == -1) { $page = 0 ; }
+
+$limit = $conf->liste_limit;
+$offset = $limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+$sql = "SELECT s.nom,s.idp, d.km,".$db->pdate("d.dated")." as dd, u.name, u.firstname, d.rowid";
+$sql .= " FROM llx_societe as s, llx_deplacement as d, llx_user as u ";
+$sql .= " WHERE d.fk_soc = s.idp AND d.fk_user = u.rowid";
+
+if ($user->societe_id > 0)
+{
+ $sql .= " AND s.idp = " . $user->societe_id;
+}
+
+$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit + 1 ,$offset);
+
+if ( $db->query($sql) )
+{
+ $num = $db->num_rows();
+ print_barre_liste("Liste des déplacements", $page, $PHP_SELF,"&socidp=$socidp",$sortfield,$sortorder,'',$num);
+
+ $i = 0;
+ print '';
+ print "";
+ print_liste_field_titre_new ("Date",$PHP_SELF,"d.dated","","&socidp=$socidp",'',$sortfield);
+ print_liste_field_titre_new ("Société",$PHP_SELF,"s.nom","","&socidp=$socidp",'',$sortfield);
+ print '| Utilisateur | ';
+
+ print "
\n";
+ $var=True;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object( $i);
+ $var=!$var;
+ print "";
+ print '| '.strftime("%d %B %Y",$objp->dd).' | ';
+ print "idp\">$objp->nom | \n";
+
+ print ''.$objp->firstname.' '.$objp->name.' | ';
+
+ print "
\n";
+
+ $i++;
+ }
+
+ print "
";
+ $db->free();
+}
+else
+{
+ print $db->error();
+ print "$sql";
+}
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>