Payroll program tool in Visual Basic 6

Payroll program in Visual Basic 6 - Techronology

Open Door payroll program was a small assignment project in college. Overall, pretty easy. But, we put in extra work to make it look professional.

Overview of the payroll program

Below are the two main sections to this tool.

Sections of the payroll tool

Firstly, is the data input screen. Secondly, is the output screen.

Data input screen

Open door - Data input screen - Techronology

So, the data input screen contains three sections: Employee input, check information, and tax rates. Beneath all that is, a command button section. In addition, these are sample inputs. Especially, the tax rates.

Employee information

Of course, you want to make sure you enter employee name, ID, and weekending date.

Check information

Likewise, you should to input check date, check number, regular and OT hours, and pay rates. If you are just testing, then some of these inputs you do not need.

Tax rates

When you enter the tax rates, they should be in decimal form. Not in percentages. Otherwise, it will not calculate properly.

Output screen

Payroll program - Output screen - Techronology

As a result from all your inputs, the output screen nicely formats your data and displays a stub. Provided that you are okay with the output, you can print the stub.

In like manner, you can clear the screen, return to the input screen, or exit the program. Keep in mind, if you click the Clear Screen button, it clears both, the output and input screens.

Developer’s note: By the way, both screens are on one form. How do you like that?


Download

Feel free to download this program. It is all open source. Also, it includes the executable. So, click on the button below to download.

Download Size: 21 kB


Code listing

'Project name: Open Door Payroll
'Designed and programmed by: Alex Shaw III
'Date created: September 25, 2003
'Last modified: September 29, 2003
'This program computes the net pay for a particular employee
Option Explicit                             'require use of Dim
Dim dblFedTax As Double                     'Federal tax
Dim dblStateTax As Double                   'state tax
Dim dblFICATax As Double                    'FICA tax
Dim dblTotalTax As Double                   'total tax
Dim dblTotalHours As Double                 'total hours
Dim dblRegPay As Double                     'regular pay
Dim dblWkdayOTPay As Double                 'weekday OT Pay
Dim dblWkendOTPay As Double                 'weekend OT Pay
Dim dblGrossPay As Double                   'gross pay
Dim dblNetPay As Double                     'net pay
Private Sub ClearData()
    'Clear text fields
    txtEmpName.Text = ""                    'employee name
    txtEmpID.Text = ""                      'employee ID
    txtWkendingDate.Text = ""               'week ending date
    txtChkDate.Text = ""                    'check date
    txtChkNum.Text = ""                     'check number
    txtRegHours.Text = ""                   'regular hours
    txtRegPayRate.Text = ""                 'regular pay rate
    txtWkdayOTHours.Text = ""               'weekday OT hours
    txtWkdayOTRate.Text = ""                'weekday OT rate
    txtWkendOTHours.Text = ""               'weekend OT hours
    txtWkendOTRate.Text = ""                'weekend OT rate
    txtFedTaxRate.Text = ""                 'federal tax rate
    txtStateTaxRate.Text = ""               'state tax rate
    txtFICATaxRate.Text = ""                'FICA tax rate
    'Clear calculation variables
    dblFedTax = 0                           'federal tax
    dblStateTax = 0                         'state tax
    dblFICATax = 0                          'FICA tax
    dblTotalTax = 0                         'total tax
    dblTotalHours = 0                       'total hours
    dblRegPay = 0                           'regular pay
    dblWkdayOTPay = 0                       'weekday OT pay
    dblWkendOTPay = 0                       'weekend OT pay
    dblGrossPay = 0                         'gross pay
    dblNetPay = 0                           'net pay
    
    'Clear pay stub labels
    lblEmpNameData.Caption = ""             'employee name
    lblEmpIDData.Caption = ""               'employee ID
    lblWkendingDateData.Caption = ""        'week ending date
    lblChkDateData.Caption = ""             'check date
    lblChkNumData.Caption = ""              'check number
    lblRegHoursData.Caption = ""            'regular hours
    lblWkdayOTHoursData.Caption = ""        'weekday OT hours
    lblWkendOTHoursData.Caption = ""        'weekend OT hours
    lblTotalHoursData.Caption = ""          'total hours
    lblRegPayRateData.Caption = ""          'regular pay rate
    lblWkdayOTRateData.Caption = ""         'weekday OT rate
    lblWkendOTRateData.Caption = ""         'weekend OT rate
    lblRegPayData.Caption = ""              'regular pay
    lblWkdayOTPayData.Caption = ""          'weekday OT pay
    lblWkendOTPayData.Caption = ""          'weekend OT pay
    lblTotalPay.Caption = ""                'total pay
    lblGrossPayData.Caption = ""            'gross pay
    lblFedTaxData.Caption = ""              'federal tax
    lblStateTaxData.Caption = ""            'state tax
    lblFICATaxData.Caption = ""             'FICA tax
    lblTotalTaxesData.Caption = ""          'total taxes
    lblNetPay.Caption = ""                  'net pay
End Sub
Private Sub InitializeButtons()
    cmdPrint.Enabled = False                'disable Print button until pay stub appears
    cmdCalc.Enabled = True                  'enable Calculations button
    cmdReturn.Visible = False               'hide Return button until pay stub appears
    cmdStub.Visible = True                  'show View Stub button
    cmdCalc.Visible = True                  'show Calculations button
    cmdClear.Visible = True                 'show Clear button
    cmdPrint.Visible = True                 'show Print button
    cmdExit.Visible = True                  'show Exit button
End Sub
Private Sub cmdCalc_Click()
    'Perform initial calculations--start with total hours
    dblTotalHours = Val(txtRegHours.Text) + Val(txtWkdayOTHours.Text) + Val(txtWkendOTHours.Text)
    
    dblRegPay = Val(txtRegHours.Text) * Val(txtRegPayRate.Text)             'regular pay
    dblWkdayOTPay = Val(txtWkdayOTHours.Text) * Val(txtWkdayOTRate.Text)    'weekday OT pay
    dblWkendOTPay = Val(txtWkendOTHours.Text) * Val(txtWkendOTRate.Text)    'weekend OT pay
    
    dblGrossPay = dblRegPay + dblWkdayOTPay + dblWkendOTPay                 'gross pay
    
    'Perform tax calculations
    dblFedTax = dblGrossPay * Val(txtFedTaxRate.Text)                       'Federal tax
    dblStateTax = dblGrossPay * Val(txtStateTaxRate.Text)                   'state tax
    dblFICATax = dblGrossPay * Val(txtFICATaxRate.Text)                     'FICA tax
    
    dblTotalTax = dblFedTax + dblStateTax + dblFICATax                      'total tax
    
    'Perform final calculations
    dblNetPay = dblGrossPay - dblTotalTax                                   'net pay
    
    'Assign calculations to labels
    lblEmpNameData.Caption = txtEmpName.Text                                'employee name
    lblEmpIDData.Caption = txtEmpID.Text                                    'employee ID
    lblWkendingDateData.Caption = txtWkendingDate.Text                      'week ending date
    lblChkDateData.Caption = txtChkDate.Text                                'check date
    lblChkNumData.Caption = txtChkNum.Text                                  'check number
    lblRegHoursData.Caption = txtRegHours.Text                              'regular hours
    lblWkdayOTHoursData.Caption = txtWkdayOTHours.Text                      'weekday OT hours
    lblWkendOTHoursData.Caption = txtWkendOTHours.Text                      'weekend OT hours
    lblTotalHoursData.Caption = dblTotalHours                               'total hours
    lblRegPayRateData.Caption = txtRegPayRate.Text                          'regular pay rate
    lblWkdayOTRateData.Caption = txtWkdayOTRate.Text                        'weekday OT rate
    lblWkendOTRateData.Caption = txtWkendOTRate.Text                        'weekend OT rate
    lblRegPayData.Caption = dblRegPay                                       'regular pay
    lblWkdayOTPayData.Caption = dblWkdayOTPay                               'weekday OT pay
    lblWkendOTPayData.Caption = dblWkdayOTPay                               'weekend OT pay
    lblTotalPay.Caption = dblGrossPay                                       'total pay
    lblGrossPayData.Caption = dblGrossPay                                   'gross pay
    lblFedTaxData.Caption = dblFedTax                                       'federal tax
    lblStateTaxData.Caption = dblStateTax                                   'state tax
    lblFICATaxData.Caption = dblFICATax                                     'FICA tax
    lblTotalTaxesData.Caption = dblTotalTax                                 'total taxes
    lblNetPay.Caption = Format(dblNetPay, "Currency")                       'net pay
    
    lblCalcStatus.Caption = "Calculation Complete"                          'change status message
End Sub
Private Sub cmdClear_Click()
    ClearData                                       'clear data
    lblCalcStatus.Caption = "None"                  'restore status message
End Sub
Private Sub cmdExit_Click()
    End                                             'end program
End Sub
Private Sub cmdPrint_Click()
    'Hide buttons before print
    cmdReturn.Visible = False                       'hide Return button until pay stub appears
    cmdStub.Visible = False                         'hide View Stub button
    cmdCalc.Visible = False                         'hide Calculations button
    cmdClear.Visible = False                        'hide Clear button
    cmdPrint.Visible = False                        'hide Print button
    cmdExit.Visible = False                         'hide Exit button
    
    frmOpenDoorPayroll.PrintForm                    'print pay stub
    'Show buttons after print
    cmdStub.Visible = False                         'hide View Stub button
    cmdReturn.Visible = True                        'show Return button
    cmdCalc.Visible = True                          'show Calculations button
    cmdClear.Visible = True                         'show Clear button
    cmdPrint.Visible = True                         'show Print button
    cmdExit.Visible = True                          'show Exit button
End Sub
Private Sub cmdReturn_Click()
    InitializeButtons                               'initialize buttons
    frmOpenDoorPayroll.BackColor = &H8000000F       'white background color for pay stub
    fraPayStub.Visible = False                      'show Pay Stub
    lblEmpName.Visible = True                       'show Employee Name label
    txtEmpName.Visible = True                       'show Employee Name text box
    lblEmpID.Visible = True                         'show Employee ID label
    txtEmpName.Visible = True                       'show Employee ID text box
    fraChkInfo.Visible = True                       'hide Check Information frame
    fraTaxRates.Visible = True                      'hide Tax Rates frame
End Sub
Private Sub cmdStub_Click()
    frmOpenDoorPayroll.BackColor = &HFFFFFF         'white background color for pay stub
    fraPayStub.Visible = True                       'show Pay Stub
    fraChkInfo.Visible = False                      'hide Check Information frame
    fraTaxRates.Visible = False                     'hide Tax Rates frame
    
    lblEmpName.Visible = False                      'hide Employee Name label
    txtEmpName.Visible = False                      'hide Employee Name text box
    lblEmpID.Visible = False                        'hide Employee ID label
    txtEmpName.Visible = False                      'hide Employee ID text box
    
    cmdPrint.Enabled = True                         'enable Print button
    cmdCalc.Enabled = False                         'disable Calculation button
    cmdStub.Visible = False                         'hide View Stub button
    cmdReturn.Visible = True                        'show Return button
End Sub
Private Sub Form_Load()
    InitializeButtons                               'initialize buttons
    ClearData                                       'clear form fields and output labels
    fraPayStub.Visible = False                      'hide Pay Stub
End Sub

Related


Support

At this point, we do not offer support for the Open Door payroll program.


Techronology home Software home