Skip to content

Commit

Permalink
Add bulk attendance routine
Browse files Browse the repository at this point in the history
  • Loading branch information
notrinos authored Jul 29, 2018
1 parent 53cd7c4 commit e9f774d
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions manage/attendance.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
$page_security = 'SA_EMPL';
$path_to_root = '../../..';

include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . '/includes/session.inc');
add_access_extensions();

$js = '';
Expand Down Expand Up @@ -70,8 +70,9 @@ function can_process() {

start_table(TABLESTYLE_NOBORDER);
start_row();
date_cells(_('Date').':', 'AttDate');
date_cells(_('Date').':', 'AttDate', _('Date of attendance'));
department_list_cells(_('For department').':', 'DeptId', null, _('All departments'), true);
submit_cells('bulk', _('Bulk'), '', _('Record all as regular work'), true);
end_row();
end_table(1);

Expand All @@ -89,28 +90,40 @@ function can_process() {

$th = array_merge($initial_cols, $remaining_cols);
$employees = db_query(get_employees(false, false, get_post('DeptId')));

$emp_ids = array();

$k = 0;
foreach ($employees as $emp) {
$emp_ids[$k] = $emp['emp_id'];
$k++;
}

if(isset($_POST['bulk'])) {
foreach($emp_ids as $id) {
if(get_post($id) == 1)
$_POST[$id.'-0'] = $Work_hours;
else
$_POST[$id.'-0'] = '';
}
$Ajax->activate('_page_body');
}

table_header($th);

$k=0;
while($employee = db_fetch($employees)) {
foreach($employees as $employee) {

start_row();
label_cell($employee['emp_id']);
label_cell($employee['emp_id'].checkbox(null, $employee['emp_id'], isset($_POST[$employee['emp_id']]) ? $_POST[$employee['emp_id']] : 1));
label_cell($employee['name']);
$name1 = $employee['emp_id'].'-0';
text_cells(null, $name1, null, 10, 10);
$emp_ids[$k] = $employee['emp_id'];

$i=0;
while($i < count($remaining_cols)) {
$name2 = $employee['emp_id'].'-'.$overtime_id[$i];
text_cells(null, $name2, null, 10, 10);
$i++;
}
$k++;
end_row();
}

Expand Down Expand Up @@ -168,4 +181,4 @@ function can_process() {
}

end_form();
end_page();
end_page();

0 comments on commit e9f774d

Please sign in to comment.