From a53b63e864913f187d6b540dc9717092ed7a6895 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 29 Apr 2002 21:19:51 +0000 Subject: [PATCH] *** empty log message *** --- htdocs/compta/paiement.php3 | 208 ++++++++++++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 htdocs/compta/paiement.php3 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 "

"; + print ""; + print ""; + + print ""; + print ""; + print ""; + print ""; + + + print ""; + print ""; + print "facnumber\">"; + print "idp\">"; + print "nom\">"; + + $strmonth[1] = "Janvier"; + $strmonth[2] = "Février"; + $strmonth[3] = "Mars"; + $strmonth[4] = "Avril"; + $strmonth[5] = "Mai"; + $strmonth[6] = "Juin"; + $strmonth[7] = "Juillet"; + $strmonth[8] = "Août"; + $strmonth[9] = "Septembre"; + $strmonth[10] = "Octobre"; + $strmonth[11] = "Novembre"; + $strmonth[12] = "Décembre"; + + + print ""; + + print ""; + + + $author = $GLOBALS["REMOTE_USER"]; + print "\n"; + + print "\n"; + + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "
Facture
Société :$obj->nom
Numéro :$obj->facnumber
Montant :".price($obj->total)." euros TTC
Paiement
Date :"; + $cday = date("d", time()); + print ""; + $cmonth = date("n", time()); + print ""; + + print "Commentaires :
"; + print "
Auteur :$author
Type :
"; + print "
Numéro :
Num du cheque ou virement
Montant :price\">
\n"; + + } + } +} + +if ($action == '') { + + $sql = "SELECT ".$db->pdate("p.datep")." as dp, p.amount, f.amount as fa_amount, f.facnumber, f.rowid as facid, c.libelle as paiement_type, p.num_paiement"; + $sql .= " FROM llx_paiement as p, llx_facture as f, c_paiement as c WHERE p.fk_facture = f.rowid AND p.fk_paiement = c.id"; + $sql .= " ORDER BY datep DESC"; + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows(); + $i = 0; $total = 0; + print "

Paiements"; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + + $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print ''; + print "\n"; + print ""; + $total = $total + $objp->amount; + $i++; + } + print "\n"; + print "
FactureDateTypeMontant FF TTC 
facid\">$objp->facnumber".strftime("%d %B %Y",$objp->dp)."$objp->paiement_type $objp->num_paiement'.price($objp->amount).' ".francs(inctva($objp->amount))." 
Total : $totalEuros HT
"; + } + +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?>