Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Time Card Processing
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01323531
Message ID:
01323542
Views:
13
I have tried that also, and end up with weird results; sometimes this puts the worked hours ahead by 1 or behind by 1. See the below code.

By the way, I wonder if you've ever heard of my Norwegian friend, Bjorn Stokke? He was the Captain of his Ship (Military SeaLift Command) several years back; I met him during the Operation Desert Shield/Desert Storm timeframe (1990-1991). I watched him drink more than any other man I had ever seen drink and then he walked up the gangway, while I prayed he wouldn't fall into the water. :)
* Convert the END HOUR and END MINUTE into END MINUTES.
iActualEndMinutes=(60 * VAL(cActualEndHour)) + VAL(cActualEndMinute)

* Convert the Effective START HOUR and Effective START MINUTE into Effective Start Minutes.
iEffectiveStartMinutes = (60 * VAL(cEffectiveStartHour)) + VAL(cEffectiveStartMinute)
iTotalEffectiveMinutes=(iActualEndMinutes - iEffectiveStartMinutes)
iActualShiftHours=(iTotalEffectiveMinutes/60)
iTotalActualShiftHours=INT(iActualShiftHours)
cScheduledEndHour=STR(VAL(cEffectiveStartHour) + iTotalActualShiftHours)
cScheduledEndMinute=cScheduledStartMinute
* Check the 24 hour time and correct it, if necessary.
cScheduledEndHour=;
	IIF(VAL(cScheduledEndHour)>23,STR(VAL(cScheduledEndHour)-24),cScheduledEndHour)
iScheduledEndMinutes=(60 * VAL(cScheduledEndHour)) + VAL(cScheduledEndMinute)
iEarlyOrLateMinutes=(iScheduledEndMinutes - iActualEndMinutes)

*********************************************
*** (9F) CLOCK-OUT - EARLY OR LATE TESTS. ***
*********************************************
DO CASE
   CASE iEarlyOrLateMinutes > 0	&& Employee clocked out EARLY. Ex: 13:59.
      cEffectiveEndHour=STR(VAL(cActualEndHour) - iAdjustEndHours)
      *cEffectiveEndHour=STR(VAL(cScheduledEndHour) - iAdjustEndHours)
      cEffectiveEndMinute=cActualEndMinute
*	cEffectiveEndMinute=STR(iActualEndMinutes + iEarlyOrLateMinutes - (60 * VAL(cActualEndHour)))	
		
   CASE iEarlyOrLateMinutes < -15	&& Employee clocked out over 15 minutes LATE. Ex: 14:16.
      cEffectiveEndHour=STR(VAL(cActualEndHour) - iAdjustEndHours)
      *cEffectiveEndMinute=STR(iActualEndMinutes - iEarlyOrLateMinutes - (60 * VAL(cActualEndHour)))
      cEffectiveEndMinute=cActualEndMinute

   OTHERWISE  && Normal Shift End.
      cEffectiveEndHour=cScheduledEndHour
      cEffectiveEndMinute=cScheduledEndMinute
ENDCASE
cEffectiveEndHour=ALLTRIM(cEffectiveEndHour)
cEffectiveEndMinute=ALLTRIM(cEffectiveEndMinute)
************************************************************
* (9G) Put together complete END Time from the above code.
***************************************************************************
cEffectiveEndTime=;
   PADL(ALLTRIM(cEffectiveEndHour),2,"0")-':'-PADL(ALLTRIM(cEffectiveEndMinute),2,"0")

nPayHours=;
  (1440 * (dClockedOut - dClockedIn)) + ;
  60*VAL(SUBSTR(cEffectiveEndTime,1,2))+VAL(SUBSTR(cEffectiveEndTime,4,2))- ;
  60*VAL(SUBSTR(cEffectiveStartTime,1,2))-VAL(SUBSTR(cEffectiveStartTime,4,2))

nPayHours = IIF(nPayHours < 0, 1440 + nPayHours, nPayHours)/60
nPayHours = ROUND(nPayHours, 2)
>Instead of adding 8 hours, add the appropriate number of hours, taken from the empoyee's data.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform