---
tags: [hr, hub]
module: HR
---

# HR Module — Hub

> Employees, positions, and payroll — payroll auto-creates Accounting journal entries.

## Models
[[[Model]Employee]] · [[[Model]Position]] · [[[Model]PayrollEntry]]

## Controllers
[[[Controller]EmployeesController]] · [[[Controller]PositionsController]] · [[[Controller]PayrollEntriesController]]

## Services
[[[Service]EmployeeServices]] · [[[Service]PositionServices]] · [[[Service]PayrollServices]]

## Infrastructure
[[[Repo]Repositories]] · [[[Routes]Routes]] · [[[DB]DatabaseTables]] · [[[Cross]CrossModuleDependencies]]

---

## Flow
```
Employee ←→ Position (many-to-many via EmployeePosition, stores salary)
                ↓
PayrollEntry (monthly) → PayrollEntryDetail (one per employee)
                ↓
[[[Service]JournalEntryServices]] → [[[Model]JournalEntry]] (Accounting)
```

---

## Cross-Module Dependencies

| This module uses | From |
|---|---|
| [[[Model]Account]] | Accounting — employee cost account + payroll payment account |
| [[[Model]JournalEntry]] | Accounting — created on every payroll run |
| [[[Service]JournalEntryServices]] | Accounting — `CreatingNewJournalEntryService`, `DeletingJournalEntryService` |
| [[[Service]AccountServices]] | Accounting — `RetrievingExpensesMainCategoryAccountsService` for employee form |
| [[[Model]FiscalYear]] | Settings — payroll year_id FK |
| [[[Service]FiscalYearServices]] | Settings — `RetrievingCurrentFinancialYearService` |
| [[[Model]User]] | CompanyUser — created_by on PayrollEntry + PayrollEntryDetail |

---

## Related Modules
[[START_HERE]] · [[_Accounting]] · [[_Settings]] · [[_CompanyUser]]
