[ 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/ -> ligne.php (source)

   1  <?php
   2  /* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   *
   5   * $Id: ligne.php,v 1.9 2005/09/17 00:53:50 eldy Exp $
   6   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/ligne.php,v $
   7   *
   8   * This program is free software; you can redistribute it and/or modify
   9   * it under the terms of the GNU General Public License as published by
  10   * the Free Software Foundation; either version 2 of the License, or
  11   * (at your option) any later version.
  12   *
  13   * This program is distributed in the hope that it will be useful,
  14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16   * GNU General Public License for more details.
  17   *
  18   * You should have received a copy of the GNU General Public License
  19   * along with this program; if not, write to the Free Software
  20   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21   *
  22   */
  23  require ("./pre.inc.php");
  24  
  25  llxHeader();
  26  
  27  
  28  $sql = "SELECT rowid, number, label FROM ".MAIN_DB_PREFIX."compta_account ORDER BY number";
  29  if ( $db->query($sql) ) {
  30    $num = $db->num_rows();
  31    $i = 0;
  32    $options = "<option value=\"0\" selected=\"true\">&nbsp;</option>";
  33    while ($i < $num) {
  34      $obj = $db->fetch_object();
  35      $options .= "<option value=\"$obj->rowid\">$obj->number</option>\n"; $i++;
  36    }
  37    $db->free();
  38  
  39  }
  40  
  41  
  42  
  43  
  44  if ($action == 'add') {
  45  
  46    $sql = "INSERT INTO ".MAIN_DB_PREFIX."compta (datec, fk_compta_account, label, amount)";
  47    $sql .= " VALUES (now(),$number, '$label',$amount)";
  48  
  49    $db->query($sql);
  50  
  51  }
  52  /*
  53   *
  54   * Mode creation
  55   *
  56   *
  57   *
  58   */
  59  
  60  if ($action == 'create') {
  61    //
  62  
  63  } else {
  64  
  65    /*
  66     *
  67     * Liste
  68     *
  69     *
  70     */
  71    print_barre_liste("Comptes comptable",$page,"ligne.php");
  72    
  73    print "<table class=\"noborder\" width=\"100%\">";
  74    print '<tr class="liste_titre">';
  75    print_liste_field_titre($langs->trans("Ref"),"ligne.php","id");
  76    print_liste_field_titre($langs->trans("Label"),"ligne.php","label");
  77    print '<td>'.$langs->trans("Amount").'</td>';
  78    print "</tr>\n";
  79      
  80    print '<form action="ligne.php" method="post">';
  81    print '<input type="hidden" name="action" value="add">';
  82    print '<tr><td><select name="number">'.$options.'</select></td>';
  83    print '<td><input type="text" name="label" size="30"></td>';
  84    print '<td><input type="text" name="amount" size="10"></td>';
  85    print '<td><input type="submit" value="add"></td>';
  86    print '</tr>';
  87    print '</form>';
  88  
  89    $sql = "SELECT ca.number, c.label, c.amount";
  90    $sql .= " FROM ".MAIN_DB_PREFIX."compta_account as ca, ".MAIN_DB_PREFIX."compta as c WHERE c.fk_compta_account = ca.rowid";
  91    $sql .= " ORDER BY ca.number";
  92    
  93    $result = $db->query($sql);
  94    if ($result) {
  95      $num = $db->num_rows();
  96      $i = 0;
  97      if ($num > 0) {
  98      $var=True;
  99      while ($i < $num) {
 100        $objp = $db->fetch_object($result);
 101        $var=!$var;
 102      
 103        print "<TR $bc[$var]>";
 104        print '<td>'.$objp->number.'</td>';
 105        print '<td>'.$objp->label.'</td>';
 106        print '<td>'.price($objp->amount).'</td>';
 107  
 108        print "</TR>\n";
 109        $i++;
 110      }
 111        }
 112      
 113  
 114        $db->free();
 115      } else {
 116        print $db->error();
 117      }
 118        print "</TABLE>";
 119  }
 120  
 121  $db->close();
 122  
 123  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/17 00:53:50 $ r&eacute;vision $Revision: 1.9 $</em>");
 124  ?>


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