I did this for my employee timeclock program of my POS... it is pretty simple.
Are you writing a POS or timesheet program?
I stored all values in a DB file in RAW date() format then i read them when needed and performed tthe following matth on them:
Code: Select all
cin$ = GetDatabaseString(#DatabaseEMPLOYEE,3)
time0 = Val(cin$)
cin$ = FormatDate(mask$,time0)
b1o$ = GetDatabaseString(#DatabaseEMPLOYEE,4)
time1 = Val(b1o$)
b1o$ = FormatDate(mask$,time1)
b1n$ = GetDatabaseString(#DatabaseEMPLOYEE,5)
time2 = Val(b1n$)
b1n$ = FormatDate(mask$,time2)
lunchout$ = GetDatabaseString(#DatabaseEMPLOYEE,6)
time3 = Val(lunchout$)
lunchout$ = FormatDate(mask$,time3)
lunchin$ = GetDatabaseString(#DatabaseEMPLOYEE,7)
time4 = Val(lunchin$)
lunchin$ = FormatDate(mask$,time4)
b2o$ = GetDatabaseString(#DatabaseEMPLOYEE,8)
time5 = Val(b2o$)
b2o$ = FormatDate(mask$,time5)
b2n$ = GetDatabaseString(#DatabaseEMPLOYEE,9)
time6 = Val(b2n$)
b2n$ = FormatDate(mask$,time6)
cout$ = GetDatabaseString(#DatabaseEMPLOYEE,10)
time7 = Val(cout$)
cout$ = FormatDate(mask$,time7)
tsecs$ = GetDatabaseString(#DatabaseEMPLOYEE,11)
status$ = GetDatabaseString(#DatabaseEMPLOYEE,12)
checknumber$ = GetDatabaseString(#DatabaseEMPLOYEE,13)
basetime = time7 - time0 ; seconds between CIN and COUT (clock in and clock OUT!)
b1 = time2 - time1 ; don't forget the breaks!
lunch = time4 - time3
b2 = time5 - time6
subby = b1 + lunch + b2
tsec = basetime - subby
secs$ = Str(tsec)
Seconds = tsec % 60
Minutes = tsec % (60 * 60) / 60
Hours = tsec % (60 * 60 * 60) / (60 * 60)
sec$ = Str(Seconds)
min$ = Str(Minutes)
hrs$ = Str(Hours)
tsecs$ = hrs$+":"+min$+":"+sec$
If you have a client in Colorado... Version 8 is due out but unless she actually READS the instructions and WATCHES your training Videos she is going to make many terrible mistakes!!!
