settlementsstatementsindex.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <?php
  2. /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file settlements/settlementsindex.php
  22. * \ingroup settlements
  23. * \brief Home page of settlements top menu
  24. */
  25. // Load Dolibarr environment
  26. $res = 0;
  27. // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
  28. if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
  29. $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
  30. }
  31. // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
  32. $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
  33. $tmp2 = realpath(__FILE__);
  34. $i = strlen($tmp) - 1;
  35. $j = strlen($tmp2) - 1;
  36. while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
  37. $i--;
  38. $j--;
  39. }
  40. if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
  41. $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
  42. }
  43. if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
  44. $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
  45. }
  46. // Try main.inc.php using relative path
  47. if (!$res && file_exists("../main.inc.php")) {
  48. $res = @include "../main.inc.php";
  49. }
  50. if (!$res && file_exists("../../main.inc.php")) {
  51. $res = @include "../../main.inc.php";
  52. }
  53. if (!$res && file_exists("../../../main.inc.php")) {
  54. $res = @include "../../../main.inc.php";
  55. }
  56. if (!$res) {
  57. die("Include of main fails");
  58. }
  59. require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
  60. require_once DOL_DOCUMENT_ROOT . '/user/class/usergroup.class.php';
  61. require_once DOL_DOCUMENT_ROOT . '/custom/financialreport/class/userinvoice.class.php';
  62. require_once DOL_DOCUMENT_ROOT . '/custom/settlements/class/groupusers.class.php';
  63. require_once DOL_DOCUMENT_ROOT . '/custom/financialreport/class/helper.class.php';
  64. require_once DOL_DOCUMENT_ROOT . '/custom/settlements/class/helper.class.php';
  65. require_once DOL_DOCUMENT_ROOT . '/custom/financialreport/class/commissionsettlements.class.php';
  66. require_once DOL_DOCUMENT_ROOT . '/custom/financialreport/class/financialreportformhelper.class.php';
  67. require_once DOL_DOCUMENT_ROOT . '/custom/bbus/class/commissionhandler.class.php';
  68. require_once DOL_DOCUMENT_ROOT . '/custom/bbus/class/userloginnaplo.class.php';
  69. require_once DOL_DOCUMENT_ROOT . '/custom/settlements/core/tpl/printPDF_szisz.php';
  70. $helper = new HelperUserInvoice($db);
  71. $settlementsHelper = new Helper($db);
  72. $formHelper = new FinancialreportFormHelper($db);
  73. $commmissionhandler = new CommissionHandler();
  74. $userLoginNaploObj = new UserLoginNaplo($db);
  75. // Load translation files required by the page
  76. $langs->loadLangs(array("settlements@settlements"));
  77. $action = GETPOST('action', 'aZ09');
  78. $cancel = GETPOST('cancel', 'int');
  79. $id = GETPOST('id', 'int');
  80. $idmenu = GETPOST('idmenu', 'int');
  81. $daterange = GETPOST('daterange', 'alpha');
  82. $datepicker = GETPOST('datepicker', 'alpha');
  83. $interval = GETPOST('interval', 'alpha');
  84. $array = GETPOST('array', 'array');
  85. $options = GETPOST('options', 'array');
  86. $commission = GETPOST('commission', 'array');
  87. $commissions = GETPOST('commissions', 'alpha');
  88. $optionsString = GETPOST('optionsString', 'alpha');
  89. $groupEntity = GETPOST('groupEntity', 'int');
  90. $printSummary = GETPOST('printSummary', 'int');
  91. $confirmsettlements = GETPOST('confirmsettlements', 'int');
  92. $confirmpersonalsettlements = GETPOST('confirmpersonalsettlements', 'alpha');
  93. if ($daterange == '' && $datepicker == '') {
  94. $now = dol_now();
  95. $daterange = date("Y-m-d", $now) . ' - ' . date("Y-m-d", $now);
  96. $isSetDatepicker = true;
  97. $datesOfRange = $helper->createArray($daterange);
  98. } else {
  99. $daterange = $daterange != '' ? $daterange : $datepicker;
  100. $datesOfRange = $helper->createArray($daterange);
  101. $isSetDatepicker = $datepicker != '';
  102. }
  103. $socid = GETPOST('socid', 'int');
  104. if (isset($user->socid) && $user->socid > 0) {
  105. $action = '';
  106. $socid = $user->socid;
  107. }
  108. $form = new Form($db);
  109. $formfile = new FormFile($db);
  110. $entities = $settlementsHelper->getAllEntities();
  111. $entitiesArray = [];
  112. $selectedEntities = '';
  113. foreach ($entities as $key => $value) {
  114. $val = GETPOST('entity_' . $key, 'int');
  115. $entitiesArray[$key] = $val;
  116. /* if ($val != '') {
  117. $entitiesArrayIsEmpty = false;
  118. } */
  119. }
  120. if (empty(array_filter($entitiesArray))) {
  121. $entitiesArray[1] = 1;
  122. }
  123. $selectedEntities = $helper->getEntities($entitiesArrayIsEmpty, $entities, $entitiesArray);
  124. $groups = $helper->getAllGroupsFromGroupClass($selectedEntities);
  125. $groupToolsAndGroupUsersArray = $helper->getGTAndGUArray();
  126. if (empty($id)) {
  127. $keys = array_keys($groups);
  128. $id = $keys[0];
  129. }
  130. include DOL_DOCUMENT_ROOT . '/custom/financialreport/core/actions_addupdatedelete.inc.php';
  131. foreach ($datesOfRange as $date) {
  132. $usersOfGroups = $helper->getUsersByIdWithDate($db, $id, $date);
  133. $usersOfGroupsCol2 = $helper->getUsersByIdWithDateCol2($db, $id, $date);
  134. $groupEntityId = $helper->getGroupEntityId($id);
  135. }
  136. $formconfirm = '';
  137. if ($confirmsettlements == 1) {
  138. $string = implode("@", $commission);
  139. foreach ($options as $optionkey => $optionValue) {
  140. $array[] = $optionkey . '|' . $optionValue;
  141. }
  142. $optionsString = implode("@", $array);
  143. //print $string;
  144. //print $optionsString;
  145. //exit;
  146. $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id . '&commissions=' . $string . '&optionsString=' . $optionsString . '&groupEntity=' . $groupEntityId, $langs->trans('GroupSettlementsConfirm'), $langs->trans('GroupSettlementsConfirmObject'), 'confirm_settlement', '', 0, 1);
  147. }
  148. if ($confirmpersonalsettlements) {
  149. $commissionArray = [];
  150. $successfully = false;
  151. $selectedUserArray = explode('_', $confirmpersonalsettlements);
  152. $result = explode('_', $commission[$selectedUserArray[1]]);
  153. $userObj = new User($db);
  154. $commissionArray['user_id'] = $result[0];
  155. $commissionArray['interval'] = $result[1];
  156. $commissionArray['HUF'] = $result[2];
  157. $commissionsForPost = implode('_', $commissionArray);
  158. $result = $userObj->fetch($result[0]);
  159. $userString = $userObj->firstname . ' ' . $userObj->lastname . ' (' . $userObj->login . ')';
  160. $successfully = true;
  161. if (!$successfully) {
  162. setEventMessages('Sikertelen művelet.', [], 'errors');
  163. } else {
  164. $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id . '&commissions=' . $commissionsForPost, $langs->trans('PersonalSettlementsConfirm'), $langs->trans('PersonalSettlementsConfirmObject', $userString), 'confirm_personal_settlement', '', 0, 1);
  165. }
  166. }
  167. if (isset($excelexport)) {
  168. $helper->createExcelHotelReport($daterange, $id, $entity, $groups);
  169. }
  170. llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
  171. if (($confirmsettlements == 1) || $confirmpersonalsettlements) {
  172. print $formconfirm;
  173. }
  174. $url = $_SERVER["PHP_SELF"] . '?idmenu=' . $idmenu . '&mainmenu=financialreport&leftmenu=&id=' . $id;
  175. $now3thSection = dol_now();
  176. print '<form method="POST" id="statementlists" action="' . $url . '">' . "\n";
  177. print '<input type="hidden" name="token" value="' . newToken() . '">';
  178. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  179. print '<input type="hidden" name="action" value="list">';
  180. print '<input type="hidden" name="datepickerdata" value="' . $daterange . '">';
  181. print '<input type="hidden" name="intervalchk" value="' . $interval . '">';
  182. $nowTitle = date('Y.m.d', dol_now());
  183. print load_fiche_titre($langs->trans("SettlementsArea") . '&nbsp; ' . $nowTitle, '', 'settlements.png@settlements');
  184. print '<div style="width:100%; padding-bottom: 50px;">';
  185. $columnWidth = 100 / count($entities);
  186. foreach ($entities as $key => $value) {
  187. if (!$entitiesArrayIsEmpty) {
  188. $checked = $entitiesArray[$key] == $key ? 'checked' : '';
  189. } else {
  190. $checked = 'checked';
  191. }
  192. print '<div class="entitiesChk" style="float:left; width:' . $columnWidth . '%; text-align:center;"><input type="checkbox" class="entitycheckbox" id="entity_' . $key . '" name="entity_' . $key . '" value="' . $key . '" ' . $checked . '><label for="' . $key . '">' . $value . '</label></div>';
  193. }
  194. print '</div>';
  195. # 1
  196. print '<div class=""><div class="" style="width:33%;float:left;">';
  197. print '<table style="width:100%;">';
  198. print '<tr style="width: 100%; height: 45px; text-align: center; background-color: lightgrey;"><td>' . $langs->trans("nameofgroup") . '</td></tr>';
  199. foreach ($groups as $key => $val) {
  200. $coloredLine = $id == $key ? ' background-color: #b0c4de' : '';
  201. print '<tr class="submitFormLink" data-value="' . $key . '" style="height:30px; ' . $coloredLine . '; cursor:pointer;">
  202. <td>
  203. <div>
  204. <span class="fa fa-group pictofixedwidth"></span> ' . $val . '
  205. </div>
  206. <div class="groupColumn2ndLine" style="float:left;">
  207. ' . $entities[$helper->getGroupEntityId($key)] . '
  208. </div>
  209. </td>
  210. </tr>';
  211. }
  212. print '</table>';
  213. print '</div>';
  214. # 2
  215. print '<div class="" style="width:33%;float:left;">';
  216. print '<table style="width:100%;">';
  217. print '<tr style="width: 100%; height: 45px; text-align: center; background-color: lightgrey;"><td colspan="2"><a href="/custom/settlements/settlementtoolssettingsindex.php?idmenu=1594&mainmenu=settlements&leftmenu=&id=' . $groupToolsAndGroupUsersArray[$id] . '&nopackageuser=1">' . $langs->trans("usersofgroup", $helper->getGroupRefByID($id)) . '</a></td></tr>';
  218. print '<tr style="width: 100%;" colspan="2"><td>' . $langs->trans('Name') . '</td></tr>';
  219. if (count($usersOfGroupsCol2) > 0) {
  220. foreach ($usersOfGroupsCol2 as $user) {
  221. print '<tr style="height:30px;">
  222. <td><span class="fa fa-user pictofixedwidth"></span> <a href="/user/card.php?id=' . $user['user_id'] . '&save_lastsearch_values=1">' . $user['lastname'] . ' ' . $user['firstname'] . '</a> (' . $user['login'] . ')</td><td></td>
  223. </tr>';
  224. }
  225. } else {
  226. print '<tr style="height: 60px; text-align: center; color:red;"><td>' . $langs->trans('nouser') . '</td></tr>';
  227. }
  228. print '</table>';
  229. print '</div>';
  230. # 3
  231. $colspan = 2;
  232. $payed = '<span class="fa fa-check pictofixedwidth" style="color: green;"></span>';
  233. print '<div class="" style="width:33%;float:left;">';
  234. print '<table style="width:100%;">';
  235. print '<tr style="width: 100%; height: 45px; text-align: center; background-color: lightgrey;"><td colspan="' . $colspan . '">' . $langs->trans("settlements") . '</td></tr>';
  236. print '<tr style="width: 100%; height: 20px; text-align: right;"><td colspan="' . $colspan . '">' . $langs->trans('selectAll') . '<input type="checkbox" id="allOptions" name="AllOptions" value="1" onclick="checkAll()"></td></tr>';
  237. $allUsersCommissionsAmountForGroupsettlementButton = 0;
  238. $totalCommissionHUFEUR = 0;
  239. foreach ($datesOfRange as $date) {
  240. if (count($usersOfGroups) > 0) {
  241. $k = 0;
  242. $userOption = 0;
  243. foreach ($usersOfGroups as $userOfGroups) {
  244. $user_id = $userOfGroups['user_id'];
  245. $from = $userOfGroups['date_creation'];
  246. $logoutDate = $helper->checklogoutRecordInUserNaplo($user_id, $from, $id);
  247. $to = $logoutDate != '' ? $logoutDate : date('Y-m-d H:i:s', $now3thSection);
  248. $iNeedThisIdForRefreshDate = $logoutDate == '' ? 'class="refreshThis"' : '';
  249. $checked = in_array($user_id, $options) ? 'checked' : '';
  250. $dateInterval = $from;
  251. $dateInterval2 = $from . ' - ' . $to;
  252. $totalCommission = $commmissionhandler->getTotalCommission($user_id, $from, $to);
  253. $totalCommissionHUFEUR += $totalCommission;
  254. $disabledButton = $totalCommission == 0 ? 'disabled' : '';
  255. $hiddenCommissionDataValue = $user_id . '_' . $dateInterval;
  256. $last5commissionSql = "SELECT ui.date_creation, ui.amount FROM llx_financialreport_userinvoice as ui WHERE ui.user_id = {$user_id} ORDER BY ui.rowid DESC LIMIT 2";
  257. $last5commissionResult = $db->query($last5commissionSql);
  258. $last5CommissionArray = [];
  259. if ($db->num_rows($last5commissionResult) > 0){
  260. while($l5row = $db->fetch_object($last5commissionResult)){
  261. $last5CommissionArray[] = $l5row;
  262. }
  263. }
  264. print '<input type="hidden" name="commission[]" value="' . $hiddenCommissionDataValue . '">';
  265. print '<tr><td colspan=' . $colspan . ' style="text-align: center;">';
  266. print '<div class="box">
  267. <div style="height: 10%;text-align: right; margin-right: 20px; margin-top:10px;">' . $langs->trans('asGroup') . '<input type="checkbox" class="options" id="option_' . $user_id . '" name="options[' . $userOption . ']" value="' . $user_id . '" ' . $checked . ' onclick="checkOptions()"></div>
  268. <div style="margin-top: 30px;">
  269. <div style="height: 10%; color: rgb(163,0,51); font-size: 30px; margin-left: 40px; float: left;">' . $userOfGroups['lastname'] . ' ' . $userOfGroups['firstname'] . '</div>
  270. <div style="height: 10%; color: rgb(163,0,51); font-size: 30px; text-align: right; padding-right: 40px;">' . $helper->correctNumber($totalCommission) . '<sup style="font-size: 10px;"> HUF</sup></div>
  271. </div>
  272. <div style="clear:both; height: 10%; color: rgb(163,0,51); margin-left: 40px; float: left;"> (' . $userOfGroups['login'] . ')</div>
  273. <div style="height: 10%; color: rgb(10, 20, 100); text-align: right; padding-right: 40px;">' . $langs->trans('Commission') . '</div>
  274. <div style="color:green;">' . $langs->trans('dailyMinimumCommission') . ': ' . $helper->correctNumber($commmissionhandler->getDailyMinimumCommission()) . ' HUF</div>
  275. <div style="text-align: center;"><table style="width:100%;"><tr style=" color:rgb(163,0,51);"><td style="text-align:right;">' . $from . '</td><td style="width:10px;"> - </td><td style="text-align:left;" ' . $iNeedThisIdForRefreshDate . '>' . $to . '</td></tr></table></div>
  276. <div style="text-align: center;"><table style="width:100%;">';
  277. print '<tr><td colspan=2 style="text-align: center;">Last commissions</td></tr>';
  278. foreach($last5CommissionArray as $commissionRecord){
  279. print '<tr><td>' . $commissionRecord->date_creation . '</td><td style="text-align: left;">' . $commissionRecord->amount . ' HUF</td></tr>';
  280. }
  281. print '</table></div>
  282. <div class="container content" style="clear: both; height: 10%"><button id="confirmpersonalsettlements" name="confirmpersonalsettlements" type="submit" value="' . $user_id . '_' . $k . '" ' . $disabledButton . '>' . $langs->trans("PersonalSettlement") . '</button></div>
  283. </div>';
  284. print '</div>';
  285. print '</td></tr>';
  286. $allUsersCommissionsAmountForGroupsettlementButton += $totalCommission;
  287. $currentUser = $user_id;
  288. $k++;
  289. $userOption++;
  290. }
  291. }
  292. if ($allUsersCommissionsAmountForGroupsettlementButton != 0) {
  293. $displayNone = empty($options) ? 'none;' : 'block';
  294. print '<tr style="text-align:center;"><td colspan="3"><button id="confirmsettlements" name="confirmsettlements" style="width:100%; height:30px; margin-bottom: 40px; display:' . $displayNone . ';" type="submit" value="1">' . $langs->trans("GroupSettlement") . '</button></td></tr>';
  295. }
  296. }
  297. print '</div></div>';
  298. print '</form>' . "\n";
  299. print '</td></tr>';
  300. $formHelper->summary($id, $totalCommissionHUFEUR);
  301. // End of page
  302. llxFooter();
  303. $db->close();
  304. ?>
  305. <style>
  306. .groupColumn2ndLine {
  307. color: grey !important;
  308. }
  309. button {
  310. width: 200px;
  311. height: 30px;
  312. background-color: rgb(163, 0, 51);
  313. color: white;
  314. border-radius: 20px;
  315. border: none;
  316. cursor: pointer;
  317. }
  318. button:disabled {
  319. background-color: #cccccc;
  320. color: #666666;
  321. cursor: not-allowed;
  322. }
  323. .container {
  324. display: flex;
  325. flex-direction: column;
  326. justify-content: center;
  327. align-items: center;
  328. }
  329. .content {
  330. margin-top: auto;
  331. }
  332. .box {
  333. height: 400px;
  334. width: 100%;
  335. background-image: url('img/rectangle-7.png');
  336. background-repeat: no-repeat;
  337. background-position: center;
  338. }
  339. .summary {
  340. clear: both;
  341. width: 93%;
  342. height: 20px;
  343. display: block;
  344. background-color: rgb(163, 0, 51);
  345. color: white;
  346. border-radius: 10px 10px 0 0;
  347. }
  348. </style>
  349. <script>
  350. $(document).ready(function () {
  351. var timer = 1000;
  352. var frissites = setInterval(function () {
  353. var currentDate = new Date(Date.now());
  354. var formattedDate = currentDate.getFullYear() + '-' +
  355. ('0' + (currentDate.getMonth() + 1)).slice(-2) + '-' +
  356. ('0' + currentDate.getDate()).slice(-2) + ' ' +
  357. ('0' + currentDate.getHours()).slice(-2) + ':' +
  358. ('0' + currentDate.getMinutes()).slice(-2) + ':' +
  359. ('0' + currentDate.getSeconds()).slice(-2);
  360. $('.refreshThis').html(formattedDate);
  361. }, timer);
  362. $('.entitiesChk').change(function () {
  363. $('#statementlists').submit();
  364. });
  365. var elements = document.getElementsByClassName('submitFormLink');
  366. for (var i = 0; i < elements.length; i++) {
  367. elements[i].addEventListener('click', function (event) {
  368. event.preventDefault();
  369. var form = document.getElementById('statementlists');
  370. var actionValue = form.getAttribute('action');
  371. var clickedElementValue = this.getAttribute('data-value');
  372. lastIndex = actionValue.lastIndexOf('&');
  373. var trimmedQueryString = actionValue.substring(0, lastIndex);
  374. form.action = trimmedQueryString + '&id=' + clickedElementValue;
  375. document.getElementById('statementlists').submit();
  376. });
  377. }
  378. });
  379. function giveMeUserData(id) {
  380. var divDisplay = $('#commissiondata_' + id).css("display"); // Az "myDiv" div display tulajdonságának lekérése
  381. if (divDisplay === "none") {
  382. $('#commissiondata_' + id).slideDown();
  383. $('#commissiondata_' + id).css('display', 'block');
  384. $('#span_' + id).removeClass('fa-angle-down').addClass('fa-angle-up');
  385. } else {
  386. $('#commissiondata_' + id).slideUp();
  387. $('#span_' + id).removeClass('fa-angle-up').addClass('fa-angle-down');
  388. //$('#commissiondata_' + id).css('display', 'none');
  389. }
  390. }
  391. function checkAll() {
  392. var checkbox = document.getElementById("allOptions");
  393. var optionsCheckboxes = document.querySelectorAll(".options");
  394. if (checkbox.checked) {
  395. $("#confirmsettlements").css('display', 'block');
  396. for (var i = 0; i < optionsCheckboxes.length; i++) {
  397. optionsCheckboxes[i].checked = true;
  398. }
  399. } else {
  400. $("#confirmsettlements").css('display', 'none');
  401. for (var i = 0; i < optionsCheckboxes.length; i++) {
  402. optionsCheckboxes[i].checked = false;
  403. }
  404. }
  405. }
  406. function checkOptions() {
  407. var optionsCheckboxes = document.querySelectorAll(".options");
  408. var vanBejelolt = false;
  409. for (var i = 0; i < optionsCheckboxes.length; i++) {
  410. if (optionsCheckboxes[i].checked) {
  411. vanBejelolt = true;
  412. break;
  413. }
  414. }
  415. if (vanBejelolt) {
  416. $("#confirmsettlements").css('display', 'block');
  417. } else {
  418. $("#confirmsettlements").css('display', 'none');
  419. var checkbox = document.getElementById("allOptions");
  420. checkbox.checked = false;
  421. }
  422. }
  423. </script>