Simplification de la couche generant les graphs. Tous les graphs passent par la classe DolGraph.

C'est cette classe qui doit ensuite s'appuier directement sur PHPlot ou une autre librairie graphique libre.
Qual: La génération des soldes ne fait plus exception ce qui permet de ne plus dépendre de jpgraph qui
n'est pas libre.
This commit is contained in:
Laurent Destailleur 2006-08-13 15:20:25 +00:00
parent 52f1b358a3
commit 6523f56aa8
10 changed files with 68 additions and 56 deletions

View File

@ -193,13 +193,16 @@ if ($account > 0)
} }
$titre=$langs->trans("FinancialAccount")." : ".$acct->label;
print_fiche_titre($titre,$mesg);
// Onglets // Onglets
$head=bank_prepare_head($acct); $head=bank_prepare_head($acct);
dolibarr_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0); dolibarr_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0);
if (! $_GET["action"]=='addline')
{
$titre=$langs->trans("FinancialAccount")." : ".$acct->label;
print_fiche_titre($titre,$mesg);
}
print '<table class="notopnoleftnoright" width="100%">'; print '<table class="notopnoleftnoright" width="100%">';
/* /*
@ -217,8 +220,6 @@ if ($account > 0)
print '<input type="hidden" name="vline" value="' . $vline . '">'; print '<input type="hidden" name="vline" value="' . $vline . '">';
print '<input type="hidden" name="account" value="' . $acct->id . '">'; print '<input type="hidden" name="account" value="' . $acct->id . '">';
print "<tr class=\"noborder\"><td colspan=\"8\">&nbsp;</td></tr>\n";
print '<tr>'; print '<tr>';
print '<td align="left" colspan="8"><b>'.$langs->trans("AddBankRecordLong").'</b></td>'; print '<td align="left" colspan="8"><b>'.$langs->trans("AddBankRecordLong").'</b></td>';
print '</tr>'; print '</tr>';

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) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 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
@ -18,14 +18,13 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
/** /**
\file htdocs/compta/bank/annuel.php \file htdocs/compta/bank/annuel.php
\ingroup banque \ingroup banque
\brief Page reporting mensuel Entrées/Sorties d'un compte bancaire \brief Page reporting mensuel Entrées/Sorties d'un compte bancaire
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -109,14 +108,14 @@ else
} }
$title=$langs->trans("FinancialAccount")." : ".$acct->label;
$lien=($year_start?"<a href='annuel.php?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> <a href='annuel.php?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
print_fiche_titre($title,$lien);
// Onglets // Onglets
$head=bank_prepare_head($acct); $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;
$lien=($year_start?"<a href='annuel.php?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> <a href='annuel.php?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
print_fiche_titre($title,$lien);
// Affiche tableau // Affiche tableau
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';

View File

@ -104,9 +104,6 @@ $form = new Form($db);
/* /*
* Affichage onglets * Affichage onglets
*/ */
$titre=$langs->trans("FinancialAccount")." : ".$account->label;
print_fiche_titre($titre,$mesg);
// Onglets // Onglets
$head=bank_prepare_head($account); $head=bank_prepare_head($account);
dolibarr_fiche_head($head, 'bankid', $langs->trans("FinancialAccount")); dolibarr_fiche_head($head, 'bankid', $langs->trans("FinancialAccount"));

View File

@ -258,8 +258,6 @@ else
/* /*
* Affichage onglets * Affichage onglets
*/ */
$titre=$langs->trans("FinancialAccount")." : ".$account->label;
print_fiche_titre($titre,$mesg);
// Onglets // Onglets
$head=bank_prepare_head($account); $head=bank_prepare_head($account);

View File

@ -158,6 +158,7 @@ if ($account > 0)
$px->SetWidth($width); $px->SetWidth($width);
$px->SetHeight($height); $px->SetHeight($height);
$px->SetType('lines'); $px->SetType('lines');
$px->setBgColor('onglet');
$px->draw($file); $px->draw($file);
@ -248,6 +249,7 @@ if ($account > 0)
$px->SetWidth($width); $px->SetWidth($width);
$px->SetHeight($height); $px->SetHeight($height);
$px->SetType('lines'); $px->SetType('lines');
$px->setBgColor('onglet');
$px->draw($file); $px->draw($file);
@ -322,6 +324,7 @@ if ($account > 0)
$px->SetWidth($width); $px->SetWidth($width);
$px->SetHeight($height); $px->SetHeight($height);
$px->SetType('lines'); $px->SetType('lines');
$px->setBgColor('onglet');
$px->draw($file); $px->draw($file);
@ -398,12 +401,9 @@ if ($account > 0)
$px->SetHeight($height); $px->SetHeight($height);
$px->SetType('bars'); $px->SetType('bars');
$px->SetShading(8); $px->SetShading(8);
$px->setBgColor('onglet');
$px->draw($file); $px->draw($file);
$titre=$langs->trans("FinancialAccount")." : ".$acct->label;
print_fiche_titre($titre,$mesg);
// 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);

View File

@ -87,13 +87,13 @@ if (! isset($_GET["num"]))
$numrows = $db->num_rows($result); $numrows = $db->num_rows($result);
$i = 0; $i = 0;
$titre=$langs->trans("FinancialAccount")." : ".$acct->label;
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], "&amp;account=".$_GET["account"], $sortfield, $sortorder,'',$numrows);
// Onglets // Onglets
$head=bank_prepare_head($acct); $head=bank_prepare_head($acct);
dolibarr_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0); dolibarr_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0);
$titre=$langs->trans("FinancialAccount")." : ".$acct->label;
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], "&amp;account=".$_GET["account"], $sortfield, $sortorder,'',$numrows);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print '<td>'.$langs->trans("AccountStatement").'</td></tr>'; print '<td>'.$langs->trans("AccountStatement").'</td></tr>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2004 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2004-2006 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
@ -18,7 +18,6 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
/** /**
@ -34,10 +33,7 @@ require_once(DOL_DOCUMENT_ROOT."/dolgraph.class.php");
$WIDTH=500; $WIDTH=500;
$HEIGHT=250; $HEIGHT=250;
// Sécurité accés client
/*
* Sécurité accés client
*/
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
@ -67,6 +63,7 @@ if (! $mesg)
$px->SetLegend(array($year - 1, $year)); $px->SetLegend(array($year - 1, $year));
$px->SetWidth($WIDTH); $px->SetWidth($WIDTH);
$px->SetHeight($HEIGHT); $px->SetHeight($HEIGHT);
$px->SetShading(4);
$px->draw($filename); $px->draw($filename);
} }
@ -76,7 +73,7 @@ if ($socidp)
$sql .= " AND fk_soc = $socidp"; $sql .= " AND fk_soc = $socidp";
} }
$sql .= " GROUP BY dm DESC "; $sql .= " GROUP BY dm DESC ";
$result=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
@ -104,7 +101,7 @@ if ($resql)
} }
else else
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }

View File

@ -63,6 +63,7 @@ class DolGraph
function DolGraph() function DolGraph()
{ {
global $conf; global $conf;
global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet;
// Test si module GD présent // Test si module GD présent
$modules_list = get_loaded_extensions(); $modules_list = get_loaded_extensions();
@ -92,12 +93,12 @@ class DolGraph
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php"; $color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
if (is_readable($color_file)) if (is_readable($color_file))
{ {
include($color_file); include_once($color_file);
if (isset($theme_bordercolor)) $this->bordercolor = $theme_bordercolor; if (isset($theme_bordercolor)) $this->bordercolor = $theme_bordercolor;
if (isset($theme_datacolor)) $this->datacolor = $theme_datacolor; if (isset($theme_datacolor)) $this->datacolor = $theme_datacolor;
if (isset($theme_bgcolor)) $this->bgcolor = $theme_bgcolor; if (isset($theme_bgcolor)) $this->bgcolor = $theme_bgcolor;
} }
//print 'bgcolor: '.join(',',$this->bgcolor).'<br>';
return 1; return 1;
} }
@ -161,12 +162,26 @@ class DolGraph
$this->graph->SetPrecisionX(0); $this->graph->SetPrecisionX(0);
// Set areas // Set areas
$this->graph->SetNewPlotAreaPixels(80, 40, $this->width-10, $this->height-40); $left_space=80; // For y labels
$right_space=10; // If no legend
if (isset($this->Legend)) $right_space=70; // For legend
$this->graph->SetNewPlotAreaPixels($left_space, 40, $this->width-$right_space, $this->height-40);
if (isset($this->MaxValue)) if (isset($this->MaxValue))
{ {
$this->graph->SetPlotAreaWorld(0,$this->MinValue,sizeof($this->data),$this->MaxValue); $this->graph->SetPlotAreaWorld(0,$this->MinValue,sizeof($this->data),$this->MaxValue);
} }
// Define title
if (strlen($this->title)) $this->graph->SetTitle($this->title);
// Défini position du graphe (et legende) au sein de l'image
if (isset($this->Legend))
{
$this->graph->SetLegendPixels($this->width-$right_space+8,40,'');
$this->graph->SetLegend($this->Legend);
}
if (isset($this->SetShading)) if (isset($this->SetShading))
{ {
$this->graph->SetShading($this->SetShading); $this->graph->SetShading($this->SetShading);
@ -187,19 +202,6 @@ class DolGraph
$this->graph->SetPlotBorderType("left"); // Affiche axe y a gauche uniquement $this->graph->SetPlotBorderType("left"); // Affiche axe y a gauche uniquement
$this->graph->SetVertTickPosition('plotleft'); // Affiche tick axe y a gauche uniquement $this->graph->SetVertTickPosition('plotleft'); // Affiche tick axe y a gauche uniquement
// Define title
if (strlen($this->title)) $this->graph->SetTitle($this->title);
// Défini position du graphe (et legende) au sein de l'image
if (isset($this->Legend))
{
$this->graph->SetLegend($this->Legend);
}
$this->graph->SetOutputFile($file); $this->graph->SetOutputFile($file);
} }
@ -264,9 +266,29 @@ class DolGraph
unset($this->bgcolor); unset($this->bgcolor);
} }
/**
* \brief Definie la couleur de fond du graphique
* \param bg_color array(R,G,B) ou 'onglet' ou 'default'
*/
function SetBgColor($bg_color = array(255,255,255)) function SetBgColor($bg_color = array(255,255,255))
{ {
$this->bgcolor = $bg_color; global $theme_bgcolor,$theme_bgcoloronglet;
if (! is_array($bg_color))
{
if ($bg_color == 'onglet')
{
//print 'ee'.join(',',$theme_bgcoloronglet);
$this->bgcolor = $theme_bgcoloronglet;
}
else
{
$this->bgcolor = $theme_bgcolor;
}
}
else
{
$this->bgcolor = $bg_color;
}
} }
function ResetDataColor() function ResetDataColor()

View File

@ -1623,7 +1623,6 @@ class Facture extends CommonObject
return $langs->trans('Bill'.$prefix.'StatusPayed').' '.img_picto($langs->trans('BillStatusPayed'),'statut6'); return $langs->trans('Bill'.$prefix.'StatusPayed').' '.img_picto($langs->trans('BillStatusPayed'),'statut6');
} }
} }
} }
/** /**

View File

@ -118,9 +118,9 @@ if ($socidp > 0)
print "<input type=\"hidden\" name=\"action\" value=\"add\">"; print "<input type=\"hidden\" name=\"action\" value=\"add\">";
print "<input type=\"hidden\" name=\"socid\" value=\"".$societe->id."\">"; print "<input type=\"hidden\" name=\"socid\" value=\"".$societe->id."\">";
// éditeur wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_SOCIETE) if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_SOCIETE)
{ {
// Editeur wysiwyg
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('note',$societe->note,280,'dolibarr_notes','In',true); $doleditor=new DolEditor('note',$societe->note,280,'dolibarr_notes','In',true);
$doleditor->Create(); $doleditor->Create();
@ -129,7 +129,6 @@ if ($socidp > 0)
{ {
print '<textarea name="note" cols="70" rows="10">'.$societe->note.'</textarea>'; print '<textarea name="note" cols="70" rows="10">'.$societe->note.'</textarea>';
} }
} }
else else
{ {