Class PayrollManager

java.lang.Object
payroll.manager.PayrollManager
All Implemented Interfaces:
PayrollManagement

public class PayrollManager extends Object implements PayrollManagement
  • Constructor Details

    • PayrollManager

      public PayrollManager(PayrollDataService payrollDataService, EmployeeManagement employeeManager, AttendanceManagement attendanceManager)
      Constructor for the PayrollManager class. Initializes the PayrollDataService, EmployeeManagement, and AttendanceManagement objects.
      Parameters:
      payrollDataService - The PayrollDataService object to use for data access.
      employeeManager - The EmployeeManagement object to use for employee management.
      attendanceManager - The AttendanceManagement object to use for attendance management.
  • Method Details

    • runBatchPayroll

      public void runBatchPayroll(List<PayrollRecord> tempPayrollRecords, String payrollPeriod) throws EmployeeRecordsException, PayrollException
      Runs the payroll for the specified period.
      Specified by:
      runBatchPayroll in interface PayrollManagement
      Parameters:
      tempPayrollRecords - the temporary payroll records to process
      payrollPeriod - the period for which the payroll is being run
      Throws:
      EmployeeRecordsException - if no records are found
      PayrollException - if an error occurs
    • submitBatchPayroll

      public void submitBatchPayroll(List<PayrollRecord> tempPayrollRecords) throws PayrollException
      Submits the temporary payroll records to the database.
      Specified by:
      submitBatchPayroll in interface PayrollManagement
      Parameters:
      tempPayrollRecords - the temporary payroll records to submit
      Throws:
      PayrollException - if an error occurs
    • runManualPayroll

      public PayrollRecord runManualPayroll(PayrollRecord tempPayrollRecord, String payrollPeriod) throws EmployeeRecordsException
      Description copied from interface: PayrollManagement
      Runs manual payroll for the specified temporary payroll record and period.
      Specified by:
      runManualPayroll in interface PayrollManagement
      Parameters:
      tempPayrollRecord - the temporary payroll record to process, has empty fields which needs calculations to be filled
      payrollPeriod - the period for which the payroll is being run
      Throws:
      EmployeeRecordsException
    • submitManualPayroll

      public void submitManualPayroll(PayrollRecord tempPayrollRecord)
      Submits the temporary payroll record to the database.
      Specified by:
      submitManualPayroll in interface PayrollManagement
      Parameters:
      tempPayrollRecord - the payroll record to submit
    • getAllPayrollRecords

      public List<PayrollRecord> getAllPayrollRecords()
      Retrieves all payroll records.
      Specified by:
      getAllPayrollRecords in interface PayrollManagement
      Returns:
      a list of all payroll records
    • getPayrollIDList

      public List<String> getPayrollIDList(String period)
      Retrieves the list of payroll IDs for the specified period
      Specified by:
      getPayrollIDList in interface PayrollManagement
      Parameters:
      period - the payroll period
      Returns:
      the list of payroll IDs
    • getPayrollRecord

      public PayrollRecord getPayrollRecord(int employeeID, int month, String period)
      Retrieves the payroll record for the specified employee and year and month
      Specified by:
      getPayrollRecord in interface PayrollManagement
      Parameters:
      employeeID - the ID of the employee
      month - the month of the payroll
      period - the period of the payroll
      Returns:
      the payroll record
    • getPayrollRecord

      public PayrollRecord getPayrollRecord(String payrollID)
      Retrieves the payroll record for the specified ID
      Specified by:
      getPayrollRecord in interface PayrollManagement
      Parameters:
      payrollID - the ID of the payroll record
      Returns:
      the payroll record
    • getPayrollRecord_List

      public List<PayrollRecord> getPayrollRecord_List(String period)
      Retrieves the list of payroll records for the specified period
      Specified by:
      getPayrollRecord_List in interface PayrollManagement
      Parameters:
      period - the period for which the records are retrieved
      Returns:
      the list of payroll records
    • getHoursWorked

      public double getHoursWorked(int employeeID, String payrollPeriod)
      Description copied from interface: PayrollManagement
      Retrieves the number of hours worked for the specified employee ID and period.
      Specified by:
      getHoursWorked in interface PayrollManagement
      Parameters:
      employeeID - the ID of the employee
      payrollPeriod - the period
      Returns:
      the number of hours worked
    • getOvertimeHours

      public double getOvertimeHours(int employeeID, String payrollPeriod)
      Description copied from interface: PayrollManagement
      Retrieves the number of overtime hours for the specified employee ID and period.
      Specified by:
      getOvertimeHours in interface PayrollManagement
      Parameters:
      employeeID - the ID of the employee
      payrollPeriod - the period
      Returns:
      the number of overtime hours