index.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <?php
  2. /* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
  4. * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/accountancy/index.php
  21. * \ingroup Accountancy (Double entries)
  22. * \brief Home accounting module
  23. */
  24. require '../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
  28. // Load translation files required by the page
  29. $langs->loadLangs(array("compta", "bills", "other", "accountancy", "loans", "banks", "admin", "dict"));
  30. // Security check
  31. if ($user->socid > 0)
  32. accessforbidden();
  33. // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
  34. $hookmanager->initHooks(array('accountancyindex'));
  35. /*
  36. * Actions
  37. */
  38. if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax disabled)
  39. {
  40. require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
  41. $zone = GETPOST('areacode', 'aZ09');
  42. $userid = GETPOST('userid', 'int');
  43. $boxorder = GETPOST('boxorder', 'aZ09');
  44. $boxorder .= GETPOST('boxcombo', 'aZ09');
  45. $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
  46. if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
  47. }
  48. /*
  49. * View
  50. */
  51. llxHeader('', $langs->trans("AccountancyArea"));
  52. if ($conf->accounting->enabled)
  53. {
  54. $step = 0;
  55. $resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
  56. $helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
  57. $showtutorial = '';
  58. if (!$helpisexpanded)
  59. {
  60. $showtutorial = '<div align="right"><a href="#" id="show_hide">';
  61. $showtutorial .= img_picto('', 'chevron-down');
  62. $showtutorial .= ' '.$langs->trans("ShowTutorial");
  63. $showtutorial .= '</a></div>';
  64. $showtutorial .= '<script type="text/javascript" language="javascript">
  65. jQuery(document).ready(function() {
  66. jQuery("#show_hide").click(function () {
  67. jQuery( "#idfaq" ).toggle({
  68. duration: 400,
  69. });
  70. });
  71. });
  72. </script>';
  73. }
  74. print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial);
  75. print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
  76. print "<br>\n";
  77. print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
  78. print "<br>\n"; print "<br>\n";
  79. print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
  80. print '<hr>';
  81. print "<br>\n";
  82. // STEPS
  83. $step++;
  84. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong>'.'</a>');
  85. print "<br>\n";
  86. $step++;
  87. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong>'.'</a>');
  88. print "<br>\n";
  89. $step++;
  90. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>'.'</a>');
  91. print "<br>\n";
  92. print "<br>\n";
  93. print $langs->trans("AccountancyAreaDescActionOnceBis");
  94. print "<br>\n";
  95. print "<br>\n";
  96. $step++;
  97. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'.'</a>');
  98. print "<br>\n";
  99. $step++;
  100. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong>'.'</a>')."\n";
  101. print "<br>\n";
  102. $step++;
  103. $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>'.'</a>';
  104. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
  105. print "<br>\n";
  106. if (!empty($conf->tax->enabled))
  107. {
  108. $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>'.'</a>';
  109. $step++;
  110. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
  111. print "<br>\n";
  112. }
  113. /*if (! empty($conf->salaries->enabled))
  114. {
  115. $step++;
  116. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
  117. // htdocs/admin/salaries.php
  118. print "<br>\n";
  119. print "<br>\n";
  120. }*/
  121. if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
  122. {
  123. $step++;
  124. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>'.'</a>');
  125. print "<br>\n";
  126. }
  127. /*
  128. if (! empty($conf->loan->enabled))
  129. {
  130. $step++;
  131. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
  132. print "<br>\n";
  133. }
  134. if (! empty($conf->don->enabled))
  135. {
  136. $step++;
  137. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
  138. print "<br>\n";
  139. }
  140. if (! empty($conf->adherents->enabled))
  141. {
  142. $step++;
  143. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
  144. print "<br>\n";
  145. }*/
  146. $step++;
  147. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong>'.'</a>');
  148. print "<br>\n";
  149. print '<br>';
  150. // Step A - E
  151. print "<br>\n";
  152. print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
  153. print '<hr>';
  154. print "<br>\n";
  155. $step = 0;
  156. $langs->loadLangs(array('bills', 'trips'));
  157. $step++;
  158. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>'.'</a>')."\n";
  159. print "<br>\n";
  160. $step++;
  161. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>'.'</a>')."\n";
  162. print "<br>\n";
  163. if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled))
  164. {
  165. $step++;
  166. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>'.'</a>')."\n";
  167. print "<br>\n";
  168. }
  169. $step++;
  170. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
  171. print "<br>\n";
  172. $step++;
  173. print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
  174. print "<br>\n";
  175. print '<br>';
  176. print '</div>';
  177. print '<div class="clearboth"></div>';
  178. print '<div class="fichecenter fichecenterbis">';
  179. /*
  180. * Show boxes
  181. */
  182. $boxlist .= '<div class="twocolumns">';
  183. $boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
  184. $boxlist .= $resultboxes['boxlista'];
  185. $boxlist .= '</div>';
  186. $boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
  187. $boxlist .= $resultboxes['boxlistb'];
  188. $boxlist .= '</div>';
  189. $boxlist .= "\n";
  190. $boxlist .= '</div>';
  191. print $boxlist;
  192. print '</div>';
  193. }
  194. else
  195. {
  196. print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
  197. print $langs->trans("Module10Desc")."<br>\n";
  198. }
  199. // End of page
  200. llxFooter();
  201. $db->close();