Skip to content

Salary Structures (هياكل الرواتب)

Assign salary components to individual employees with custom amounts, effective date ranges, and calculation overrides.

Attributes

FieldTypeDescription
idintegerPrimary key
employee_idintegerEmployee FK
salary_component_idintegerSalary Component FK
amountdecimalFixed amount or percentage value
calculation_typeenumfixed or percentage
percentage_valuedecimalPercentage value (nullable)
effective_fromdateStart date
effective_todateEnd date (nullable = ongoing)
is_activebooleanActive status

API Endpoints

MethodURLDescription
GET/api/hr/employees/{id}/salary-structureList employee's salary components
POST/api/hr/employees/{id}/salary-structureAssign component to employee
POST/api/hr/salary-structures/apply-mandatoryApply all mandatory components to employees

Examples

bash
# View employee salary breakdown
curl -X GET "https://moon-erp.elbaset.com/api/hr/employees/1/salary-structure" \
  -H "Authorization: Bearer {token}"

# Assign a component
curl -X POST "https://moon-erp.elbaset.com/api/hr/employees/1/salary-structure" \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "salary_component_id": 3,
    "amount": 500,
    "calculation_type": "fixed",
    "effective_from": "2026-03-01"
  }'

# Apply all mandatory components
curl -X POST "https://moon-erp.elbaset.com/api/hr/salary-structures/apply-mandatory" \
  -H "Authorization: Bearer {token}"
dart
// View employee salary breakdown
final response = await dio.get('/api/hr/employees/1/salary-structure');

// Assign a component
final response = await dio.post('/api/hr/employees/1/salary-structure', data: {
  'salary_component_id': 3,
  'amount': 500,
  'calculation_type': 'fixed',
  'effective_from': '2026-03-01',
});

Business Rules

  • Each employee can have multiple salary components with different effective dates
  • The breakdown endpoint returns all active components for the employee with computed amounts
  • "Apply Mandatory" auto-assigns all mandatory salary components to employees who don't have them
  • When effective_to is null, the component is considered ongoing
  • Historical structures (past effective_to) are kept for payroll audit trail

Moon ERP API Documentation