Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

VB.DOT NET PROGRAM REQUIREMENTS Project Name : Payroll Program Purpose: The appl

ID: 666316 • Letter: V

Question

VB.DOT NET PROGRAM

REQUIREMENTS

Project Name: Payroll Program

Purpose:

The application maintains employee records and calculates the weekly payroll for the employees of an auto parts store. The user adds new employees to the payroll file. The user selects employees to pay for the weekly payroll and the program creates the Weekly Payroll file.

Program Procedures:

When the application starts, a menu window opens that allows the user to Add New Employee, Create Payroll, or Display Weekly Payroll. For a new employee, the user enters the employee first name, last name, social security number, tax status, employee type, and pay rate, which is posted to the EmployeeMaster.txt file. For the weekly payroll, the user selects the employees to pay for the current week from a listbox and creates the payroll record for that employee. Each pay record is written to the WeeklyPayroll.txt file. The user can display the Weekly Payroll file after it has been completed. All files are comma delimited text files. A new Weekly Payroll file is created each time this option is selected.

Algorithms, Processing, and Conditions

Selecting Add New Employee opens a window to accept new employee information for entry to the EmployeeMaster.txt file. This file contains the employee first name, last name, social security number, tax status, employee type, and pay rate.

Clicking the Enter Data button causes the employee data to be validated. If valid, the data is added to the EmployeeMaster.txt file. The screen is cleared and focus is on First Name texbox.

Clicking the Finished Data Entry button causes the program to disable the data entry fields and display total of employees entered in this session.

The Add New Employee menu bar contains a File selector with a sub menu of Clear and Exit options, and a Return selector. Exit causes the application to close. Return displays the Start page.

The Clear menu option clears the data entry fields and sets the focus to the First Name text box.

Selecting Create Weekly Payroll opens a window that displays a list box containing the names of the current employees from the Employee Master.txt file sorted by last name.

Selecting an employee name displays the employee pay information. If the employee is hourly, a text box for the hours worked is displayed. User clicks the Pay Employee button. When present, Hours Worked is validated. The program calculates and displays the employee payroll information. Clicking OK writes the record to the WeeklyPayroll.txt file and places a “P” in front of that employee. Clear cancels the entry. This file contains the employee first name, last name, gross pay, tax deduction, and net pay. A new payroll file is started each time the Weekly payroll option is run.

Clicking the Finished Payroll button disables the Employee Name listbox and displays a summary of the number of employees paid and the total payroll.

The Weekly Payroll menu bar contains Exit and Return selections. Exit causes the application to close. Return displays the Start window.

Selecting Display Payroll opens a window that presents a listbox displaying the pay records for all employees paid for this payroll. The records are sorted alphabetically by last name. A summary of the current payroll is displayed below the listbox. The summary contains the total gross pay for salaried workers and, separately, for hourly workers, the total amount of taxes deducted and the total net payroll amount.

The Display Payroll menu bar contains Exit and Return options. The Exit option closes the application. The Return displays the Start window.

Notes and Restrictions

1.Use a 3-tier program structure.

2.Use a masked text box for Social Security Number.

3.All fields are required and cannot be blank.

4.Last Name and First Name must begin with an alphabetic character.

5.Employee type must be H(hourly) or S(alary).

6.Pay rate for H is hourly rate and S is annual salary; default is H.

7.Tax Status: S(ingle) – 19%; M(arried) – 15%; F(amily) – 12%; default is S

8.The minimum value for hours worked is 5. The maximum for hours worked is 60.

9.The minimum pay per hour is $12.00. The maximum pay per hour is $40.00.

10.The minimum salary is $30,000. The maximum salary is $150,000.

11.Company pays time and a half for hours worked in excess of 40 for hourly employees.

12.SalaryEmployee is the base class and HourlyEmployee is the subclass for the Business Tier.

13.The EmployeeMaster.txt is continuous. The WeeklyPayroll.txt is refreshed each time the payroll is prepared.

14.Display errors in message boxes. Program cannot continue until each error is corrected.

15.All calculations must be done in business classes.

16.All data file read and writes must be done in data classes.

17.All data files are comma delimited text files with .txt extensions

18.All data filenames must have a “YCI” suffix. Your final EmployeeMaster.txt file must have at least 15 employees split approximately 1:3 between salaried and hourly. Your final WeeklyPayroll.txt file must have at least 10 employees representing most of the pay variations. Place a copy of these files in the project folder containing the project .sln file.

19.Use String.Format for listbox output.

Explanation / Answer

Imports System.Windows.Forms.OpenFileDialog

Public Class empPayrollForm

Private CurrentEmployeeList As EmployeeList

Private CurrentPayrollList As PayrollList

Private CurrentRecord As Integer

Private OpenEmpFileDialog As String

Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click

closes application

Me.Close()

End Sub

Private Sub openFileButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles openFileButton.Click

'opens file

Dim payrollResult As DialogResult

OpenEmpFileDialog.Title = "Please Select Master Employee File"

OpenEmpFileDialog.Filter = "Text Files(*.txt)|*.txt|All Files(*.*)|*.*"

employeeResult = OpenEmpFileDialog.ShowDialog

If employeeResult = Windows.Forms.DialogResult.OK Then

    CurrentEmployeeList = New EmployeeList(OpenEmpFileDialog.FileName)

    selEmpComboBox.Items.AddRange(Employee.empId)

End If

OpenPayrollFileDialog.Title = "Please Select Master Payroll File"

payrollResult = OpenPayrollFileDialog.ShowDialog

If payrollResult = Windows.Forms.DialogResult.OK Then

      CurrentPayrollList = New PayrollList(OpenPayrollFileDialog.FileName)

End If

End Sub

Option Explicit On

Option Strict On

Imports System.IO

Imports System.Convert

Module Employee

     Public Structure Employee

            Public empId As Integer

            Public empName As String

            Public empAddress As String

            Public empSSN As String

     End Structure

    Public Class EmployeeList

           Private CurrentReader As StreamReader

           Private CurrentWriter As StreamWriter

           Private CurrentList(0) As Employee

           Private RecordCount As Integer

           Public Sub New(ByVal argFile As String)

               CurrentReader = New StreamReader(argFile)

               Call ReadEmployees(argFile)

               CurrentReader.Close()

     End Sub

    Private Sub ReadEmployees(ByVal argFile As String)

       Dim CurrentEmployee As Employee

       Dim Fields() As String

       Dim CurrentRecord As String

       Dim DelimiterChars() As Char = {ToChar(",")}

       CurrentRecord = CurrentReader.ReadLine()

       Do Until CurrentRecord Is Nothing

            Fields = CurrentRecord.Split(DelimiterChars)

            With CurrentEmployee

               .empId = CInt(Fields(0))

               .empName = Fields(1)

               .empAddress = Fields(2)

               .empSSN = Fields(3)

      End With

        ReDim Preserve CurrentList(RecordCount)

        CurrentList(RecordCount) = CurrentEmployee

        CurrentRecord = CurrentReader.ReadLine()

        RecordCount += 1

   Loop

   RecordCount += 1

   End Sub

End Class

End Module

                                OR

SELECT   per.employee_number, NVL (per.known_as, per.full_name) employee_name,
         org.NAME ORGANIZATION, pj.NAME job, pap.NAME POSITION,
         NVL (petf.reporting_name, petf.element_name) element_name,
         peevf.effective_start_date change_date,
         (SELECT peevf_old.screen_entry_value
            FROM pay_element_entry_values_f peevf_old
           WHERE 1 = 1
             AND peevf_old.effective_end_date = peevf.effective_start_date - 1
             AND peevf_old.element_entry_value_id =
                                                  peevf.element_entry_value_id
             AND peevf_old.input_value_id = peevf.input_value_id
             AND peevf_old.element_entry_id = peevf.element_entry_id)
                                                                    old_value,
         peevf.screen_entry_value new_value,
         ( NVL (peevf.screen_entry_value, 0)
          - NVL ((SELECT peevf_old.screen_entry_value
                    FROM pay_element_entry_values_f peevf_old
                   WHERE 1 = 1
                     AND peevf_old.effective_end_date =
                                                peevf.effective_start_date - 1
                     AND peevf_old.element_entry_value_id =
                                                  peevf.element_entry_value_id

AND peevf_old.input_value_id = peevf.input_value_id
                     AND peevf_old.element_entry_id = peevf.element_entry_id),
                 0
                )
         ) difference,
         (SELECT peevf_current.screen_entry_value
            FROM pay_element_entry_values_f peevf_current
           WHERE 1 = 1
             AND peevf_current.effective_end_date =
                                          TO_DATE ('12/31/4712', 'MM/DD/RRRR')
             AND peevf_current.element_entry_value_id =
                                                  peevf.element_entry_value_id
             AND peevf_current.input_value_id = peevf.input_value_id
             AND peevf_current.element_entry_id = peevf.element_entry_id)
                                                                current_value
    FROM pay_element_types_f petf,
         pay_input_values_f pivf,
         pay_element_entries_f peef,
         pay_element_entry_values_f peevf,
         per_all_assignments_f pas,
         per_all_people_f per,
         per_jobs pj,
         per_all_positions pap,
         hr_all_organization_units org
   WHERE 1 = 1
     AND petf.effective_end_date = TO_DATE ('12/31/4712', 'MM/DD/RRRR')
     AND petf.element_type_id = pivf.element_type_id
     AND pivf.NAME = 'Amount'
     AND pivf.effective_end_date = TO_DATE ('12/31/4712', 'MM/DD/RRRR')
     AND petf.element_type_id = peef.element_type_id
     AND peef.effective_end_date = TO_DATE ('12/31/4712', 'MM/DD/RRRR')
     AND peef.element_entry_id = peevf.element_entry_id
     AND pivf.input_value_id = peevf.input_value_id
     AND peef.assignment_id = pas.assignment_id
     AND pas.effective_end_date = TO_DATE ('12/31/4712', 'MM/DD/RRRR')
     AND pas.person_id = per.person_id
     AND per.effective_end_date = TO_DATE ('12/31/4712', 'MM/DD/RRRR')
     AND (SELECT peevf_old.screen_entry_value
            FROM pay_element_entry_values_f peevf_old
           WHERE 1 = 1
             AND peevf_old.effective_end_date = peevf.effective_start_date - 1
             AND peevf_old.element_entry_value_id =
                                                  peevf.element_entry_value_id
             AND peevf_old.input_value_id = peevf.input_value_id
             AND peevf_old.element_entry_id = peevf.element_entry_id) IS NOT NULL
     AND pas.job_id = pj.job_id(+)
     AND pas.position_id = pap.position_id(+)
     AND pas.organization_id = org.organization_id

--     AND per.employee_number = '10002'
--     AND petf.element_name = 'Basic Salary'
ORDER BY per.employee_number, petf.element_name

THIS IS THE CODE FOR ALL THE PAYROLL QUERIES FIRSTLY CHECK IT OUT IF STILL FINDING ANY PROBLEM THEN PLEASE REVERT ME.