dolibarr  7.0.0-beta
bilan.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
25 require('../../main.inc.php');
26 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
27 
28 $langs->load("banks");
29 $langs->load("categories");
30 
31 if (!$user->rights->banque->lire)
33 
34 
41 function valeur($sql)
42 {
43  global $db;
44 
45  $valeur = 0;
46 
47  $resql=$db->query($sql);
48  if ($resql)
49  {
50  $obj=$db->fetch_object($resql);
51  $valeur = $obj->amount;
52  $db->free($resql);
53  }
54  return $valeur;
55 }
56 
57 
58 /*
59  * View
60  */
61 
62 llxHeader();
63 
64 print load_fiche_titre("Bilan");
65 print '<br>';
66 
67 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="2">';
68 print "<tr class=\"liste_titre\">";
69 echo '<td colspan="2">'.$langs->trans("Summary").'</td>';
70 print "</tr>\n";
71 
72 
73 $sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."paiement";
74 $paiem = valeur($sql);
75 print "<tr class=\"oddeven\"><td>Somme des paiements (associes a une facture)</td><td align=\"right\">".price($paiem)."</td></tr>";
76 
77 
78 $sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."bank WHERE amount > 0";
79 $credits = valeur($sql);
80 print "<tr class=\"oddeven\"><td>Somme des credits</td><td align=\"right\">".price($credits)."</td></tr>";
81 
82 
83 $sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."bank WHERE amount < 0";
84 $debits = valeur($sql);
85 print "<tr class=\"oddeven\"><td>Somme des debits</td><td align=\"right\">".price($debits)."</td></tr>";
86 
87 
88 $sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."bank ";
89 $solde = valeur($sql);
90 print "<tr class=\"oddeven\"><td>".$langs->trans("BankBalance")."</td><td align=\"right\">".price($solde)."</td></tr>";
91 
92 
93 print "</table>";
94 
95 llxFooter();
96 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
valeur($sql)
Get result of sql for field amount.
Definition: bilan.php:41
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
print
Draft customers invoices.
Definition: index.php:91
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->societe->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1013