30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
42$langs->loadLangs(array(
'banks',
'categories'));
46 $socid = $user->socid;
55$companystatic =
new Societe($db);
57$title = $langs->trans(
'ListTransactionsByCategory');
58$help_url =
'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas';
63print
load_fiche_titre($langs->trans(
"BankTransactionByCategories"),
'',
'bank_account');
65print
'<table class="noborder centpercent">';
66print
"<tr class=\"liste_titre\">";
67print
'<td>'.$langs->trans(
"Rubrique").
'</td>';
68print
'<td class="right">'.$langs->trans(
"Nb").
'</td>';
69print
'<td class="right">'.$langs->trans(
"Total").
'</td>';
70print
'<td class="right">'.$langs->trans(
"Average").
'</td>';
73$sql =
"SELECT sum(d.amount) as somme, count(*) as nombre, c.label, c.rowid ";
74$sql .=
" FROM ".MAIN_DB_PREFIX.
"categorie as c";
75$sql .=
", ".MAIN_DB_PREFIX.
"category_bankline as l";
76$sql .=
", ".MAIN_DB_PREFIX.
"bank as d";
77$sql .=
" WHERE c.entity = ".$conf->entity;
78$sql .=
" AND c.rowid = l.fk_categ";
79$sql .=
" AND d.rowid = l.lineid";
80$sql .=
" GROUP BY c.label, c.rowid";
81$sql .=
" ORDER BY c.label";
83$result = $db->query($sql);
85 $num = $db->num_rows($result);
91 $objp = $db->fetch_object($result);
93 print
'<tr class="oddeven">';
94 print
"<td><a href=\"".DOL_URL_ROOT.
"/compta/bank/bankentries_list.php?bid=$objp->rowid\">$objp->label</a></td>";
95 print
'<td class="right">'.$objp->nombre.
'</td>';
96 print
'<td class="right"><span class="amount">'.price(abs($objp->somme)).
"</span></td>";
97 print
'<td class="right"><span class="amount">'.price(
price2num(abs($objp->somme / $objp->nombre),
'MT')).
"</span></td>";
100 $total += abs($objp->somme);
101 $totalnb += $objp->nombre;
105 print
'<tr class="liste_total"><td colspan="2">'.$langs->trans(
"Total").
'</td>';
106 print
'<td class="liste_total right">'.price($total).
'</td>';
107 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage third parties objects (customers, suppliers, prospects...)
load_fiche_titre($title, $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=null, $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.