29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
35$langs->loadLangs(array(
'banks',
'categories'));
41$hookmanager->initHooks(array(
'bankstats',
'globalcard'));
47$fieldid =
GETPOST(
'ref') ?
'ref' :
'rowid';
49 $socid = $user->socid;
51$result =
restrictedArea($user,
'banque',
$id,
'bank_account&bank_account',
'',
'', $fieldid);
55if (
GETPOST(
"mode") ==
'showalltime') {
56 $mode =
'showalltime';
87$title =
$object->ref.
' - '.$langs->trans(
"Graph");
91$result =
dol_mkdir($conf->bank->dir_temp);
93 $langs->load(
"errors");
98 $sql =
"SELECT MIN(b.datev) as min, MAX(b.datev) as max";
99 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
100 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
101 $sql .=
" WHERE b.fk_account = ba.rowid";
102 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
103 if ($account &&
GETPOST(
"option") !=
'all') {
104 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
107 $resql = $db->query($sql);
109 $num = $db->num_rows($resql);
110 $obj = $db->fetch_object($resql);
111 $min = $db->jdate($obj->min);
112 $max = $db->jdate($obj->max);
120 $log =
"graph.php: min=".$min.
" max=".$max;
126 if ($mode ==
'standard') {
130 $monthnext = (int) $month + 1;
131 $yearnext = (int) $year;
132 if ($monthnext > 12) {
136 $monthnext = sprintf(
'%02d', $monthnext);
137 $yearnext = sprintf(
'%04d', $yearnext);
139 $sql =
"SELECT date_format(b.datev,'%Y%m%d')";
140 $sql .=
", SUM(b.amount)";
141 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
142 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
143 $sql .=
" WHERE b.fk_account = ba.rowid";
144 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
145 $sql .=
" AND b.datev >= '".$db->escape($year).
"-".$db->escape($month).
"-01 00:00:00'";
146 $sql .=
" AND b.datev < '".$db->escape($yearnext).
"-".$db->escape($monthnext).
"-01 00:00:00'";
147 if ($account &&
GETPOST(
"option") !=
'all') {
148 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
150 $sql .=
" GROUP BY date_format(b.datev,'%Y%m%d')";
152 $resql = $db->query($sql);
154 $num = $db->num_rows($resql);
157 $row = $db->fetch_row($resql);
158 $amounts[$row[0]] = $row[1];
169 $sql =
"SELECT SUM(b.amount)";
170 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
171 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
172 $sql .=
" WHERE b.fk_account = ba.rowid";
173 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
174 $sql .=
" AND b.datev < '".$db->escape($year).
"-".sprintf(
"%02s", $month).
"-01'";
175 if ($account &&
GETPOST(
"option") !=
'all') {
176 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
179 $resql = $db->query($sql);
181 $row = $db->fetch_row($resql);
194 $day =
dol_mktime(12, 0, 0, (
int) $month, 1, (
int) $year);
197 $xyear = substr($textdate, 0, 4);
198 $xday = substr($textdate, 6, 2);
199 $xmonth = substr($textdate, 4, 2);
203 while ($xmonth == $month) {
204 $subtotal += (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
208 $datas[$i] = $solde + $subtotal;
210 $datamin[$i] =
$object->min_desired;
211 $dataall[$i] =
$object->min_allowed;
218 $xyear = substr($textdate, 0, 4);
219 $xday = substr($textdate, 6, 2);
220 $xmonth = substr($textdate, 4, 2);
232 $file = $conf->bank->dir_temp.
"/balance".$account.
"-".$year.$month.
".png";
233 $fileurl = DOL_URL_ROOT.
'/viewimage.php?modulepart=banque_temp&file='.
"/balance".$account.
"-".$year.$month.
".png";
234 $title = $langs->transnoentities(
"Balance").
' - '.$langs->transnoentities(
"Month").
': '.$month.
' '.$langs->transnoentities(
"Year").
': '.$year;
235 $graph_datas = array();
236 foreach ($datas as $i => $val) {
237 $graph_datas[$i] = array(isset($labels[$i]) ? $labels[$i] :
'', $datas[$i]);
239 array_push($graph_datas[$i], $datamin[$i]);
242 array_push($graph_datas[$i], $dataall[$i]);
247 $px1->SetData($graph_datas);
248 $arraylegends = array($langs->transnoentities(
"Balance"));
250 array_push($arraylegends, $langs->transnoentities(
"BalanceMinimalDesired"));
253 array_push($arraylegends, $langs->transnoentities(
"BalanceMinimalAllowed"));
255 $px1->SetLegend($arraylegends);
256 $px1->SetLegendWidthMin(180);
257 $px1->SetMaxValue($px1->GetCeilMaxValue() < 0 ? 0 : $px1->GetCeilMaxValue());
258 $px1->SetMinValue($px1->GetFloorMinValue() > 0 ? 0 : $px1->GetFloorMinValue());
259 $px1->SetTitle($title);
260 $px1->SetWidth($WIDTH);
261 $px1->SetHeight($HEIGHT);
262 $px1->SetType(array(
'lines',
'lines',
'lines'));
263 $px1->setBgColor(
'onglet');
264 $px1->setBgColorGrid(array(255, 255, 255));
265 $px1->SetHorizTickIncrement(1);
266 $px1->draw($file, $fileurl);
268 $show1 = $px1->show();
281 if ($mode ==
'standard') {
284 $sql =
"SELECT date_format(b.datev,'%Y%m%d')";
285 $sql .=
", SUM(b.amount)";
286 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
287 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
288 $sql .=
" WHERE b.fk_account = ba.rowid";
289 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
290 $sql .=
" AND b.datev >= '".$db->escape($year).
"-01-01 00:00:00'";
291 $sql .=
" AND b.datev <= '".$db->escape($year).
"-12-31 23:59:59'";
292 if ($account &&
GETPOST(
"option") !=
'all') {
293 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
295 $sql .=
" GROUP BY date_format(b.datev,'%Y%m%d')";
297 $resql = $db->query($sql);
299 $num = $db->num_rows($resql);
302 $row = $db->fetch_row($resql);
303 $amounts[$row[0]] = $row[1];
314 $sql =
"SELECT SUM(b.amount)";
315 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
316 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
317 $sql .=
" WHERE b.fk_account = ba.rowid";
318 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
319 $sql .=
" AND b.datev < '".$db->escape($year).
"-01-01'";
320 if ($account &&
GETPOST(
"option") !=
'all') {
321 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
324 $resql = $db->query($sql);
326 $row = $db->fetch_row($resql);
341 $day =
dol_mktime(12, 0, 0, 1, 1, (
int) $year);
344 $xyear = substr($textdate, 0, 4);
345 $xday = substr($textdate, 6, 2);
348 while ($xyear == $year && $day <= $datetime) {
349 $subtotal += (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
353 $datas[$i] = $solde + $subtotal;
355 $datamin[$i] =
$object->min_desired;
356 $dataall[$i] =
$object->min_allowed;
365 $xyear = substr($textdate, 0, 4);
366 $xday = substr($textdate, 6, 2);
371 $file = $conf->bank->dir_temp.
"/balance".$account.
"-".$year.
".png";
372 $fileurl = DOL_URL_ROOT.
'/viewimage.php?modulepart=banque_temp&file='.
"/balance".$account.
"-".$year.
".png";
373 $title = $langs->transnoentities(
"Balance").
' - '.$langs->transnoentities(
"Year").
': '.$year;
374 $graph_datas = array();
375 foreach ($datas as $i => $val) {
376 $graph_datas[$i] = array(isset($labels[$i]) ? $labels[$i] :
'', $datas[$i]);
378 array_push($graph_datas[$i], $datamin[$i]);
381 array_push($graph_datas[$i], $dataall[$i]);
385 $px2->SetData($graph_datas);
386 $arraylegends = array($langs->transnoentities(
"Balance"));
388 array_push($arraylegends, $langs->transnoentities(
"BalanceMinimalDesired"));
391 array_push($arraylegends, $langs->transnoentities(
"BalanceMinimalAllowed"));
393 $px2->SetLegend($arraylegends);
394 $px2->SetLegendWidthMin(180);
395 $px2->SetMaxValue($px2->GetCeilMaxValue() < 0 ? 0 : $px2->GetCeilMaxValue());
396 $px2->SetMinValue($px2->GetFloorMinValue() > 0 ? 0 : $px2->GetFloorMinValue());
397 $px2->SetTitle($title);
398 $px2->SetWidth($WIDTH);
399 $px2->SetHeight($HEIGHT);
400 $px2->SetType(array(
'linesnopoint',
'linesnopoint',
'linesnopoint'));
401 $px2->setBgColor(
'onglet');
402 $px2->setBgColorGrid(array(255, 255, 255));
403 $px2->SetHideXGrid(
true);
405 $px2->draw($file, $fileurl);
407 $show2 = $px2->show();
420 if ($mode ==
'showalltime') {
424 $sql =
"SELECT date_format(b.datev,'%Y%m%d')";
425 $sql .=
", SUM(b.amount)";
426 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
427 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
428 $sql .=
" WHERE b.fk_account = ba.rowid";
429 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
430 if ($account &&
GETPOST(
"option") !=
'all') {
431 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
433 $sql .=
" GROUP BY date_format(b.datev,'%Y%m%d')";
435 $resql = $db->query($sql);
437 $num = $db->num_rows($resql);
441 $row = $db->fetch_row($resql);
442 $amounts[$row[0]] = $row[1];
465 while ($day <= ($max + 86400)) {
466 $subtotal += (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
468 if ($day > ($max + 86400)) {
471 $datas[$i] = $solde + $subtotal;
473 $datamin[$i] =
$object->min_desired;
474 $dataall[$i] =
$object->min_allowed;
479 $labels[$i] = substr($textdate, 0, 6);
488 $file = $conf->bank->dir_temp.
"/balance".$account.
".png";
489 $fileurl = DOL_URL_ROOT.
'/viewimage.php?modulepart=banque_temp&file='.
"/balance".$account.
".png";
490 $title = $langs->transnoentities(
"Balance").
" - ".$langs->transnoentities(
"AllTime");
491 $graph_datas = array();
492 foreach ($datas as $i => $val) {
493 $graph_datas[$i] = array(isset($labels[$i]) ? $labels[$i] :
'', $datas[$i]);
495 array_push($graph_datas[$i], $datamin[$i]);
498 array_push($graph_datas[$i], $dataall[$i]);
503 $px3->SetData($graph_datas);
504 $arraylegends = array($langs->transnoentities(
"Balance"));
506 array_push($arraylegends, $langs->transnoentities(
"BalanceMinimalDesired"));
509 array_push($arraylegends, $langs->transnoentities(
"BalanceMinimalAllowed"));
511 $px3->SetLegend($arraylegends);
512 $px3->SetLegendWidthMin(180);
513 $px3->SetMaxValue($px3->GetCeilMaxValue() < 0 ? 0 : $px3->GetCeilMaxValue());
514 $px3->SetMinValue($px3->GetFloorMinValue() > 0 ? 0 : $px3->GetFloorMinValue());
515 $px3->SetTitle($title);
516 $px3->SetWidth($WIDTH);
517 $px3->SetHeight($HEIGHT);
518 $px3->SetType(array(
'linesnopoint',
'linesnopoint',
'linesnopoint'));
519 $px3->setBgColor(
'onglet');
520 $px3->setBgColorGrid(array(255, 255, 255));
521 $px3->draw($file, $fileurl);
523 $show3 = $px3->show();
536 if ($mode ==
'standard') {
541 $monthnext = (int) $month + 1;
542 $yearnext = (int) $year;
543 if ($monthnext > 12) {
547 $monthnext = sprintf(
'%02d', $monthnext);
548 $yearnext = sprintf(
'%04d', $yearnext);
550 $sql =
"SELECT date_format(b.datev,'%d')";
551 $sql .=
", SUM(b.amount)";
552 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
553 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
554 $sql .=
" WHERE b.fk_account = ba.rowid";
555 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
556 $sql .=
" AND b.datev >= '".$db->escape($year).
"-".$db->escape($month).
"-01 00:00:00'";
557 $sql .=
" AND b.datev < '".$db->escape($yearnext).
"-".$db->escape($monthnext).
"-01 00:00:00'";
558 $sql .=
" AND b.amount > 0";
559 if ($account &&
GETPOST(
"option") !=
'all') {
560 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
562 $sql .=
" GROUP BY date_format(b.datev,'%d')";
564 $resql = $db->query($sql);
566 $num = $db->num_rows($resql);
569 $row = $db->fetch_row($resql);
570 $credits[$row[0]] = $row[1];
578 $monthnext = (int) $month + 1;
579 $yearnext = (int) $year;
580 if ($monthnext > 12) {
584 $monthnext = sprintf(
'%02d', $monthnext);
585 $yearnext = sprintf(
'%04d', $yearnext);
587 $sql =
"SELECT date_format(b.datev,'%d')";
588 $sql .=
", SUM(b.amount)";
589 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
590 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
591 $sql .=
" WHERE b.fk_account = ba.rowid";
592 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
593 $sql .=
" AND b.datev >= '".$db->escape($year).
"-".$db->escape($month).
"-01 00:00:00'";
594 $sql .=
" AND b.datev < '".$db->escape($yearnext).
"-".$db->escape($monthnext).
"-01 00:00:00'";
595 $sql .=
" AND b.amount < 0";
596 if ($account &&
GETPOST(
"option") !=
'all') {
597 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
599 $sql .=
" GROUP BY date_format(b.datev,'%d')";
601 $resql = $db->query($sql);
603 while ($row = $db->fetch_row($resql)) {
604 $debits[$row[0]] = abs($row[1]);
614 $data_credit = array();
615 $data_debit = array();
616 for ($i = 0; $i < 31; $i++) {
617 $data_credit[$i] = isset($credits[substr(
"0".($i + 1), -2)]) ? $credits[substr(
"0".($i + 1), -2)] : 0;
618 $data_debit[$i] = isset($debits[substr(
"0".($i + 1), -2)]) ? $debits[substr(
"0".($i + 1), -2)] : 0;
619 $labels[$i] = sprintf(
"%02d", $i + 1);
620 $datamin[$i] =
$object->min_desired;
624 $file = $conf->bank->dir_temp.
"/movement".$account.
"-".$year.$month.
".png";
625 $fileurl = DOL_URL_ROOT.
'/viewimage.php?modulepart=banque_temp&file='.
"/movement".$account.
"-".$year.$month.
".png";
626 $title = $langs->transnoentities(
"BankMovements").
' - '.$langs->transnoentities(
"Month").
': '.$month.
' '.$langs->transnoentities(
"Year").
': '.$year;
627 $graph_datas = array();
628 foreach ($data_credit as $i => $val) {
629 $graph_datas[$i] = array($labels[$i], $data_credit[$i], $data_debit[$i]);
632 $px4->SetData($graph_datas);
633 $px4->SetLegend(array($langs->transnoentities(
"Credit"), $langs->transnoentities(
"Debit")));
634 $px4->SetLegendWidthMin(180);
635 $px4->SetMaxValue($px4->GetCeilMaxValue() < 0 ? 0 : $px4->GetCeilMaxValue());
636 $px4->SetMinValue($px4->GetFloorMinValue() > 0 ? 0 : $px4->GetFloorMinValue());
637 $px4->SetTitle($title);
638 $px4->SetWidth($WIDTH);
639 $px4->SetHeight($HEIGHT);
640 $px4->SetType(array(
'bars',
'bars'));
642 $px4->setBgColor(
'onglet');
643 $px4->setBgColorGrid(array(255, 255, 255));
644 $px4->SetHorizTickIncrement(1);
645 $px4->draw($file, $fileurl);
647 $show4 = $px4->show();
657 if ($mode ==
'standard') {
661 $sql =
"SELECT date_format(b.datev,'%m')";
662 $sql .=
", SUM(b.amount)";
663 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
664 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
665 $sql .=
" WHERE b.fk_account = ba.rowid";
666 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
667 $sql .=
" AND b.datev >= '".$db->escape($year).
"-01-01 00:00:00'";
668 $sql .=
" AND b.datev <= '".$db->escape($year).
"-12-31 23:59:59'";
669 $sql .=
" AND b.amount > 0";
670 if ($account &&
GETPOST(
"option") !=
'all') {
671 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
673 $sql .=
" GROUP BY date_format(b.datev,'%m');";
675 $resql = $db->query($sql);
677 $num = $db->num_rows($resql);
680 $row = $db->fetch_row($resql);
681 $credits[$row[0]] = $row[1];
688 $sql =
"SELECT date_format(b.datev,'%m')";
689 $sql .=
", SUM(b.amount)";
690 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
691 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
692 $sql .=
" WHERE b.fk_account = ba.rowid";
693 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
694 $sql .=
" AND b.datev >= '".$db->escape($year).
"-01-01 00:00:00'";
695 $sql .=
" AND b.datev <= '".$db->escape($year).
"-12-31 23:59:59'";
696 $sql .=
" AND b.amount < 0";
697 if ($account &&
GETPOST(
"option") !=
'all') {
698 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
700 $sql .=
" GROUP BY date_format(b.datev,'%m')";
702 $resql = $db->query($sql);
704 while ($row = $db->fetch_row($resql)) {
705 $debits[$row[0]] = abs($row[1]);
715 $data_credit = array();
716 $data_debit = array();
717 for ($i = 0; $i < 12; $i++) {
718 $data_credit[$i] = isset($credits[substr(
"0".($i + 1), -2)]) ? $credits[substr(
"0".($i + 1), -2)] : 0;
719 $data_debit[$i] = isset($debits[substr(
"0".($i + 1), -2)]) ? $debits[substr(
"0".($i + 1), -2)] : 0;
721 $datamin[$i] =
$object->min_desired;
725 $file = $conf->bank->dir_temp.
"/movement".$account.
"-".$year.
".png";
726 $fileurl = DOL_URL_ROOT.
'/viewimage.php?modulepart=banque_temp&file='.
"/movement".$account.
"-".$year.
".png";
727 $title = $langs->transnoentities(
"BankMovements").
' - '.$langs->transnoentities(
"Year").
': '.$year;
728 $graph_datas = array();
729 foreach ($data_credit as $i => $val) {
730 $graph_datas[$i] = array($labels[$i], $data_credit[$i], $data_debit[$i]);
733 $px5->SetData($graph_datas);
734 $px5->SetLegend(array($langs->transnoentities(
"Credit"), $langs->transnoentities(
"Debit")));
735 $px5->SetLegendWidthMin(180);
736 $px5->SetMaxValue($px5->GetCeilMaxValue() < 0 ? 0 : $px5->GetCeilMaxValue());
737 $px5->SetMinValue($px5->GetFloorMinValue() > 0 ? 0 : $px5->GetFloorMinValue());
738 $px5->SetTitle($title);
739 $px5->SetWidth($WIDTH);
740 $px5->SetHeight($HEIGHT);
741 $px5->SetType(array(
'bars',
'bars'));
743 $px5->setBgColor(
'onglet');
744 $px5->setBgColorGrid(array(255, 255, 255));
745 $px5->SetHorizTickIncrement(1);
746 $px5->draw($file, $fileurl);
748 $show5 = $px5->show();
760print
dol_get_fiche_head($head,
'graph', $langs->trans(
"FinancialAccount"), 0,
'account');
763$linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
766 if (!preg_match(
'/,/', $account)) {
767 $moreparam =
'&month='.$month.
'&year='.$year.($mode ==
'showalltime' ?
'&mode=showalltime' :
'');
769 if (
GETPOST(
"option") !=
'all') {
770 $morehtml =
'<a href="'.$_SERVER[
"PHP_SELF"].
'?account='.$account.
'&option=all'.$moreparam.
'">'.$langs->trans(
"ShowAllAccounts").
'</a>';
771 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref',
'', $moreparam, 0,
'',
'', 1);
773 $morehtml =
'<a href="'.$_SERVER[
"PHP_SELF"].
'?account='.$account.$moreparam.
'">'.$langs->trans(
"BackToAccount").
'</a>';
774 print $langs->trans(
"AllAccounts");
778 $bankaccount =
new Account($db);
779 $listid = explode(
',', $account);
780 foreach ($listid as $key =>
$id) {
781 $bankaccount->fetch(
$id);
782 $bankaccount->label = $bankaccount->ref;
783 print $bankaccount->getNomUrl(1);
784 if ($key < (count($listid) - 1)) {
790 print $langs->trans(
"AllAccounts");
796print
'<table class="notopnoleftnoright" width="100%">';
799print
'<tr><td class="right">'.$morehtml.
' ';
800if ($mode ==
'showalltime') {
801 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?account='.$account.(GETPOST(
"option") !=
'all' ?
'' :
'&option=all').
'">';
802 print $langs->trans(
"GoBack");
805 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?mode=showalltime&account='.$account.(GETPOST(
"option") !=
'all' ?
'' :
'&option=all').
'">';
806 print $langs->trans(
"ShowAllTimeBalance");
809print
'<br><br></td></tr>';
815if ($mode ==
'standard') {
816 $prevyear = (int) $year;
817 $nextyear = (int) $year;
818 $prevmonth = (int) $month - 1;
819 $nextmonth = (int) $month + 1;
820 if ($prevmonth < 1) {
824 if ($nextmonth > 12) {
828 $nextmonth = sprintf(
'%02d', $nextmonth);
829 $prevmonth = sprintf(
'%02d', $prevmonth);
830 $nextyear = sprintf(
'%04d', $nextyear);
831 $prevyear = sprintf(
'%04d', $prevyear);
834 $link =
"<a href='".$_SERVER[
"PHP_SELF"].
"?account=".$account.(GETPOST(
"option") !=
'all' ?
'' :
'&option=all').
"&year=".$prevyear.
"&month=".$prevmonth.
"'>".
img_previous(
'',
'class="valignbottom"').
"</a> ".$langs->trans(
"Month").
" <a href='".$_SERVER[
"PHP_SELF"].
"?account=".$account.(GETPOST(
"option") !=
'all' ?
'' :
'&option=all').
"&year=".$nextyear.
"&month=".$nextmonth.
"'>".
img_next(
'',
'class="valignbottom"').
"</a>";
835 print
'<div class="right clearboth">'.$link.
'</div>';
837 print
'<div class="center clearboth margintoponly">';
838 $file =
"movement".$account.
"-".$year.$month.
".png";
842 print
'<div class="center clearboth margintoponly">';
847 $prevyear = (int) $year - 1;
848 $nextyear = (int) $year + 1;
849 $nextyear = sprintf(
'%04d', $nextyear);
850 $prevyear = sprintf(
'%04d', $prevyear);
851 $link =
"<a href='".$_SERVER[
"PHP_SELF"].
"?account=".$account.(GETPOST(
"option") !=
'all' ?
'' :
'&option=all').
"&year=".($prevyear).
"'>".
img_previous(
'',
'class="valignbottom"').
"</a> ".$langs->trans(
"Year").
" <a href='".$_SERVER[
"PHP_SELF"].
"?account=".$account.(GETPOST(
"option") !=
'all' ?
'' :
'&option=all').
"&year=".($nextyear).
"'>".
img_next(
'',
'class="valignbottom"').
"</a>";
853 print
'<div class="right clearboth margintoponly">'.$link.
'</div>';
855 print
'<div class="center clearboth margintoponly">';
859 print
'<div class="center clearboth margintoponly">';
864if ($mode ==
'showalltime') {
865 print
'<div class="center clearboth margintoponly">';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
bank_prepare_head(Account $object)
Prepare array with list of tabs.
Class to manage bank accounts.
static getDefaultGraphSizeForStats($direction, $defaultsize='')
getDefaultGraphSizeForStats
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_now($mode='auto')
Return date for now.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_previous($titlealt='default', $moreatt='')
Show previous logo.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_next($titlealt='default', $moreatt='')
Show next logo.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
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.