* Copyright (C) 2005 Laurent Destailleur * Copyright (C) 2005-2006 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. * * $Id$ * $Source$ */ /** \file htdocs/compta/prelevement/index.php \brief Prelevement \version $Revision$ */ require("./pre.inc.php"); require_once DOL_DOCUMENT_ROOT."/includes/modules/modPrelevement.class.php"; if (!$user->rights->prelevement->bons->lire) accessforbidden(); // Sécurité accés client if ($user->societe_id > 0) { $action = ''; $socid = $user->societe_id; } /* * Affichage page * */ llxHeader(); print_fiche_titre($langs->trans("StandingOrdersArea")); print ''; print '
'; $bprev = new BonPrelevement($db); $var=true; print ''; print ''; $var=!$var; print ''; print ''; $var=!$var; print ''; print '
'.$langs->trans("Statistics").'
Nb de facture à prélever'; print $bprev->NbFactureAPrelever(); print '
Somme à prélever'; print price($bprev->SommeAPrelever()); print '

'; /* * Bon de prélèvement * */ $sql = "SELECT p.rowid, p.ref, p.amount,".$db->pdate("p.datec")." as datec"; $sql .= " ,p.statut "; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " ORDER BY datec DESC LIMIT 5"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; $var=True; print"\n\n"; print ''; print ''; print ''; print ''; while ($i < $num) { $obj = $db->fetch_object($result); $var=!$var; print "\n"; print '\n"; print '\n"; print "\n"; $i++; } print "
'.$langs->trans("WithdrawalReceiptShort").''.$langs->trans("Date").''.$langs->trans("Amount").'
"; print ' '; print ''.$obj->ref."'.dolibarr_print_date($obj->datec,"%d/%m/%Y %H:%M")."'.price($obj->amount)."
"; $db->free($result); } else { dolibarr_print_error($db); } print '
'; /* * Factures * */ $sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " WHERE s.idp = f.fk_soc"; $sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) { $sql .= " AND f.fk_soc = $socid"; } if ( $db->query($sql) ) { $num = $db->num_rows(); $i = 0; if ($num) { print ''; print ''; print ''; $var = True; while ($i < $num && $i < 20) { $obj = $db->fetch_object(); $var=!$var; print ''; print ''; print ''; $i++; } print "
Factures en attente de prélèvement ('.$num.')
'; print ''.img_file().' '.$obj->facnumber.''.img_object($langs->trans("ShowCompany"),'company').' '.$obj->nom.'

"; } } else { dolibarr_print_error($db); } print '
'; llxFooter('$Date$ - $Revision$'); ?>