25require
'../../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
37$hookmanager->initHooks([
'bankindex']);
40$langs->loadLangs([
'banks',
'bills',
'compta']);
53include DOL_DOCUMENT_ROOT.
'/core/actions_addbox.inc.php';
60$accountstatic =
new Account($db);
63$title = $langs->trans(
'MenuBankCash');
64$help_url =
'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barvermögen';
69llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-bank page-index');
71print
load_fiche_titre($langs->trans(
"BankArea"), $resultboxes[
'selectboxlist'],
'bank_account');
74print
'<div class="fichecenter">';
76print
'<div class="twocolumns">';
78print
'<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
85$sql =
"SELECT b.rowid, b.ref, b.label, b.number, b.courant, b.currency_code, b.account_number";
86$sql .=
", SUM(bl.amount) as solde";
87$sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_account as b";
88$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as bl ON bl.fk_account = b.rowid";
89$sql .=
" WHERE b.entity IN (".getEntity(
'bank_account').
")";
90$sql .=
" AND b.clos = 0";
91$sql .=
" GROUP BY b.rowid, b.ref, b.label, b.number, b.courant, b.currency_code, b.account_number";
92$sql .= $db->order(
"b.label",
"ASC");
94$resql = $db->query($sql);
96 print
'<div class="div-table-responsive-no-min">';
97 print
'<table class="noborder centpercent">';
98 print
'<tr class="liste_titre">';
99 print
'<th colspan="2">'.$langs->trans(
"BankAccounts");
100 $lastmodified =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/compta/bank/list.php', [
'search_status' =>
'opened']).
'" title="'.$langs->trans(
"FullList").
'">';
101 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
102 $lastmodified .=
'</a>';
105 print
'<th class="right">'.$langs->trans(
"Balance").
'</th>';
108 $num = $db->num_rows($resql);
114 $obj = $db->fetch_object($resql);
116 $currency_code = ($obj->currency_code ? $obj->currency_code :
$conf->currency);
117 $solde = (float)
price2num($obj->solde,
'MU');
118 if (!array_key_exists($currency_code, $solde_total)) {
119 $solde_total[$currency_code] = 0;
121 $solde_total[$currency_code] += $solde;
125 if (!array_key_exists($currency_code, $solde_others)) {
126 $solde_others[$currency_code] = 0;
128 $solde_others[$currency_code] += $solde;
133 $accountstatic->id = $obj->rowid;
134 $accountstatic->ref = $obj->ref;
135 $accountstatic->label = $obj->label;
136 $accountstatic->number = $obj->number;
137 $accountstatic->account_number = $obj->account_number;
138 $accountstatic->currency_code = $obj->currency_code;
139 $accountstatic->type = $obj->courant;
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="'.dolBuildUrl(DOL_URL_ROOT.
'/compta/bank/bankentries_list.php', [
'id' => (
int) $obj->rowid]).
'">';
146 print
'<span class="amount">';
147 print
price($solde, 0, $langs, 1, -1, -1, $currency_code);
156 foreach ($solde_others as $currency_code => $total) {
157 print
'<tr class="oddeven">';
158 print
'<td colspan="2"><span class="opacitymedium">'.$langs->trans(
"Others").
'...'.(count($solde_others) > 1 ?
' ('.dol_escape_htmltag((
string) $currency_code).
')' :
'').
'</span></td>';
159 print
'<td class="nowraponall right amount">';
160 print
'<span class="amount">'.price($total, 0, $langs, 1, -1, -1, $currency_code).
'</span>';
166 foreach ($solde_total as $currency_code => $total) {
167 print
'<tr class="liste_total">';
168 print
'<td class="liste_total" colspan="2">'.$langs->trans(
"Total").
' ('.
dol_escape_htmltag((
string) $currency_code).
')</td>';
169 print
'<td class="liste_total nowraponall right amount">'.price($total, 0, $langs, 1, -1, -1, $currency_code).
'</td>';
173 print
'<tr class="oddeven">';
174 print
'<td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
182 dol_print_error($db);
186print $resultboxes[
'boxlista'];
188print
'</div><div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
195$sql =
"SELECT bl.rowid, bl.label, bl.amount, bl.dateo, bl.datev, bl.tms as datem, bl.fk_account";
196$sql .=
", b.rowid as bankid, b.ref as bankref, b.label as banklabel, b.currency_code";
197$sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as bl";
198$sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"bank_account as b ON b.rowid = bl.fk_account";
199$sql .=
" WHERE b.entity IN (".getEntity(
'bank_account').
")";
200$sql .= $db->order(
"bl.tms",
"DESC");
201$sql .= $db->plimit($max, 0);
203$resql = $db->query($sql);
205 print
'<div class="div-table-responsive-no-min">';
206 print
'<table class="noborder centpercent">';
207 print
'<tr class="liste_titre">';
208 print
'<th colspan="3">'.$langs->trans(
"LatestBankTransactionsModified", $max);
209 $lastmodified =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/compta/bank/bankentries_list.php', [
'sortfield' =>
'b.tms',
'sortorder' =>
'DESC']).
'" title="'.$langs->trans(
"FullList").
'">';
210 $lastmodified .=
'<span class="badge marginleftonlyshort">...</span>';
211 $lastmodified .=
'</a>';
214 print
'<th class="right">'.$langs->trans(
"Amount").
'</th>';
217 $num = $db->num_rows($resql);
221 $obj = $db->fetch_object($resql);
223 $accountlinestatic->id = $obj->rowid;
224 $accountlinestatic->ref = (string) $obj->rowid;
225 $accountlinestatic->label = $obj->label;
226 $accountlinestatic->amount = $obj->amount;
228 $accountstatic->id = $obj->bankid;
229 $accountstatic->ref = $obj->bankref;
230 $accountstatic->label = $obj->banklabel;
231 $accountstatic->currency_code = $obj->currency_code;
233 print
'<tr class="oddeven">';
234 print
'<td class="nowraponall">'.$accountlinestatic->getNomUrl(1).
'</td>';
236 $labeltoshow = $obj->label;
238 if (preg_match(
'/^\((.+)\)$/i', (
string) $obj->label, $reg)) {
239 if ($reg[1] ==
'payment_salary') {
240 $reg[1] =
'SalaryPayment';
242 if ($langs->transnoentitiesnoconv($reg[1]) != $reg[1]) {
243 $labeltoshow = $langs->transnoentitiesnoconv($reg[1]);
246 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($labeltoshow).
'">'.
dol_escape_htmltag($labeltoshow).
'</td>';
247 print
'<td class="nowraponall">'.$accountstatic->getNomUrl(1).
'</td>';
248 print
'<td class="nowraponall right amount">'.price($obj->amount, 0, $langs, 1, -1, -1, $obj->currency_code).
'</td>';
253 print
'<tr class="oddeven">';
254 print
'<td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
262 dol_print_error($db);
266print $resultboxes[
'boxlistb'];
268print
'</div></div></div>';
274$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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage bank accounts.
Class to manage bank transaction lines.
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
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.
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.