report.lib.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. /* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. * or see https://www.gnu.org/
  18. */
  19. /**
  20. * \file htdocs/core/lib/report.lib.php
  21. * \brief Set of functions for reporting
  22. */
  23. /**
  24. * Show header of a report
  25. *
  26. * @param string $reportname Name of report
  27. * @param string $notused Not used
  28. * @param string $period Period of report
  29. * @param string $periodlink Link to switch period
  30. * @param string $description Description
  31. * @param integer $builddate Date generation
  32. * @param string $exportlink Link for export or ''
  33. * @param array $moreparam Array with list of params to add into form
  34. * @param string $calcmode Calculation mode
  35. * @param string $varlink Add a variable into the address of the page
  36. * @return void
  37. */
  38. function report_header($reportname, $notused, $period, $periodlink, $description, $builddate, $exportlink = '', $moreparam = array(), $calcmode = '', $varlink = '')
  39. {
  40. global $langs;
  41. print "\n\n<!-- start banner of report -->\n";
  42. if (!empty($varlink)) {
  43. $varlink = '?'.$varlink;
  44. }
  45. $title = $langs->trans("Report");
  46. print_barre_liste($title, 0, '', '', '', '', '', -1, '', 'generic', 0, '', '', -1, 1, 1);
  47. print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].$varlink.'">'."\n";
  48. print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
  49. print dol_get_fiche_head();
  50. foreach ($moreparam as $key => $value) {
  51. print '<input type="hidden" name="'.$key.'" value="'.$value.'">'."\n";
  52. }
  53. print '<table class="border tableforfield centpercent">'."\n";
  54. $variante = ($periodlink || $exportlink);
  55. // Ligne de titre
  56. print '<tr>';
  57. print '<td width="150">'.$langs->trans("ReportName").'</td>';
  58. print '<td>';
  59. print $reportname;
  60. print '</td>';
  61. if ($variante) {
  62. print '<td></td>';
  63. }
  64. print '</tr>'."\n";
  65. // Calculation mode
  66. if ($calcmode) {
  67. print '<tr>';
  68. print '<td width="150">'.$langs->trans("CalculationMode").'</td>';
  69. print '<td>';
  70. print $calcmode;
  71. if ($variante) {
  72. print '<td></td>';
  73. }
  74. print '</td>';
  75. print '</tr>'."\n";
  76. }
  77. // Ligne de la periode d'analyse du rapport
  78. print '<tr>';
  79. print '<td>'.$langs->trans("ReportPeriod").'</td>';
  80. print '<td>';
  81. if ($period) {
  82. print $period;
  83. }
  84. if ($variante) {
  85. print '<td class="nowraponall">'.$periodlink.'</td>';
  86. }
  87. print '</td>';
  88. print '</tr>'."\n";
  89. // Ligne de description
  90. print '<tr>';
  91. print '<td>'.$langs->trans("ReportDescription").'</td>';
  92. print '<td>'.$description.'</td>';
  93. if ($variante) {
  94. print '<td></td>';
  95. }
  96. print '</tr>'."\n";
  97. // Ligne d'export
  98. print '<tr>';
  99. print '<td>'.$langs->trans("GeneratedOn").'</td>';
  100. print '<td>';
  101. print dol_print_date($builddate, 'dayhour');
  102. print '</td>';
  103. if ($variante) {
  104. print '<td>'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'</td>';
  105. }
  106. print '</tr>'."\n";
  107. print '</table>'."\n";
  108. print dol_get_fiche_end();
  109. print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
  110. print '</form>';
  111. print '<br>';
  112. print "\n<!-- end banner of report -->\n\n";
  113. }