-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelapsed_table.php
86 lines (80 loc) · 3.29 KB
/
elapsed_table.php
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
<table border="1" cellpadding="10" style="min-width: 768px; width: 70vw; margin: 10px 0px;">
<caption>
<b>Elapsed Working Time <?php echo empty($withNonCountingTimeRanges) ? '' : ' with Non-counting Time Ranges' ?></b>
<br/>
<span>
<b>From</b> <?php echo $from->toDateTimeString() ?> |
<b>To</b> <?php echo $to->toDateTimeString() ?>
</span>
</caption>
<thead>
<th>Date</th>
<th>Working Time</th>
<th>Break Time</th>
<th>Non-counting Time</th>
<th>Total</th>
</thead>
<tbody>
<?php foreach ($timeMatches as $index => $time) { ?>
<?php
switch ($time['day']) {
case 1: $d = 'Monday'; break;
case 2: $d = 'Tuesday'; break;
case 3: $d = 'Wednesday'; break;
case 4: $d = 'Thursday'; break;
case 5: $d = 'Friday'; break;
case 6: $d = 'Saturday'; break;
case 0: $d = 'Sunday'; break;
default: $d = 'N/A';
}
?>
<tr>
<td>
<?php echo "$d (" . $time['date']->toDateString() . ")" ?>
</td>
<td>
<?php
echo str_pad($time['from_hour'], 2, '0', STR_PAD_LEFT) . ':' .
str_pad($time['from_minute'], 2, '0', STR_PAD_LEFT) . ' - ' .
str_pad($time['to_hour'], 2, '0', STR_PAD_LEFT) . ':' .
str_pad($time['to_minute'], 2, '0', STR_PAD_LEFT);
?>
</td>
<td>
<?php
foreach ((array) array_get($time, 'break') as $break) {
echo str_pad($break['from_hour'], 2, '0', STR_PAD_LEFT) . ':' .
str_pad($break['from_minute'], 2, '0', STR_PAD_LEFT) . ' - ' .
str_pad($break['to_hour'], 2, '0', STR_PAD_LEFT) . ':' .
str_pad($break['to_minute'], 2, '0', STR_PAD_LEFT) . '<br/>';
}
?>
</td>
<td>
<?php
foreach ((array) array_get($time, 'skip') as $skip) {
echo $skip[0]->format('H:i:s') . ' - ' .
(empty($skip[1]) ? '∞' : $skip[1]->format('H:i:s')) . '<br/>';
}
?>
</td>
<td align="right">
<?php
echo "<b>" . $calendar->secondsForHumans($tmp = $time['partial_elapsed']) . "</b>";
echo "<br/>($tmp seconds)";
?>
</td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr style="font-weight: bold">
<td align="right"><b>Total</b></td>
<td colspan="4" align="right">
<?php echo $calendar->secondsForHumans($elapsed) ?>
<br/>
(<?php echo $elapsed ?> seconds)
</td>
</tr>
</tfoot>
</table>