report.lib.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 date $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. * @return void
  36. */
  37. function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='')
  38. {
  39. global $langs, $hselected;
  40. print "\n\n<!-- debut cartouche rapport -->\n";
  41. $h=0;
  42. $head[$h][0] = $_SERVER["PHP_SELF"];
  43. $head[$h][1] = $langs->trans("Report");
  44. $head[$h][2] = 'report';
  45. dol_fiche_head($head, $hselected);
  46. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  47. foreach($moreparam as $key => $value)
  48. {
  49. print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
  50. }
  51. print '<table width="100%" class="border">';
  52. // Ligne de titre
  53. print '<tr>';
  54. print '<td valign="top" width="110">'.$langs->trans("ReportName").'</td>';
  55. if (! $variantexxx) print '<td colspan="3">';
  56. else print '<td>';
  57. print $nom;
  58. if ($variantexxx) print '</td><td colspan="2">'.$variantexxx;
  59. print '</td>';
  60. print '</tr>';
  61. // Calculation mode
  62. if ($calcmode)
  63. {
  64. print '<tr>';
  65. print '<td valign="top" width="110">'.$langs->trans("CalculationMode").'</td>';
  66. if (! $variante) print '<td colspan="3">';
  67. else print '<td>';
  68. print $calcmode;
  69. if ($variante) print '</td><td colspan="2">'.$variante;
  70. print '</td>';
  71. print '</tr>';
  72. }
  73. // Ligne de la periode d'analyse du rapport
  74. print '<tr>';
  75. print '<td>'.$langs->trans("ReportPeriod").'</td>';
  76. if (! $periodlink) print '<td colspan="3">';
  77. else print '<td>';
  78. if ($period) print $period;
  79. if ($periodlink) print '</td><td colspan="2">'.$periodlink;
  80. print '</td>';
  81. print '</tr>';
  82. // Ligne de description
  83. print '<tr>';
  84. print '<td valign="top">'.$langs->trans("ReportDescription").'</td>';
  85. print '<td colspan="3">'.$description.'</td>';
  86. print '</tr>';
  87. // Ligne d'export
  88. print '<tr>';
  89. print '<td>'.$langs->trans("GeneratedOn").'</td>';
  90. if (! $exportlink) print '<td colspan="3">';
  91. else print '<td>';
  92. print dol_print_date($builddate);
  93. if ($exportlink) print '</td><td>'.$langs->trans("Export").'</td><td>'.$exportlink;
  94. print '</td></tr>';
  95. print '<tr>';
  96. print '<td colspan="4" align="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></td>';
  97. print '</tr>';
  98. print '</table>';
  99. print '</form>';
  100. print '</div>';
  101. print "\n<!-- fin cartouche rapport -->\n\n";
  102. }