Esempio n. 1
0
 *    \ingroup    commande
 *    \brief      Page des stats expeditions par mois
 */
require "../../main.inc.php";
require_once DOL_DOCUMENT_ROOT . "/expedition/class/expedition.class.php";
require_once DOL_DOCUMENT_ROOT . "/expedition/class/expeditionstats.class.php";
require_once DOL_DOCUMENT_ROOT . "/core/class/dolgraph.class.php";
/*
 * View
 */
llxHeader();
$WIDTH = 500;
$HEIGHT = 200;
$mesg = '';
print_fiche_titre($langs->trans("StatisticsOfSendings") . ' ' . $_GET["year"], $mesg);
$stats = new ExpeditionStats($db);
$data = $stats->getNbExpeditionByMonth($_GET["year"]);
dol_mkdir($conf->expedition->dir_temp);
$filename = $conf->expedition->dir_temp . "/expedition" . $year . ".png";
$fileurl = DOL_URL_ROOT . '/viewimage.php?modulepart=expeditionstats&file=expedition' . $year . '.png';
$px = new DolGraph();
$mesg = $px->isGraphKo();
if (!$mesg) {
    $px->SetData($data);
    $px->SetMaxValue($px->GetCeilMaxValue());
    $px->SetWidth($WIDTH);
    $px->SetHeight($HEIGHT);
    $px->SetYLabel($langs->trans("NbOfOrders"));
    $px->SetShading(3);
    $px->SetHorizTickIncrement(1);
    $px->SetPrecisionY(0);
Esempio n. 2
0
$nowyear = strftime("%Y", dol_now());
$year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear;
//$startyear=$year-2;
$startyear = $year - 1;
$endyear = $year;
$langs->load("sendings");
$langs->load("other");
$langs->load("companies");
/*
 * View
 */
$form = new Form($db);
llxHeader();
print load_fiche_titre($langs->trans("StatisticsOfSendings"), $mesg);
dol_mkdir($dir);
$stats = new ExpeditionStats($db, $socid, $mode, $userid > 0 ? $userid : 0);
// Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
//var_dump($data);exit;
// $data = array(array('Lib',val1,val2,val3),...)
if (!$user->rights->societe->client->voir || $user->societe_id) {
    $filenamenb = $dir . '/shipmentsnbinyear-' . $user->id . '-' . $year . '.png';
    if ($mode == 'customer') {
        $fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=shipmentstats&file=shipmentsnbinyear-' . $user->id . '-' . $year . '.png';
    }
    if ($mode == 'supplier') {
        $fileurlnb = DOL_URL_ROOT . '/viewimage.php?modulepart=shipmentstatssupplier&file=shipmentsnbinyear-' . $user->id . '-' . $year . '.png';
    }
} else {
    $filenamenb = $dir . '/shipmentsnbinyear-' . $year . '.png';
    if ($mode == 'customer') {