settlementshotelsindex.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. <?php
  2. $res = 0;
  3. // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
  4. if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
  5. $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
  6. }
  7. // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
  8. $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
  9. $tmp2 = realpath(__FILE__);
  10. $i = strlen($tmp) - 1;
  11. $j = strlen($tmp2) - 1;
  12. while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
  13. $i--;
  14. $j--;
  15. }
  16. if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
  17. $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
  18. }
  19. if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
  20. $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
  21. }
  22. // Try main.inc.php using relative path
  23. if (!$res && file_exists("../main.inc.php")) {
  24. $res = @include "../main.inc.php";
  25. }
  26. if (!$res && file_exists("../../main.inc.php")) {
  27. $res = @include "../../main.inc.php";
  28. }
  29. if (!$res && file_exists("../../../main.inc.php")) {
  30. $res = @include "../../../main.inc.php";
  31. }
  32. if (!$res) {
  33. die("Include of main fails");
  34. }
  35. require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
  36. require_once DOL_DOCUMENT_ROOT . '/user/class/usergroup.class.php';
  37. require_once DOL_DOCUMENT_ROOT . '/custom/financialreport/class/userinvoice.class.php';
  38. require_once DOL_DOCUMENT_ROOT . '/custom/settlements/class/groupusers.class.php';
  39. require_once DOL_DOCUMENT_ROOT . '/custom/financialreport/class/helper.class.php';
  40. require_once DOL_DOCUMENT_ROOT . '/custom/bbus/class/commissionhandler.class.php';
  41. require_once DOL_DOCUMENT_ROOT . '/custom/bbus/class/userloginnaplo.class.php';
  42. $helper = new HelperUserInvoice($db);
  43. $commmissionhandler = new CommissionHandler();
  44. $userLoginNaploObj = new UserLoginNaplo($db);
  45. // Load translation files required by the page
  46. $langs->loadLangs(array("financialreport@financialreport"));
  47. $action = GETPOST('action', 'aZ09');
  48. $cancel = GETPOST('cancel', 'int');
  49. $id = GETPOST('id', 'int');
  50. $idmenu = GETPOST('idmenu', 'int');
  51. $daterange = GETPOST('daterange', 'alpha');
  52. $datepicker = GETPOST('datepicker', 'alpha');
  53. $interval = GETPOST('interval', 'alpha');
  54. $array = GETPOST('array', 'array');
  55. $options = GETPOST('options', 'array');
  56. if ($daterange == '' && $datepicker == '') {
  57. $now = dol_now();
  58. $daterange = date('Y-m-01') . ' - ' . date('Y-m-t');
  59. $isSetDatepicker = true;
  60. } else {
  61. $daterange = $daterange != '' ? $daterange : $datepicker;
  62. $isSetDatepicker = $datepicker != '';
  63. }
  64. $daterangeString = $helper->createDaterangeString($daterange);
  65. $socid = GETPOST('socid', 'int');
  66. if (isset($user->socid) && $user->socid > 0) {
  67. $action = '';
  68. $socid = $user->socid;
  69. }
  70. $form = new Form($db);
  71. $formfile = new FormFile($db);
  72. $groupHotels = $helper->getGroupHotels();
  73. include DOL_DOCUMENT_ROOT . '/custom/financialreport/core/actions_addupdatedelete.inc.php';
  74. $title = '';
  75. $help_url = '';
  76. $morejs = '';
  77. $morecss = '';
  78. llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
  79. $url = $_SERVER["PHP_SELF"] . "?id={$id}";
  80. print '<form method="POST" id="statementlists" action="' . $url . '">' . "\n";
  81. print '<input type="hidden" name="token" value="' . newToken() . '">';
  82. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  83. print '<input type="hidden" name="action" value="list">';
  84. /*print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
  85. print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
  86. print '<input type="hidden" name="page" value="' . $page . '">';
  87. print '<input type="hidden" name="contextpage" value="' . $contextpage . '">';*/
  88. print '<input type="hidden" name="datepickerdata" value="' . $daterange . '">';
  89. print '<input type="hidden" name="intervalchk" value="' . $interval . '">';
  90. $now = date('Y.m.d', dol_now());
  91. print load_fiche_titre($langs->trans("HotelGroupFinancialReport"), '', 'financialreport@financialreport');
  92. include DOL_DOCUMENT_ROOT . '/custom/financialreport/core/tpl/daterangehoteldiv.tpl.php';
  93. $entity = 4;
  94. $hotelsArray = $helper->getAllHotels();
  95. //---------------------------------------------
  96. # 1
  97. //---------------------------------------------
  98. foreach ($groupHotels as $record) {
  99. $usersList = $helper->getUsersList($record['fk_group_id'], $daterange, $entity);
  100. $usersIdList = $helper->getUsersIdList($record['fk_group_id'], $daterange, $entity);
  101. $AllAmountHUFInPeriod = $helper->getAllAmountInPeriod($record['fk_group_id'], $daterange, 'HUF', $usersIdList, $entity);
  102. $AllAmountEURInPeriod = $helper->getAllAmountInPeriod($record['fk_group_id'], $daterange, 'EUR', $usersIdList, $entity);
  103. $AllCommissionHUFInPeriod = $helper->getAllCommissionInPeriod($record['fk_group_id'], $daterange, 'HUF', $usersIdList, $entity);
  104. $AllCommissionEURHUFInPeriod = $helper->getAllCommissionInPeriod($record['fk_group_id'], $daterange, 'EUR', $usersIdList, $entity);
  105. print '<div class="" style="width:100%;float:left; margin-left: 10px;">';
  106. print '<table class="center" style="width:100%;">';
  107. //print '<tr style="width: 100%; height: 40px; background-color: lightgrey;"><td colspan="' . $colspan . '">' . $langs->trans("settlements") . '</td></tr>';
  108. print '<tr class="statementtitles"><td colspan="3"><div class="groupTitle">' . $record['groulabel'] . '<br>' . $record['hotellabel'] . '</div></td></tr>
  109. <tr><td colspan="4">' . $daterangeString . '</td></tr>
  110. <tr><td colspan="4">&nbsp;</td></tr>
  111. <tr class="statementtitles"><td style="width:50%;">' . $langs->trans('Incomes') . '</b></td><td style="width:50%;"><b>' . $langs->trans('Commissions') . '</b></td></tr>
  112. <tr class="redcolor"><td>' . $helper->correctNumber($AllAmountHUFInPeriod) . ' HUF</td><td>' . $helper->correctNumber($AllCommissionHUFInPeriod) . ' HUF</td></tr>
  113. <tr class="redcolor"><td>' . $helper->correctNumber($AllAmountEURInPeriod) . ' EUR</td><td>' . $helper->correctNumber($AllCommissionEURHUFInPeriod) . ' HUF</td></tr>
  114. <tr><td colspan="3"><div class="closer"></div></td></tr>
  115. <tr><td>&nbsp;</td></tr>
  116. </table>';
  117. print '</div>';
  118. }
  119. $colspan = 2;
  120. print '</form>' . "\n";
  121. // End of page
  122. llxFooter();
  123. $db->close();
  124. ?>
  125. <style>
  126. .groupTitle {
  127. height: 50px;
  128. width: 100%;
  129. background-color: rgb(163, 0, 51);
  130. color: white !important;
  131. border-radius: 10px 10px 0 0;
  132. padding-top: 10px;
  133. }
  134. .closer {
  135. height: 20px;
  136. width: 100%;
  137. border-radius: 0 0 10px 10px;
  138. border-right: 2px solid lightgrey;
  139. border-left: 2px solid lightgrey;
  140. border-bottom: 2px solid lightgrey;
  141. }
  142. .shadow {}
  143. .statementtitles {
  144. font-size: 15px;
  145. font-weight: bold;
  146. text-transform: uppercase;
  147. }
  148. .redcolor {
  149. color: rgb(163, 0, 51);
  150. font-weight: bold;
  151. font-size: 20px;
  152. }
  153. .smallredcolor {
  154. color: rgb(163, 0, 51);
  155. font-weight: normal;
  156. }
  157. button {
  158. width: 200px;
  159. height: 30px;
  160. background-color: rgb(163, 0, 51);
  161. color: white;
  162. border-radius: 20px;
  163. border: none;
  164. cursor: pointer;
  165. }
  166. button:disabled {
  167. background-color: #cccccc;
  168. color: #666666;
  169. cursor: not-allowed;
  170. }
  171. .container {
  172. display: flex;
  173. flex-direction: column;
  174. justify-content: center;
  175. align-items: center;
  176. }
  177. .content {
  178. margin-top: auto;
  179. }
  180. .box {
  181. height: 220px;
  182. width: 100%;
  183. background-image: url('img/rectangle-6.png');
  184. background-repeat: no-repeat;
  185. background-position: center;
  186. }
  187. </style>
  188. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css">
  189. <script src="https://cdn.jsdelivr.net/npm/moment"></script>
  190. <script src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
  191. <script>
  192. function giveMeUserData(id) {
  193. var divDisplay = $('#commissiondata_' + id).css("display"); // Az "myDiv" div display tulajdonságának lekérése
  194. if (divDisplay === "none") {
  195. $('#commissiondata_' + id).slideDown();
  196. $('#commissiondata_' + id).css('display', 'block');
  197. $('#span_' + id).removeClass('fa-angle-down').addClass('fa-angle-up');
  198. } else {
  199. $('#commissiondata_' + id).slideUp();
  200. $('#span_' + id).removeClass('fa-angle-up').addClass('fa-angle-down');
  201. //$('#commissiondata_' + id).css('display', 'none');
  202. }
  203. }
  204. var datepickerdata = document.querySelector('input[type="hidden"][name="datepickerdata"]');
  205. var interval = document.querySelector('input[type="hidden"][name="intervalchk"]');
  206. var checkbox = document.querySelector('input[type="checkbox"][name="interval"]');
  207. var datepickerinput = document.querySelector('input[type="text"][name="datepicker"]');
  208. var daterangeinput = document.querySelector('input[type="text"][name="daterange"]');
  209. if (interval.value == 'on') {
  210. checkbox.checked = true;
  211. checkStatus();
  212. daterangeinput.value = datepickerdata.value;
  213. }
  214. datepickerinput.value = datepickerdata.value;
  215. function checkStatus() {
  216. var checkbox = document.getElementById("chkbdatepicker");
  217. var isChecked = checkbox.checked;
  218. if (isChecked) {
  219. var datepickerdiv = document.getElementById("datepickerdiv");
  220. var daterangediv = document.getElementById("daterangediv");
  221. datepickerdiv.style.display = "none";
  222. daterangediv.style.display = "block";
  223. datepickerinput.value = '';
  224. daterangeinput.value = '';
  225. } else {
  226. datepickerinput.value = '';
  227. daterangeinput.value = '';
  228. var datepickerdiv = document.getElementById("datepickerdiv");
  229. var daterangediv = document.getElementById("daterangediv");
  230. daterangediv.style.display = "none";
  231. datepickerdiv.style.display = "block";
  232. }
  233. }
  234. var datepicker =
  235. $(function () {
  236. $('#daterange').daterangepicker({
  237. "showDropdowns": true,
  238. "autoUpdateInput": false,
  239. locale: {
  240. format: 'YYYY-MM-DD',
  241. cancelLabel: 'Mégse',
  242. applyLabel: 'OK',
  243. moLabel: 'OK',
  244. firstDay: 1,
  245. "daysOfWeek": [
  246. "Vas",
  247. "Hé",
  248. "Ke",
  249. "Sze",
  250. "Csü",
  251. "Pé",
  252. "Szo"
  253. ],
  254. "monthNames": [
  255. "Január",
  256. "Február",
  257. "Március",
  258. "Április",
  259. "Május",
  260. "Június",
  261. "Július",
  262. "Augsztus",
  263. "Szeptember",
  264. "Október",
  265. "November",
  266. "December"
  267. ],
  268. },
  269. });
  270. });
  271. $(function () {
  272. $('#datepicker').daterangepicker({
  273. "singleDatePicker": true,
  274. "showDropdowns": true,
  275. "autoUpdateInput": false,
  276. locale: {
  277. format: 'YYYY-MM-DD',
  278. cancelLabel: 'Mégse',
  279. applyLabel: 'OK',
  280. moLabel: 'OK',
  281. firstDay: 1,
  282. "daysOfWeek": [
  283. "Vas",
  284. "Hé",
  285. "Ke",
  286. "Sze",
  287. "Csü",
  288. "Pé",
  289. "Szo"
  290. ],
  291. "monthNames": [
  292. "Január",
  293. "Február",
  294. "Március",
  295. "Április",
  296. "Május",
  297. "Június",
  298. "Július",
  299. "Augsztus",
  300. "Szeptember",
  301. "Október",
  302. "November",
  303. "December"
  304. ],
  305. },
  306. });
  307. });
  308. $('input[name="datepicker"]').on('apply.daterangepicker', function (ev, picker) {
  309. $(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
  310. });
  311. $('input[name="datepicker"]').on('cancel.daterangepicker', function (ev, picker) {
  312. $(this).val('');
  313. });
  314. $('input[name="daterange"]').on('apply.daterangepicker', function (ev, picker) {
  315. $(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD'));
  316. });
  317. $('input[name="daterange"]').on('cancel.daterangepicker', function (ev, picker) {
  318. $(this).val('');
  319. });
  320. </script>