From 56f1f58c2b05e7d0f03376fd000e877999914e2a Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 18 Jun 2002 22:23:12 +0000 Subject: [PATCH] *** empty log message *** --- htdocs/compta/resultat/index.php3 | 136 ++++++++++++++++++++++++++++ htdocs/compta/resultat/pre.inc.php3 | 57 ++++++++++++ 2 files changed, 193 insertions(+) create mode 100644 htdocs/compta/resultat/index.php3 create mode 100644 htdocs/compta/resultat/pre.inc.php3 diff --git a/htdocs/compta/resultat/index.php3 b/htdocs/compta/resultat/index.php3 new file mode 100644 index 00000000000..d35d921d56e --- /dev/null +++ b/htdocs/compta/resultat/index.php3 @@ -0,0 +1,136 @@ + + * + * $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("./pre.inc.php3"); + + +require("../../tva.class.php3"); +require("../../chargesociales.class.php3"); + +/* + * + */ + +llxHeader(); + + +$db = new Db(); + + +print_barre_liste("Factures",$page,$PHP_SELF); + + +print ""; +print ''; +print ""; +print ""; +print "\n"; + +$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid"; +$sql .= " FROM societe as s,llx_facture as f WHERE f.fk_soc = s.idp"; + +if ($year > 0) { + $sql .= " AND date_format(f.datef, '%Y') = $year"; +} + +$sql .= " ORDER BY f.fk_statut, f.paye, f.datef DESC "; + +$result = $db->query($sql); +if ($result) { + $num = $db->num_rows(); + + $i = 0; + + if ($num > 0) { + $var=True; + while ($i < $num) { + $objp = $db->fetch_object( $i); + $var=!$var; + + print ""; + print "\n"; + + if ($objp->df > 0 ) { + print "\n"; + } else { + print "\n"; + } + + print "\n"; + + $total = $total + $objp->amount; + print "\n"; + + print "\n"; + $i++; + } + } + $db->free(); +} else { + print $db->error(); +} +/* + * Charges sociales + * + */ + + +$sql = "SELECT c.libelle as nom, s.amount,".$db->pdate("s.date_ech")." as de, s.date_pai, s.libelle, s.paye"; +$sql .= " FROM c_chargesociales as c, llx_chargesociales as s"; +$sql .= " WHERE s.fk_type = c.id"; +if ($year > 0) { + $sql .= " AND date_format(s.periode, '%Y') = $year"; +} +$sql .= " ORDER BY lower(s.date_ech) DESC"; + +if ( $db->query($sql) ) { + $num = $db->num_rows(); + $i = 0; + + while ($i < $num) { + $obj = $db->fetch_object( $i); + $var = !$var; + print ""; + print ''; + print ''; + print ''; + + $total = $total - $obj->amount; + print "\n"; + + print ''; + $i++; + } +} else { + print $db->error(); +} + + + +print "
NuméroDateMontantSolde
Facture facid\">$objp->facnumber $objp->nom"; + print strftime("%d/%m/%y",$objp->df)."!!!".price($objp->amount)."".price($total)."
'.$obj->nom.' - '.$obj->libelle.''.strftime("%d/%m/%y",$obj->de).''.price($obj->amount).'".price($total)."
"; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/compta/resultat/pre.inc.php3 b/htdocs/compta/resultat/pre.inc.php3 new file mode 100644 index 00000000000..196e04e7ee1 --- /dev/null +++ b/htdocs/compta/resultat/pre.inc.php3 @@ -0,0 +1,57 @@ + + * + * 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("../../main.inc.php3"); + +function llxHeader($head = "") { + global $user, $conf; + + + /* + * + * + */ + top_menu($head); + + $menu = new Menu(); + + $menu->add("/compta/facture.php3","Factures"); + $menu->add("../charges.php3","Charges"); + + $menu->add("../ca.php3","Chiffres d'affaires"); + + $menu->add("/compta/tva/index.php3","TVA"); + + $menu->add("resultat/","Résultats"); + /* + * A automatiser + */ + $menu->add_submenu("index.php3?year=2002","2002"); + $menu->add_submenu("index.php3?year=2001","2001"); + + $menu->add("/compta/bank/index.php3","Bank"); + + + left_menu($menu->liste); + +} + +?>