28require
'../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
32$langs->loadLangs(array(
'banks',
'categories'));
36 $socid = $user->socid;
45$companystatic =
new Societe($db);
47$title = $langs->trans(
'ListTransactionsByCategory');
48$help_url =
'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas';
53print
load_fiche_titre($langs->trans(
"BankTransactionByCategories"),
'',
'bank_account');
55print
'<table class="noborder centpercent">';
56print
"<tr class=\"liste_titre\">";
57print
'<td>'.$langs->trans(
"Rubrique").
'</td>';
58print
'<td class="right">'.$langs->trans(
"Nb").
'</td>';
59print
'<td class="right">'.$langs->trans(
"Total").
'</td>';
60print
'<td class="right">'.$langs->trans(
"Average").
'</td>';
63$sql =
"SELECT sum(d.amount) as somme, count(*) as nombre, c.label, c.rowid ";
64$sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_categ as c";
65$sql .=
", ".MAIN_DB_PREFIX.
"bank_class as l";
66$sql .=
", ".MAIN_DB_PREFIX.
"bank as d";
67$sql .=
" WHERE c.entity = ".$conf->entity;
68$sql .=
" AND c.rowid = l.fk_categ";
69$sql .=
" AND d.rowid = l.lineid";
70$sql .=
" GROUP BY c.label, c.rowid";
71$sql .=
" ORDER BY c.label";
73$result = $db->query($sql);
75 $num = $db->num_rows($result);
81 $objp = $db->fetch_object($result);
83 print
'<tr class="oddeven">';
84 print
"<td><a href=\"".DOL_URL_ROOT.
"/compta/bank/bankentries_list.php?bid=$objp->rowid\">$objp->label</a></td>";
85 print
'<td class="right">'.$objp->nombre.
'</td>';
86 print
'<td class="right"><span class="amount">'.price(abs($objp->somme)).
"</span></td>";
87 print
'<td class="right"><span class="amount">'.price(abs(
price2num($objp->somme / $objp->nombre,
'MT'))).
"</span></td>";
90 $total += abs($objp->somme);
91 $totalnb += $objp->nombre;
95 print
'<tr class="liste_total"><td colspan="2">'.$langs->trans(
"Total").
'</td>';
96 print
'<td class="liste_total right">'.price($total).
'</td>';
97 print
'<td colspan="2" class="liste_total right">'.price($totalnb ?
price2num($total / $totalnb,
'MT') : 0).
'</td></tr>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage third parties objects (customers, suppliers, prospects...)
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.