Nettoyage
This commit is contained in:
parent
90eed0b28d
commit
fd709fe453
Binary file not shown.
@ -23,6 +23,7 @@ Table des mati
|
||||
2. Facturation
|
||||
2.1. Facture
|
||||
2.2. Paiements
|
||||
2.3. Factures récurrentes
|
||||
|
||||
3. Produits
|
||||
3.1. Aspect général
|
||||
@ -149,6 +150,24 @@ Table des mati
|
||||
supprimer le paiement puis en créer un nouveau.
|
||||
|
||||
|
||||
2.3. Factures récurrentes
|
||||
-------------------------
|
||||
|
||||
Cette fonctionnalité est apparue dans la version 1.1.0
|
||||
|
||||
2.3.1. Créer une facture récurrente
|
||||
-----------------------------------
|
||||
|
||||
La création d'une facture récurrente s'effectue depuis une facture
|
||||
validée qui sert de modèle.
|
||||
|
||||
Dans le formulaire de création si le _N.P._ contient une valeur cela
|
||||
signifie que le prix du produit a changé depuis la création de la
|
||||
facture qui sert de modèle. Il faut alors indiquer si on souhaite
|
||||
garder le prix de référence on si on crée la facture récurrente avec
|
||||
le nouveau prix du produit.
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@ -1,176 +0,0 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
class Charge {
|
||||
var $db;
|
||||
|
||||
var $id;
|
||||
var $libelle;
|
||||
var $price;
|
||||
var $tms;
|
||||
var $debut;
|
||||
var $fin;
|
||||
|
||||
var $debut_epoch;
|
||||
var $fin_epoch;
|
||||
|
||||
Function Service($DB, $id=0) {
|
||||
$this->db = $DB;
|
||||
$this->id = $id;
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function create($user) {
|
||||
|
||||
$sql = "INSERT INTO llx_charges (datec, fk_user_author) VALUES (now(), ".$user->id.")";
|
||||
|
||||
if ($this->db->query($sql) ) {
|
||||
$id = $this->db->last_insert_id();
|
||||
|
||||
if ( $this->update($id, $user) ) {
|
||||
return $id;
|
||||
}
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function update($id, $user) {
|
||||
|
||||
$sql = "UPDATE llx_service ";
|
||||
$sql .= " SET label = '" . trim($this->libelle) ."'";
|
||||
$sql .= ",ref = '" . trim($this->ref) ."'";
|
||||
$sql .= ",price = " . $this->price ;
|
||||
$sql .= ",description = '" . trim($this->description) ."'";
|
||||
$sql .= ",fk_user_modif = " . $user->id ;
|
||||
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function start_comm($id, $user, $datedeb=0) {
|
||||
|
||||
$sql = "UPDATE llx_service ";
|
||||
if ($datedeb) {
|
||||
$sql .= " SET debut_comm = '$datedeb'";
|
||||
} else {
|
||||
$sql .= " SET debut_comm = now()";
|
||||
}
|
||||
$sql .= ",fk_user_modif = " . $user->id ;
|
||||
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function stop_comm($id, $user, $datefin=0) {
|
||||
|
||||
$sql = "UPDATE llx_service ";
|
||||
if ($datefin) {
|
||||
$sql .= " SET fin_comm = '$datefin'";
|
||||
} else {
|
||||
$sql .= " SET fin_comm = now()";
|
||||
}
|
||||
$sql .= ",fk_user_modif = " . $user->id ;
|
||||
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
if ( $this->db->query($sql) ) {
|
||||
return 1;
|
||||
} else {
|
||||
print $this->db->error() . ' in ' . $sql;
|
||||
}
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
Function fetch($id) {
|
||||
|
||||
$sql = "SELECT s.ref,s.label,s.price,s.tms,s.debut_comm,s.fin_comm,s.description,";
|
||||
$sql .= $this->db->pdate("s.debut_comm") . ' as debut_epoch,';
|
||||
$sql .= $this->db->pdate("s.fin_comm") . ' as fin_epoch';
|
||||
$sql .= " FROM llx_service as s";
|
||||
$sql .= " WHERE s.rowid = $id";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
if ($this->db->num_rows()) {
|
||||
$obj = $this->db->fetch_object($result , 0);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->libelle = $obj->label;
|
||||
$this->price = $obj->price;
|
||||
$this->description = $obj->description;
|
||||
|
||||
$this->tms = $obj->tms;
|
||||
|
||||
$this->debut = $obj->debut_comm;
|
||||
$this->fin = $obj->fin_comm;
|
||||
|
||||
$this->debut_epoch = $obj->debut_epoch;
|
||||
$this->fin_epoch = $obj->fin_epoch;
|
||||
|
||||
}
|
||||
$this->db->free();
|
||||
|
||||
} else {
|
||||
print $this->db->error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
?>
|
||||
@ -1,216 +0,0 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require("../service.class.php");
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($action == 'add') {
|
||||
$service = new Service($db);
|
||||
|
||||
$service->ref = $ref;
|
||||
$service->libelle = $label;
|
||||
$service->price = $price;
|
||||
$service->description = $desc;
|
||||
|
||||
$id = $service->create($user);
|
||||
|
||||
if ($comm_now && $id) {
|
||||
$service->start_comm($id, $user);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($action == 'set_datedeb') {
|
||||
$service = new Service($db);
|
||||
$service->start_comm($id, $user->id, $datedeb);
|
||||
}
|
||||
if ($action == 'set_datefin') {
|
||||
$service = new Service($db);
|
||||
$service->stop_comm($id, $user->id, $datefin);
|
||||
}
|
||||
|
||||
if ($action == 'update') {
|
||||
$service = new Service($db);
|
||||
|
||||
$service->ref = $ref;
|
||||
$service->libelle = $label;
|
||||
$service->price = $price;
|
||||
$service->description = $desc;
|
||||
|
||||
$service->update($id, $user);
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'create') {
|
||||
|
||||
print_titre("Nouveau service");
|
||||
print '<form action="'.$PHP_SELF.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<table border="1" cellpadding="3" cellspacing="0">';
|
||||
|
||||
print '<tr><td valign="top">Référence</td>';
|
||||
print '<td><input size="12" type="text" name="ref"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Libelle</td>';
|
||||
print '<td><input size="30" type="text" name="label"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Prix</td>';
|
||||
print '<td><input size="8" type="text" name="price"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Description</td><td>';
|
||||
print "<textarea name=\"desc\" rows=\"12\" cols=\"40\">";
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">Commercialisé</td>';
|
||||
print '<td><select name="comm_now">';
|
||||
print '<option value="1">oui';
|
||||
print '<option value="0">non';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td align="center" colspan="2"><input type="submit"></td></tr>';
|
||||
print '</form>';
|
||||
print '</table>';
|
||||
|
||||
} else {
|
||||
|
||||
if ($id) {
|
||||
|
||||
$service = new Service($db);
|
||||
$service->fetch($id);
|
||||
|
||||
print '<div class="titre">Fiche service</div><br>';
|
||||
|
||||
print '<table width="100%" border="1" cellpadding="3" cellspacing="0">';
|
||||
|
||||
print '<tr><td valign="top">Référence</td>';
|
||||
print '<td bgcolor="#e0e0e0">'.$service->ref.'</td>';
|
||||
print '<td valign="top">Créé le</td>';
|
||||
print '<td>'.$service->tms.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Libelle</td>';
|
||||
print '<td bgcolor="#e0e0e0">'.$service->libelle.'</td>';
|
||||
print '<td valign="top">Début comm</td>';
|
||||
print '<td>'.$service->debut.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Prix</td>';
|
||||
print '<td>'.price($service->price).'</td>';
|
||||
|
||||
print '<td valign="top">Fin comm</td>';
|
||||
|
||||
if ($service->fin_epoch < time()) {
|
||||
print '<td bgcolor="#99ffff"><b>'.$service->fin.' </b></td></tr>';
|
||||
} else {
|
||||
print '<td>'.$service->fin.' </td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td valign="top">Description</td><td colspan="3">';
|
||||
print nl2br($service->description);
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="3">';
|
||||
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
|
||||
print '<td width="20%" align="center">[<a href="fiche.php?action=edit&id='.$id.'">Editer</a>]</td>';
|
||||
|
||||
print '<td width="20%" align="center">[<a href="fiche.php?action=datedeb&id='.$id.'">Date de debut</a>]</td>';
|
||||
print '<td width="20%" align="center">[<a href="fiche.php?action=datefin&id='.$id.'">Date de fin</a>]</td>';
|
||||
print '<td width="20%" align="center">-</td>';
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($action == 'datedeb') {
|
||||
print '<p><b>Affectation de la date de début de commercialisation</b></p>';
|
||||
print '<form action="'.$PHP_SELF.'?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="set_datedeb">';
|
||||
print '<table width="100%" border="1" cellpadding="3" cellspacing="0">';
|
||||
print '<tr><td>Date de debut de commercialisation</td>';
|
||||
print '<td><input size="10" type="text" name="datedeb" value="'.strftime("%Y-%m-%d", time()).'"></td>';
|
||||
print '<td><input type="submit"></td></tr>';
|
||||
print '</table></form><br>';
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
if ($action == 'datefin') {
|
||||
print '<p><b>Affectation de la date de fin de commercialisation</b></p>';
|
||||
print '<form action="'.$PHP_SELF.'?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="set_datefin">';
|
||||
print '<table width="100%" border="1" cellpadding="3" cellspacing="0">';
|
||||
print '<tr><td>Date de fin de commercialisation</td>';
|
||||
print '<td><input size="10" type="text" name="datefin" value="'.strftime("%Y-%m-%d", time()).'"></td>';
|
||||
print '<td><input type="submit"></td></tr>';
|
||||
print '</table></form><br>';
|
||||
}
|
||||
/*
|
||||
*
|
||||
* Mode edition
|
||||
*
|
||||
*/
|
||||
|
||||
if ($action == 'edit') {
|
||||
print '<hr><div class="titre">Editer la fiche service</div><br>';
|
||||
print '<form action="'.$PHP_SELF.'?id='.$id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<table border="1" cellpadding="3" cellspacing="0">';
|
||||
|
||||
print '<tr><td valign="top">Référence</td>';
|
||||
print '<td><input size="12" type="text" name="ref" value="'.$service->ref.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Libelle</td>';
|
||||
print '<td><input size="30" type="text" name="label" value="'.$service->libelle.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Prix</td>';
|
||||
print '<td><input size="8" type="text" name="price" value="'.$service->price.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">Description</td><td>';
|
||||
print "<textarea name=\"desc\" rows=\"12\" cols=\"40\">";
|
||||
print $service->description;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td align="center" colspan="2"><input type="submit"></td></tr>';
|
||||
print '</form>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
@ -1,85 +0,0 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($sortfield == "") {
|
||||
$sortfield="lower(p.ref)";
|
||||
}
|
||||
if ($sortorder == "") {
|
||||
$sortorder="ASC";
|
||||
}
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$limit = $conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
print_barre_liste("Liste des services", $page, $PHP_SELF);
|
||||
|
||||
/*
|
||||
*
|
||||
* Liste
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT p.rowid, p.label, p.price, p.duration,p.ref FROM llx_service as p";
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql .= $db->plimit( $limit ,$offset);
|
||||
|
||||
if ( $db->query($sql) ) {
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
|
||||
print "<TR class=\"liste_titre\"><td>";
|
||||
print_liste_field_titre("Réf",$PHP_SELF, "p.ref");
|
||||
print "</td><td>";
|
||||
print_liste_field_titre("Libellé",$PHP_SELF, "p.label");
|
||||
print "</td><td align=\"right\">Prix</td>";
|
||||
print "</TR>\n";
|
||||
$var=True;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object( $i);
|
||||
$var=!$var;
|
||||
print "<TR $bc[$var]>";
|
||||
print "<TD><a href=\"fiche.php?id=$objp->rowid\">$objp->ref</a></TD>\n";
|
||||
print "<TD>$objp->label</TD>\n";
|
||||
print '<TD align="right">'.price($objp->price).'</TD>';
|
||||
print "</TR>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</TABLE>";
|
||||
$db->free();
|
||||
} else {
|
||||
print $db->error() . ' in ' . $sql;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
@ -1,45 +0,0 @@
|
||||
<?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.php");
|
||||
|
||||
function llxHeader($head = "", $urlp = "")
|
||||
{
|
||||
global $user, $conf;
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
top_menu($head);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/product/index.php", "Produits");
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/service/index.php", "Services");
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/service/fiche.php?action=create", "Nouveau");
|
||||
|
||||
left_menu($menu->liste);
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,40 +0,0 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 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_service
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
datec datetime,
|
||||
tms timestamp,
|
||||
ref varchar(15),
|
||||
label varchar(255),
|
||||
description text,
|
||||
price smallint,
|
||||
duration varchar(32),
|
||||
debut_comm datetime,
|
||||
fin_comm datetime,
|
||||
fk_user_author integer,
|
||||
fk_user_modif integer,
|
||||
|
||||
UNIQUE INDEX(ref)
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user