25require
'../../main.inc.php';
26require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
38$hookmanager->initHooks([
'bankindex']);
41$langs->loadLangs([
'banks',
'bills',
'compta']);
55 require_once DOL_DOCUMENT_ROOT.
'/core/class/infobox.class.php';
58 $boxorder =
GETPOST(
'boxorder',
'aZ09');
59 $boxorder .=
GETPOST(
'boxcombo',
'aZ09');
62 setEventMessages($langs->trans(
"BoxAdded"),
null);
71$accountstatic =
new Account($db);
74$title = $langs->trans(
'MenuBankCash');
75$help_url =
'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barvermögen';
80llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-bank page-index');
82print
load_fiche_titre($langs->trans(
"BankArea"), $resultboxes[
'selectboxlist'],
'bank_account');
85print
'<div class="fichecenter">';
87print
'<div class="twocolumns">';
89print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
96$sql =
"SELECT b.rowid, b.ref, b.label, b.number, b.courant, b.currency_code, b.account_number";
97$sql .=
", SUM(bl.amount) as solde";
98$sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_account as b";
99$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as bl ON bl.fk_account = b.rowid";
100$sql .=
" WHERE b.entity IN (".getEntity(
'bank_account').
")";
101$sql .=
" AND b.clos = 0";
102$sql .=
" GROUP BY b.rowid, b.ref, b.label, b.number, b.courant, b.currency_code, b.account_number";
103$sql .= $db->order(
"b.label",
"ASC");
105$resql = $db->query($sql);
107 print
'<div class="div-table-responsive-no-min">';
108 print
'<table class="noborder centpercent">';
109 print
'<tr class="liste_titre">';
110 print
'<th colspan="2">'.$langs->trans(
"BankAccounts");
111 $lastmodified =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?search_status=opened" title="'.$langs->trans(
"FullList").
'">';
112 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
113 $lastmodified .=
'</a>';
116 print
'<th class="right">'.$langs->trans(
"Balance").
'</th>';
119 $num = $db->num_rows($resql);
124 $obj = $db->fetch_object($resql);
126 $accountstatic->id = $obj->rowid;
127 $accountstatic->ref = $obj->ref;
128 $accountstatic->label = $obj->label;
129 $accountstatic->number = $obj->number;
130 $accountstatic->account_number = $obj->account_number;
131 $accountstatic->currency_code = $obj->currency_code;
132 $accountstatic->type = $obj->courant;
134 $currency_code = ($obj->currency_code ? $obj->currency_code :
$conf->currency);
135 $solde = (float)
price2num($obj->solde,
'MU');
136 if (!array_key_exists($currency_code, $solde_total)) {
137 $solde_total[$currency_code] = 0;
139 $solde_total[$currency_code] += $solde;
141 print
'<tr class="oddeven">';
142 print
'<td>'.$accountstatic->getNomUrl(1).
'</td>';
143 print
'<td>'.dol_escape_htmltag($obj->number).
'</td>';
144 print
'<td class="nowraponall right amount">';
145 print
'<a href="'.DOL_URL_ROOT.
'/compta/bank/bankentries_list.php?id='.((int) $obj->rowid).
'">';
146 print
price($solde, 0, $langs, 1, -1, -1, $currency_code);
154 foreach ($solde_total as $currency_code => $total) {
155 print
'<tr class="liste_total">';
156 print
'<td class="liste_total" colspan="2">'.$langs->trans(
"Total").
' ('.
dol_escape_htmltag((
string) $currency_code).
')</td>';
157 print
'<td class="liste_total nowraponall right amount">'.price($total, 0, $langs, 1, -1, -1, $currency_code).
'</td>';
161 print
'<tr class="oddeven">';
162 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
170 dol_print_error($db);
174print $resultboxes[
'boxlista'];
176print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
183$sql =
"SELECT bl.rowid, bl.label, bl.amount, bl.dateo, bl.datev, bl.tms as datem, bl.fk_account";
184$sql .=
", b.rowid as bankid, b.ref as bankref, b.label as banklabel, b.currency_code";
185$sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as bl";
186$sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"bank_account as b ON b.rowid = bl.fk_account";
187$sql .=
" WHERE b.entity IN (".getEntity(
'bank_account').
")";
188$sql .= $db->order(
"bl.tms",
"DESC");
189$sql .= $db->plimit($max, 0);
191$resql = $db->query($sql);
193 print
'<div class="div-table-responsive-no-min">';
194 print
'<table class="noborder centpercent">';
195 print
'<tr class="liste_titre">';
196 print
'<th colspan="3">'.$langs->trans(
"LatestBankTransactionsModified", $max);
197 $lastmodified =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/bankentries_list.php?sortfield=b.tms&sortorder=DESC" title="'.$langs->trans(
"FullList").
'">';
198 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
199 $lastmodified .=
'</a>';
202 print
'<th class="right">'.$langs->trans(
"Amount").
'</th>';
205 $num = $db->num_rows($resql);
209 $obj = $db->fetch_object($resql);
211 $accountlinestatic->id = $obj->rowid;
212 $accountlinestatic->ref = (string) $obj->rowid;
213 $accountlinestatic->label = $obj->label;
214 $accountlinestatic->amount = $obj->amount;
216 $accountstatic->id = $obj->bankid;
217 $accountstatic->ref = $obj->bankref;
218 $accountstatic->label = $obj->banklabel;
219 $accountstatic->currency_code = $obj->currency_code;
221 print
'<tr class="oddeven">';
222 print
'<td class="nowraponall">'.$accountlinestatic->getNomUrl(1).
'</td>';
223 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
224 print
'<td class="nowraponall">'.$accountstatic->getNomUrl(1).
'</td>';
225 print
'<td class="nowraponall right amount">'.price($obj->amount, 0, $langs, 1, -1, -1, $obj->currency_code).
'</td>';
230 print
'<tr class="oddeven">';
231 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
239 dol_print_error($db);
243print $resultboxes[
'boxlistb'];
245print
'</div></div></div>';
251$reshook = $hookmanager->executeHooks(
'dashboardBank', $parameters, $object);
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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 bank accounts.
Class to manage bank transaction lines.
static saveboxorder($dbs, $zone, $boxorder, $userid=0)
Save order of boxes for area and user.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.