-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
173 lines (148 loc) · 5.95 KB
/
Copy pathindex.php
File metadata and controls
173 lines (148 loc) · 5.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?php /* HISTORY $Id: index.php,v 1.1.1.1 2003/12/04 17:54:58 iexposure Exp $ */
##
## Reports module
## (c) Copyright 2003
## Internet Exposure
## Authors: Daniel Kigelman and Alex Yakushev
##
// check permissions
$denyRead = getDenyRead( $m );
$denyEdit = getDenyEdit( $m );
if ($denyRead) {
$AppUI->redirect( "m=help&a=access_denied" );
}
$AppUI->savePlace();
// setup the title block
$titleBlock = new CTitleBlock( 'Reports', 'applet3-48.png', $m, "$m.$a" );
$titleBlock->show();
if (isset( $_GET['tab'] )) {
$AppUI->setState( 'ReportsVwTab', $_GET['tab'] );
}
$tab = $AppUI->getState( 'ReportsVwTab' ) !== NULL ? $AppUI->getState( 'ReportsVwTab' ) : 0;
//save billing report settings
if ( is_null( $AppUI->getState( 'start_date_billing' ) ) ) {
setDateRange( $default_start_date, $default_end_date );
$AppUI->setState( 'start_date_billing', $default_start_date );
$AppUI->setState( 'end_date_billing', $default_end_date );
}
if ( is_null( $AppUI->getState( 'start_date_payroll' ) ) ) {
setDateRange( $default_start_date, $default_end_date );
$AppUI->setState( 'start_date_payroll', $default_start_date );
$AppUI->setState( 'end_date_payroll', $default_end_date );
}
if ( isset( $_POST['format_end_date_billing'] ) ) {
$AppUI->setState( 'end_date_billing', @$_POST['format_end_date_billing'] );
}
if ( isset( $_POST['format_start_date_billing'] ) ) {
$AppUI->setState( 'start_date_billing', @$_POST['format_start_date_billing'] );
}
if ( isset( $_POST['task'] ) ) {
$AppUI->setState( 'billing_report_task' , @$_POST['task'] );
}
if ( isset( $_POST['project'] ) ) {
$AppUI->setState( 'billing_report_project' , @$_POST['project'] );
}
if ( isset( $_POST['company'] ) ) {
$AppUI->setState( 'billing_report_company' , @$_POST['company'] );
}
if ( isset( $_POST['department'] ) ) {
$AppUI->setState( 'billing_report_department' , @$_POST['department'] );
}
if ( isset( $_POST['employee'] ) ) {
$AppUI->setState( 'billing_report_employee' , @$_POST['employee'] );
}
if ( isset( $_POST['do_billing_report'] ) ) {
$AppUI->setState( 'show_details_billing', is_null( @$_POST['showDetails'] ) ? 0: 1 );
$AppUI->setState( 'list_by_task_billing', is_null( @$_POST['listByTask'] ) ? 0: 1 );
$AppUI->setState( 'list_by_project_billing', is_null( @$_POST['listByProject'] ) ? 0: 1 );
$AppUI->setState( 'list_by_company_billing', is_null( @$_POST['listByCompany'] ) ? 0: 1 );
$AppUI->setState( 'list_by_department_billing', is_null( @$_POST['listByDepartment'] ) ? 0: 1 );
$AppUI->setState( 'list_by_employee_billing', is_null( @$_POST['listByEmployee'] ) ? 0: 1 );
}
//set default values for checkboxes on billing tab to true
if ( $AppUI->getState( 'list_by_task_billing' ) === NULL ) {
$AppUI->setState( 'list_by_task_billing', 1 );
}
if ( $AppUI->getState( 'list_by_project_billing' ) === NULL ) {
$AppUI->setState( 'list_by_project_billing', 1 );
}
if ( $AppUI->getState( 'list_by_company_billing' ) === NULL ) {
$AppUI->setState( 'list_by_company_billing', 1 );
}
if ( $AppUI->getState( 'list_by_department_billing' ) === NULL ) {
$AppUI->setState( 'list_by_department_billing', 1 );
}
if ( $AppUI->getState( 'list_by_employee_billing' ) === NULL ) {
$AppUI->setState( 'list_by_employee_billing', 1 );
}
//save payroll report settings
if ( isset( $_POST['do_payroll_report'] ) ) {
$AppUI->setState( 'show_timesheet_payroll', is_null( @$_POST['showTimesheet'] ) ? 0 : 1 );
$AppUI->setState( 'show_project_payroll', is_null( @$_POST['showProject'] ) ? 0 : 1 );
$AppUI->setState( 'show_work_categories_payroll', is_null( @$_POST['showWorkCategories'] ) ? 0 : 1 );
$AppUI->setState( 'show_work_category_column', is_null( @$_POST['showWorkCategoryColumn'] ) ? 0 : 1 );
$AppUI->setState( 'show_billing_category_column', is_null( @$_POST['showBillingCategoryColumn'] ) ? 0 : 1 );
}
//set default values for checkboxes on payroll tab to true
if ( $AppUI->getState( 'show_timesheet_payroll' ) === NULL ) {
$AppUI->setState( 'show_timesheet_payroll', 1 );
}
if ( $AppUI->getState( 'show_project_payroll' ) === NULL ) {
$AppUI->setState( 'show_project_payroll', 1 );
}
if ( $AppUI->getState( 'show_work_categories_payroll' ) === NULL ) {
$AppUI->setState( 'show_work_categories_payroll', 1 );
}
if ( isset( $_POST['employee_payroll'] ) ) {
$AppUI->setState( 'employee_payroll', $_POST['employee_payroll'] );
}
if ( isset( $_POST['format_start_date_payroll'] ) ) {
$AppUI->setState( 'start_date_payroll', $_POST['format_start_date_payroll'] );
}
if ( isset( $_POST['format_end_date_payroll'] ) ) {
$AppUI->setState( 'end_date_payroll', $_POST['format_end_date_payroll'] );
}
$tabBox = new CTabBox( "?m=reports", "./modules/reports/", $tab );
$tabBox->add( 'vw_payroll', 'Payroll' );
$tabBox->add( 'vw_billing', 'Billing' );
$tabBox->show();
if (isset( $_POST['do_payroll_report'])) { // payroll report!!
// check for hackers first
if (($AppUI->user_type == 0 or $AppUI->user_type == 7) and ($AppUI->getState('employee_payroll') != $AppUI->user_id)) {
$AppUI->redirect( "m=help&a=access_denied" );
}
// all good, prepare for take-off.
require( dPgetConfig( 'root_dir' )."/modules/reports/payroll.php" );
}
if (isset( $_POST['do_billing_report'])) { // billing report!!
// check for hackers first
if (($AppUI->user_type == 0 or $AppUI->user_type == 7) and ($AppUI->getState('billing_report_employee') != $AppUI->user_id) ) {
$AppUI->redirect( "m=help&a=access_denied" );
} else {
if (!$AppUI->getState('list_by_employee_billing'))
$AppUI->redirect( "m=help&a=access_denied" );
}
// all good, prepare for take-off.
require( dPgetConfig( 'root_dir' )."/modules/reports/billing.php" );
}
function setDateRange( &$start_date, &$end_date ) {
//get today's date
$dt = new CDate();
if ( $dt->getDay() >= 15 ) {
$ds = $dt;
$ds->addMonths(-1);
$ds->setDay(26);
$de = $dt;
$de->setDay(8);
} else {
$ds = $dt;
$ds->addMonths(-1);
$ds->setDay(9);
$de = $dt;
$de->addMonths(-1);
$de->setDay(26);
}
$start_date = $ds->format( FMT_TIMESTAMP_DATE );
$end_date = $de->format( FMT_TIMESTAMP_DATE );
}
?>