Skip to main content
Version: CESC

Employee Management

Author(s)

  • Reshmi Karan

Last Updated Date

2024-12-09


SRS References

NO


Version History

VersionDateChangesAuthor
1.02024-12-09Initial draftReshmi Karan
............

Feature Overview

Objective:

The purpose of this feature is to manage Employee Records effectively by incorporating employee details, employment statuses with gratuity status, department and division tracking, and other key employee-related data. This system provides Super Owner/vendor the ability to onboard employees, track their retirement benefits (gratuities), handle skill assignments, and monitor their department/division affiliations in a streamlined manner.

Scope:

  • Includes employee CRUD operations (create, read, update, delete).
  • Integrates vendor, division, and department data with employee records.
  • Handles gratuity calculation only for employees with status Retired or Voluntary Retirement.
  • Ensures inactive employees have no gratuity computation or associated payouts.

Dependencies:


Requirements

Functional Requirements:

  1. Employee records can be created, updated, retrieved, and deleted.
  2. Employees are assigned to specific vendors, divisions, and departments.
  3. Gratuity is calculated only for employees with status Retired or Voluntary Retirement.
  4. Employees marked as Inactive should not have any gratuity computations.
  5. Data validation rules must ensure proper field entry, uniqueness, and accurate computation.
  6. Implement Excel export functionality for employee data.
  7. Update status with retirement date gratuity calculation.

Non-Functional Requirements:

  1. Employee-related operations should perform with minimal latency under expected database load.
  2. Security mechanisms must ensure sensitive employee information is protected.
  3. Gratuity calculations must follow defined financial business logic.

Design Specifications

  • UI/UX Design:

  • Data Models:

    public record Employee
    {
    public Guid EmployeeId { get; set; }
    public string? EmployeeCode { get; set; }
    public required Guid VendorId { get; set; }
    public string? VendorName { get; set; }
    public required Guid DivisionId { get; init; }
    public string? DivisionName { get; init; }
    public required Guid DepartmentId { get; init; }
    public string? DepartmentName { get; init; }
    public SkillLevel Skill { get; set; }//enum
    public required string EmployeeName { get; set; }
    public DateTime? Dob { get; set; }
    public Gender Gender { get; set; }//enum
    public string? AadharNumber { get; set; }
    public string? PanNumber { get; set; }
    public string? UanNumber { get; set; }
    public string? EsicNumber { get; set; }
    public string? PfNumber { get; set; }
    public DateTime? StartDate { get; set; }
    public DateTime? JoiningDate { get; set; }
    public string? Designation { get; set; }
    public EmployeeStatus Status { get; set; }
    public string? ContactNumber { get; set; }
    public string? EmailAddress { get; set; }
    public GratuityStatus GratuityStatus { get; set; }
    public DateTime? RetirementDate { get; set; }
    public decimal GratuityAmount { get; set; }
    public DateTime? GratuityReceived { get; set; }
    public List<FileInformation> Files { get; set; } = [];
    public DateTime? LogDts { get; set; }
    public string? LogUserName { get; set; }
    public List<Location> Locations { get; set; } = new List<Location>();
    [System.Text.Json.Serialization.JsonIgnoreAttribute]
    public int TotalNumber { get; set; }
    }

    public record EmployeeGratuityDetail
    {
    public Guid EmployeeId { get; set; }
    public string? EmployeeCode { get; set; }
    public required DateTime JoiningDate { get; set; }
    public GratuityStatus GratuityStatus { get; set; }
    public EmployeeStatus Status { get; set; }
    public DateTime? RetirementDate { get; set; }
    public decimal GratuityAmount { get; set; }
    public DateTime? GratuityReceived { get; set; }
    public DateTime? LogDts { get; set; }
    public string? LogUserName { get; set; }
    }
    public record EmployeeFilterParam : SortingPaginatedData
    {
    public Guid? EmployeeId { get; init; }
    public int PageNumber { get; set; }
    public int RowsPerPage { get; set; }
    public string? EmployeeName { get; init; }
    public string? EmployeeCode { get; init; }
    public required Guid VendorId { get; set; }
    public required Guid DivisionId { get; set; }
    public string? PanNumber { get; init; }
    public string? GstNumber { get; init; }
    public EmployeeStatus? Status { get; init; }
    public AddressForFilter? Address { get; init; }
    public bool IsExcel { get; init; }
    // Allowed fields for sorting specific to EmployeeFilterParam
    public override IEnumerable<string> AllowedSortByFields => new[]
    {
    "EmployeeName",
    "EmployeeCode",
    "Status",
    "Skill",
    "DivisionName",
    "RetirementDate"
    };
    }

    public record EmployeeStatusFilter
    {
    public Guid EmployeeId { get; set; }
    public EmployeeStatus Status { get; set; }
    public GratuityStatus GratuityStatus { get; set; } = GratuityStatus.None;
    public DateTime? RetirementDate { get; set; }
    public decimal GratuityAmount { get; set; }
    public DateTime? GratuityReceived { get; set; }
    }
    public enum EmployeeStatus
    {
    InActive = 0,
    Active = 1,
    Retired = 2,
    VoluntaryRetirement = 3
    }
    public enum Gender
    {
    Male = 0,
    Female = 1,
    Other = 2,
    }
    public enum SkillLevel
    {
    Unskilled,
    SemiSkilled,
    Skilled,
    HighlySkilled
    }
    public enum GratuityStatus
    {
    None,
    Paid,
    Pending,
    Unpaid,
    NotApplicable
    }
  • API Interfaces:

    EndpointMethodParametersResponseResponse Status Codes
    /api/Employee/emp/getGETEmployeeId (required, Guid)List of Employee200, 204, 500
    /api/Employee/emp/setPOSTEmployee (required)String (Message)200, 204, 500
    /api/Employee/emp/updatePUTEmployee (required)String (Message)201, 204, 500
    /api/Employee/emp/get/allGETEmployeeFilterParam (required)ServerPaginatedData<Employee>200, 204, 500
    /api/Employee/emp/status-updatePUTEmployeeStatusFilter (required)List<FileInformation>200, 204, 500
    /api/Employee/emp/file/uploadPOSTEmployeeId (required, Guid), List<FileWithType>String (Message)200, 204, 500
    /api/Employee/emp/file/delete/{fileId}DELETEEmployeeId (required, Guid), fileId(required,string)String (Message)200, 204, 500
  • Third-Party Integrations:

  • Workflow:

    1. Employee CRUD Operations:
    • Super Owner/vendor logs in to the system.

    • The user accesses the Employee Management dashboard.

    • The user creates/updates/deletes employee records.

    • Changes trigger appropriate database operations and log the event data.

    1. Gratuity Computation on Retirement/Voluntary Retirement:
    • Upon status updates for Retired/Voluntary Retirement, the system computes gratuity values.

    • Employees with Inactive status should skip gratuity logic.

    1. Export Employee Data to Excel:
    • The user clicks on a button to export employee data filtered by divisions/parameters.
    • System generates the required report and sends it to the user's system.

Development Tasks & Estimates

NoTask NameEstimate (Hours)DependenciesNotes
1Employee Management: Get paginated api2.5 hourswith excel export and sorting
2Employee Management: Get api by Id1.5 hours
3Employee Management: Set Vendor1.5 hours
4Employee Management: Update Vendor1.5 hours
5Employee Management: Update status1.5 hoursgratuity amount/status, retirement date all are update when status update
6Employee Management: File Upload1.5 hours
7Employee Management: File Delete1.5 hours
8Total11.5 hours

Testing & Quality Assurance

  • Unit Tests:

    1. Employee Retrieval:
    • Verify retrieval of employee details by ID.
    • Test edge cases such as invalid or non-existent employee IDs.
    1. Employee CRUD Operations:
    • Test create, read, update, and delete operations for employees.
    • Verify proper error handling for invalid inputs.
    1. Employee Status Update:
    • Test status change functionality (e.g., active, inactive) for employees.
    • Ensure validation rules are respected during status updates.
    1. File Upload & Deletion:
    • Test successful file upload scenarios for employee-related documents.
    • Verify handling of invalid file types during upload.
    • Ensure file deletion works with valid file IDs and handles edge cases.
    1. Pagination & Filtering:
    • Test employee filtering with pagination parameters.
    • Verify edge cases like no results found or invalid pagination parameters.
    1. Error Handling:
    • Validate that proper error responses are returned for database failures and invalid requests.
    1. Gratuity Calculation & Status Handling:
    • Verify gratuity is calculated only for employees with statuses Retired or Voluntary Retirement.
    • Test edge cases like employees marked as Inactive or having no retirement date.
    • Validate that Gratuity Amount computation follows the defined business logic.
    • Test the system's behavior when the gratuity status is Paid, Pending, Unpaid, or Not Applicable.
  • Integration Tests:

  • Acceptance Criteria:

  • Testing Tools:
    Scalar for API testing.


Deployment Considerations

  • Configuration Changes:

    CREATE Table tblemployee
    (
    employee_id UUID,
    employeecode text unique,
    vendor_id UUID not null,
    vendorname text not null,
    division_id UUID not null,
    divisionname text not null,
    department_id UUID,
    departmentname text,
    skill TEXT,--full-time, contract, etc.
    employeename TEXT,
    dob DATE,
    gender TEXT CHECK (gender IN ('Male', 'Female', 'Other')),
    aadharnumber TEXT,
    pannumber TEXT,
    uannumber TEXT UNIQUE,
    esicnumber TEXT UNIQUE,
    pfnumber TEXT UNIQUE,
    epfdetails Jsonb,
    esicdetails Jsonb,
    startdate DATE,
    joiningdate TIMESTAMPTZ,
    designation TEXT,
    status TEXT, --(Active/Inactive)
    contactnumber text,
    emailaddress TEXT UNIQUE,
    gratuitystatus TEXT,
    retirementdate TIMESTAMPTZ,
    files jsonb,
    logdts TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
    logusername TEXT,
    CONSTRAINT tblemployee_pkey PRIMARY KEY (employee_id),
    CONSTRAINT tblemployee_vendorid_fkey FOREIGN KEY (vendor_id)
    REFERENCES tblvendor (vendor_id)
    ON UPDATE CASCADE
    ON DELETE RESTRICT,
    CONSTRAINT tblemployee_divisionid_fkey FOREIGN KEY (division_id)
    REFERENCES tbldivision (division_id)
    ON UPDATE CASCADE
    ON DELETE RESTRICT
    );
    CREATE INDEX idx_tblemployee_vendor_id ON tblemployee(vendor_id);
    CREATE INDEX idx_tblemployee_division_id ON tbldivision(division_id);
    alter table tblemployee add gratuityamount decimal;
    alter table tblemployee add gratuityreceived TIMESTAMPTZ;
  • Rollout Plan:


Risks & Mitigations

RiskImpactLikelihoodMitigation Strategy

Review & Approval

(Include a section for review and approval by stakeholders.)

  • Reviewer:
    Abhishak Kumar Roy

  • Approval Date:
    2024-09-12


Notes
(Add any additional notes or considerations related to the feature development here.)