diff --git a/htdocs/compta/paiement.php3 b/htdocs/compta/paiement.php3 new file mode 100644 index 00000000000..c9de0ac979c --- /dev/null +++ b/htdocs/compta/paiement.php3 @@ -0,0 +1,208 @@ + + * + * $Id$ + * $Source$ + * + * action : - create + * - add + * + * + * 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("../lib/functions.inc.php3"); +llxHeader(); +$db = new Db(); + +$bc[0]="bgcolor=\"#90c090\""; +$bc[1]="bgcolor=\"#b0e0b0\""; + + +if ($action == 'add') { + $datepaye = $db->idate(mktime(12, 0 , 0, $pmonth, $pday, $pyear)); + $author = $GLOBALS["REMOTE_USER"]; + + $sql = "INSERT INTO llx_paiement (fk_facture, datec, datep, amount, author, fk_paiement, num_paiement, note)"; + $sql .= " VALUES ($facid, now(), $datepaye,$amount,'$author', $paiementid, '$num_paiement', '$note')"; + $result = $db->query($sql); + if ($result) { + $label = "Facture $facnumber - $societe"; + $sql = "INSERT INTO llx_bank (datec, dateo, amount, author, label)"; + $sql .= " VALUES (now(), $datepaye, $amount,'$author', '$label')"; + $result = $db->query($sql); + } else { + print "$sql"; + } + $action = ''; + +} elseif ($action == 'create') { + + $sql = "SELECT s.nom,s.idp, f.amount, f.total, f.facnumber"; + $sql .= " FROM societe as s, llx_facture as f WHERE f.fk_soc = s.idp"; + $sql .= " AND f.rowid = $facid"; + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows(); + if ($num) { + $obj = $db->fetch_object( 0); + print "Emettre un paiement
"; + print "