Time Clock Report
This page uses a Hashtag List to show Time Clock records.
The table is styled using Bootstrap 3 default theme classes.
Methods are provided to Clock-Out or Delete old records.
An Overall Total Hours calculation is done in the Footer Template.
No Time Clock Records
Processed this Hashtag Markup:
<# start list for timeclock;
sort by start time in descending order;
show 20 rows per page;
#>
<# start header #>
<table class="table table-striped table-hover table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Start Time</th>
<th>End Time</th>
<th class="text-center">Hours</th>
<th>Action</th>
</tr>
</thead>
<# end header #>
<# start row #>
<tr>
<td><# name as html #></td>
<td><# start time as html #></td>
<td><# end time as html #></td>
<td class="text-right"><# hours #></td>
<td>
<# if "<# status #>"=="clocked in" #>
<a href="clock-out?id=<# id #>" class="label label-primary label-action">Clock-Out</a>
<# else #>
<a href="delete?id=<# id #>" class="label label-primary label-action">Delete</a>
<# end if #>
</td>
</tr>
<# end row #>
<# start footer #>
<tfoot>
<tr>
<td colspan="3" class="text-right"><strong>Overall Total:</strong></td>
<# set <# total_hours #> to total of <# hours as timespan #>; #>
<td class="text-right"><strong><# total_hours as time "h:mm:ss" #></strong></td>
<td></td>
</tr>
</tfoot>
</table>
<# end footer #>
<# no results #>
<h4 class="alert alert-warning text-center">No Time Clock Records</h4>
<# end no results #>
<# end list #>
Hashtag Markup for Clock-Out Action:
/timeclock/clock-out
<# update record for "timeclock.<#[url.id]#>";
set end_time to "<#[system.date_time_short]#>";
set hours to <# end_time as timestamp #> - <# start_time as timestamp #> as time "h:mm:ss";
set status to "clocked out";
redirect to "/timeclock/report";
#>
Hashtag Markup for Delete Action:
/timeclock/delete
<# delete record for "timeclock.<#[url.id]#>";
redirect to "/timeclock/report";
#>