[ 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/compta/ventilation/fournisseur/ -> fiche.php (source)

   1  <?PHP
   2  /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
   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: fiche.php,v 1.1 2005/10/20 19:27:19 simontosser Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/ventilation/fournisseur/fiche.php,v $
  21   *
  22   */
  23  
  24  /**
  25          \file       htdocs/compta/ventilation/fournisseur/fiche.php
  26          \ingroup    compta
  27          \brief      Page fiche ventilation
  28          \version    $Revision: 1.1 $
  29  */
  30  
  31  require ("./pre.inc.php");
  32  
  33  $mesg = '';
  34  
  35  if (!$user->rights->compta->ventilation->creer) accessforbidden();
  36  
  37  if ($_POST["action"] == 'ventil' && $user->rights->compta->ventilation->creer)
  38  {
  39    $sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
  40    $sql .= " SET fk_code_ventilation = ".$_POST["codeventil"];
  41    $sql .= " WHERE rowid = ".$_GET["id"];
  42  
  43    $db->query($sql);
  44  }
  45  
  46  llxHeader("","","Fiche ventilation");
  47  
  48  if ($cancel == $langs->trans("Cancel"))
  49  {
  50    $action = '';
  51  }
  52  /*
  53   *
  54   *
  55   */
  56  
  57  $sql = "SELECT rowid, numero, intitule";
  58  $sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux";
  59  $sql .= " ORDER BY numero ASC";
  60  
  61  $result = $db->query($sql);
  62  if ($result)
  63  {
  64    $num = $db->num_rows($result);
  65    $i = 0; 
  66    
  67    while ($i < $num)
  68      {
  69        $row = $db->fetch_row($result);
  70        $cgs[$row[0]] = $row[1] . ' ' . $row[2];
  71        $i++;
  72      }
  73  }
  74  
  75  /*
  76   * Création
  77   *
  78   */
  79  $form = new Form($db);
  80  
  81  if($_GET["id"])
  82  {
  83    $sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ttc, l.qty, l.rowid, l.tva_taux, l.fk_code_ventilation ";
  84    $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l";
  85    $sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
  86    $sql .= " WHERE f.rowid = l.fk_facture_fourn AND f.fk_statut = 1 AND l.rowid = ".$_GET["id"];
  87     
  88    $result = $db->query($sql);
  89  
  90    if ($result)
  91      {
  92        $num_lignes = $db->num_rows($result);
  93        $i = 0; 
  94        
  95        if ($num_lignes)
  96      {
  97        
  98        $objp = $db->fetch_object($result);
  99  
 100  
 101        if($objp->fk_code_ventilation == 0)
 102          {
 103            print '<form action="fiche.php?id='.$_GET["id"].'" method="post">'."\n";
 104            print '<input type="hidden" name="action" value="ventil">';
 105          }
 106  
 107        
 108        print_titre("Ventilation");
 109        
 110        print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 111        print '<tr><td>Facture</td>';
 112        print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a></td></tr>';
 113  
 114        print '<tr><td width="20%">Ligne</td>';
 115        print '<td>'.stripslashes(nl2br($objp->description)).'</td></tr>';
 116        print '<tr><td width="20%">Ventiler dans le compte :</td><td>';
 117  
 118        if($objp->fk_code_ventilation == 0)
 119          {
 120            print $form->select_array("codeventil",$cgs, $objp->fk_code_ventilation);
 121          }
 122        else
 123          {
 124            print $cgs[$objp->fk_code_ventilation];
 125          }
 126  
 127        print '</td></tr>';
 128        
 129        if($objp->fk_code_ventilation == 0)
 130          {
 131            print '<tr><td>&nbsp;</td><td><input type="submit" value="'.$langs->trans("Ventiler").'"></td></tr>';
 132          }
 133        print '</table>';
 134        print '</form>';
 135      }
 136        else
 137      {
 138        print "Error";
 139      }
 140      }
 141    else
 142      {
 143        print "Error";
 144      }
 145  }
 146  else
 147  {
 148    print "Error ID incorrect";
 149  }
 150  
 151  $db->close();
 152  
 153  llxFooter("<em>Derni&egrave;re modification $Date: 2005/10/20 19:27:19 $ r&eacute;vision $Revision: 1.1 $</em>");
 154  ?>


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