* * 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 * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. */ /** * \file htdocs/custom/buchaltungswidget/rentabilitaet_detail.php * \ingroup buchaltungswidget * \brief Detail page for Profitability analysis with full charts and year selection */ // Load Dolibarr environment $res = 0; if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; } $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; } if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; } if (!$res && file_exists("../main.inc.php")) { $res = @include "../main.inc.php"; } if (!$res && file_exists("../../main.inc.php")) { $res = @include "../../main.inc.php"; } if (!$res && file_exists("../../../main.inc.php")) { $res = @include "../../../main.inc.php"; } if (!$res) { die("Include of main fails"); } require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; // Load translation files $langs->loadLangs(array("buchaltungswidget@buchaltungswidget", "bills", "compta")); // Access control if (!$user->hasRight('facture', 'lire') && !$user->hasRight('fournisseur', 'facture', 'lire')) { accessforbidden(); } // Get parameters $selectedYear = GETPOST('year', 'int'); if (empty($selectedYear)) { $selectedYear = date('Y'); } $currentYear = date('Y'); $years = range($currentYear - 5, $currentYear + 1); /* * View */ $title = $langs->trans("Rentabilitaet"); llxHeader('', $title, '', '', 0, 0, array('/includes/nnnick/chartjs/dist/Chart.min.js'), array('/buchaltungswidget/css/buchaltungswidget.css')); print load_fiche_titre($title, '', 'accountancy'); // Year selector print '
| '.$langs->trans("Month").' | '; print ''.$langs->trans("MaterialsPurchasedForCustomers").' | '; print ''.$langs->trans("MaterialsServicesInvoiced").' | '; print ''.$langs->trans("GrossProfit").' | '; print ''.$langs->trans("ProfitMargin").' | '; print ''.($selectedYear - 1).' '.$langs->trans("ProfitMargin").' | '; print '
|---|---|---|---|---|---|
| '.$name.' | '; print ''.price($purchased, 0, $langs, 1, 2, 2, $conf->currency).' | '; print ''.price($invoiced, 0, $langs, 1, 2, 2, $conf->currency).' | '; print ''.price($grossProfit, 0, $langs, 1, 2, 2, $conf->currency).' | '; print ''.number_format($margin, 1, ',', '.').' % | '; print ''.number_format($marginLast, 1, ',', '.').' % | '; print '
| '.$langs->trans("Total").' | '; print ''.price($totalPurchased, 0, $langs, 1, 2, 2, $conf->currency).' | '; print ''.price($totalInvoiced, 0, $langs, 1, 2, 2, $conf->currency).' | '; print ''.price($totalGrossProfit, 0, $langs, 1, 2, 2, $conf->currency).' | '; print ''.number_format($totalMargin, 1, ',', '.').' % | '; print ''.number_format($totalMarginLast, 1, ',', '.').' % | '; print '