How do you do an overtime counter?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have been able to make my code calculate the difference between two various times depending on the time a button is clicked.. button1 brings up StartTime and button2 will bring up EndTime, Diff and Overtime;
<pre class="prettyprint lang-vb" style="font-size:12px Dim Diff As DateTime
Diff = (EndTime - StartTime.Subtract(TimeSpan))[/code]
This data is then displayed in a data grid.
Now, on a separate column, I have Overtime and I want this to work by - recalling a variable from mySQL (lets call it MaxHours).
So say if MaxHours for one employee = 9 hours and the difference between StartTime and EndTime = 12 hours
Then I would like for the columns to display as Diff = 9 Hours and Overtime = 3 hours
Heres some pseudo code;
<pre class="prettyprint" style="font-size:12px If Diff > MaxHours Then
Overtime = diff - MaxHours
Display Overtime [/code]
I think it may be something like that, but Im not sure. Any ideas?
<br/>


View the full article
 
Back
Top