Frontend
Employees
Employee Master

Employee Master

Navigation Path

Company → Employee → Employee Master


Employee Master Page

URL

/employee/employee-master


Page Description

  • Used to add new employees and edit existing employee details
  • Editing is performed by searching using an existing Employee Code
  • Employee records cannot be deleted from the system

1. Add New Employee

Description

  • Allows administrators to create a new employee record
  • Employee Code acts as a unique identifier

Add Employee – Fields

Basic Information

Field NameDescription
Employee CodeUnique employee identifier
NameEmployee full name
Father NameFather’s name
Mother NameMother’s name
GenderSelect gender
CategorySelect or create category
ReligionSelect or create religion
Marital StatusSelect marital status
Spouse NameEnter spouse name (if applicable)
Date of BirthSelect birth date

Posting & Organization Details

Field NameDescription
Posting StateSelect or create state
Posting CitySelect or create city
DepartmentSelect department
Sub DepartmentEnter sub department
UnitSelect or create unit
DesignationSelect designation
Nature TypeSelect nature type
Stationed AtSelect stationed location
RoleEnter role
QualificationEnter qualification
GradeSelect or create grade

Contact & Identity Details

Field NameDescription
PAN NumberEnter PAN number
Aadhaar Card NoEnter Aadhaar number
Email IDEnter email
Mobile NumberEnter mobile number

Bank & Payment Details

Field NameDescription
Payment ModeBank Transfer
BankSelect or create bank
Account NumberEnter account number
IFSC CodeEnter IFSC code
Bank Reference NoEnter bank reference number

Employment Dates

Field NameDescription
Date of JoiningSelect joining date
Date of ConfirmationSelect confirmation date
SAF Start DateSelect SAF start date
Contract End DateSelect contract end date
Resign DateSelect resignation date
Leaving DateSelect leaving date
Leaving ReasonEnter leaving reason
Reason for LeaveEnter leave reason

Statutory & Salary Configuration

Field NameDescription
PF ApplicableEnable/Disable PF
PF Based OnBasic
PF NoEnter PF number
UAN NoEnter UAN number
ESI ApplicableEnable/Disable ESI
ESI TypeSelect ESI type
ESI NoEnter ESI number
Bonus ApplicableEnable/Disable bonus
Bonus Based OnSelect bonus rule
Professional TaxEnable/Disable
Pension PF ApplicableEnable/Disable
Voluntary PF ApplicableEnable/Disable
Voluntary PF TypePercent / Amount
VOL PF Percent / AmtEnter value
LWF ApplicableEnable/Disable
AC10 Not ApplicableEnable/Disable
ESIONNHEnable/Disable

Additional Payroll Settings

Field NameDescription
Site AllowanceAmount per month
Fooding DeductionPercentage or amount
OT As PerSelect OT type
Site Increment ApplicableEnable/Disable
Appraisal ApplicableEnable/Disable
Approve Appraisal Through Reporting ManagerYes/No
Approve Appraisal Through Site ManagerYes/No
CTC Structure as per HOYes/No
Make Salary Site BasedYes/No
GPA AmountEnter GPA amount
Trust Deduction AmountEnter amount
CTC / BASICEnter amount
Stop SalaryYes/No
Head MappingUsing unit heads
Total EarningsAuto-calculated
Total DeductionsAuto-calculated

Actions

ActionBehavior
SaveValidates and saves employee record
ResetClears all entered values
CancelNavigates away from the page

2. Edit Existing Employee

Description

  • Editing is done within the same Employee Master page
  • Admin enters an existing Employee Code and performs search
  • All employee details are auto-filled for update

Edit Flow

  1. Enter existing Employee Code
  2. Click Search
  3. Employee details are populated
  4. Update required fields
  5. Click Save

Edit Rules

  • Employee Code cannot be changed
  • All other fields are editable
  • Deletion of employee records is not allowed

API Endpoints

The Employee Master module interacts with the following API endpoints:

Base URL

export const EMPLOYEEMASTER_URL = '/api/salaryEmployeeMaster'

Endpoints

EndpointMethodDescriptionParameters/Body
EMPLOYEEMASTER_URLPOSTCreate a new salary employeeBody: data
EMPLOYEEMASTER_URLGETGet all salary employees with paginationQuery: page, limit
EMPLOYEEMASTER_URL/:salaryEmployeeIdGETGet salary employee by IDPath: salaryEmployeeId
EMPLOYEEMASTER_URL/:salaryEmployeeIdPATCHUpdate an existing salary employeePath: salaryEmployeeId, Body: body
EMPLOYEEMASTER_URL/delete/:salaryEmployeeIdPATCHDelete a salary employee (soft delete)Path: salaryEmployeeId
EMPLOYEEMASTER_URL/managersGETGet manager employeesQuery: managerType, page, limit
EMPLOYEEMASTER_URL/search/employeePOSTSearch employeesBody: data (search criteria)
EMPLOYEEMASTER_URL/export/employeeGETExport all employees to ExcelReturns: Excel file (blob)
EMPLOYEEMASTER_URL/search/export/configurationsPOSTSearch and export employees to ExcelBody: data (search criteria), Returns: Excel file (blob)
EMPLOYEEMASTER_URL/import/employee/configurationsPOSTImport employee configurationsBody: data (file/data)
EMPLOYEEMASTER_URL/import/employee/headsPOSTImport employee headsBody: data (file/data)
EMPLOYEEMASTER_URL/export/employee/headsPOSTExport employee headsBody: data, Returns: Excel file (blob)
EMPLOYEEMASTER_URL/import/new-joining-employeesPOSTImport new joining employeesBody: data (file/data)
EMPLOYEEMASTER_URL/import/from-exported-sheet/employeePOSTImport employees from exported sheetBody: data (file/data)
EMPLOYEEMASTER_URL/import/from-exported-sheet/employee-headsPOSTImport employee heads from exported sheetBody: data (file/data)
EMPLOYEEMASTER_URL/bulk-update/left-statusPOSTBulk update employee left statusBody: data (array of employee IDs and status)

RTK Query Hooks

The following hooks are available for frontend integration:

  • useCreateSalaryEmployeeMutation
  • useGetAllSalaryEmployeesQuery
  • useGetSalaryEmployeeByIdQuery
  • useUpdateSalaryEmployeeMutation
  • useDeleteSalaryEmployeeMutation
  • useSearchEmployeeMutation
  • useImportDataEmployeeMutation
  • useExportToExcelEmployeeQuery
  • useSerachAndExporToExcelEmployeeMutation
  • useImportEmployeeHeadsMutation
  • useSearchAndExportEmployeeHeadsMutation
  • useGetManagerEmployeesQuery
  • useImportNewJoiningEmployeesMutation
  • useImportEmployeesFromExportedSheetMutation
  • useImportEmployeeHeadsFromExportedSheetMutation
  • useBulkUpdateEmployeeLeftStatusMutation


Field Definitions, Usage, and Calculation Logic

This section provides a technical deep-dive into the Employee Master's data structure, validation ecosystem, and business logic governing payroll and statutory compliance.

1. Field Definitions

The Employee Master is the primary entity for personnel management, partitioned by companyId and unitId.

A. Basic & Identity Information

Field NameTechnical NameData TypeDescriptionExample Value
Employee CodeempCodeStringUnique system identifier.WS00123
Manual CodemanualEmpCodeStringLegacy identifier from previous systems.E-554
Aadhaar CardadhaarCardNumberString12-digit UID (Unique for active employees).123456789012
PAN NumberpanNumberString10-char alphanumeric (Unique for active).ABCDE1234F
GendergenderStringMale, Female, Other.Male

B. Organizational Mapping

Field NameTechnical NameData TypeDescription
UnitunitIdObjectIdReference to the operational Unit (Mandatory).
DesignationdesignationIdObjectIdReference to SalaryDesignationMaster.
DepartmentdepartmentIdObjectIdReference to departmentMaster.
Stationed AtstationedAtObjectIdGeographical reporting location.

C. Statutory & Salary Configuration

Field NameTechnical NameData TypeDescription
Basic SalarybasicSalaryNumberFixed monthly basic pay amount.
CTC / Total CompcurrentTotalCompensationNumberTotal Cost to Company (if based on CTC).
PF ApplicableprovidentFundApplicableBooleanEnables PF calculation for this employee.
PF Based OnPFBasedOnEnumBasic, Actual, Manual, Conditional.
AC10 N/Aac10NotApplicableBooleanSkips Pension (Account 10) contribution.
ESI Based OnesiBasedOnEnumAsper Rule, Manual, Gross, Derived.

2. Field Usage & Validation Rules

CategoryValidation / RuleSystem Behavior
UniquenessPartial IndexingpanNumber, adhaarCardNumber, and bankAccountNumber are strictly unique among Active employees within a company to prevent ghost payroll.
BankingIFSC RegexMust match ^[A-Za-z]\{4\}0[A-Za-z0-9]\{6\}$ (Standard RBI format).
RBACUnit Access ControlUsers can only view/edit employees within Units authorized via unitAccessPlugin.
IntegritySoft-DeleteDeletion sets isDeleted.status to true. Permanent deletion is blocked if the employee has historical salary records.

3. Relationships & Dependencies

  • Aadhaar Linking: The system uses Aadhaar as a bridge to legacy records. If a "new" employee is created with an existing Aadhaar, the system automatically attempts to transfer unpaid loans from the old record.
  • Head Mapping: The isHeadMapping flag determines whether the employee uses the Unit-level default salary distribution or has custom head overrides unique to their profile.

4. Calculation Logic

A. Statutory PF (Provident Fund)

The logic follows the PFBasedOn selection:

  • Basic: Calculated as 12% of the Basic Salary.
  • Actual: Calculated after daily-rate normalization: (FullAmount / MonthDays) * AttendanceDays.
  • Contribution Capping:
    • If pfGross > providentFundMaximumLimit (typically ₹15,000), the taxable wages are capped.
    • Pension (AC10): Calculated only if employeeAge < 58 and ac10NotApplicable is false.

B. Total Summarization

Total compensation is dynamically calculated across the system:

  • Total Earnings = Σ (Active Earnings Heads)
  • Total Deductions = Σ (Active Deduction Heads) + Statutory PF/ESI/PT
  • Net Pay = Total Earnings - Total Deductions

C. Loan-to-Employee Transfers

Enabled via a post('save') Mongoose hook:

  1. Trigger: New employee creation.
  2. Scan: Find non-deleted employees with the same adhaarCardNumber.
  3. Migration: Any pending LoanMaster records (status != 'COMPLETED') are updated with the new employeeId and marked as isTransferred: true.

5. Data Flow (Lifecycle)

From UI/Excel to Database

  1. Ingress: User submits form or uploads Excel.
  2. Normalization:
    • Dates (e.g., Joining Date) are normalized to DD/MM/YYYY.
    • Shorthand Codes (e.g., 'Y' for PF Applicable) are cast to Booleans.
  3. Pre-Save Middleware: Checks for record uniqueness and branch permissions.
  4. Persist: Saves the primary record in SalaryEmployeeMaster.
  5. Head Cloning: The system searches CompanyHeadMaster and creates a mirrored set in EmployeeHead (linked to the New Employee ID).
  6. Audit: Changes are logged in the logger system with "Old" and "New" value diffs.

End of Technical Documentation