In the TIME TOTAL CALCULATION SUBROUTINE i need to take the SQL fields (start_hour, start_minute, end_hour, end_minute) from a row consistion of (oid,emp_id,date,f_name,l_name,start_hour, start_minute,start_stamp, end_hour, end_minute, end_stamp, comment).
Then update the 'total_time' field WHERE oid = $sav_oid Field with that total. Oh yes. 24 hour format would be good.
#!/usr/bin/perl
### clock_out.cgi
use CGI qw/:standard/;
require "common.sub";
$oid = $ENV{QUERY_STRING};
$sav_oid = $oid;
$end_hour = &filter(param(hour));
$end_minute = &filter(param(minute));
$comment = &filter(param(comment));
print header;
&Create_DB_Connection;
&clock_out;
&print_output;
# Disconnect from the database
$sth->finish;
$dbh->disconnect;
################ BEGIN CLOCKOUT SUBROUTINE
sub clock_out{
$SQL = "UPDATE timeclock SET
end_hour = '$hour',
end_minute = '$minute',
end_stamp = CURRENT_TIMESTAMP,
WHERE
oid = '$sav_oid'
";
&Do_SQL;
} # End of clock_out
################ END CLOCKOUT SUBROUTINE
################ BEGIN TIME TOTAL CALCULATION SUBROUTINE
sub calc_total{
$SQL = "select oid,* FROM timeclock WHERE oid = $sav_oid";
&Do_SQL;
################ END WRITE DATA SUBROUTINE
################ BEGIN PRINT OUTPUT SUBROUTINE
sub print_output{
print<<HTML;
<BODY BGCOLOR="#F1EDD3">
<CENTER><FONT SIZE=5 FACE=ARIAL>
Record added to database
<P>
<CENTER>
</CENTER>
</P>
</FONT></CENTER>
</BODY></HTML>
HTML
} # End of subroutine
################ END PRINT OUTPUT SUBROUTINE
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.