[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: box_factures_imp.php,v 1.24 2005/08/11 19:06:17 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_factures_imp.php,v $ 21 * 22 */ 23 24 /** 25 \file htdocs/includes/boxes/box_factures_imp.php 26 \ingroup factures 27 \brief Module de génération de l'affichage de la box factures impayees 28 */ 29 30 include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); 31 32 33 class box_factures_imp extends ModeleBoxes { 34 35 var $boxcode="oldestunpayedcustomerbills"; 36 var $boximg="object_bill"; 37 var $boxlabel; 38 var $depends = array("facture"); 39 40 var $info_box_head = array(); 41 var $info_box_contents = array(); 42 43 44 /** 45 * \brief Constructeur de la classe 46 */ 47 function box_factures_imp() 48 { 49 global $langs; 50 $langs->load("boxes"); 51 52 $this->boxlabel=$langs->trans("BoxOldestUnpayedCustomerBills"); 53 } 54 55 /** 56 * \brief Charge les données en mémoire pour affichage ultérieur 57 * \param $max Nombre maximum d'enregistrements à charger 58 */ 59 function loadBox($max=5) 60 { 61 global $user, $langs, $db; 62 $langs->load("boxes"); 63 64 $warning_delay=31*24*60*60; // Delai affichage warning retard (si retard paiement facture > delai) 65 66 $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpayedCustomerBills",$max)); 67 68 if ($user->rights->facture->lire) 69 { 70 $sql = "SELECT s.nom,s.idp,f.facnumber,".$db->pdate("f.date_lim_reglement")." as datelimite, f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid"; 71 $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = s.idp AND f.paye=0 AND fk_statut = 1"; 72 if($user->societe_id) 73 { 74 $sql .= " AND s.idp = $user->societe_id"; 75 } 76 //$sql .= " ORDER BY f.datef DESC, f.facnumber DESC "; 77 $sql .= " ORDER BY f.datef ASC, f.facnumber ASC "; 78 $sql .= $db->plimit($max, 0); 79 80 $result = $db->query($sql); 81 if ($result) 82 { 83 $num = $db->num_rows($result); 84 85 $i = 0; 86 87 while ($i < $num) 88 { 89 $objp = $db->fetch_object($result); 90 91 $late=""; 92 if ($objp->datelimite < (time() - $warning_delay)) $late=img_warning($langs->trans("Late")); 93 94 $this->info_box_contents[$i][0] = array('align' => 'left', 95 'logo' => $this->boximg, 96 'text' => $objp->facnumber, 97 'text2'=> $late, 98 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid); 99 100 $this->info_box_contents[$i][1] = array('align' => 'left', 101 'text' => $objp->nom, 102 'maxlength'=>44, 103 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->idp); 104 105 $i++; 106 } 107 } 108 } 109 else { 110 $this->info_box_contents[0][0] = array('align' => 'left', 111 'text' => $langs->trans("ReadPermissionNotAllowed")); 112 } 113 } 114 115 function showBox() 116 { 117 parent::showBox($this->info_box_head, $this->info_box_contents); 118 } 119 120 } 121 122 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |