report.lib.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. /* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.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 VAT report
  25. *
  26. * @param string $nom Name of report
  27. * @param string $variante Link for alternate report
  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($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='')
  39. {
  40. global $langs;
  41. if (empty($hselected)) $hselected='report';
  42. print "\n\n<!-- debut cartouche rapport -->\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. dol_fiche_head($head, 'report');
  49. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
  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. // Ligne de titre
  56. print '<tr>';
  57. print '<td width="110">'.$langs->trans("ReportName").'</td>';
  58. if (! $variantexxx) print '<td colspan="3">';
  59. else print '<td>';
  60. print $nom;
  61. if ($variantexxx) print '</td><td colspan="2">'.$variantexxx;
  62. print '</td>';
  63. print '</tr>';
  64. // Calculation mode
  65. if ($calcmode)
  66. {
  67. print '<tr>';
  68. print '<td width="110">'.$langs->trans("CalculationMode").'</td>';
  69. if (! $variante) print '<td colspan="3">';
  70. else print '<td>';
  71. print $calcmode;
  72. if ($variante) print '</td><td colspan="2">'.$variante;
  73. print '</td>';
  74. print '</tr>';
  75. }
  76. // Ligne de la periode d'analyse du rapport
  77. print '<tr>';
  78. print '<td>'.$langs->trans("ReportPeriod").'</td>';
  79. if (! $periodlink) print '<td colspan="3">';
  80. else print '<td>';
  81. if ($period) print $period;
  82. if ($periodlink) print '</td><td colspan="2">'.$periodlink;
  83. print '</td>';
  84. print '</tr>';
  85. // Ligne de description
  86. print '<tr>';
  87. print '<td>'.$langs->trans("ReportDescription").'</td>';
  88. print '<td colspan="3">'.$description.'</td>';
  89. print '</tr>';
  90. // Ligne d'export
  91. print '<tr>';
  92. print '<td>'.$langs->trans("GeneratedOn").'</td>';
  93. if (! $exportlink) print '<td colspan="3">';
  94. else print '<td>';
  95. print dol_print_date($builddate);
  96. if ($exportlink) print '</td><td>'.$langs->trans("Export").'</td><td>'.$exportlink;
  97. print '</td></tr>';
  98. print '</table>';
  99. print '<br><div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
  100. print '</form>';
  101. dol_fiche_end();
  102. print "\n<!-- fin cartouche rapport -->\n\n";
  103. }