Add navigation on month/year on bank report

This commit is contained in:
Laurent Destailleur 2009-01-01 16:43:11 +00:00
parent a5a65a1a52
commit 1b6598493a
2 changed files with 84 additions and 56 deletions

View File

@ -22,7 +22,7 @@
* \ingroup banque * \ingroup banque
* \brief Page reporting mensuel Entr<EFBFBD>es/Sorties d'un compte bancaire * \brief Page reporting mensuel Entr<EFBFBD>es/Sorties d'un compte bancaire
* \version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php");
@ -120,7 +120,7 @@ $head=bank_prepare_head($acct);
dolibarr_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0); dolibarr_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0);
$title=$langs->trans("FinancialAccount")." : ".$acct->label; $title=$langs->trans("FinancialAccount")." : ".$acct->label;
$lien=($year_start?"<a href='annuel.php?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='annuel.php?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":""); $lien=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -187,6 +187,12 @@ if ($_GET["account"] || $_GET["ref"])
$i++; $i++;
} }
// If we are the first of month, only $datas[0] is defined to an int value, others are defined to ""
// and this make artichow report a warning.
//$datas[0]=100; KO
//$datas[0]=100; $datas[1]=90; OK
//var_dump($datas);
//exit;
// Fabrication tableau 1 // Fabrication tableau 1
$file= $conf->banque->dir_temp."/balance".$account."-".$year.$month.".png"; $file= $conf->banque->dir_temp."/balance".$account."-".$year.$month.".png";
@ -197,6 +203,7 @@ if ($_GET["account"] || $_GET["ref"])
if ($acct->min_desired) $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i],$datamin[$i]); if ($acct->min_desired) $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i],$datamin[$i]);
else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
} }
$px = new DolGraph(); $px = new DolGraph();
$px->SetData($graph_datas); $px->SetData($graph_datas);
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired"))); if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
@ -636,6 +643,7 @@ if ($_GET["account"] || $_GET["ref"])
} }
} }
// Onglets // Onglets
$head=bank_prepare_head($acct); $head=bank_prepare_head($acct);
dolibarr_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0); dolibarr_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0);
@ -647,7 +655,8 @@ if ($_GET["account"] || $_GET["ref"])
// Ref // Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>'; print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($acct,'ref','',1,'ref'); $moreparam='&month='.$month.'&year='.$year.($mode=='showalltime'?'&mode=showalltime':'');
print $form->showrefnav($acct,'ref','',1,'ref','ref','',$moreparam);
print '</td></tr>'; print '</td></tr>';
// Label // Label
@ -663,6 +672,15 @@ if ($_GET["account"] || $_GET["ref"])
if ($mode == 'standard') if ($mode == 'standard')
{ {
$prevyear=$year;$nextyear=$year;
$prevmonth=$month-1;$nextmonth=$month+1;
if ($prevmonth < 1) { $prevmonth=12; $prevyear--; }
if ($nextmonth > 12) { $nextmonth=1; $nextyear++; }
// For month
$lien="<a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year=".$prevyear."&month=".$prevmonth."'>".img_previous()."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year=".$nextyear."&month=".$nextmonth."'>".img_next()."</a>";
print '<tr><td align="right">'.$lien.'</td></tr>';
print '<tr><td align="center">'; print '<tr><td align="center">';
$file = "movement".$account."-".$year.$month.".png"; $file = "movement".$account."-".$year.$month.".png";
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">'; print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
@ -672,6 +690,11 @@ if ($_GET["account"] || $_GET["ref"])
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">'; print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
print '</td></tr>'; print '</td></tr>';
// For year
$prevyear=$year-1;$nextyear=$year+1;
$lien="<a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year=".($prevyear)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$acct->id."&year=".($nextyear)."'>".img_next()."</a>";
print '<tr><td align="right">'.$lien.'</td></tr>';
print '<tr><td align="center">'; print '<tr><td align="center">';
$file = "movement".$account."-".$year.".png"; $file = "movement".$account."-".$year.".png";
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">'; print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
@ -681,28 +704,33 @@ if ($_GET["account"] || $_GET["ref"])
$file = "balance".$account."-".$year.".png"; $file = "balance".$account."-".$year.".png";
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">'; print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
print '</td></tr>'; print '</td></tr>';
print '<tr><td align="center"><br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=showalltime&account='.$account.'">';
print $langs->trans("ShowAllTimeBalance");
print '</a>';
print '</td></tr>';
} }
// All time
if ($mode == 'showalltime') if ($mode == 'showalltime')
{ {
print '<tr><td align="center">'; print '<tr><td align="center">';
$file = "balance".$account.".png"; $file = "balance".$account.".png";
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">'; print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=bank&file='.$file.'" alt="" title="">';
print '</td></tr>'; print '</td></tr>';
}
// Switch All time/Not all time
if ($mode == 'showalltime')
{
print '<tr><td align="center"><br>'; print '<tr><td align="center"><br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.'">';
print $langs->trans("GoBack"); print $langs->trans("GoBack");
print '</a>'; print '</a>';
print '</td></tr>'; print '</td></tr>';
} }
else
{
print '<tr><td align="center"><br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=showalltime&account='.$account.'">';
print $langs->trans("ShowAllTimeBalance");
print '</a>';
print '</td></tr>';
}
print '</table>'; print '</table>';