[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004 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: index.php,v 1.14 2005/09/17 00:53:50 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/voyage/index.php,v $ 21 * 22 */ 23 24 require ("./pre.inc.php"); 25 26 llxHeader(); 27 28 if ($action == 'add') { 29 30 $sql = "INSERT INTO ".MAIN_DB_PREFIX."voyage (date_depart, date_arrivee, amount, depart, arrivee, fk_reduc, reduction) "; 31 $sql .= " VALUES ('$date_depart','$date_arrivee',$amount,'$depart','$arrivee',$reducid, $reduc);"; 32 33 $result = $db->query($sql); 34 if ($result) { 35 $rowid = $db->last_insert_id(MAIN_DB_PREFIX."voyage"); 36 37 } else { 38 print $db->error(); 39 print "<p>$sql"; 40 } 41 42 } 43 if ($action == 'del') { 44 /* $sql = "DELETE FROM ".MAIN_DB_PREFIX."voyage WHERE rowid = $rowid"; 45 *$result = $db->query($sql); 46 */ 47 } 48 49 if ($vline) { 50 $viewline = $vline; 51 } else { 52 $viewline = 20; 53 } 54 55 $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."voyage_reduc;"; 56 $result = $db->query($sql); 57 if ($result) { 58 $var=True; 59 $num = $db->num_rows(); 60 $i = 0; 61 $options = "<option value=\"0\" selected=\"true\"></option>"; 62 while ($i < $num) { 63 $obj = $db->fetch_object($result); 64 $options .= "<option value=\"$obj->rowid\">$obj->label</option>\n"; $i++; 65 } 66 $db->free(); 67 } 68 69 70 print_titre("Voyages"); 71 72 73 $sql = "SELECT b.rowid,".$db->pdate("b.date_depart")." as date_depart,".$db->pdate("b.date_arrivee")." as date_arrivee, b.amount, b.reduction,b.depart, b.arrivee "; 74 $sql .= " FROM ".MAIN_DB_PREFIX."voyage as b ORDER BY b.date_depart ASC"; 75 76 $result = $db->query($sql); 77 if ($result) { 78 79 print "<form method=\"post\" action=\"index.php?viewall=$viewall&vline=$vline&account=$account\">"; 80 print "<input type=\"hidden\" name=\"action\" value=\"add\">"; 81 print "<table class=\"border\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">"; 82 print "<tr class=\"liste_titre\">"; 83 print '<td>Date</td><td>'.$langs->trans("Description").'</td>'; 84 print "<td align=\"right\">Montant</td>"; 85 print "<td align=\"right\">Réduction</td>"; 86 print "</tr>\n"; 87 88 89 $var=True; 90 $num = $db->num_rows(); 91 $i = 0; $total = 0; 92 93 $sep = 0; 94 95 while ($i < $num) { 96 $objp = $db->fetch_object($result); 97 $total = $total + $objp->amount; 98 $time = time(); 99 100 $var=!$var; 101 102 print "<tr $bc[$var]>"; 103 print "<td>".strftime("%d %b %y %H:%M",$objp->date_depart)."<br>\n"; 104 print "".strftime("%d %b %y %H:%M",$objp->date_arrivee)."</TD>\n"; 105 106 print "<td>$objp->depart - $objp->arrivee</td>"; 107 108 print "<td align=\"right\">".price($objp->amount)."</TD>\n"; 109 print "<td align=\"right\">".price($objp->reduction)."</TD>\n"; 110 print "<td align=\"center\"><a href=\"index.php?action=del&rowid=$objp->rowid\">[Del]</a></td>"; 111 print "</tr>"; 112 113 114 $i++; 115 } 116 $db->free(); 117 118 print "<tr>"; 119 print "<td><input name=\"date_depart\" type=\"text\" size=16 maxlength=16><br>"; 120 print "<input name=\"date_arrivee\" type=\"text\" size=16 maxlength=16></td>"; 121 print "<td><input name=\"depart\" type=\"text\" size=40><br>"; 122 print "<input name=\"arrivee\" type=\"text\" size=40></td>"; 123 124 print "<td><input name=\"amount\" type=\"text\" size=8></td>"; 125 126 print "<td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".$langs->trans("Add")."\"</td>"; 127 print "</tr><tr><td colspan=\"1\">Réduction</td>"; 128 129 print "<td><select name=\"reducid\">$options"; 130 131 print "</select></td>"; 132 133 print '<td><input name="reduc" type="text" size="6" value="0.00">'.$langs->trans("Currency".$conf->monnaie).'</td><td> </td>'; 134 135 print '</tr>'; 136 print "</table></form>"; 137 } else { 138 print "<p>".$db->error(); 139 140 } 141 142 143 $db->close(); 144 145 llxFooter("<em>Dernière modification $Date: 2005/09/17 00:53:50 $ révision $Revision: 1.14 $</em>"); 146 ?>
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 |
![]() |