report.lib.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 <http://www.gnu.org/licenses/>.
  17. * or see http://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 timestamp|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. if (empty($hselected)) $hselected='report';
  42. print "\n\n<!-- start banner of report -->\n";
  43. if(! empty($varlink)) $varlink = '?'.$varlink;
  44. $h=0;
  45. $head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
  46. $head[$h][1] = $langs->trans("Report");
  47. $head[$h][2] = 'report';
  48. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
  49. dol_fiche_head($head, 'report');
  50. foreach($moreparam as $key => $value)
  51. {
  52. print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
  53. }
  54. print '<table width="100%" class="border">';
  55. $variante = ($periodlink || $exportlink);
  56. // Ligne de titre
  57. print '<tr>';
  58. print '<td width="110">'.$langs->trans("ReportName").'</td>';
  59. print '<td>';
  60. print $reportname;
  61. print '</td>';
  62. if ($variante) print '<td></td>';
  63. print '</tr>';
  64. // Calculation mode
  65. if ($calcmode)
  66. {
  67. print '<tr>';
  68. print '<td width="110">'.$langs->trans("CalculationMode").'</td>';
  69. print '<td>';
  70. print $calcmode;
  71. if ($variante) print '<td></td>';
  72. print '</td>';
  73. print '</tr>';
  74. }
  75. // Ligne de la periode d'analyse du rapport
  76. print '<tr>';
  77. print '<td>'.$langs->trans("ReportPeriod").'</td>';
  78. print '<td>';
  79. if ($period) print $period;
  80. if ($variante) print '<td class="nowraponall">'.$periodlink.'</td>';
  81. print '</td>';
  82. print '</tr>';
  83. // Ligne de description
  84. print '<tr>';
  85. print '<td>'.$langs->trans("ReportDescription").'</td>';
  86. print '<td>'.$description.'</td>';
  87. if ($variante) print '<td></td>';
  88. print '</tr>';
  89. // Ligne d'export
  90. print '<tr>';
  91. print '<td>'.$langs->trans("GeneratedOn").'</td>';
  92. print '<td>';
  93. print dol_print_date($builddate, 'dayhour');
  94. print '</td>';
  95. if ($variante) print '<td>'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'</td>';
  96. print '</tr>';
  97. print '</table>';
  98. dol_fiche_end();
  99. print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
  100. print '</form>';
  101. print '<br>';
  102. print "\n<!-- end banner of report -->\n\n";
  103. }