-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvw_payroll.php
More file actions
150 lines (127 loc) · 5.42 KB
/
Copy pathvw_payroll.php
File metadata and controls
150 lines (127 loc) · 5.42 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
<?php
// may need so more thought as to which company to pull. (maybe just search for 'internal' type companies)
$is_special = ($AppUI->user_type > 0 and $AppUI->user_type < 7);
$sql = "
SELECT user_id, user_username, user_first_name, user_last_name
FROM users
WHERE user_company = $AppUI->user_company
" . ($is_special ? "" : " and user_id = " . $AppUI->user_id) . "
ORDER by user_last_name, user_first_name
";
$result = db_loadList($sql);
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
?>
<script language="javascript">
function setColor(color) {
var f = document.editFrm;
if (color) {
f.project_color_identifier.value = color;
}
test.style.background = f.project_color_identifier.value;
}
function setShort() {
var f = document.editFrm;
var x = 10;
if (f.project_name.value.length < 11) {
x = f.project_name.value.length;
}
if (f.project_short_name.value.length == 0) {
f.project_short_name.value = f.project_name.value.substr(0,x);
}
}
function checkPayrollFields() {
if ( document.payrollForm.start_date_payroll.value == '' ) {
alert ('Please enter a start date');
return false;
}
if ( document.payrollForm.end_date_payroll.value == '' ) {
alert ('Please enter an end date');
return false;
}
}
var calendarField = '';
function popCalendar( field ){
calendarField = field;
idate = eval( 'document.payrollForm.format_' + field + '.value' );
window.open( 'index.php?m=public&a=calendar&dialog=1&callback=setCalendar&date=' + idate, 'calwin', 'top=250,left=250,width=250, height=220, scollbars=false' );
}
/**
* @param string Input date in the format YYYYMMDD
* @param string Formatted date
*/
function setCalendar( idate, fdate ) {
fld_date = eval( 'document.payrollForm.format_' + calendarField );
fld_fdate = eval( 'document.payrollForm.' + calendarField );
fld_date.value = idate;
fld_fdate.value = fdate;
}
</script>
<form name="payrollForm" action="index.php?m=reports" method="post" onsubmit="return checkPayrollFields()">
<table border="0" width="600">
<tr>
<td>Date Range</td>
<td>
<?php
$fmt_start_date = new CDate( $AppUI->getState( 'start_date_payroll' ) );
$fmt_end_date = new CDate( $AppUI->getState( 'end_date_payroll' ) );
$view_start_date = $fmt_start_date->format( $df );
$view_end_date = $fmt_end_date->format( $df );
?>
<input type="hidden" name="format_start_date_payroll" value="<?php echo $fmt_start_date->format( FMT_TIMESTAMP_DATE );?>">
<input type="text" class="text" name="start_date_payroll" id="date1_payroll" disabled="disabled" value="<?php echo $view_start_date ?>">
<a href="#" onClick="return popCalendar('start_date_payroll', 'y-mm-dd');">
<img src="./images/calendar.gif" width="24" height="12" alt="<?php echo $AppUI->_('Calendar');?>" border="0" />
</a>
-
<input type="hidden" name="format_end_date_payroll" value="<?php echo $fmt_end_date->format( FMT_TIMESTAMP_DATE );?>">
<input type="text" class="text" name="end_date_payroll" id="date2_payroll" disabled="disabled" value="<?php echo $view_end_date ?>">
<a href="#" onClick="return popCalendar('end_date_payroll', 'y-mm-dd');">
<img src="./images/calendar.gif" width="24" height="12" alt="<?php echo $AppUI->_('Calendar');?>" border="0" />
</a>
</td>
</tr>
<?php
if ($is_special) {
echo "\t<tr>\n";
echo "\t\t<td>Employees</td>\n";
echo "\t\t<td>\n";
$selectMe = $AppUI->getState('employee_payroll') ? $AppUI->getState('employee_payroll') : 0;
echo "\t\t\t<select name=\"employee_payroll\" size=\"1\" style=\"width:135px;\" class=\"text\">\n";
echo "\t\t\t\t<option value=\"0\"" . (($selectMe == 0) ? "selected" : "") . "/>All\n";
foreach ($result as $employee) {
$selected = ($employee['user_id'] == $selectMe) ? " selected" : "";
echo "\t\t\t\t<option value=\"" . $employee['user_id'] . "\"" . $selected . " />" . $employee['user_last_name'] . ", " . $employee['user_first_name'] . "\n";
}
echo "\t\t\t</select>\n";
echo "\t\t</td>\n";
echo "\t</tr>\n";
} else {
echo "<input type=\"hidden\" name=\"employee_payroll\" value=\"" . $AppUI->user_id . "\">\n";
}
?>
<tr>
<td>Options</td>
<td>
<?php
$timesheetChecked = $AppUI->getState('show_timesheet_payroll') ? " checked" : "";
$projectChecked = $AppUI->getState('show_project_payroll') ? " checked" : "";
$workCategoriesChecked = $AppUI->getState('show_work_categories_payroll') ? " checked" : "";
$workCategoryColChecked = $AppUI->getState('show_work_category_column') ? " checked" : "";
$billingCategoryColChecked = $AppUI->getState('show_billing_category_column') ? " checked" : "";
?>
<input type="checkbox" name="showTimesheet" value="1" <?php echo $timesheetChecked ?> />Show main report
<input type="checkbox" name="showWorkCategoryColumn" value="1" <?php echo $workCategoryColChecked ?> />Work Category Column
<input type="checkbox" name="showBillingCategoryColumn" value="1" <?php echo $billingCategoryColChecked ?> />Billing Category Column<br />
<input type="checkbox" name="showProject" value="1" <?php echo $projectChecked ?> />Show project totals<br />
<input type="checkbox" name="showWorkCategories" value="1" <?php echo $workCategoriesChecked ?> />Show work category totals
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="submit" name="do_payroll_report" value="Submit" class="button">
</td>
</table>
</form>