index.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. if (cfr('SALARYTSHEETS')) {
  3. $altcfg = $ubillingConfig->getAlter();
  4. if ($altcfg['SALARY_ENABLED']) {
  5. $greed = new Avarice();
  6. $beggar = $greed->runtime('SALARY');
  7. if (!empty($beggar)) {
  8. $salary = new Salary();
  9. //creating of new timesheet
  10. if (wf_CheckPost(array('newtimesheet', 'newtimesheetdate', '_employeehours'))) {
  11. $tsSheetCreateResult = $salary->timesheetCreate();
  12. if ($tsSheetCreateResult == 0) {
  13. //succeful creation
  14. rcms_redirect('?module=salary_timesheets');
  15. } else {
  16. if ($tsSheetCreateResult == 1) {
  17. //date duplicate
  18. show_error(__('Timesheets with that date already exist'));
  19. }
  20. }
  21. }
  22. $tsCf = $salary->timesheetCreateForm();
  23. if ($tsCf) {
  24. $timesheetsControls = wf_modal(web_add_icon() . ' ' . __('Create'), __('Create') . ' ' . __('Timesheet'), $tsCf, 'ubButton', '800', '600');
  25. show_window('', $timesheetsControls);
  26. if (!wf_CheckGet(array('showdate'))) {
  27. //render available timesheets list by date
  28. show_window(__('Timesheets'), $salary->timesheetsListRender('?module=salary_timesheets'));
  29. } else {
  30. //saving changes for single timesheet row
  31. if (wf_CheckPost(array('edittimesheetid'))) {
  32. $salary->timesheetSaveChanges();
  33. rcms_redirect('?module=salary_timesheets&showdate=' . $_GET['showdate']);
  34. }
  35. //render timesheet by date (edit form)
  36. show_window(__('Timesheet') . ' ' . $_GET['showdate'], $salary->timesheetEditForm($_GET['showdate']));
  37. show_window('', wf_BackLink('?module=salary_timesheets'));
  38. }
  39. } else {
  40. show_warning(__('No available workers for timesheets'));
  41. }
  42. } else {
  43. show_error(__('No license key available'));
  44. }
  45. } else {
  46. show_error(__('This module is disabled'));
  47. }
  48. } else {
  49. show_error(__('Permission denied'));
  50. }