*** empty log message ***

This commit is contained in:
Rodolphe Quiedeville 2002-05-11 17:19:18 +00:00
parent 7b2b156a85
commit c708213b01
6 changed files with 571 additions and 0 deletions

View File

@ -0,0 +1,178 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require("./pre.inc.php3");
require("./reduc.class.php3");
llxHeader();
$db = new Db();
if ($action == 'add') {
$author = $GLOBALS["REMOTE_USER"];
$sql = "INSERT INTO llx_voyage (date_depart, date_arrivee, amount, depart, arrivee, fk_reduc) ";
$sql .= " VALUES ('$date_depart','$date_arrivee',$amount,'$depart','$arrivee',$reduc);";
$result = $db->query($sql);
if ($result) {
$rowid = $db->last_insert_id();
} else {
print $db->error();
print "<p>$sql";
}
}
if ($action == 'del') {
/* $sql = "DELETE FROM llx_voyage WHERE rowid = $rowid";
*$result = $db->query($sql);
*/
}
if ($vline) {
$viewline = $vline;
} else {
$viewline = 20;
}
$sql = "SELECT rowid, label FROM llx_voyage_reduc;";
$result = $db->query($sql);
if ($result) {
$var=True;
$num = $db->num_rows();
$i = 0;
$options = "<option value=\"0\" SELECTED></option>";
while ($i < $num) {
$obj = $db->fetch_object($i);
$options .= "<option value=\"$obj->rowid\">$obj->label</option>\n"; $i++;
}
$db->free();
}
print_titre("Bilan des reductions");
/*
* Cartes
*
*/
$sql = "SELECT rowid FROM llx_voyage_reduc";
$result = $db->query($sql);
if ($result) {
$cartes= array();
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($i);
$cartes[$i] = $obj->rowid;
$i++;
}
$db->free;
}
/*
*
*/
for ($j = 0 ; $j < sizeof($cartes) ; $j++) {
$reduc = new Reduc($db);
$reduc->fetch($cartes[$j]);
print "<TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";
print "<TR>";
print '<td colspan="2">Description</TD>';
print '<td align="right">Montant</TD>';
print '<td>&nbsp;</TD>';
print "</TR>\n";
print '<tr><td colspan="2">'.$reduc->label.'</td><td align="right">'.$reduc->price.'</td>';
print '<td>&nbsp;</TD></tr>';
/*
*
*/
$sql = "SELECT b.rowid,".$db->pdate("b.date_depart")." as date_depart,".$db->pdate("b.date_arrivee")." as date_arrivee, b.amount, b.depart, b.arrivee , b.reduction";
$sql .= " FROM llx_voyage as b WHERE fk_reduc=".$reduc->id." ORDER BY b.date_depart ASC";
$result = $db->query($sql);
if ($result) {
print "<TR class=\"liste_titre\">";
print "<td>Date</td><td>Description</TD>";
print "<td align=\"right\">Montant</TD>";
print "<td align=\"right\">Réduction</td>";
print "</TR>\n";
$var=True;
$num = $db->num_rows();
$i = 0;
$total = 0;
$total_reduc = 0;
while ($i < $num) {
$objp = $db->fetch_object( $i);
$total = $total + $objp->amount;
$total_reduc = $total_reduc + $objp->reduction;
$time = time();
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".strftime("%d&nbsp;%b&nbsp;%y&nbsp;%H:%M",$objp->date_depart)."<br>\n";
print "".strftime("%d %b %y %H:%M",$objp->date_arrivee)."</TD>\n";
print "<td>$objp->depart<br>$objp->arrivee</td>";
print "<td align=\"right\">".price($objp->amount)."</TD>\n";
print "<td align=\"right\">".price($objp->reduction)."</TD>\n";
print "</tr>";
$i++;
}
$db->free();
print "<tr><td align=\"right\" colspan=\"2\">Total :</td>";
print "<td align=\"right\"><b>".price($total)."</b></td><td align=\"right\">".price($total_reduc)."</td></tr>\n";
print "<tr><td align=\"right\" colspan=\"3\">Carte :</td>";
print "<td align=\"right\">".price($reduc->price)."</td></tr>\n";
print "<tr><td align=\"right\" colspan=\"3\">Gain :</td>";
print "<td align=\"right\">".price($total_reduc - $reduc->price)."</td></tr>\n";
print "</table>";
} else {
print "<p>".$db->error();
}
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,154 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require("./pre.inc.php3");
llxHeader();
$db = new Db();
if ($action == 'add') {
$author = $GLOBALS["REMOTE_USER"];
$sql = "INSERT INTO llx_voyage (date_depart, date_arrivee, amount, depart, arrivee, fk_reduc, reduction) ";
$sql .= " VALUES ('$date_depart','$date_arrivee',$amount,'$depart','$arrivee',$reducid, $reduc);";
$result = $db->query($sql);
if ($result) {
$rowid = $db->last_insert_id();
} else {
print $db->error();
print "<p>$sql";
}
}
if ($action == 'del') {
/* $sql = "DELETE FROM llx_voyage WHERE rowid = $rowid";
*$result = $db->query($sql);
*/
}
if ($vline) {
$viewline = $vline;
} else {
$viewline = 20;
}
$sql = "SELECT rowid, label FROM llx_voyage_reduc;";
$result = $db->query($sql);
if ($result) {
$var=True;
$num = $db->num_rows();
$i = 0;
$options = "<option value=\"0\" SELECTED></option>";
while ($i < $num) {
$obj = $db->fetch_object($i);
$options .= "<option value=\"$obj->rowid\">$obj->label</option>\n"; $i++;
}
$db->free();
}
print_titre("Voyages");
$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 ";
$sql .= " FROM llx_voyage as b ORDER BY b.date_depart ASC";
$result = $db->query($sql);
if ($result) {
print "<form method=\"post\" action=\"$PHP_SELF?viewall=$viewall&vline=$vline&account=$account\">";
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print "<TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";
print "<TR class=\"liste_titre\">";
print "<td>Date</td><td>Description</TD>";
print "<td align=\"right\">Montant</TD>";
print "<td align=\"right\">Réduction</td>";
print "</TR>\n";
$var=True;
$num = $db->num_rows();
$i = 0; $total = 0;
$sep = 0;
while ($i < $num) {
$objp = $db->fetch_object( $i);
$total = $total + $objp->amount;
$time = time();
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".strftime("%d&nbsp;%b&nbsp;%y&nbsp;%H:%M",$objp->date_depart)."<br>\n";
print "".strftime("%d %b %y %H:%M",$objp->date_arrivee)."</TD>\n";
print "<td>$objp->depart<br>$objp->arrivee</td>";
print "<td align=\"right\">".price($objp->amount)."</TD>\n";
print "<td align=\"right\">".price($objp->reduction)."</TD>\n";
print "<td align=\"right\"><small>".francs($objp->amount)."</small></TD>\n";
print "<td align=\"center\"><a href=\"$PHP_SELF?action=del&rowid=$objp->rowid\">[Del]</a></td>";
print "</tr>";
$i++;
}
$db->free();
print "<tr><td align=\"right\" colspan=\"2\">Total :</td>";
print "<td align=\"right\"><b>".price($total)."</b></td><td align=\"right\">".francs($total)."</td></tr>\n";
print "<tr>";
print "<td><input name=\"date_depart\" type=\"text\" size=16 maxlength=16><br>";
print "<input name=\"date_arrivee\" type=\"text\" size=16 maxlength=16></td>";
print "<td><input name=\"depart\" type=\"text\" size=40><br>";
print "<input name=\"arrivee\" type=\"text\" size=40></td>";
print "<td><input name=\"amount\" type=\"text\" size=8></td>";
print "<td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"ajouter\"</td>";
print "</tr><tr><td colspan=\"1\">Réduction</td>";
print "<td><select name=\"reducid\">$options";
print "</select></td>";
print "<td><input name=\"reduc\" type=\"text\" size=6 value=0.00>euros</td><td>&nbsp;</td>";
print '</tr>';
print "</table></form>";
} else {
print "<p>".$db->error();
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,50 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require("../../main.inc.php3");
function llxHeader($head = "") {
global $user, $conf;
/*
*
*
*/
top_menu($head);
$menu = new Menu();
$menu->add("index.php3","Voyages");
$menu->add_submenu("index.php3","Voyages");
$menu->add_submenu("bilan.php3","Bilan");
$menu->add_submenu("reduc.php3","Reduc");
$menu->add("/compta/facture.php3","Factures");
$menu->add("/compta/bank/index.php3","Bank");
left_menu($menu->liste);
}
?>

View File

@ -0,0 +1,58 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
class Reduc {
var $id;
var $price;
var $label;
Function Reduc($DB, $rowid=0) {
global $config;
$this->db = $DB;
$this->rowid = $rowid;
return 1;
}
Function fetch($id) {
$sql = "SELECT b.rowid,".$this->db->pdate("b.date_debut")." as debut,".$this->db->pdate("b.date_fin")." as fin, b.amount, b.label ";
$sql .= " FROM llx_voyage_reduc as b WHERE rowid = $id";
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows()) {
$obj = $this->db->fetch_object( 0);
$this->id = $obj->rowid;
$this->price = $obj->amount;
$this->label = $obj->label;
}
$this->db->free();
}
}
}
?>

View File

@ -0,0 +1,84 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require("./pre.inc.php3");
llxHeader();
$db = new Db();
print_titre ("Abonnement de réduction");
print "<TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">";
print "<TR class=\"liste_titre\">";
print "<td>Date</td><td>Description</TD>";
print "<td align=\"right\"><a href=\"$PHP_SELF?vue=credit\">Montant</a></TD>";
print "<td align=\"right\">Francs</td>";
print "</TR>\n";
$sql = "SELECT b.rowid,".$db->pdate("b.date_debut")." as debut,".$db->pdate("b.date_fin")." as fin, b.amount, b.label ";
$sql .= " FROM llx_voyage_reduc as b ";
$result = $db->query($sql);
if ($result) {
$var=True;
$num = $db->num_rows();
$i = 0; $total = 0;
$sep = 0;
while ($i < $num) {
$objp = $db->fetch_object( $i);
$total = $total + $objp->amount;
$time = time();
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".strftime("%d %b %y",$objp->debut)." au ".strftime("%d %b %y",$objp->fin)."</TD>\n";
print "<td>$objp->label</td>";
print "<td align=\"right\">".price($objp->amount)."</TD>\n";
print "<td align=\"right\"><small>".francs($objp->amount)."</small></TD>\n";
print "</tr>";
$i++;
}
$db->free();
}
print "<tr><td align=\"right\" colspan=\"2\">Total :</td>";
print "<td align=\"right\"><b>".price($total)."</b></td><td align=\"right\">".francs($total)."</td></tr>\n";
print "</table>";
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,47 @@
-- ===================================================================
-- Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- $Id$
-- $Source$
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- ===================================================================
create table llx_voyage
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
datec datetime,
dateo date, -- date operation
date_depart datetime, -- date du voyage
date_arrivee datetime, -- date du voyage
amount real NOT NULL default 0, -- prix du billet
reduction real NOT NULL default 0, -- montant de la reduction obtenue
depart varchar(255),
arrivee varchar(255),
fk_type smallint, -- Train, Avion, Bateaux
fk_reduc integer,
distance integer, -- distance en kilometre
dossier varchar(50), -- numero de dossier
note text
);
-- insert into llx_voyage (date_depart, date_arrivee, amount, depart, arrivee, fk_reduc)
-- values ('2002-04-21 12:05','2002-04-21 15:25',26.8,'Paris','Auray',1);
-- insert into llx_voyage (date_depart, date_arrivee, amount, depart, arrivee, fk_reduc)
-- values ('2002-04-23 15:42','2002-04-23 19:10',26.8,'Auray','Paris',1);