Frontend
Masters
Head Master

Salary Head Master

The Salary Head Master is the core configuration layer where generic company-wide heads (defined in CompanyHeadMaster) are instantiated and customized for specific Units and Designations. It defines exactly how much an employee earns or is deducted, and how those amounts interact with statutory rules (PF/ESI/OT).

Navigation Path

Company → Masters → Head Master


1. Salary Head List Page

URL

/masters/head-master

Page Description

  • Displays a consolidated view of Earnings and Deductions scoped to specific Units and Designations.
  • Supports Inline Editing for quick amount adjustments.
  • Features Statutory Flag Toggles (PF, ESI, etc.) directly within the table rows for rapid configuration.
  • Implements a Virtual Row Engine to suggest missing heads based on company templates.

Filter & Search Section

Field NameTypeDescription
UnitSearchable DropdownFilters heads by a specific business unit. Supports infinite scrolling.
DesignationCreatable DropdownFilters by role. Allows creating new designations on-the-fly if not found.
Head TypeDropdownFilters by category: Earnings, Deduction, Over Time, Bonus, Reimbursement, etc.
DescriptionText InputSearch for a specific head by its name or description.

Actions:

  • Clear → Resets all filters and reloads the default list.
  • Search → Automatically triggers as values are selected/typed (Debounced).

List Table Columns

Column NameDescription
S NoSerial number.
DescriptionName of the salary component (e.g., Basic, HRA, PF).
AmountThe monetary value. Editable Inline for established records.
ActionsIncludes the Edit icon and several Statutory Flag Toggles.

Row Actions & Status Toggles

These buttons allow instant updates to the calculation behavior of a specific head:

ToggleNamePurpose
PFProvident FundToggles providentFundGrossPart. If green, the head contributes to PF gross.
ESIESIToggles esiGrossPart. If green, the head contributes to ESI gross.
PDPresence DependentIf active, the amount is pro-rated based on attendance (Worked Days).
OTOvertimeIf active, the head is included in the base for Overtime calculations.
NFHNational HolidayInclusion in base for National Festival Holiday pay.

2. Head Master Configuration (Add/Edit)

Triggered From

  • Virtual Row → Create Button: To instantiate a template head for a specific destination.
  • Table Row → Edit Icon: To open the detailed configuration form.

Page Description

  • Provides granular control over how a head is calculated (Fixed Amount vs. Formula).
  • Allows mapping to statutory sections and setting display priorities.

Key Configuration Fields

Field NameTypeMandatoryDescription
DescriptionText InputYesFull name of the salary component.
AmountNumberYes*Fixed value. (*Mutually exclusive with Formula).
FormulaDropdownNoReference to a Formula Master definition.
Display OrderNumberNoSorting sequence in UI and Salary Register.
ActiveCheckboxYesEnables/Disables the head from payroll processing.
MappingCheckboxYesControls ledger mapping for accounting integration.

Validation Rules

  • Mutual Exclusivity: A head cannot have both a fixed Amount and a Formula assigned.
  • Uniqueness: The system prevents creating duplicate heads for the same { Unit, Designation, Template } combination.
  • Unit Constraints: Heads defined at the Unit level (null designation) often enforce Amount: 0 via backend defaults, requiring formula-based calculations.

Field Definitions, Usage, and Calculation Logic

1. Technical Field Definitions

Field NameData TypeDescription
companyHeadIdObjectIdReference to the template head definition (CompanyHeadMaster).
unitIdObjectIdScopes the head to a specific physical unit/location.
designationIdObjectIdScopes the head to a specific role. Records with null designation are "Unit-level" constants.
salaryRegisterShowFlagBooleanDetermines if this head appears as a separate column in the final Salary Register.
blockSummationBooleanIf true, the head is informational and does not add to the "Gross Salary" total.

2. Business Logic & System Behavior

A. The "Virtual Row" Engine

To prevent redundant data entry, the frontend (HeadMasterTable.jsx) uses a merging logic:

  • Missing Heads: The UI compares the list of templates in CompanyHeadMaster against existing SalaryHeadMaster records for the selected Unit and Designation.
  • Dynamic Display: Template-only items are shown as "Virtual Rows" (highlighted in yellow).
  • Auto-Initialization: Entering an amount or clicking "Create" on a Virtual Row triggers a POST request that instantiates the database record.

B. Bulk Operation Logic

  • Excel Import: Supports broad mappings. The import engine can auto-create State and Category if they are missing in the referenced sheet.
  • Bulk Creation: When a new Designation is saved, the system can automatically seed all active template heads into the SalaryHeadMaster for that designation using the useCreateHeadsUsingUnitsAndDesignationMutation.

API Endpoints

Base URL

export const SALARYHEADMASTER_URL = '/api/salaryHeadMaster'

Endpoints

EndpointMethodDescriptionParameters/Body
${SALARYHEADMASTER_URL}POSTCreate a new Salary HeadBody: data
${SALARYHEADMASTER_URL}GETGet all active headsQuery: page, limit
${SALARYHEADMASTER_URL}/searchPOSTMulti-criteria searchBody: { unitId, designationName, exportType }
${SALARYHEADMASTER_URL}/:idPATCHUpdate amount or flagsPath: id, Body: data
${SALARYHEADMASTER_URL}/delete/:idPATCHSoft delete a headPath: id
${SALARYHEADMASTER_URL}/import/headsPOSTBulk Excel ImportMultipart: file

RTK Query Hooks

The following hooks are available for frontend integration (from salaryHeadMasterApiSlice.js):

  • useCreateSalaryHeadMasterMutation
  • useUpdateSalaryHeadMasterMutation
  • useSearchSalaryHeadMasterMutation
  • useImportSalaryHeadsMutation
  • useCreateHeadsUsingUnitsAndDesignationMutation

End of Documentation