* * 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("../paiement.class.php"); require("./bank/account.class.php"); /* * Sécurité accés client */ if ($user->societe_id > 0) { $action = ''; $socidp = $user->societe_id; } /* * Affichage */ llxHeader(); if ($action == 'create') { $sql = "SELECT s.nom,s.idp, f.amount, f.total_ttc as total, f.facnumber"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."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); $total = $obj->total; print_titre("Emettre un paiement"); print '
'; print ''; print ''; print "\n"; print "\n"; print "\n"; print ''; $sql = "SELECT sum(p.amount) FROM ".MAIN_DB_PREFIX."paiement as p WHERE p.fk_facture = $facid;"; $result = $db->query($sql); if ($result) { $sumpayed = $db->result(0,0); $db->free(); } print ''; print ''; print ""; print "facnumber\">"; print "idp\">"; print "nom\">"; print ""; print ""; print "\n"; print "'; print "\n"; print "\n"; print "\n"; print "\n"; print ''; print "\n"; print "
Facture
Numéro :$obj->facnumber
Société :$obj->nom
Montant :'.price($obj->total).' euros TTC
Déjà payé'.price($sumpayed).' euros TTC
Paiement
Date :"; print_date_select(); print "Commentaires
Type :"; print ""; print '
Compte à créditer :"; print "
Numéro :
Num du cheque ou virement
 Reste à payer : ".price($total - $sumpayed)." euros TTC
Montant :
\n"; } } } if ($action == '') { if ($page == -1) $page = 0 ; $limit = $conf->liste_limit; $offset = $limit * $page ; if ($sortorder == "") $sortorder="DESC"; if ($sortfield == "") $sortfield="p.datep"; $sql = "SELECT ".$db->pdate("p.datep")." as dp, p.amount, f.amount as fa_amount, f.facnumber"; $sql .=", f.rowid as facid, c.libelle as paiement_type, p.num_paiement"; $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."c_paiement as c"; $sql .= " WHERE p.fk_facture = f.rowid AND p.fk_paiement = c.id"; if ($socidp) { $sql .= " AND f.fk_soc = $socidp"; } $sql .= " ORDER BY $sortfield $sortorder"; $sql .= $db->plimit( $limit +1 ,$offset); $result = $db->query($sql); if ($result) { $num = $db->num_rows(); $i = 0; $var=True; print_barre_liste("Paiements", $page, $PHP_SELF,"",$sortfield,$sortorder,'',$num); print ''; print ''; print ""; print ""; print "'; print ""; print "\n"; while ($i < min($num,$limit)) { $objp = $db->fetch_object( $i); $var=!$var; print ""; print "\n"; print "\n"; print "\n"; print ''; print ""; $i++; } print "
FactureDate"; print_liste_field_titre("Type",$PHP_SELF,"c.libelle","",""); print 'Montant 
facid\">$objp->facnumber".strftime("%d %B %Y",$objp->dp)."$objp->paiement_type $objp->num_paiement'.price($objp->amount).' 
"; } print 'Rapports'; } $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>