dolibarr  16.0.5
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 <https://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 // Load translation files required by the page
29 $langs->loadLangs(array('banks', 'categories'));
30 
31 if (empty($user->rights->banque->lire)) {
33 }
34 
35 
42 function valeur($sql)
43 {
44  global $db;
45 
46  $valeur = 0;
47 
48  $resql = $db->query($sql);
49  if ($resql) {
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%" 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 // End of page
96 llxFooter();
97 $db->close();
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
price
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.
Definition: functions.lib.php:5541
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
valeur
if(empty($user->rights->banque->lire)) valeur($sql)
Get result of sql for field amount.
Definition: bilan.php:42
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59