Ejemplo n.º 1
0
$nowyear = strftime("%Y", dol_now());
$year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear;
//$startyear=$year-2;
$startyear = $year - 1;
$endyear = $year;
$mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
/*
 * View
 */
$form = new Form($db);
llxHeader();
$title = $langs->trans("TripsAndExpensesStatistics");
$dir = $conf->deplacement->dir_temp;
print_fiche_titre($title, $mesg);
dol_mkdir($dir);
$stats = new DeplacementStats($db, $socid, $userid);
// Build graphic number of object
// $data = array(array('Lib',val1,val2,val3),...)
//print "$endyear, $startyear";
$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
//var_dump($data);
$filenamenb = $dir . "/tripsexpensesnbinyear-" . $year . ".png";
$fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesnbinyear-' . $year . '.png';
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
if (!$mesg) {
    $px1->SetData($data);
    $px1->SetPrecisionY(0);
    $i = $startyear;
    $legend = array();
    while ($i <= $endyear) {
Ejemplo n.º 2
0
 * View
 */

llxHeader();

$title=$langs->trans("TripsAndExpensesStatistics");
$dir=$conf->deplacement->dir_temp;

$mesg = '<a href="month.php?year='.($year - 1).'&amp;mode='.$mode.'">'.img_previous().'</a> ';
$mesg.= $langs->trans("Year")." $year";
$mesg.= ' <a href="month.php?year='.($year + 1).'&amp;mode='.$mode.'">'.img_next().'</a>';
print_fiche_titre($title, $mesg);

create_exdir($dir);

$stats = new DeplacementStats($db, $socid);


$data = $stats->getNbByMonth($year);

$filename = $dir."/tripsexpensesnb-".$year.".png";
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesnb-'.$year.'.png';

$px = new DolGraph();
$mesg = $px->isGraphKo();
if (! $mesg)
{
    $px->SetData($data);
    $px->SetMaxValue($px->GetCeilMaxValue());
    $px->SetMinValue($px->GetFloorMinValue());
    $px->SetWidth($GRAPHWIDTH);