Sei sulla pagina 1di 6

Payroll Simulation

Companies tend to use two broad ways of calculating overtime. Sometimes this may depend on the type of job and the number of shifts considered. In some jobs, people work 9 to 5, onday to !riday. "his is the typical corporate scenario. In some other cases, such as when I worked in a pseudo#health care $mentally challenged% environment, people work & days a week and the shifts rotating on a '(#hour a day basis. )egardless, a week worth of work counts for (* regular hours+ anything above that is considered overtime. "here is a trick that is also applied, not necessarily because employers tend to cheat $some times some ,ealous supervisor would think of scoring high points with the management by playing with other people-s times...% but because shifts and businesses are different. .s mentioned already, there are two typical scenarios.

!irst scenario/ Suppose a business uses regular shifts from 9 to 5. If an employee works

on onday from 9 to 5 and on "uesday from 9 to 0. "his employee would have worked 1 2 3 suppose the employee worked on onday from 9. to &7 , that is 5* hours. .t the end of the week, this employee should have worked 1 regular hours and'( overtime hours for the whole week. In other words, this employee would have worked overtime for a particular day only if on that day he worked more than 1 hours Second scenario/ Suppose a business is run '( hours a day with long shifts. In this type of business, suppose an employee worked on onday from 1. to 17 , that is 5' hours.

.t the end of the week, depending on the business, this employee would count for 5' regular hours
In this e8ercise, we will simulate a payroll calculation. 9e will consider the first scenario only. 9e will consider that any time above 1hours for a particular day is overtime. :ased on this, an employee who worked only '3 hours in a week can have some overtime while another employee in the same business and who worked 01 hours may not have overtime.

Practical Learning: Simulating a Payroll

5. Start icrosoft .ccess and create a :lank ;atabase named Payroll1 '. <n the main menu, click Insert #= !orm 0. In the 6ew !orm dialog bo8, double#click ;esign >iew (. Save the form as 7ayroll 5. ;esign it as follows/

Control <ption ?roup "e8t :o8 "e8t :o8 <ption ?roup Babel Babel Babel Babel Babel Babel Babel Babel "e8t :o8 "e8t :o8 "e8t :o8 "e8t :o8 "e8t :o8 "e8t :o8 "e8t :o8 "e8t :o8 "e8t :o8 "e8t :o8 "e8t :o8 "e8t :o8 "e8t :o8 "e8t :o8 <ption ?roup :utton Babel Babel Babel "e8t :o8 "e8t :o8 "e8t :o8 Babel "e8t :o8

Caption @mployee Identification @mployee 6ame/ Aourly Salary "ime Sheet onday "uesday 9ednesday "hursday !riday Saturday Sunday !irst 9eek/


<ther 7roperties

t8t@mployee6ame t8tAourlySalary !ormat/ Currency

t8t onday5 t8t"uesday5 t8t9ednesday5 t8t"hursday5 t8t!riday5 t8tSaturday5 t8tSunday5 t8t onday' t8t"uesday' t8t9ednesday' t8t"hursday' t8t!riday' t8tSaturday' t8tSunday' 7ayroll 7rocessing 7rocess It Aours .mount )egular t8t)egularAours t8t)egular.mount 6et 7ay/ <vertime t8t<vertimeAours t8t6et7ay !ormat/ Currency !ormat/ Currency cmd7rocessIt

"e8t :o8 :utton Close

t8t<vertime.mount !ormat/ Currency cmdClose

3. )ight#click the 7rocess It button and click :uild @vent... &. In the Choose :uilder dialog bo8, double#click Code :uilder 1. Implement the event as follows/ Private Sub cmdProcessIt_Click() Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim monday1 As Double tuesday1 As Double wednesday1 As Double thursday1 As Double friday1 As Double saturday1 As Double sunday1 As Double monday As Double tuesday As Double wednesday As Double thursday As Double friday As Double saturday As Double sunday As Double total!ours"eek1 As Double total!ours"eek As Double re#!ours1 As Double re#!ours As Double ovt!ours1 As Double ovt!ours As Double re#Amount1 As Currency re#Amount As Currency ovtAmount1 As Currency ovtAmount As Currency re#ular!ours As Double overtime!ours As Double re#ularAmount As Currency overtimeAmount As Currency total$arnin#s As Currency

Dim hourlySalary As Currency % &etrieve the hourly salary hourlySalary ' CDbl((e)t*t!ourlySalary) % &etrieve the time for each day % +irst "eek monday1 ' CDbl((e)t*t(onday1) tuesday1 ' CDbl((e)t*t,uesday1) wednesday1 ' CDbl((e)t*t"ednesday1) thursday1 ' CDbl((e)t*t,hursday1) friday1 ' CDbl((e)t*t+riday1) saturday1 ' CDbl((e)t*tSaturday1) sunday1 ' CDbl((e)t*tSunday1) % Second "eek monday ' CDbl((e)t*t(onday )

tuesday ' CDbl((e)t*t,uesday ) wednesday ' CDbl((e)t*t"ednesday ) thursday ' CDbl((e)t*t,hursday ) friday ' CDbl((e)t*t+riday ) saturday ' CDbl((e)t*tSaturday ) sunday ' CDbl((e)t*tSunday ) % Calculate the total number of hours for each week total!ours"eek1 ' monday1 - tuesday1 - wednesday1 - thursday1 - _ friday1 - saturday1 - sunday1 total!ours"eek ' monday - tuesday - wednesday - thursday - _ friday - saturday - sunday % ,he overtime is .aid time and half Dim ovtSalary As Double ovtSalary ' hourlySalary / 1)0 % If the em.loyee worked under 12 hours3 there is no overtime If total!ours"eek1 4 12 ,hen re#!ours1 ' total!ours"eek1 re#Amount1 ' hourlySalary / re#!ours1 ovt!ours1 ' 2 ovtAmount1 ' 2 % If the em.loyee worked over 12 hours3 calculate the overtime $lseIf total!ours"eek1 5' 12 ,hen re#!ours1 ' 12 re#Amount1 ' hourlySalary / 12 ovt!ours1 ' total!ours"eek1 6 12 ovtAmount1 ' ovt!ours1 / ovtSalary $nd If If total!ours"eek 4 12 ,hen re#!ours ' total!ours"eek re#Amount ' hourlySalary / re#!ours ovt!ours ' 2 ovtAmount ' 2 $lseIf total!ours"eek 5' 12 ,hen re#!ours ' 12 re#Amount ' hourlySalary / 12 ovt!ours ' total!ours"eek 6 12 ovtAmount ' ovt!ours / ovtSalary $nd If re#ular!ours ' re#!ours1 - re#!ours overtime!ours ' ovt!ours1 - ovt!ours re#ularAmount ' re#Amount1 - re#Amount overtimeAmount ' ovtAmount1 - ovtAmount total$arnin#s ' re#ularAmount - overtimeAmount (e)t*t&e#ular!ours ' re#ular!ours (e)t*t7vertime!ours ' overtime!ours (e)t*t&e#ularAmount ' CCur(re#ularAmount) (e)t*t7vertimeAmount ' CCur(overtimeAmount) (e)t*t8etPay ' CCur(total$arnin#s) $nd Sub 9. )eturn to the form 5*. )ight#click the Close button and click :uild @vent...

55. In the Choose :uilder dialog bo8, double#click Code :uilder 5'. Implement the event as follows/ Private Sub cmdClose_Click() 7n $rror 9o,o $rr_cmdClose_Click DoCmd)Close $*it_cmdClose_Click: $*it Sub $rr_cmdClose_Click: (s#;o* $rr)Descri.tion &esume $*it_cmdClose_Click $nd Sub 50. )eturn to the form and switch it to !orm >iew 5(. "est it with some values