diff -ur --exclude=CVS --exclude=install --exclude=conf.php --unidirectional-new-file dolibarrcvs/htdocs/includes/boxes/box_ca.php dolibarr/htdocs/includes/boxes/box_ca.php --- dolibarrcvs/htdocs/includes/boxes/box_ca.php 1969-12-31 20:00:00.000000000 -0400 +++ dolibarr/htdocs/includes/boxes/box_ca.php 2005-08-11 20:32:41.000000000 -0400 @@ -0,0 +1,150 @@ + + * Copyright (C) 2004-2005 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: box_ca.php,v 1.0 2005/08/11 21:25:17 chris Exp $ + * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_ca.php,v $ + * + */ + +/** + \file htdocs/includes/boxes/box_ca.php + \ingroup factures + \brief Module de génération de l'affichage de la box chiffre d'affaire +*/ + +include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); + + +class box_ca extends ModeleBoxes { + + var $boxcode="salesturnover"; + var $boximg="object_payment"; + var $boxlabel; +// var $depends = array("facture"); + + var $info_box_head = array(); + var $info_box_contents = array(); + + /** + * \brief Constructeur de la classe + */ + function box_ca() + { + global $langs; + $langs->load("boxes"); + + $this->boxlabel=$langs->trans("BoxSalesTurnover"); + } + + /** + * \brief Charge les données en mémoire pour affichage ultérieur + * \param $max Nombre maximum d'enregistrements à charger + */ + function loadBox($max=2) + { + global $user, $langs, $db; + + $langs->load("boxes"); + + $this->info_box_head = array('text' => $langs->trans("BoxTitleSalesTurnover")); + + if ($user->rights->facture->lire) + { + $sql = "SELECT sum(f.amount) AS total ,DATE_FORMAT(f.datef,'%Y') AS period"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + $sql .= " WHERE f.fk_soc = s.idp"; + if($user->societe_id) + { + $sql .= " AND s.idp = $user->societe_id"; + } + $sql .= " GROUP BY period ORDER BY period DESC"; + $sql .= $db->plimit($max, 0); + + $result = $db->query($sql); + $annee = array(); + + if ($result) + { + for ($year = 0; $year < $db->num_rows($result); $year++) + { + $objp = $db->fetch_object($result); + $annee[ $objp->period ] = $objp->total; + } + + for ( $line = 0; $line < $max; $line++ ) + { + $timestamp = mktime(0, 0, 0, date("m"), date("d"), date("Y")- $line); + $year = date('Y', $timestamp) ; + + $this->info_box_contents[$line][0] = array('align' => 'left', + 'text' => $langs->trans('Year').' '.$year + ); + $this->info_box_contents[$line][1] = array('align' => 'right', + 'text' => price( isset($annee[ $year ]) ? $annee[ $year ] : 0 ) + ); + } + } + + $sql = "SELECT sum(f.amount) AS total ,DATE_FORMAT(f.datef,'%Y%m') AS period"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + $sql .= " WHERE f.fk_soc = s.idp"; + if($user->societe_id) + { + $sql .= " AND s.idp = $user->societe_id"; + } + $sql .= " GROUP BY period ORDER BY period DESC"; + $sql .= $db->plimit($max, 0); + + $result = $db->query($sql); + $mois = array(); + + if ($result) + { + for ($month = 0; $month < $db->num_rows($result); $month++) + { + $objp = $db->fetch_object($result); + $mois[ $objp->period ] = $objp->total; + } + for ( $line2 = 0; $line2 < $max; $line2++ ) + { + $timestamp = mktime(0, 0, 0, date("m")- $line2 , date("d"), date("Y")); + $yearmonth = date('Ym',$timestamp) ; + + $this->info_box_contents[ $line2 + $line ][0] = array('align' => 'left', + 'text' => $langs->trans("Month").' '.ucfirst(strftime('%B',$timestamp)) + ); + $this->info_box_contents[ $line2 + $line ][1] = array('align' => 'right', + 'text' => price( isset($mois[ $yearmonth ]) ? $mois[ $yearmonth ] : 0 ) + ); + } + } + } + else { + $this->info_box_contents[0][0] = array('align' => 'left', + 'text' => $langs->trans("ReadPermissionNotAllowed")); + } + } + + function showBox() + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } + +} + +?> diff -ur --exclude=CVS --exclude=install --exclude=conf.php --unidirectional-new-file dolibarrcvs/htdocs/includes/boxes/box_clients_imp.php dolibarr/htdocs/includes/boxes/box_clients_imp.php --- dolibarrcvs/htdocs/includes/boxes/box_clients_imp.php 1969-12-31 20:00:00.000000000 -0400 +++ dolibarr/htdocs/includes/boxes/box_clients_imp.php 2005-08-15 20:00:04.000000000 -0400 @@ -0,0 +1,112 @@ + + * Copyright (C) 2004-2005 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: box_clients_imp.php,v 1.0 2005/08/03 17:43:47 chris Exp $ + * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_clients_imp.php,v $ + * + */ + +/** + \file htdocs/includes/boxes/box_clients_imp.php + \ingroup factures + \brief Module de génération de l'affichage de la box total des factures clients impayees +*/ + +include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); + + +class box_clients_imp extends ModeleBoxes { + + var $boxcode="boxtotalunpayedcustomersbills"; + var $boximg="object_bill"; + var $boxlabel; + var $depends = array("facture"); + + var $info_box_head = array(); + var $info_box_contents = array(); + + + /** + * \brief Constructeur de la classe + */ + function box_clients_imp() + { + global $langs; + $langs->load("boxes"); + + $this->boxlabel=$langs->trans("BoxTotalUnpayedCustomerBills"); + } + + /** + * \brief Charge les données en mémoire pour affichage ultérieur + */ + function loadBox() + { + global $user, $langs, $db; + $langs->load("boxes"); + + $this->info_box_head = array('text' => $langs->trans("BoxTitleTotalUnpayedCustomerBills",$max)); + + if ($user->rights->facture->lire) + { + $sql = "CREATE TEMPORARY TABLE ".MAIN_DB_PREFIX."temp_".session_id(); + $sql .= " SELECT f.amount - SUM(COALESCE(p.amount,0)) AS soldefact"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."paiement_facture as p ON p.fk_facture = f.rowid"; + $sql .= " WHERE f.fk_soc = s.idp AND f.paye=0 AND fk_statut = 1"; + if($user->societe_id) + { + $sql .= " AND s.idp = $user->societe_id"; + } + $sql .= " GROUP BY f.rowid"; + + if ( $db->query($sql) ) { + $sql = "SELECT SUM(soldefact) as total FROM ".MAIN_DB_PREFIX."temp_".session_id(); + $result = $db->query($sql); + if ($result && $db->num_rows($result) > 0) + { + $objp = $db->fetch_object($result); + + $this->info_box_contents[0][0] = array('align' => 'right', + 'class' => 'total_head', + 'text' => $langs->trans('Total') + ); + + $this->info_box_contents[0][1] = array('align' => 'right', + 'width' => '100', + 'text' => price($objp->total) + ); + } + } + $sql = "DROP TABLE ".MAIN_DB_PREFIX."temp_".session_id(); + $db->query($sql); + } + else { + $this->info_box_contents[0][0] = array('align' => 'left', + 'text' => $langs->trans("ReadPermissionNotAllowed")); + } + } + + function showBox() + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } + +} + +?> diff -ur --exclude=CVS --exclude=install --exclude=conf.php --unidirectional-new-file dolibarrcvs/htdocs/includes/boxes/box_comptes.php dolibarr/htdocs/includes/boxes/box_comptes.php --- dolibarrcvs/htdocs/includes/boxes/box_comptes.php 1969-12-31 20:00:00.000000000 -0400 +++ dolibarr/htdocs/includes/boxes/box_comptes.php 2005-08-11 21:44:46.000000000 -0400 @@ -0,0 +1,137 @@ + + * Copyright (C) 2005 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: box_comptes.php,v 1.0 2005/08/11 21:25:17 chris Exp $ + * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_comptes.php,v $ + * + */ + +/** + \file htdocs/includes/boxes/box_comptes.php + \ingroup banque + \brief Module de génération de l'affichage de la box comptes +*/ + +include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); + + +class box_comptes extends ModeleBoxes { + + var $boxcode="currentaccounts"; + var $boximg="object_bill"; + var $boxlabel; +// var $depends = array("banque"); // Je ne sais pas à quoi cela sert + + var $info_box_head = array(); + var $info_box_contents = array(); + + /** + * \brief Constructeur de la classe + */ + function box_comptes() + { + global $langs; + $langs->load("boxes"); + + $this->boxlabel=$langs->trans('BoxCurrentAccounts'); + } + + /** + * \brief Charge les données en mémoire pour affichage ultérieur + * \param $max Nombre maximum d'enregistrements à charger + */ + function loadBox($max=5) + { + global $user, $langs, $db; + $langs->load("boxes"); + + $this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts")); + + if ($user->rights->banque->lire) + { + $sql = "SELECT rowid, label, bank, number"; + $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; + $sql .= " WHERE clos = 0 AND courant = 1"; + $sql .= " ORDER BY label"; + $sql .= $db->plimit($max, 0); + + $result = $db->query($sql); + + if ($result) + { + $num = $db->num_rows($result); + + $i = 0; + $solde_total = 0; + + while ($i < $num) + { + $objp = $db->fetch_object($result); + $acc = new Account($db); + $acc->fetch($objp->rowid); + $solde_total += $acc->solde(); + + $this->info_box_contents[$i][0] = array('align' => 'left', + 'logo' => $this->boximg, + 'text' => stripslashes($objp->label), + 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid); + + $this->info_box_contents[$i][1] = array('align' => 'left', + 'text' => stripslashes($objp->bank) + ); + + $this->info_box_contents[$i][2] = array('align' => 'left', + 'text' => stripslashes($objp->number) + ); + + $this->info_box_contents[$i][3] = array('align' => 'right', + 'text' => price( $acc->solde() ) + ); + + $i++; + } + $this->info_box_contents[$i][0] = array('align' => 'right', + 'colspan' => '4', + 'class' => 'total_head', + 'text' => $langs->trans('Total') + ); + + $this->info_box_contents[$i][1] = array('align' => 'right', + 'class' => 'total_value', + 'text' => price($solde_total) + ); + } + else { + dolibarr_print_error($db); + } + } + else { + $this->info_box_contents[0][0] = array('align' => 'left', + 'text' => $langs->trans("ReadPermissionNotAllowed")); + } + + } + + function showBox() + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } + +} + +?> diff -ur --exclude=CVS --exclude=install --exclude=conf.php --unidirectional-new-file dolibarrcvs/htdocs/includes/boxes/box_fournisseurs_imp.php dolibarr/htdocs/includes/boxes/box_fournisseurs_imp.php --- dolibarrcvs/htdocs/includes/boxes/box_fournisseurs_imp.php 1969-12-31 20:00:00.000000000 -0400 +++ dolibarr/htdocs/includes/boxes/box_fournisseurs_imp.php 2005-08-15 20:00:07.000000000 -0400 @@ -0,0 +1,112 @@ + + * Copyright (C) 2004-2005 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: box_fournisseurs_imp.php,v 1.0 2005/08/03 17:43:47 chris Exp $ + * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_fournisseurs_imp.php,v $ + * + */ + +/** + \file htdocs/includes/boxes/box_fournisseurs_imp.php + \ingroup factures + \brief Module de génération de l'affichage de la box total des factures fournisseurs impayees +*/ + +include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); + + +class box_fournisseurs_imp extends ModeleBoxes { + + var $boxcode="boxtotalunpayedsuppliersbills"; + var $boximg="object_bill"; + var $boxlabel; + var $depends = array("facture"); + + var $info_box_head = array(); + var $info_box_contents = array(); + + + /** + * \brief Constructeur de la classe + */ + function box_fournisseurs_imp() + { + global $langs; + $langs->load("boxes"); + + $this->boxlabel=$langs->trans("BoxTotalUnpayedSuppliersBills"); + } + + /** + * \brief Charge les données en mémoire pour affichage ultérieur + */ + function loadBox() + { + global $user, $langs, $db; + $langs->load("boxes"); + + $this->info_box_head = array('text' => $langs->trans("BoxTitleTotalUnpayedSuppliersBills",$max)); + + if ($user->rights->facture->lire) + { + $sql = "CREATE TEMPORARY TABLE ".MAIN_DB_PREFIX."temp_".session_id(); + $sql .= " SELECT f.total_ht - SUM(COALESCE(p.amount,0)) AS soldefact"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f"; + $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."paiementfourn as p ON p.fk_facture_fourn = f.rowid"; + $sql .= " WHERE f.fk_soc = s.idp AND f.paye=0 AND fk_statut = 1"; + if($user->societe_id) + { + $sql .= " AND s.idp = $user->societe_id"; + } + $sql .= " GROUP BY f.rowid"; + + if ( $db->query($sql) ) { + $sql = "SELECT SUM(soldefact) as total FROM ".MAIN_DB_PREFIX."temp_".session_id(); + $result = $db->query($sql); + if ($result && $db->num_rows($result) > 0) + { + $objp = $db->fetch_object($result); + + $this->info_box_contents[0][0] = array('align' => 'right', + 'class' => 'total_head', + 'text' => $langs->trans('Total') + ); + + $this->info_box_contents[0][1] = array('align' => 'right', + 'width' => '100', + 'text' => price($objp->total) + ); + } + } + $sql = "DROP TABLE ".MAIN_DB_PREFIX."temp_".session_id(); + $db->query($sql); + } + else { + $this->info_box_contents[0][0] = array('align' => 'left', + 'text' => $langs->trans("ReadPermissionNotAllowed")); + } + } + + function showBox() + { + parent::showBox($this->info_box_head, $this->info_box_contents); + } + +} + +?> diff -ur --exclude=CVS --exclude=install --exclude=conf.php --unidirectional-new-file dolibarrcvs/htdocs/includes/boxes/modules_boxes.php dolibarr/htdocs/includes/boxes/modules_boxes.php --- dolibarrcvs/htdocs/includes/boxes/modules_boxes.php 2005-08-11 22:25:50.000000000 -0400 +++ dolibarr/htdocs/includes/boxes/modules_boxes.php 2005-08-11 22:31:42.000000000 -0400 @@ -87,6 +87,8 @@ $tdparam=""; if (isset($contents[$i][$j]['align'])) $tdparam.=' align="'. $contents[$i][$j]['align'].'"'; if (isset($contents[$i][$j]['width'])) $tdparam.=' width="'. $contents[$i][$j]['width'].'"'; + if (isset($contents[$i][$j]['colspan'])) $tdparam.=' colspan="'. $contents[$i][$j]['colspan'].'"'; + if (isset($contents[$i][$j]['class'])) $tdparam.=' class="'. $contents[$i][$j]['class'].'"'; if ($contents[$i][$j]['text']) { $texte=isset($contents[$i][$j]['text'])?$contents[$i][$j]['text']:''; diff -ur --exclude=CVS --exclude=install --exclude=conf.php --unidirectional-new-file dolibarrcvs/htdocs/includes/modules/modBanque.class.php dolibarr/htdocs/includes/modules/modBanque.class.php --- dolibarrcvs/htdocs/includes/modules/modBanque.class.php 2005-07-31 10:11:14.000000000 -0400 +++ dolibarr/htdocs/includes/modules/modBanque.class.php 2005-08-11 18:15:28.000000000 -0400 @@ -73,6 +73,9 @@ // Boites $this->boxes = array(); + $this->boxes[0][0] = "Soldes Comptes Bancaires"; + $this->boxes[0][1] = "box_comptes.php"; + // Permissions $this->rights = array(); $this->rights_class = 'banque'; diff -ur --exclude=CVS --exclude=install --exclude=conf.php --unidirectional-new-file dolibarrcvs/htdocs/langs/fr_FR/boxes.lang dolibarr/htdocs/langs/fr_FR/boxes.lang --- dolibarrcvs/htdocs/langs/fr_FR/boxes.lang 2005-04-30 13:52:30.000000000 -0400 +++ dolibarr/htdocs/langs/fr_FR/boxes.lang 2005-08-15 19:25:07.000000000 -0400 @@ -12,6 +12,10 @@ BoxLastCustomerOrders=Dernières commandes BoxLastSuppliers=Derniers fournisseurs BoxLastBooks=Derniers livres +BoxCurrentAccounts=Soldes Comptes courants +BoxSalesTurnover=Chiffre d'affaire +BoxTotalUnpayedCustomerBills=Total des factures clients impayées +BoxTotalUnpayedSuppliersBills=Total des factures fournisseurs impayées BoxTitleLastBooks=Les %s derniers ouvrages enregistrés BoxTitleNbOfCustomers=Nombre de clients BoxTitleLastRssInfos=Les %s dernières infos de %s @@ -26,4 +30,8 @@ BoxTitleLastProductsInContract=Les %s derniers produits/services contractés BoxTitleOldestUnpayedCustomerBills=Les %s plus anciennes factures clients impayées BoxTitleOldestUnpayedSupplierBills=Les %s plus anciennes factures fournisseurs impayées +BoxTitleCurrentAccounts=Les soldes de comptes courants +BoxTitleSalesTurnover=Le chiffre d'affaire réalisé +BoxTitleTotalUnpayedCustomerBills=Impayés clients +BoxTitleTotalUnpayedSuppliersBills=Impayés fournisseurs FailedToRefreshDataInfoNotUpToDate=Echec du rafraichissement du flux RSS. Les informations datent du %s. diff -ur --exclude=CVS --exclude=install --exclude=conf.php --unidirectional-new-file dolibarrcvs/htdocs/theme/eldy/eldy.css dolibarr/htdocs/theme/eldy/eldy.css --- dolibarrcvs/htdocs/theme/eldy/eldy.css 2005-08-15 12:16:09.000000000 -0400 +++ dolibarr/htdocs/theme/eldy/eldy.css 2005-08-15 12:18:08.000000000 -0400 @@ -673,7 +673,13 @@ font: helvetica, verdana, arial, sans-serif; } +td.total_head, td.total_value { +background: #C3CBCF; +} +td.total_head { +font-weight : bold; +} /*