info.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. /* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/compta/sociales/info.php
  19. * \ingroup tax
  20. * \brief Page with info about social contribution
  21. */
  22. require '../../main.inc.php';
  23. require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  26. if (!empty($conf->projet->enabled)) {
  27. include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  28. include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
  29. }
  30. // Load translation files required by the page
  31. $langs->loadLangs(array('compta', 'bills'));
  32. $id = GETPOST('id', 'int');
  33. $action = GETPOST('action', 'aZ09');
  34. $object = new ChargeSociales($db);
  35. if ($id > 0) {
  36. $object->fetch($id);
  37. }
  38. // Security check
  39. $socid = GETPOST('socid', 'int');
  40. if ($user->socid) {
  41. $socid = $user->socid;
  42. }
  43. $result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges');
  44. /*
  45. * Actions
  46. */
  47. if ($action == 'setlib' && $user->rights->tax->charges->creer) {
  48. $object->fetch($id);
  49. $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
  50. if ($result < 0) {
  51. setEventMessages($object->error, $object->errors, 'errors');
  52. }
  53. }
  54. /*
  55. * View
  56. */
  57. $form = new Form($db);
  58. if (!empty($conf->projet->enabled)) {
  59. $formproject = new FormProjets($db);
  60. }
  61. $title = $langs->trans("SocialContribution").' - '.$langs->trans("Info");
  62. $help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
  63. llxHeader("", $title, $help_url);
  64. $object->fetch($id);
  65. $object->info($id);
  66. $head = tax_prepare_head($object);
  67. $alreadypayed = $object->getSommePaiement();
  68. print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, $object->picto);
  69. $morehtmlref = '<div class="refidno">';
  70. // Label of social contribution
  71. $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
  72. $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
  73. // Project
  74. if (!empty($conf->projet->enabled)) {
  75. $langs->load("projects");
  76. $morehtmlref .= '<br>'.$langs->trans('Project').' : ';
  77. if (!empty($object->fk_project)) {
  78. $proj = new Project($db);
  79. $proj->fetch($object->fk_project);
  80. $morehtmlref .= ' : '.$proj->getNomUrl(1);
  81. if ($proj->title) {
  82. $morehtmlref .= ' - '.$proj->title;
  83. }
  84. } else {
  85. $morehtmlref .= '';
  86. }
  87. }
  88. $morehtmlref .= '</div>';
  89. $linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  90. $object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status
  91. $morehtmlright = '';
  92. dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
  93. print '<div class="fichecenter">';
  94. print '<div class="underbanner clearboth"></div>';
  95. print '<br>';
  96. print '<table class="centpercent"><tr><td>';
  97. dol_print_object_info($object);
  98. print '</td></tr></table>';
  99. print '</div>';
  100. // End of page
  101. llxFooter();
  102. $db->close();