dolibarr/htdocs/core/lib/report.lib.php

139 lines
3.8 KiB
PHP
Raw Normal View History

<?php
2012-08-03 20:09:37 +02:00
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
2018-10-27 14:43:12 +02:00
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/
/**
2011-10-24 12:59:44 +02:00
* \file htdocs/core/lib/report.lib.php
2010-01-12 00:25:54 +01:00
* \brief Set of functions for reporting
*/
/**
2017-09-05 10:16:08 +02:00
* Show header of a report
*
2017-09-05 10:16:08 +02:00
* @param string $reportname Name of report
* @param string $notused Not used
* @param string $period Period of report
* @param string $periodlink Link to switch period
* @param string $description Description
2019-03-11 01:01:15 +01:00
* @param integer $builddate Date generation
* @param string $exportlink Link for export or ''
* @param array $moreparam Array with list of params to add into form
* @param string $calcmode Calculation mode
2017-08-31 15:44:36 +02:00
* @param string $varlink Add a variable into the address of the page
* @return void
*/
function report_header($reportname, $notused, $period, $periodlink, $description, $builddate, $exportlink = '', $moreparam = array(), $calcmode = '', $varlink = '')
{
global $langs;
2010-01-12 00:25:54 +01:00
2017-09-05 10:16:08 +02:00
print "\n\n<!-- start banner of report -->\n";
2017-08-31 15:44:36 +02:00
2021-02-23 22:03:23 +01:00
if (!empty($varlink)) {
$varlink = '?'.$varlink;
}
2015-12-09 12:55:08 +01:00
2019-03-11 01:01:15 +01:00
$head = array();
$h = 0;
2015-12-09 12:55:08 +01:00
$head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
$head[$h][1] = $langs->trans("Report");
2012-08-03 20:09:37 +02:00
$head[$h][2] = 'report';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
2017-09-05 10:16:08 +02:00
2020-10-22 22:50:03 +02:00
print dol_get_fiche_head($head, 'report');
2010-01-12 00:25:54 +01:00
2021-02-23 22:03:23 +01:00
foreach ($moreparam as $key => $value) {
print '<input type="hidden" name="'.$key.'" value="'.$value.'">'."\n";
}
2019-08-21 04:21:43 +02:00
print '<table class="border tableforfield centpercent">'."\n";
2017-09-05 10:16:08 +02:00
$variante = ($periodlink || $exportlink);
// Ligne de titre
print '<tr>';
2020-08-30 17:42:49 +02:00
print '<td width="150">'.$langs->trans("ReportName").'</td>';
2017-09-05 10:16:08 +02:00
print '<td>';
print $reportname;
print '</td>';
2021-02-23 22:03:23 +01:00
if ($variante) {
print '<td></td>';
}
print '</tr>'."\n";
2010-01-12 00:25:54 +01:00
// Calculation mode
2021-02-23 22:03:23 +01:00
if ($calcmode) {
print '<tr>';
2020-08-30 17:42:49 +02:00
print '<td width="150">'.$langs->trans("CalculationMode").'</td>';
2017-09-05 10:16:08 +02:00
print '<td>';
print $calcmode;
2021-02-23 22:03:23 +01:00
if ($variante) {
print '<td></td>';
}
print '</td>';
print '</tr>'."\n";
}
2014-11-15 18:30:37 +01:00
// Ligne de la periode d'analyse du rapport
print '<tr>';
print '<td>'.$langs->trans("ReportPeriod").'</td>';
2017-09-05 10:16:08 +02:00
print '<td>';
2021-02-23 22:03:23 +01:00
if ($period) {
print $period;
}
if ($variante) {
print '<td class="nowraponall">'.$periodlink.'</td>';
}
print '</td>';
print '</tr>'."\n";
// Ligne de description
print '<tr>';
2015-09-03 11:54:03 +02:00
print '<td>'.$langs->trans("ReportDescription").'</td>';
2017-09-05 10:16:08 +02:00
print '<td>'.$description.'</td>';
2021-02-23 22:03:23 +01:00
if ($variante) {
print '<td></td>';
}
print '</tr>'."\n";
// Ligne d'export
print '<tr>';
print '<td>'.$langs->trans("GeneratedOn").'</td>';
2017-09-05 10:16:08 +02:00
print '<td>';
2017-09-05 09:43:22 +02:00
print dol_print_date($builddate, 'dayhour');
2017-09-05 10:16:08 +02:00
print '</td>';
2021-02-23 22:03:23 +01:00
if ($variante) {
print '<td>'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'</td>';
}
print '</tr>'."\n";
2010-01-12 00:25:54 +01:00
print '</table>'."\n";
2010-01-12 00:25:54 +01:00
2020-10-27 18:19:31 +01:00
print dol_get_fiche_end();
2017-08-31 15:44:36 +02:00
2017-09-05 10:16:08 +02:00
print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
print '</form>';
print '<br>';
print "\n<!-- end banner of report -->\n\n";
}