';
+
+
+
+print '';
+print '';
+print '| '.$langs->trans("Statistics").' | ';
+print " \n";
+
+$listoftype=$tripandexpense_static->listOfTypes();
+foreach ($listoftype as $typefee)
+{
+ $dataseries[]=array('label'=>$typefee['label'],'values'=>array(0=>(isset($nb[$typefee['code']])?$nb[$typefee['code']]:0)));
+}
+
+if ($conf->use_javascript_ajax)
+{
+ print '| ';
+ $data=array('series'=>$dataseries);
+ dol_print_graph('stats',300,180,$data,1,'pie',1);
+ print ' | ';
+}
+
+print '';
+print '| '.$langs->trans("Total").' | ';
+print ''.$totalnb.' | ';
+print ' ';
+
+print ' ';
+
+
+// Right area
+print ' | ';
+
+$max=10;
+
+$langs->load("boxes");
+
+$sql = "SELECT u.rowid as uid, u.name, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km";
+$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
+if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+$sql.= " WHERE u.rowid = d.fk_user";
+$sql.= " AND d.entity = ".$conf->entity;
+if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+if ($socid) $sql.= " AND d.fk_soc = ".$socid;
+$sql.= $db->order("d.tms","DESC");
+$sql.= $db->plimit($max, 0);
+
+$result = $db->query($sql);
+if ($result)
+{
+ $var=false;
+ $num = $db->num_rows($result);
+
+ $i = 0;
+
+ print '';
+ print '';
+ print '| '.$langs->trans("BoxTitleLastModifiedExpenses",min($max,$num)).' | ';
+ print ''.$langs->trans("FeesKilometersOrAmout").' | ';
+ print ''.$langs->trans("DateModificationShort").' | ';
+ print ' | ';
+ print ' ';
+ if ($num)
+ {
+ $total_ttc = $totalam = $total = 0;
+
+ $deplacementstatic=new Deplacement($db);
+ $userstatic=new User($db);
+ while ($i < $num && $i < $max)
+ {
+ $objp = $db->fetch_object($result);
+ $deplacementstatic->ref=$objp->rowid;
+ $deplacementstatic->id=$objp->rowid;
+ $userstatic->id=$objp->uid;
+ $userstatic->nom=$objp->name;
+ $userstatic->prenom=$objp->firstname;
+ print '';
+ print '| '.$deplacementstatic->getNomUrl(1).' | ';
+ print ''.$userstatic->getNomUrl(1).' | ';
+ print ''.$objp->km.' | ';
+ print ''.dol_print_date($db->jdate($objp->dm),'day').' | ';
+ print ''.$deplacementstatic->LibStatut($objp->fk_statut,3).' | ';
+ print ' ';
+ $var=!$var;
+ $i++;
+ }
+
+ }
+ else
+ {
+ print '| '.$langs->trans("None").' | ';
+ }
+ print ' ';
+}
+else dol_print_error($db);
+
+
$db->close();
-llxFooter('$Date$ - $Revision$');
+llxFooter('$Date: 2011/06/29 17:55:33 $ - $Revision: 1.44 $');
?>
diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php
new file mode 100755
index 00000000000..404e0afb5f4
--- /dev/null
+++ b/htdocs/compta/deplacement/list.php
@@ -0,0 +1,129 @@
+
+ * Copyright (C) 2004-2011 Laurent Destailleur
+ * Copyright (C) 2004 Eric Seigne
+ * Copyright (C) 2005-2009 Regis Houssin
+ *
+ * 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.
+ */
+
+/**
+ * \file htdocs/compta/deplacement/list.php
+ * \brief Page list of expenses
+ * \version $Id: list.php,v 1.1 2011/06/29 17:55:33 eldy Exp $
+ */
+
+require("../../main.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/compta/tva/class/tva.class.php");
+require_once(DOL_DOCUMENT_ROOT."/compta/deplacement/class/deplacement.class.php");
+
+$langs->load("companies");
+$langs->load("users");
+$langs->load("trips");
+
+// Security check
+$socid = $_GET["socid"]?$_GET["socid"]:'';
+if ($user->societe_id) $socid=$user->societe_id;
+$result = restrictedArea($user, 'deplacement','','');
+
+$sortfield = GETPOST("sortfield",'alpha');
+$sortorder = GETPOST("sortorder",'alpha');
+$page = GETPOST("page",'int');
+if ($page == -1) { $page = 0; }
+$offset = $conf->liste_limit * $page;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+if (! $sortorder) $sortorder="DESC";
+if (! $sortfield) $sortfield="d.dated";
+$limit = $conf->liste_limit;
+
+
+/*
+ * View
+ */
+
+$tripandexpense_static=new Deplacement($db);
+
+llxHeader();
+
+$sql = "SELECT s.nom, s.rowid as socid,"; // Ou
+$sql.= " d.rowid, d.type, d.dated as dd, d.km, "; // Comment
+$sql.= " u.name, u.firstname"; // Qui
+$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
+$sql.= ", ".MAIN_DB_PREFIX."deplacement as d";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON d.fk_soc = s.rowid";
+if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
+$sql.= " WHERE d.fk_user = u.rowid";
+$sql.= " AND d.entity = ".$conf->entity;
+if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id;
+if ($socid) $sql.= " AND s.rowid = ".$socid;
+$sql.= $db->order($sortfield,$sortorder);
+$sql.= $db->plimit($limit + 1 ,$offset);
+
+//print $sql;
+$resql=$db->query($sql);
+if ($resql)
+{
+ $num = $db->num_rows($resql);
+
+ print_barre_liste($langs->trans("ListOfFees"), $page, $_SERVER["PHP_SELF"],"&socid=$socid",$sortfield,$sortorder,'',$num);
+
+ $i = 0;
+ print '';
+ print "";
+ print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"d.type","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.name","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid",'',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("FeesKilometersOrAmout"),$_SERVER["PHP_SELF"],"d.km","","&socid=$socid",'align="right"',$sortfield,$sortorder);
+ print_liste_field_titre('',$_SERVER["PHP_SELF"], '');
+ print " \n";
+
+ $var=true;
+ while ($i < min($num,$limit))
+ {
+ $objp = $db->fetch_object($resql);
+
+ $soc = new Societe($db);
+ if ($objp->socid) $soc->fetch($objp->socid);
+
+ $var=!$var;
+ print '';
+ print '| '.img_object($langs->trans("ShowTrip"),"trip").' '.$objp->rowid.' | ';
+ print ''.$langs->trans($objp->type).' | ';
+ print ''.dol_print_date($db->jdate($objp->dd),'day').' | ';
+ print ''.img_object($langs->trans("ShowUser"),"user").' '.$objp->firstname.' '.$objp->name.' | ';
+ if ($objp->socid) print ''.$soc->getNomUrl(1).' | ';
+ else print ' | ';
+ print ''.$objp->km.' | ';
+
+ print ''.$tripandexpense_static->getLibStatut(5).' | ';
+ print " \n";
+
+ $i++;
+ }
+
+ print " ";
+ $db->free($resql);
+}
+else
+{
+ dol_print_error($db);
+}
+$db->close();
+
+llxFooter('$Date: 2011/06/29 17:55:33 $ - $Revision: 1.1 $');
+?>
diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php
index 47aa79c1060..94ea39a56b2 100644
--- a/htdocs/compta/dons/class/don.class.php
+++ b/htdocs/compta/dons/class/don.class.php
@@ -22,7 +22,7 @@
* \file htdocs/compta/dons/class/don.class.php
* \ingroup don
* \brief Fichier de la classe des dons
- * \version $Id$
+ * \version $Id: don.class.php,v 1.10 2011/06/29 17:55:34 eldy Exp $
*/
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@@ -310,6 +310,8 @@ class Don extends CommonObject
$sql.= ", fk_user_valid";
$sql.= ", datedon";
$sql.= ", email";
+ $sql.= ", phone";
+ $sql.= ", phone_mobile";
$sql.= ") VALUES (";
$sql.= " '".$this->db->idate($now)."'";
$sql.= ", ".$conf->entity;
@@ -328,7 +330,9 @@ class Don extends CommonObject
$sql.= ", ".$user->id;
$sql.= ", null";
$sql.= ", '".$this->db->idate($this->date)."'";
- $sql.= ", '".$this->email."'";
+ $sql.= ", '".$this->db->escape($this->email)."'";
+ $sql.= ", '".$this->db->escape($this->phone)."'";
+ $sql.= ", '".$this->db->escape($this->phone_mobile)."'";
$sql.= ")";
dol_syslog("Don::create sql=".$sql, LOG_DEBUG);
@@ -367,6 +371,8 @@ class Don extends CommonObject
$sql .= ",note='".$this->db->escape($this->note)."'";
$sql .= ",datedon='".$this->db->idate($this->date)."'";
$sql .= ",email='".$this->email."'";
+ $sql .= ",phone='".$this->phone."'";
+ $sql .= ",phone_mobile='".$this->phone_mobile."'";
$sql .= ",fk_statut=".$this->statut;
$sql .= " WHERE rowid = $this->id";
@@ -383,9 +389,9 @@ class Don extends CommonObject
}
}
- /*
- * Suppression du don de la base
- * @param rowid id du don a supprimer
+ /**
+ * Delete a donation
+ * @param rowid Id of donation to delete
*/
function delete($rowid)
{
@@ -413,7 +419,8 @@ class Don extends CommonObject
/**
* Load donation from database
- * @param rowid Id of donation toload
+ * @param rowid Id of donation to load
+ * @param ref Ref of donation to load
* @return int <0 if KO, >0 if OK
*/
function fetch($rowid,$ref='')
@@ -421,7 +428,7 @@ class Don extends CommonObject
global $conf;
$sql = "SELECT d.rowid, d.datec, d.tms as datem, d.datedon,";
- $sql.= " d.prenom, d.nom, d.societe, d.amount, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.fk_don_projet,";
+ $sql.= " d.prenom, d.nom, d.societe, d.amount, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.phone, d.phone_mobile, d.fk_don_projet,";
$sql.= " p.title as project_label";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_don_projet";
@@ -451,6 +458,8 @@ class Don extends CommonObject
$this->zip = $obj->cp;
$this->town = $obj->ville;
$this->email = $obj->email;
+ $this->phone = $obj->phone;
+ $this->phone_mobile = $obj->phone_mobile;
$this->pays = $obj->pays;
$this->projet = $obj->project_label;
$this->fk_project = $obj->fk_don_projet;
diff --git a/htdocs/compta/dons/index.php b/htdocs/compta/dons/index.php
index 972d21b33f3..eded37ea345 100644
--- a/htdocs/compta/dons/index.php
+++ b/htdocs/compta/dons/index.php
@@ -21,7 +21,7 @@
* \file htdocs/compta/dons/index.php
* \ingroup don
* \brief Home page of donation module
- * \version $Id$
+ * \version $Id: index.php,v 1.28 2011/06/29 17:55:33 eldy Exp $
*/
require("../../main.inc.php");
@@ -43,10 +43,11 @@ $donation_static=new Don($db);
* View
*/
-llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Subvenciones');
-
$donstatic=new Don($db);
+$help_url='EN:Module_Donations|FR:Module_Dons|ES:Módulo_Subvenciones';
+llxHeader('',$langs->trans("Donations"),$help_url);
+
$sql = "SELECT count(d.rowid) as nb, sum(d.amount) as somme , d.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
$sql.= " GROUP BY d.fk_statut";
@@ -133,8 +134,7 @@ print " |