[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/includes/boxes/ -> box_factures_fourn_imp.php (source)

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


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics