info.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. // Load Dolibarr environment
  23. require '../../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  27. if (isModEnabled('project')) {
  28. include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
  29. include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
  30. }
  31. // Load translation files required by the page
  32. $langs->loadLangs(array('compta', 'bills'));
  33. $id = GETPOST('id', 'int');
  34. $action = GETPOST('action', 'aZ09');
  35. $object = new ChargeSociales($db);
  36. if ($id > 0) {
  37. $object->fetch($id);
  38. }
  39. // Security check
  40. $socid = GETPOST('socid', 'int');
  41. if ($user->socid) {
  42. $socid = $user->socid;
  43. }
  44. $result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges');
  45. /*
  46. * Actions
  47. */
  48. if ($action == 'setlib' && $user->rights->tax->charges->creer) {
  49. $object->fetch($id);
  50. $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
  51. if ($result < 0) {
  52. setEventMessages($object->error, $object->errors, 'errors');
  53. }
  54. }
  55. /*
  56. * View
  57. */
  58. $form = new Form($db);
  59. if (isModEnabled('project')) {
  60. $formproject = new FormProjets($db);
  61. }
  62. $title = $langs->trans("SocialContribution").' - '.$langs->trans("Info");
  63. $help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:M&oacute;dulo Impuestos y cargas sociales (IVA, impuestos)';
  64. llxHeader("", $title, $help_url);
  65. $object->fetch($id);
  66. $object->info($id);
  67. $head = tax_prepare_head($object);
  68. $alreadypayed = $object->getSommePaiement();
  69. print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, $object->picto);
  70. $morehtmlref = '<div class="refidno">';
  71. // Label of social contribution
  72. $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
  73. $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
  74. // Project
  75. if (isModEnabled('project')) {
  76. $langs->load("projects");
  77. $morehtmlref .= '<br>'.$langs->trans('Project').' : ';
  78. if (!empty($object->fk_project)) {
  79. $proj = new Project($db);
  80. $proj->fetch($object->fk_project);
  81. $morehtmlref .= ' : '.$proj->getNomUrl(1);
  82. if ($proj->title) {
  83. $morehtmlref .= ' - '.$proj->title;
  84. }
  85. } else {
  86. $morehtmlref .= '';
  87. }
  88. }
  89. $morehtmlref .= '</div>';
  90. $linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  91. $object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status
  92. $morehtmlright = '';
  93. dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
  94. print '<div class="fichecenter">';
  95. print '<div class="underbanner clearboth"></div>';
  96. print '<br>';
  97. print '<table class="centpercent"><tr><td>';
  98. dol_print_object_info($object);
  99. print '</td></tr></table>';
  100. print '</div>';
  101. // End of page
  102. llxFooter();
  103. $db->close();