diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 512f32645b9..fc04a6ff987 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -22,7 +22,7 @@ * \ingroup banque * \brief Page reporting mensuel Entr�es/Sorties d'un compte bancaire * \version $Id$ -*/ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); @@ -33,18 +33,18 @@ $year_start=isset($_GET["year_start"])?$_GET["year_start"]:$_POST["year_start"]; $year_current = strftime("%Y",time()); if (! $year_start) { - $year_start = $year_current - 2; - $year_end = $year_current; + $year_start = $year_current - 2; + $year_end = $year_current; } else { - $year_end=$year_start+2; + $year_end=$year_start+2; } // S�curit� acc�s client -if ($user->societe_id > 0) +if ($user->societe_id > 0) { - $socid = $user->societe_id; + $socid = $user->societe_id; } @@ -55,11 +55,11 @@ $form = new Form($db); // R�cup�re info du compte $acct = new Account($db); -if ($_GET["account"]) +if ($_GET["account"]) { $result=$acct->fetch($_GET["account"]); } -if ($_GET["ref"]) +if ($_GET["ref"]) { $result=$acct->fetch(0,$_GET["ref"]); $_GET["account"]=$acct->id; @@ -120,7 +120,7 @@ $head=bank_prepare_head($acct); dolibarr_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0); $title=$langs->trans("FinancialAccount")." : ".$acct->label; -$lien=($year_start?"".img_previous()." ".$langs->trans("Year")." ".img_next()."":""); +$lien=($year_start?"".img_previous()." ".$langs->trans("Year")." ".img_next()."":""); print ''; @@ -145,50 +145,50 @@ print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print ''; + print ''; } print ''; print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) -{ - print ''; +{ + print ''; } print ''; $var=true; for ($mois = 1 ; $mois < 13 ; $mois++) { - $var=!$var; - print ''; - print ""; - for ($annee = $year_start ; $annee <= $year_end ; $annee++) - { - $case = sprintf("%04s-%02s",$annee,$mois); - - print '"; + $var=!$var; + print ''; + print ""; + for ($annee = $year_start ; $annee <= $year_end ; $annee++) + { + $case = sprintf("%04s-%02s",$annee,$mois); + + print '"; - print '"; - } - print ''; + print '"; + } + print ''; } // Total debit-credit print '"; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print ''; + print ''; } print "\n"; @@ -197,7 +197,7 @@ print ''; $nbcol=0; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - $nbcol+=2; + $nbcol+=2; } print "\n"; @@ -209,11 +209,11 @@ if ($_GET["account"]) { $sql .= " WHERE fk_account = ".$_GET["account"]; } $resql=$db->query($sql); if ($resql) { - $obj = $db->fetch_object($resql); - if ($obj) $balance=$obj->total; + $obj = $db->fetch_object($resql); + if ($obj) $balance=$obj->total; } else { - dolibarr_print_error($db); + dolibarr_print_error($db); } print '"; print ''; diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index c213bc793d5..a7650a6715b 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2007 Laurent Destailleur + * Copyright (C) 2006-2009 Laurent Destailleur * * 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 @@ -187,7 +187,13 @@ if ($_GET["account"] || $_GET["ref"]) $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 $file= $conf->banque->dir_temp."/balance".$account."-".$year.$month.".png"; $title=$langs->transnoentities("Balance").' - '.$langs->transnoentities("Month").': '.$month.' '.$langs->transnoentities("Year").': '.$year; @@ -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]); else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]); } + $px = new DolGraph(); $px->SetData($graph_datas); if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired"))); @@ -212,8 +219,8 @@ if ($_GET["account"] || $_GET["ref"]) $px->setBgColorGrid(array(255,255,255)); $px->SetHorizTickIncrement(1); $px->SetPrecisionY(0); - $px->draw($file); - + $px->draw($file); + unset($graph_datas); unset($px); unset($datas); @@ -636,6 +643,7 @@ if ($_GET["account"] || $_GET["ref"]) } } + // Onglets $head=bank_prepare_head($acct); dolibarr_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0); @@ -647,7 +655,8 @@ if ($_GET["account"] || $_GET["ref"]) // Ref print ''; print ''; // Label @@ -663,6 +672,15 @@ if ($_GET["account"] || $_GET["ref"]) 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="".img_previous()." ".$langs->trans("Month")." ".img_next().""; + print ''; + print ''; + // For year + $prevyear=$year-1;$nextyear=$year+1; + $lien="".img_previous()." ".$langs->trans("Year")." ".img_next().""; + print ''; + print ''; - - print ''; } - - // All time + if ($mode == 'showalltime') { print ''; - + } + + // Switch All time/Not all time + if ($mode == 'showalltime') + { print ''; } - - print '
'.$langs->trans("Month").''.$annee.''.$annee.'
'.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Debit").''.$langs->trans("Credit").'
".dolibarr_print_date(dolibarr_mktime(1,1,1,$mois,1,2000),"%B")." '; - if ($decaiss[$case]>0) - { - print price($decaiss[$case]); - $totsorties[$annee]+=$decaiss[$case]; - } - print "
".dolibarr_print_date(dolibarr_mktime(1,1,1,$mois,1,2000),"%B")." '; + if ($decaiss[$case]>0) + { + print price($decaiss[$case]); + $totsorties[$annee]+=$decaiss[$case]; + } + print " '; - if ($encaiss[$case]>0) - { - print price($encaiss[$case]); - $totentrees[$annee]+=$encaiss[$case]; - } - print "
 '; + if ($encaiss[$case]>0) + { + print price($encaiss[$case]); + $totentrees[$annee]+=$encaiss[$case]; + } + print "
'.$langs->trans("Total")."'.price($totsorties[$annee]).''.price($totentrees[$annee]).''.price($totsorties[$annee]).''.price($totentrees[$annee]).'
 
'.$langs->trans("CurrentBalance")."'.price($balance).'
'.$langs->trans("Ref").''; - 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 '
'.$lien.'
'; $file = "movement".$account."-".$year.$month.".png"; print ''; @@ -672,6 +690,11 @@ if ($_GET["account"] || $_GET["ref"]) print ''; print '
'.$lien.'
'; $file = "movement".$account."-".$year.".png"; print ''; @@ -681,30 +704,35 @@ if ($_GET["account"] || $_GET["ref"]) $file = "balance".$account."-".$year.".png"; print ''; print '

'; - print ''; - print $langs->trans("ShowAllTimeBalance"); - print ''; - print '
'; $file = "balance".$account.".png"; print ''; print '

'; print ''; print $langs->trans("GoBack"); print ''; print '
'; + else + { + print '
'; + print ''; + print $langs->trans("ShowAllTimeBalance"); + print ''; + print ''; + } + + print ''; print "\n\n";