Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 109,295 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,182 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Calculating a pay slip

 
Reply to this topicStart new topic

Calculating a pay slip

Daisygirl
post 1 Jul, 2008 - 07:17 AM
Post #1


New D.I.C Head

*
Joined: 15 Jan, 2008
Posts: 11

hi ya,
I'm trying to create a program which is a sort of a payslip. It calculates the hours that the staff works, including overtime. The details have to be read from a .txt file. I have managed to create that file and make it so that it appears in vb6. BUt i'm havin problems calculating the total hours worked, overtime etc. (overtime is calculated if the hours worked is over 40)

below is the code to open file and display on vb6.

CODE


Private Sub cmdDisplay_Click()

Dim strEmpFileName  As String
    Dim strBackSlash  As String
    Dim intEmpFileNbr As Integer
    
    Dim strEmpName    As String
    Dim intDeptNbr    As Integer
    Dim strJobTitle   As String
    Dim dtmHireDate   As Date
    Dim HrsWorked     As Single
    Dim sngHrlyRate   As Single
    
    strBackSlash = IIf(Right$(App.Path, 1) = "\", "", "\")
    strEmpFileName = App.Path & strBackSlash & "EMPLOYEE.DAT"
    intEmpFileNbr = FreeFile
    
    Open strEmpFileName For Input As #intEmpFileNbr
    
    Do Until EOF(intEmpFileNbr)
        Input #intEmpFileNbr, strEmpName, intDeptNbr, strJobTitle, dtmHireDate, sngHrlyRate, HrsWorked
        Print strEmpName; _
              Tab(25); Format$(intDeptNbr, "@@@@"); _
              Tab(35); strJobTitle; _
              Tab(55); Format$(dtmHireDate, "mm/dd/yyyy"); _
              Tab(70); Format$(Format$(sngHrlyRate, "Standard"), "@@@@@@@"); _
              Tab(80); Format$(Format$(HrsWorked, "Standard"), "@@@@@@@")
    Loop
    
    Close #intEmpFileNbr

End Sub



Help me please

Thank you x

The EMPLOYEE.dat file shows

"ANDY ANDERSON",100,"PROGRAMMER",#3/4/1997#,9.5, 40
"BILLY BABCOCK",110,"SYSTEMS ANALYST",#2/16/1996#,10,44
"CHARLIE CHEESEMAN",100,"COMPUTER OPERATOR",#3/1/1996#,7.5,38
"DARLENE DUNCAN",200,"RECEPTIONIST",#10/11/1998#,8.9,45.5
"ERNIE EACHUS",300,"MAIL ROOM CLERK",#8/19/1997#,7.9,20
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/6/08 09:16AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month