while (@row = $sth->fetchrow()){ $total_minutes = $row[5]; $total_hours = $row[4] * 60; #multiply hours by 60 to get minute +s $all_minutes = $total_hours + $total_minutes; $total_time = $total_time + $all_minutes; $total_time_hours += int($total_time / 60); $total_time_minutes = $total_time % 60; $all_time = "$total_time_hours:$total_time_minutes"; ## Make our HTML look better if no data. $row[0] = " " if($row[0] eq ""); $row[1] = " " if($row[1] eq ""); $row[2] = " " if($row[2] eq ""); $row[3] = " " if($row[3] eq ""); $row[4] = " " if($row[4] eq ""); $row[5] = " " if($row[5] eq ""); $row[6] = " " if($row[6] eq ""); @date_array01 = split(/ /,$row[2]); $print_date = $date_array01[0]; $in_time_sec = $date_array01[1]; @in_time_array = split(/:/,$in_time_sec); $in_time = join(":",$in_time_array[0],$in_time_array[1]); @date_array02 = split(/ /,$row[3]); $out_time_sec = $date_array02[1]; @out_time_array = split(/:/,$out_time_sec); $out_time = join(":",$out_time_array[0],$out_time_array[1]); print <<HTML; <TR BGCOLOR="#FFFFFF"> <TD><FONT SIZE=2 FACE=ARIAL>$print_date</FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$in_time</FONT></TD> <TD><FONT SIZE=2 FACE=ARIAL>$out_time</FONT></TD> <TD BGCOLOR="#FFFFCC"><FONT SIZE=2 FACE=ARIAL>$row[4]:$row[5]</FON +T></TD> <TD><FONT SIZE=2 FACE=ARIAL>$row[6]</FONT></TD> HTML } # End of while. print<<HTML; </TR><tr> <td BGCOLOR="#eecb27" colspan=2></TD> <td><B>Total Time:</B></TD><td bgcolor=#FFFF99><B>$all_time</B></TD>
In reply to Time Totaling re-explained by nlafferty
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |