diff --git a/htdocs/compta/ventilation/fiche.php b/htdocs/compta/ventilation/fiche.php
new file mode 100644
index 00000000000..1278d0e2060
--- /dev/null
+++ b/htdocs/compta/ventilation/fiche.php
@@ -0,0 +1,143 @@
+
+ *
+ * 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 ($_POST["action"] == 'ventil' && $user->rights->compta->ventiler)
+{
+ $sql = " UPDATE ".MAIN_DB_PREFIX."facturedet";
+ $sql .= " SET fk_code_ventilation = ".$_POST["codeventil"];
+ $sql .= " WHERE rowid = ".$_GET["id"];
+
+ $db->query($sql);
+}
+
+llxHeader("","","Fiche ventilation");
+
+if ($cancel == $langs->trans("Cancel"))
+{
+ $action = '';
+}
+/*
+ *
+ *
+ */
+
+$sql = "SELECT rowid, numero, intitule";
+$sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux";
+$sql .= " ORDER BY numero ASC";
+
+$result = $db->query($sql);
+if ($result)
+{
+ $num = $db->num_rows();
+ $i = 0;
+
+ while ($i < $num)
+ {
+ $row = $db->fetch_row();
+ $cgs[$row[0]] = $row[1] . ' ' . $row[2];
+ $i++;
+ }
+}
+
+/*
+ * Création
+ *
+ */
+$form = new Form($db);
+
+if($_GET["id"] && $user->rights->compta->ventiler)
+{
+ $sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux, l.remise_percent, l.subprice, ".$db->pdate("l.date_start")." as date_start, ".$db->pdate("l.date_end")." as date_end, l.fk_code_ventilation ";
+ $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l";
+ $sql .= " , ".MAIN_DB_PREFIX."facture as f";
+ $sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND l.rowid = ".$_GET["id"];
+
+ $result = $db->query($sql);
+ if ($result)
+ {
+ $num_lignes = $db->num_rows();
+ $i = 0;
+
+ if ($num_lignes)
+ {
+
+ $objp = $db->fetch_object();
+
+
+ if($objp->fk_code_ventilation == 0)
+ {
+ print '
';
+ }
+ else
+ {
+ print "Error";
+ }
+ }
+ else
+ {
+ print "Error";
+ }
+}
+else
+{
+ print "Error";
+}
+
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/compta/ventilation/index.php b/htdocs/compta/ventilation/index.php
new file mode 100644
index 00000000000..a569a62a6ae
--- /dev/null
+++ b/htdocs/compta/ventilation/index.php
@@ -0,0 +1,105 @@
+
+ * Copyright (C) 2004 Laurent Destailleur
+ *
+ * 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$
+ *
+ */
+
+/*!
+ \file htdocs/compta/index.php
+ \ingroup compta
+ \brief Page accueil zone comptabilité
+ \version $Revision$
+*/
+
+require("./pre.inc.php");
+
+$user->getrights('banque');
+
+$langs->load("compta");
+
+/*
+ * Sécurité accés client
+ */
+if ($user->societe_id > 0)
+{
+ $action = '';
+ $socidp = $user->societe_id;
+}
+
+llxHeader("","Accueil Compta");
+
+
+/*
+ * Actions
+ */
+
+if ($action == 'add_bookmark')
+{
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$socidp." AND fk_user=".$user->id;
+ if (! $db->query($sql) )
+ {
+ dolibarr_print_error($db);
+ }
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");";
+ if (! $db->query($sql) )
+ {
+ dolibarr_print_error($db);
+ }
+}
+
+if ($action == 'del_bookmark')
+{
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE rowid=$bid";
+ $result = $db->query($sql);
+}
+
+
+
+/*
+ * Affichage page
+ *
+ */
+print_titre("Espace ventilation");
+
+print '';
+
+print '';
+
+/*
+ * Zone recherche facture
+ */
+print ' ";
+
+print ' | ';
+
+print ' |
';
+
+print '
';
+
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/compta/ventilation/liste.php b/htdocs/compta/ventilation/liste.php
new file mode 100644
index 00000000000..c201388d046
--- /dev/null
+++ b/htdocs/compta/ventilation/liste.php
@@ -0,0 +1,119 @@
+
+ * Copyright (C) 2004 Éric Seigne
+ * Copyright (C) 2004 Laurent Destailleur
+ *
+ * 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$
+ *
+ */
+
+/*! \file htdocs/compta/facture.php
+ \ingroup facture
+ \brief Page de création d'une facture
+ \version $Revision$
+*/
+
+require("./pre.inc.php");
+
+$user->getrights('facture');
+$user->getrights('banque');
+
+if (!$user->rights->facture->lire)
+ accessforbidden();
+
+$langs->load("bills");
+
+require_once "../../facture.class.php";
+require_once "../../paiement.class.php";
+
+
+if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; }
+/*
+ * Sécurité accés client
+ */
+if ($user->societe_id > 0)
+{
+ $action = '';
+ $socidp = $user->societe_id;
+}
+
+llxHeader('',$langs->trans("Bill"),'Facture');
+
+/*
+ * Lignes de factures
+ *
+ */
+$page = $_GET["page"];
+if ($page < 0) $page = 0;
+$limit = $conf->liste_limit;
+$offset = $limit * $page ;
+
+$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux, l.remise_percent, l.subprice, ".$db->pdate("l.date_start")." as date_start, ".$db->pdate("l.date_end")." as date_end, l.fk_code_ventilation ";
+$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l";
+$sql .= " , ".MAIN_DB_PREFIX."facture as f";
+$sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND fk_code_ventilation = 0";
+$sql .= " ORDER BY l.rowid DESC";
+$sql .= $db->plimit($limit+1,$offset);
+
+
+$result = $db->query($sql);
+if ($result)
+{
+ $num_lignes = $db->num_rows();
+ $i = 0;
+
+ print_barre_liste("Lignes de facture à ventiler",$page,"liste.php","",$sortfield,$sortorder,'',$num_lignes);
+
+ if ($num_lignes)
+ {
+ echo '';
+ print "| Facture | ";
+ print ''.$langs->trans("Description").' | ';
+ print ''.$langs->trans("VAT").' | ';
+ print "
\n";
+ }
+ $var=True;
+ while ($i < min($num_lignes, $limit))
+ {
+ $objp = $db->fetch_object();
+ $var=!$var;
+ print "";
+
+ print '| '.$objp->facnumber.' | ';
+
+
+ print ''.stripslashes(nl2br($objp->description)).' | ';
+
+ print '';
+ print img_edit();
+ print ' | ';
+
+
+ print "
";
+ $i++;
+ }
+ print "
";
+}
+else
+{
+ print $db->error();
+}
+$db->close();
+
+llxFooter("Dernière modification $Date$ révision $Revision$");
+?>
diff --git a/htdocs/compta/ventilation/pre.inc.php b/htdocs/compta/ventilation/pre.inc.php
new file mode 100644
index 00000000000..757b5377e87
--- /dev/null
+++ b/htdocs/compta/ventilation/pre.inc.php
@@ -0,0 +1,107 @@
+
+ * Copyright (C) 2004 Laurent Destailleur
+ *
+ * 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$
+ *
+ */
+
+/*!
+ \file htdocs/compta/pre.inc.php
+ \ingroup compta
+ \brief Fichier gestionnaire du menu compta
+*/
+
+require("../../main.inc.php");
+$user->getrights('');
+
+function llxHeader($head = "", $title="", $help_url='')
+{
+ global $user, $conf, $langs;
+
+ top_menu($head, $title);
+
+ $menu = new Menu();
+
+ // Les recettes
+
+ $menu->add(DOL_URL_ROOT."/compta/clients.php", $langs->trans("Customers"));
+
+ if ($user->comm > 0 && $conf->commercial->enabled && $conf->propal->enabled)
+ {
+ $langs->load("propal");
+ $menu->add(DOL_URL_ROOT."/compta/propal.php",$langs->trans("Prop"));
+ }
+
+ if ($conf->contrat->enabled)
+ {
+ $langs->load("contracts");
+ $menu->add(DOL_URL_ROOT."/contrat/",$langs->trans("Contracts"));
+ }
+
+ if ($conf->don->enabled)
+ {
+ $langs->load("donations");
+ $menu->add(DOL_URL_ROOT."/compta/dons/",$langs->trans("Donations"));
+ }
+
+ if ($conf->facture->enabled)
+ {
+ $langs->load("bills");
+ $menu->add(DOL_URL_ROOT."/compta/facture.php",$langs->trans("Bills"));
+ }
+
+
+ // Les dépenses
+ if ($conf->fournisseur->enabled)
+ {
+ $langs->load("suppliers");
+ $menu->add(DOL_URL_ROOT."/fourn/index.php", $langs->trans("Suppliers"));
+ }
+
+ if ($user->societe_id == 0)
+ {
+ $menu->add(DOL_URL_ROOT."/compta/deplacement/", "Déplacement");
+ }
+
+ if ($conf->compta->enabled && $conf->compta->tva && $user->societe_id == 0)
+ {
+ $menu->add(DOL_URL_ROOT."/compta/tva/index.php",$langs->trans("VAT"));
+ }
+
+ if ($conf->compta->enabled)
+ {
+ $menu->add(DOL_URL_ROOT."/compta/charges/index.php","Charges");
+ }
+
+ $menu->add(DOL_URL_ROOT."/compta/ventilation/",$langs->trans("Ventilation"));
+ $menu->add_submenu(DOL_URL_ROOT."/compta/ventilation/liste.php",$langs->trans("A ventiler"));
+
+ if ($user->rights->compta->ventilation->param)
+ $menu->add(DOL_URL_ROOT."/compta/param/",$langs->trans("Param"));
+
+ if (! $user->compta)
+ {
+ $menu->clear();
+ $menu->add(DOL_URL_ROOT."/",$langs->trans("Home"));
+ }
+
+ left_menu($menu->liste, $help_url);
+}
+
+?>