29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
33$langs->loadLangs(array(
'banks',
'categories'));
37 $socid = $user->socid;
46$companystatic =
new Societe($db);
48$title = $langs->trans(
'ListTransactionsByCategory');
49$help_url =
'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas';
54print
load_fiche_titre($langs->trans(
"BankTransactionByCategories"),
'',
'bank_account');
56print
'<table class="noborder centpercent">';
57print
"<tr class=\"liste_titre\">";
58print
'<td>'.$langs->trans(
"Rubrique").
'</td>';
59print
'<td class="right">'.$langs->trans(
"Nb").
'</td>';
60print
'<td class="right">'.$langs->trans(
"Total").
'</td>';
61print
'<td class="right">'.$langs->trans(
"Average").
'</td>';
64$sql =
"SELECT sum(d.amount) as somme, count(*) as nombre, c.label, c.rowid ";
65$sql .=
" FROM ".MAIN_DB_PREFIX.
"categorie as c";
66$sql .=
", ".MAIN_DB_PREFIX.
"category_bankline as l";
67$sql .=
", ".MAIN_DB_PREFIX.
"bank as d";
68$sql .=
" WHERE c.entity = ".$conf->entity;
69$sql .=
" AND c.rowid = l.fk_categ";
70$sql .=
" AND d.rowid = l.lineid";
71$sql .=
" GROUP BY c.label, c.rowid";
72$sql .=
" ORDER BY c.label";
74$result = $db->query($sql);
76 $num = $db->num_rows($result);
82 $objp = $db->fetch_object($result);
84 print
'<tr class="oddeven">';
85 print
"<td><a href=\"".DOL_URL_ROOT.
"/compta/bank/bankentries_list.php?bid=$objp->rowid\">$objp->label</a></td>";
86 print
'<td class="right">'.$objp->nombre.
'</td>';
87 print
'<td class="right"><span class="amount">'.price(abs($objp->somme)).
"</span></td>";
88 print
'<td class="right"><span class="amount">'.price(
price2num(abs($objp->somme / $objp->nombre),
'MT')).
"</span></td>";
91 $total += abs($objp->somme);
92 $totalnb += $objp->nombre;
96 print
'<tr class="liste_total"><td colspan="2">'.$langs->trans(
"Total").
'</td>';
97 print
'<td class="liste_total right">'.price($total).
'</td>';
98 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.