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';
43$langs->loadLangs(array(
'banks',
'categories'));
49$hookmanager->initHooks(array(
'bankstats',
'globalcard'));
55$fieldid =
GETPOST(
'ref') ?
'ref' :
'rowid';
57 $socid = $user->socid;
59$result =
restrictedArea($user,
'banque',
$id,
'bank_account&bank_account',
'',
'', $fieldid);
63if (
GETPOST(
"mode") ==
'showalltime') {
64 $mode =
'showalltime';
95$title =
$object->ref.
' - '.$langs->trans(
"Graph");
108 $langs->load(
"errors");
113 $sql =
"SELECT MIN(b.datev) as min, MAX(b.datev) as max";
114 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
115 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
116 $sql .=
" WHERE b.fk_account = ba.rowid";
117 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
118 if ($account &&
GETPOST(
"option") !=
'all') {
119 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
122 $resql = $db->query($sql);
124 $num = $db->num_rows($resql);
125 $obj = $db->fetch_object($resql);
126 $min = $db->jdate($obj->min);
127 $max = $db->jdate($obj->max);
135 $log =
"graph.php: min=".$min.
" max=".$max;
141 if ($mode ==
'standard') {
145 $monthnext = (int) $month + 1;
146 $yearnext = (int) $year;
147 if ($monthnext > 12) {
151 $monthnext = sprintf(
'%02d', $monthnext);
152 $yearnext = sprintf(
'%04d', $yearnext);
154 $sql =
"SELECT date_format(b.datev,'%Y%m%d')";
155 $sql .=
", SUM(b.amount)";
156 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
157 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
158 $sql .=
" WHERE b.fk_account = ba.rowid";
159 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
160 $sql .=
" AND b.datev >= '".$db->escape($year).
"-".$db->escape($month).
"-01 00:00:00'";
161 $sql .=
" AND b.datev < '".$db->escape($yearnext).
"-".$db->escape($monthnext).
"-01 00:00:00'";
162 if ($account &&
GETPOST(
"option") !=
'all') {
163 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
165 $sql .=
" GROUP BY date_format(b.datev,'%Y%m%d')";
167 $resql = $db->query($sql);
169 $num = $db->num_rows($resql);
172 $row = $db->fetch_row($resql);
173 $amounts[$row[0]] = $row[1];
184 $sql =
"SELECT SUM(b.amount)";
185 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
186 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
187 $sql .=
" WHERE b.fk_account = ba.rowid";
188 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
189 $sql .=
" AND b.datev < '".$db->escape($year).
"-".sprintf(
"%02s", $month).
"-01'";
190 if ($account &&
GETPOST(
"option") !=
'all') {
191 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
194 $resql = $db->query($sql);
196 $row = $db->fetch_row($resql);
209 $day =
dol_mktime(12, 0, 0, (
int) $month, 1, (
int) $year);
212 $xyear = substr($textdate, 0, 4);
213 $xday = substr($textdate, 6, 2);
214 $xmonth = substr($textdate, 4, 2);
218 while ($xmonth == $month) {
219 $subtotal += (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
223 $datas[$i] = $solde + $subtotal;
225 $datamin[$i] =
$object->min_desired;
226 $dataall[$i] =
$object->min_allowed;
233 $xyear = substr($textdate, 0, 4);
234 $xday = substr($textdate, 6, 2);
235 $xmonth = substr($textdate, 4, 2);
247 $file =
$conf->bank->dir_temp.
"/balance".$account.
"-".$year.$month.
".png";
248 $fileurl = DOL_URL_ROOT.
'/viewimage.php?modulepart=banque_temp&file='.
"/balance".$account.
"-".$year.$month.
".png";
249 $title = $langs->transnoentities(
"Balance").
' - '.$langs->transnoentities(
"Month").
': '.$month.
' '.$langs->transnoentities(
"Year").
': '.$year;
250 $graph_datas = array();
251 foreach ($datas as $i => $val) {
252 $graph_datas[$i] = array(isset($labels[$i]) ? $labels[$i] :
'', $datas[$i]);
254 array_push($graph_datas[$i], $datamin[$i]);
257 array_push($graph_datas[$i], $dataall[$i]);
262 $px1->SetData($graph_datas);
263 $arraylegends = array($langs->transnoentities(
"Balance"));
265 array_push($arraylegends, $langs->transnoentities(
"BalanceMinimalDesired"));
268 array_push($arraylegends, $langs->transnoentities(
"BalanceMinimalAllowed"));
270 $px1->SetLegend($arraylegends);
271 $px1->SetLegendWidthMin(180);
272 $px1->SetMaxValue($px1->GetCeilMaxValue() < 0 ? 0 : $px1->GetCeilMaxValue());
273 $px1->SetMinValue($px1->GetFloorMinValue() > 0 ? 0 : $px1->GetFloorMinValue());
274 $px1->SetTitle($title);
275 $px1->SetWidth($WIDTH);
276 $px1->SetHeight($HEIGHT);
277 $px1->SetType(array(
'lines',
'lines',
'lines'));
278 $px1->setBgColor(
'onglet');
279 $px1->setBgColorGrid(array(255, 255, 255));
280 $px1->SetHorizTickIncrement(1);
281 $px1->draw($file, $fileurl);
283 $show1 = $px1->show();
296 if ($mode ==
'standard') {
299 $sql =
"SELECT date_format(b.datev,'%Y%m%d')";
300 $sql .=
", SUM(b.amount)";
301 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
302 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
303 $sql .=
" WHERE b.fk_account = ba.rowid";
304 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
305 $sql .=
" AND b.datev >= '".$db->escape($year).
"-01-01 00:00:00'";
306 $sql .=
" AND b.datev <= '".$db->escape($year).
"-12-31 23:59:59'";
307 if ($account &&
GETPOST(
"option") !=
'all') {
308 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
310 $sql .=
" GROUP BY date_format(b.datev,'%Y%m%d')";
312 $resql = $db->query($sql);
314 $num = $db->num_rows($resql);
317 $row = $db->fetch_row($resql);
318 $amounts[$row[0]] = $row[1];
329 $sql =
"SELECT SUM(b.amount)";
330 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
331 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
332 $sql .=
" WHERE b.fk_account = ba.rowid";
333 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
334 $sql .=
" AND b.datev < '".$db->escape($year).
"-01-01'";
335 if ($account &&
GETPOST(
"option") !=
'all') {
336 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
339 $resql = $db->query($sql);
341 $row = $db->fetch_row($resql);
356 $day =
dol_mktime(12, 0, 0, 1, 1, (
int) $year);
359 $xyear = substr($textdate, 0, 4);
360 $xday = substr($textdate, 6, 2);
363 while ($xyear == $year && $day <= $datetime) {
364 $subtotal += (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
368 $datas[$i] = $solde + $subtotal;
370 $datamin[$i] =
$object->min_desired;
371 $dataall[$i] =
$object->min_allowed;
380 $xyear = substr($textdate, 0, 4);
381 $xday = substr($textdate, 6, 2);
386 $file =
$conf->bank->dir_temp.
"/balance".$account.
"-".$year.
".png";
387 $fileurl = DOL_URL_ROOT.
'/viewimage.php?modulepart=banque_temp&file='.
"/balance".$account.
"-".$year.
".png";
388 $title = $langs->transnoentities(
"Balance").
' - '.$langs->transnoentities(
"Year").
': '.$year;
389 $graph_datas = array();
390 foreach ($datas as $i => $val) {
391 $graph_datas[$i] = array(isset($labels[$i]) ? $labels[$i] :
'', $datas[$i]);
393 array_push($graph_datas[$i], $datamin[$i]);
396 array_push($graph_datas[$i], $dataall[$i]);
400 $px2->SetData($graph_datas);
401 $arraylegends = array($langs->transnoentities(
"Balance"));
403 array_push($arraylegends, $langs->transnoentities(
"BalanceMinimalDesired"));
406 array_push($arraylegends, $langs->transnoentities(
"BalanceMinimalAllowed"));
408 $px2->SetLegend($arraylegends);
409 $px2->SetLegendWidthMin(180);
410 $px2->SetMaxValue($px2->GetCeilMaxValue() < 0 ? 0 : $px2->GetCeilMaxValue());
411 $px2->SetMinValue($px2->GetFloorMinValue() > 0 ? 0 : $px2->GetFloorMinValue());
412 $px2->SetTitle($title);
413 $px2->SetWidth($WIDTH);
414 $px2->SetHeight($HEIGHT);
415 $px2->SetType(array(
'linesnopoint',
'linesnopoint',
'linesnopoint'));
416 $px2->setBgColor(
'onglet');
417 $px2->setBgColorGrid(array(255, 255, 255));
418 $px2->SetHideXGrid(
true);
420 $px2->draw($file, $fileurl);
422 $show2 = $px2->show();
435 if ($mode ==
'showalltime') {
439 $sql =
"SELECT date_format(b.datev,'%Y%m%d')";
440 $sql .=
", SUM(b.amount)";
441 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
442 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
443 $sql .=
" WHERE b.fk_account = ba.rowid";
444 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
445 if ($account &&
GETPOST(
"option") !=
'all') {
446 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
448 $sql .=
" GROUP BY date_format(b.datev,'%Y%m%d')";
450 $resql = $db->query($sql);
452 $num = $db->num_rows($resql);
456 $row = $db->fetch_row($resql);
457 $amounts[$row[0]] = $row[1];
480 while ($day <= ($max + 86400)) {
481 $subtotal += (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
483 if ($day > ($max + 86400)) {
486 $datas[$i] = $solde + $subtotal;
488 $datamin[$i] =
$object->min_desired;
489 $dataall[$i] =
$object->min_allowed;
494 $labels[$i] = substr($textdate, 0, 6);
503 $file =
$conf->bank->dir_temp.
"/balance".$account.
".png";
504 $fileurl = DOL_URL_ROOT.
'/viewimage.php?modulepart=banque_temp&file='.
"/balance".$account.
".png";
505 $title = $langs->transnoentities(
"Balance").
" - ".$langs->transnoentities(
"AllTime");
506 $graph_datas = array();
507 foreach ($datas as $i => $val) {
508 $graph_datas[$i] = array(isset($labels[$i]) ? $labels[$i] :
'', $datas[$i]);
510 array_push($graph_datas[$i], $datamin[$i]);
513 array_push($graph_datas[$i], $dataall[$i]);
518 $px3->SetData($graph_datas);
519 $arraylegends = array($langs->transnoentities(
"Balance"));
521 array_push($arraylegends, $langs->transnoentities(
"BalanceMinimalDesired"));
524 array_push($arraylegends, $langs->transnoentities(
"BalanceMinimalAllowed"));
526 $px3->SetLegend($arraylegends);
527 $px3->SetLegendWidthMin(180);
528 $px3->SetMaxValue($px3->GetCeilMaxValue() < 0 ? 0 : $px3->GetCeilMaxValue());
529 $px3->SetMinValue($px3->GetFloorMinValue() > 0 ? 0 : $px3->GetFloorMinValue());
530 $px3->SetTitle($title);
531 $px3->SetWidth($WIDTH);
532 $px3->SetHeight($HEIGHT);
533 $px3->SetType(array(
'linesnopoint',
'linesnopoint',
'linesnopoint'));
534 $px3->setBgColor(
'onglet');
535 $px3->setBgColorGrid(array(255, 255, 255));
536 $px3->draw($file, $fileurl);
538 $show3 = $px3->show();
551 if ($mode ==
'standard') {
556 $monthnext = (int) $month + 1;
557 $yearnext = (int) $year;
558 if ($monthnext > 12) {
562 $monthnext = sprintf(
'%02d', $monthnext);
563 $yearnext = sprintf(
'%04d', $yearnext);
565 $sql =
"SELECT date_format(b.datev,'%d')";
566 $sql .=
", SUM(b.amount)";
567 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
568 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
569 $sql .=
" WHERE b.fk_account = ba.rowid";
570 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
571 $sql .=
" AND b.datev >= '".$db->escape($year).
"-".$db->escape($month).
"-01 00:00:00'";
572 $sql .=
" AND b.datev < '".$db->escape($yearnext).
"-".$db->escape($monthnext).
"-01 00:00:00'";
573 $sql .=
" AND b.amount > 0";
574 if ($account &&
GETPOST(
"option") !=
'all') {
575 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
577 $sql .=
" GROUP BY date_format(b.datev,'%d')";
579 $resql = $db->query($sql);
581 $num = $db->num_rows($resql);
584 $row = $db->fetch_row($resql);
585 $credits[$row[0]] = $row[1];
593 $monthnext = (int) $month + 1;
594 $yearnext = (int) $year;
595 if ($monthnext > 12) {
599 $monthnext = sprintf(
'%02d', $monthnext);
600 $yearnext = sprintf(
'%04d', $yearnext);
602 $sql =
"SELECT date_format(b.datev,'%d')";
603 $sql .=
", SUM(b.amount)";
604 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
605 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
606 $sql .=
" WHERE b.fk_account = ba.rowid";
607 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
608 $sql .=
" AND b.datev >= '".$db->escape($year).
"-".$db->escape($month).
"-01 00:00:00'";
609 $sql .=
" AND b.datev < '".$db->escape($yearnext).
"-".$db->escape($monthnext).
"-01 00:00:00'";
610 $sql .=
" AND b.amount < 0";
611 if ($account &&
GETPOST(
"option") !=
'all') {
612 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
614 $sql .=
" GROUP BY date_format(b.datev,'%d')";
616 $resql = $db->query($sql);
618 while ($row = $db->fetch_row($resql)) {
619 $debits[$row[0]] = abs($row[1]);
629 $data_credit = array();
630 $data_debit = array();
631 for ($i = 0; $i < 31; $i++) {
632 $data_credit[$i] = isset($credits[substr(
"0".($i + 1), -2)]) ? $credits[substr(
"0".($i + 1), -2)] : 0;
633 $data_debit[$i] = isset($debits[substr(
"0".($i + 1), -2)]) ? $debits[substr(
"0".($i + 1), -2)] : 0;
634 $labels[$i] = sprintf(
"%02d", $i + 1);
635 $datamin[$i] =
$object->min_desired;
639 $file =
$conf->bank->dir_temp.
"/movement".$account.
"-".$year.$month.
".png";
640 $fileurl = DOL_URL_ROOT.
'/viewimage.php?modulepart=banque_temp&file='.
"/movement".$account.
"-".$year.$month.
".png";
641 $title = $langs->transnoentities(
"BankMovements").
' - '.$langs->transnoentities(
"Month").
': '.$month.
' '.$langs->transnoentities(
"Year").
': '.$year;
642 $graph_datas = array();
643 foreach ($data_credit as $i => $val) {
644 $graph_datas[$i] = array($labels[$i], $data_credit[$i], $data_debit[$i]);
647 $px4->SetData($graph_datas);
648 $px4->SetLegend(array($langs->transnoentities(
"Credit"), $langs->transnoentities(
"Debit")));
649 $px4->SetLegendWidthMin(180);
650 $px4->SetMaxValue($px4->GetCeilMaxValue() < 0 ? 0 : $px4->GetCeilMaxValue());
651 $px4->SetMinValue($px4->GetFloorMinValue() > 0 ? 0 : $px4->GetFloorMinValue());
652 $px4->SetTitle($title);
653 $px4->SetWidth($WIDTH);
654 $px4->SetHeight($HEIGHT);
655 $px4->SetType(array(
'bars',
'bars'));
657 $px4->setBgColor(
'onglet');
658 $px4->setBgColorGrid(array(255, 255, 255));
659 $px4->SetHorizTickIncrement(1);
660 $px4->draw($file, $fileurl);
662 $show4 = $px4->show();
672 if ($mode ==
'standard') {
676 $sql =
"SELECT date_format(b.datev,'%m')";
677 $sql .=
", SUM(b.amount)";
678 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
679 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
680 $sql .=
" WHERE b.fk_account = ba.rowid";
681 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
682 $sql .=
" AND b.datev >= '".$db->escape($year).
"-01-01 00:00:00'";
683 $sql .=
" AND b.datev <= '".$db->escape($year).
"-12-31 23:59:59'";
684 $sql .=
" AND b.amount > 0";
685 if ($account &&
GETPOST(
"option") !=
'all') {
686 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
688 $sql .=
" GROUP BY date_format(b.datev,'%m');";
690 $resql = $db->query($sql);
692 $num = $db->num_rows($resql);
695 $row = $db->fetch_row($resql);
696 $credits[$row[0]] = $row[1];
703 $sql =
"SELECT date_format(b.datev,'%m')";
704 $sql .=
", SUM(b.amount)";
705 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank as b";
706 $sql .=
", ".MAIN_DB_PREFIX.
"bank_account as ba";
707 $sql .=
" WHERE b.fk_account = ba.rowid";
708 $sql .=
" AND ba.entity IN (".getEntity(
'bank_account').
")";
709 $sql .=
" AND b.datev >= '".$db->escape($year).
"-01-01 00:00:00'";
710 $sql .=
" AND b.datev <= '".$db->escape($year).
"-12-31 23:59:59'";
711 $sql .=
" AND b.amount < 0";
712 if ($account &&
GETPOST(
"option") !=
'all') {
713 $sql .=
" AND b.fk_account IN (".$db->sanitize($account).
")";
715 $sql .=
" GROUP BY date_format(b.datev,'%m')";
717 $resql = $db->query($sql);
719 while ($row = $db->fetch_row($resql)) {
720 $debits[$row[0]] = abs($row[1]);
730 $data_credit = array();
731 $data_debit = array();
732 for ($i = 0; $i < 12; $i++) {
733 $data_credit[$i] = isset($credits[substr(
"0".($i + 1), -2)]) ? $credits[substr(
"0".($i + 1), -2)] : 0;
734 $data_debit[$i] = isset($debits[substr(
"0".($i + 1), -2)]) ? $debits[substr(
"0".($i + 1), -2)] : 0;
736 $datamin[$i] =
$object->min_desired;
740 $file =
$conf->bank->dir_temp.
"/movement".$account.
"-".$year.
".png";
741 $fileurl = DOL_URL_ROOT.
'/viewimage.php?modulepart=banque_temp&file='.
"/movement".$account.
"-".$year.
".png";
742 $title = $langs->transnoentities(
"BankMovements").
' - '.$langs->transnoentities(
"Year").
': '.$year;
743 $graph_datas = array();
744 foreach ($data_credit as $i => $val) {
745 $graph_datas[$i] = array($labels[$i], $data_credit[$i], $data_debit[$i]);
748 $px5->SetData($graph_datas);
749 $px5->SetLegend(array($langs->transnoentities(
"Credit"), $langs->transnoentities(
"Debit")));
750 $px5->SetLegendWidthMin(180);
751 $px5->SetMaxValue($px5->GetCeilMaxValue() < 0 ? 0 : $px5->GetCeilMaxValue());
752 $px5->SetMinValue($px5->GetFloorMinValue() > 0 ? 0 : $px5->GetFloorMinValue());
753 $px5->SetTitle($title);
754 $px5->SetWidth($WIDTH);
755 $px5->SetHeight($HEIGHT);
756 $px5->SetType(array(
'bars',
'bars'));
758 $px5->setBgColor(
'onglet');
759 $px5->setBgColorGrid(array(255, 255, 255));
760 $px5->SetHorizTickIncrement(1);
761 $px5->draw($file, $fileurl);
763 $show5 = $px5->show();
775print
dol_get_fiche_head($head,
'graph', $langs->trans(
"FinancialAccount"), 0,
'account');
778$linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
781 if (!preg_match(
'/,/', $account)) {
782 $moreparam =
'&month='.$month.
'&year='.$year.($mode ==
'showalltime' ?
'&mode=showalltime' :
'');
784 if (
GETPOST(
"option") !=
'all') {
785 $morehtml =
'<a href="'.$_SERVER[
"PHP_SELF"].
'?account='.$account.
'&option=all'.$moreparam.
'">'.$langs->trans(
"ShowAllAccounts").
'</a>';
786 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref',
'', $moreparam, 0,
'',
'', 1);
788 $morehtml =
'<a href="'.$_SERVER[
"PHP_SELF"].
'?account='.$account.$moreparam.
'">'.$langs->trans(
"BackToAccount").
'</a>';
789 print $langs->trans(
"AllAccounts");
793 $bankaccount =
new Account($db);
794 $listid = explode(
',', $account);
795 foreach ($listid as $key =>
$id) {
796 $bankaccount->fetch(
$id);
797 $bankaccount->label = $bankaccount->ref;
798 print $bankaccount->getNomUrl(1);
799 if ($key < (count($listid) - 1)) {
805 print $langs->trans(
"AllAccounts");
811print
'<table class="notopnoleftnoright" width="100%">';
814print
'<tr><td class="right">'.$morehtml.
' ';
815if ($mode ==
'showalltime') {
816 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?account='.$account.(GETPOST(
"option") !=
'all' ?
'' :
'&option=all').
'">';
817 print $langs->trans(
"GoBack");
820 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?mode=showalltime&account='.$account.(GETPOST(
"option") !=
'all' ?
'' :
'&option=all').
'">';
821 print $langs->trans(
"ShowAllTimeBalance");
824print
'<br><br></td></tr>';
830if ($mode ==
'standard') {
831 $prevyear = (int) $year;
832 $nextyear = (int) $year;
833 $prevmonth = (int) $month - 1;
834 $nextmonth = (int) $month + 1;
835 if ($prevmonth < 1) {
839 if ($nextmonth > 12) {
843 $nextmonth = sprintf(
'%02d', $nextmonth);
844 $prevmonth = sprintf(
'%02d', $prevmonth);
845 $nextyear = sprintf(
'%04d', $nextyear);
846 $prevyear = sprintf(
'%04d', $prevyear);
849 $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>";
850 print
'<div class="right clearboth">'.$link.
'</div>';
852 print
'<div class="center clearboth margintoponly">';
853 $file =
"movement".$account.
"-".$year.$month.
".png";
857 print
'<div class="center clearboth margintoponly">';
862 $prevyear = (int) $year - 1;
863 $nextyear = (int) $year + 1;
864 $nextyear = sprintf(
'%04d', $nextyear);
865 $prevyear = sprintf(
'%04d', $prevyear);
866 $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>";
868 print
'<div class="right clearboth margintoponly">'.$link.
'</div>';
870 print
'<div class="center clearboth margintoponly">';
874 print
'<div class="center clearboth margintoponly">';
879if ($mode ==
'showalltime') {
880 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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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.
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)
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.