* * 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.php3"); llxHeader(); $db = new Db(); $yn[1] = "oui"; $yn[0] = "non"; if ($action == 'valid') { $sql = "UPDATE llx_facture_fourn set fk_statut = 1 WHERE rowid = $facid ;"; $result = $db->query( $sql); } if ($action == 'payed') { $sql = "UPDATE llx_facture_fourn set paye = 1 WHERE rowid = $facid ;"; $result = $db->query( $sql); } if ($action == 'add') { $datefacture = $db->idate(mktime(12, 0 , 0, $pmonth, $pday, $pyear)); $tva = ($tva_taux * $amount) / 100 ; $remise = 0; $total = $tva + $amount ; $sql = "INSERT INTO llx_facture_fourn (facnumber, libelle, fk_soc, datec, datef, note, amount, remise, tva, total, fk_user_author) "; $sql .= " VALUES ('$facnumber','$libelle', $socidp, now(), $datefacture,'$note', $amount, $remise, $tva, $total, $user->id);"; $result = $db->query($sql); if ($result) { $sql = "SELECT rowid, facnumber FROM llx_facture_fourn WHERE facnumber='$facnumber';"; $result = $db->query($sql); if ($result) { $objfac = $db->fetch_object( 0); $facid = $objfac->rowid; $facnumber = $objfac->facnumber; $action = ''; } } else { print "
Erreur : la facture n'a pas été créée, vérifier le numéro !$sql
". $db->error();
print "
Retour à la propal"; } $facid = $facid; $action = ''; } /* * * Mode creation * * * */ if ($action == 'create') { print_titre("Emettre une facture"); print "