ELMS — Employee Lifecycle Management System

A full-stack HRIS covering the entire employee lifecycle from recruitment to confirmation. Built with PHP 8 + MySQL + vanilla JavaScript.

9

Core Modules

22+

Database Tables

40+

API Endpoints

System Flow

Requisition → Candidates → Screening → Interview → Salary Proposal → Offer Approval → Offer Letter → Send Email → Candidate Response → Employee Creation → Salary Setup → Probation Appraisal → Confirmation Letter → Send Confirmation

Architecture

Backend

  • PHP 8.x with PDO/MySQL
  • RESTful JSON API endpoints
  • Transaction support for multi-step operations
  • Lifecycle logging via addCandidateLog()

Frontend

  • Vanilla JavaScript (no framework)
  • apiGet() / apiPost() from ajax/common.js
  • Quill.js rich-text editor for letters
  • Modal system, accordion, step wizard

Key Patterns

Database — Entity Relationship Diagram

Database: elms | Engine: InnoDB | Charset: utf8mb4

┌─────────────────────┐      ┌──────────────────────┐
│    departments       │      │  candidate_statuses  │
├─────────────────────┤      ├──────────────────────┤
│ PK id               │      │ PK id                │
│    name             │      │    code    (UNI)     │
│    code             │      │    name              │
└────────┬────────────┘      │    sort_order        │
         │ 1:N               └────────┬─────────────┘
    ┌────┴──────────────┐             │ 1:N
    │   designations    │        ┌───┴──────────────────┐
    ├───────────────────┤        │     candidates         │
    │ PK id             │        ├───────────────────────┤
    │ FK dept_id ───────┼──┐     │ PK id                 │
    └───────────────────┘  │     │ FK job_id → requisitions
                           │     │ FK status_id → statuses
┌─────────────────────┐   │     │    first_name, last_name
│   requisitions      │   │     │    email, phone, nid
├─────────────────────┤   │     │    gender, dob
│ PK id               │   │     │    present_address
│ FK dept_id ─────────┼───┘     │    permanent_address
│    title, vacancies │         │    current_salary
│    salary_min/max   │         │    expected_salary
└─────────────────────┘         └───────────┬───────────┘
                                            │ 1:N
         ┌──────────────────┬───────────────┼──────────────┐
         │                  │               │              │
    ┌────┴─────────┐  ┌────┴──────┐  ┌─────┴─────┐  ┌────┴──────────┐
    │candidate_logs│  │screenings│  │interview_log│  │salary_proposals│
    ├──────────────┤  ├───────────┤  ├───────────┤  ├───────────────┤
    │FK candidate_id│  │FK cand_id │  │FK cand_id │  │FK candidate_id│
    │ action       │  │ rating    │  │ round     │  │ proposed_sal  │
    │ from/to_status│ │ result   │  │ scores    │  │ salary_breakd │
    └──────────────┘  └───────────┘  │ decision  │  │ (JSON)        │
                                     └───────────┘  │ status        │
                                                    └───────┬───────┘
                                                            │
                      ┌─────────────────────────────────────┘
                      │
┌─────────────────────┴────────────────────────────────────────────┐
│                          offers                                 │
├──────────────────────────────────────────────────────────────────┤
│ PK id │ FK candidate_id │ FK designation_id │ FK dept_id        │
│ salary │ joining_date │ probation_months │ status               │
│ response_status │ responded_at │ response_notes                 │
│ sent_at │ accepted_at                                                │
└──────────┬──────────────────────────┬───────────────────────────┘
           │ 1:N                      │ 1:N
┌──────────┴───────────┐  ┌──────────┴─────────────────────┐
│   offer_letters      │  │       offer_approvals          │
│ FK offer_id           │  │ FK offer_id                    │
│ letter_content        │  │ level, approver, status        │
│ status: Draft→Gen→Sent│  └───────────────────────────────┘
│ generated_at, sent_at │
│ sent_to_email         │  ┌───────────────────────────────┐
└───────────────────────┘  │       offer_email_log          │
                           │ FK offer_id, recipient         │
                           │ subject, body, sent_at         │
                           └───────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│                      TEMPLATE SYSTEM                          │
├─────────────────────────────────────────────────────────────────┤
│  template_modules: module_name, render_file                    │
│  letter_templates: name, type (=module), content (HTML+{{TAGS}}) │
│  merge_tags: type, tag, label                                  │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│                       PROBATION MODULE                         │
├─────────────────────────────────────────────────────────────────┤
│  probation_appraisals: employee_id → PBI_ID                    │
│    end_date, overall_score, recommendation, status              │
│  probation_categories: name, weight %                          │
│  probation_scores: appraisal_id + category_id → score          │
│  probation_workflow: appraisal_id + level + status              │
│    Levels: Self Assessment → Supervisor → Dept Head             │
│            → HR Review → GM → Managing Director                 │
└─────────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────────┐
│                    EMPLOYEE / CONFIRMATION                     │
├─────────────────────────────────────────────────────────────────┤
│  personnel_basic_info: PBI_ID, PBI_CODE, PBI_NAME, offer_id     │
│    EMPLOYMENT_TYPE, dept_id, DESG_ID, 70+ fields                │
│  salary_info: PBI_ID, offer_id, 50+ salary fields               │
│  confirmation_letters: employee_id → PBI_ID                     │
│    letter_content, employment_type, status                      │
│    Draft → Generated → Approved → Sent                          │
└─────────────────────────────────────────────────────────────────┘

Module 1: Recruitment & Candidate Pipeline

Purpose

Manage job requisitions and track candidates through the hiring pipeline with full audit logging.

Workflow

HR creates Requisition (dept, designation, vacancies, salary range) ↓ Candidates apply / are added → auto-assigned status "Applied" (status_id=1) ↓ Each status change logged to candidate_logs (from_status → to_status, notes, created_by) ↓ candidates.status_id FK → candidate_statuses (Applied → Screened → Shortlisted → Interviewed → Selected → Offered → Hired)

Key Tables

TablePurposeKey Fields
departmentsOrg departmentsid, name, code
designationsJob designationsid, name, code, dept_id FK
requisitionsJob postingstitle, dept_id, vacancies, salary_min/max, skills, status
candidatesApplicantsjob_id FK, first_name, last_name, email, phone, nid, gender, dob, status_id FK
candidate_statusesLookup statusescode (UNI), name, sort_order
candidate_logsAudit trailcandidate_id FK, action, from_status, to_status, notes, created_by

Status Flow

Applied → Screened → Shortlisted → Interviewed → Selected → Offered → Hired
    │         │            │              │
    └─────────┴────────────┴──────────────┴→ Rejected (at any stage)

Module 2: Screening & Interview

Workflow

HR screens candidate → result: Shortlisted / Rejected ↓ screening.match fields = Match / Partial / No Match Interview rounds added (1, 2, 3...) each with 4 score dimensions: Technical | Communication | Problem-Solving | Attitude ↓ is_final_round=1 marks last round → triggers decision ↓ decision: Shortlisted / Rejected / Selected Candidate status auto-updates via candidate_logs

Key Tables

TablePurpose
screeningsFK candidate_id, screened_by, rating, comm_score, exp/skill/edu_match, result
interview_logFK candidate_id, round, type, interviewer, 4 scores, rating, decision, is_final_round

Module 3: Salary Proposal

Workflow

HR creates proposal → enters Gross Salary ↓ auto-calc (see Salary Calculation section) Basic = Gross × 0.571425 House Rent = Basic × 0.5 Medical = Basic × 0.1 Conveyance = Basic × 0.15 Total Salary = Gross ↓ Gender-based tax fetched via AJAX → offer_management/ajax/get_taxinfo_ajx.php ↓ Total Payable = Total Salary − Personal PF − PF Deductible − Monthly Tax ↓ Stored as JSON in salary_breakdown column Status: Draft → Proposed → Pending_Approval → Approved → Finalized

Salary Breakdown JSON

{
  "gross_salary": 50000,
  "basic": 28571.25,
  "house_rent": 14285.63,
  "medical_allowance": 2857.13,
  "conveyance_allowance": 4285.69,
  "total_salary": 50000,
  "personal_pf": 0,
  "pf_deductible": 0,
  "monthly_income_tax": 0,
  "total_payable": 50000
}

Key Files

FilePurpose
offer_management/salary_breakdown.phpInteractive salary calculator UI
offer_management/proposal.phpProposal list page
offer_management/ajax/proposal_create.phpSave proposal with salary_breakdown JSON
offer_management/ajax/proposal_submit.phpSubmit for approval
offer_management/ajax/proposal_approve.phpApprove/reject/finalize proposal
offer_management/ajax/proposal_finalize.phpFinalize → creates offer
offer_management/ajax/get_taxinfo_ajx.phpBangladesh tax calculator (FY 2024-25)

Module 4: Offer Management

Workflow

Proposal Finalized → offer created (status=Pending) ↓ Offer Approval page shows Pending offers ↓ approve.php All approval levels approved → offers.status = 'Approved' ↓ Ready for letter generation

Offer Status Flow

Pending → Approved → (letter generated/sent) → Accepted / Rejected
         ↘ Rejected

Key Tables

TablePurpose
offerscandidate_id FK, salary, joining_date, designation_id FK, dept_id FK, probation_months, status, response_status, response_notes
offer_approvalsoffer_id FK, level, approver, status (Pending/Approved/Rejected), comment

Key Files

FilePurpose
offer_management/approval.phpOffer approval page (Pending/Ready/History tabs)
offer_management/ajax/create.phpCreates offer + first approval level, updates candidate to "Offered"
offer_management/ajax/approve.phpApprove/reject offer at each level
offer_management/ajax/list_offers.phpCentral query — supports status, response_status, letter_status, with_letter filters

Module 5: Offer Letter Generation & Send

Workflow

letter.php → shows Approved offers with letter status (Not Generated / Generated / Sent) ↓ "Generate" generate_letter.php?offer_id=X 1. Fetch offer + candidate details 2. Load templates (type=Offer) from letter_templates 3. User selects template → AJAX: templates/ajax/render.php { module: "Offer", record_id: offerId, content: templateHTML } 4. render.php loads templates/render/offer.php → getOfferTagMap() 5. Resolves 12 {{TAGS}} → returns rendered HTML 6. Loaded into Quill editor → user edits → "Generate Letter" 7. AJAX: letter_generate.php → INSERT/UPDATE offer_letters (status='Generated') ↓ letter.php → "Send" → email modal 8. AJAX: letter_send.php - INSERT offer_email_log (recipient, subject, body) - UPDATE offer_letters SET status='Sent', sent_at=NOW() - UPDATE offers SET sent_at=NOW() - Log lifecycle: offer_sent

Template Merge Tags (Offer)

TagSource
{{CANDIDATE_NAME}}candidates.first_name + last_name
{{DESIGNATION}}designations.name
{{JOB_TITLE}}requisitions.title
{{DEPARTMENT}}departments.name
{{SALARY}}offers.salary
{{JOINING_DATE}}offers.joining_date
{{PROBATION_MONTHS}}offers.probation_months
{{COMPANY_NAME}}Hardcoded: TechCorp International
{{HR_NAME}}Hardcoded: HR Department
{{DATE}}Current date
{{RESPONSE_DATE}}Current date + 14 days
{{SALARY_BREAKDOWN}}HTML table from salary_proposals.salary_breakdown JSON

Module 6: Candidate Response

Workflow

response.php → tabbed view: Pending Response / Responded ↓ Pending tab: list_offers.php?status=Approved&response_status=Pending&letter_status=Sent → Only shows offers with sent letters awaiting response ↓ "Record Response" Mark Response modal → Accept / Reject + notes ↓ respond.php → UPDATE offers SET response_status, responded_at, response_notes → If Accepted: candidate status = 5 (Offered) → If Rejected: candidate status = 99 → Log lifecycle: offer_accepted / offer_rejected_candidate

Response Status Flow

Pending → Accepted → (ready for employee creation)
       ↘ Rejected

Module 7: Employee Creation (6-Step Wizard)

Workflow

employee/list.php → shows Accepted offers ready for employee creation ↓ "Create Employee" employee/create.php?offer_id=X → 6-step wizard: Step 1: Personal Info (auto-filled from candidate) Step 2: Employment (Employment Type defaults to "Probationer") Step 3: Address (present + permanent) Step 4: Family & Nominee (spouse, children, nominee) Step 5: Other Details (location, working days, notes) Step 6: Salary Setup (interactive calculator) ↓ "Create Employee" 1. submitEmployee() → POST employee/ajax/save.php → INSERT personnel_basic_info (70+ fields, auto-generated PBI_CODE: EMP-00001) 2. submitSalaryData() → POST employee/ajax/save_salary.php → INSERT/UPDATE salary_info (50+ salary fields) 3. Redirect to employee/view.php?offer_id=X

Step 6: Salary Setup

Gross Salary (editable, oninput=calculateSalary()) ↓ auto-calc Basic = Gross × 0.571425 (readonly) House Rent = Basic × 0.5 (readonly) Medical = Basic × 0.1 (readonly) Conveyance = Basic × 0.15 (readonly) Total Salary = Gross (readonly) ↓ AJAX to get_taxinfo_ajx.php Monthly Income Tax (readonly, gender-aware) ↓ Total Payable = Total Salary − Personal PF − PF Deductible − Monthly Tax

Employment Types

Casual | Apprentice | Probationer (default) | Temporary | Replace | Permanent | Seasonal | Contractual | Regular

Key Tables

TablePurpose
personnel_basic_info70+ employee fields: PBI_CODE, PBI_NAME, PBI_EMAIL, EMPLOYMENT_TYPE, dept_id, DESG_ID, offer_id, candidate_id
salary_info50+ salary fields: gross_salary, basic_salary, house_rent, total_payable, m_income_tex, pf, pf_deductible, ac_no, etc.

Module 8: Probation Appraisal

Workflow

probation/list.php → shows employees with EMPLOYMENT_TYPE='Probationer' ↓ "Start Appraisal" Creates probation_appraisals record + 6 workflow levels + empty scores ↓ Self Assessment → Supervisor → Dept Head → HR Review → GM → Managing Director ↓ each level: approve / sendback / reject Probation scores entered per category (weighted %) ↓ Overall Score = Σ(score × weight) / Σ(weight) ↓ Recommendation: Confirm / Extend / Terminate ↓ final level approved appraisals.status = 'Completed' → employee appears in Confirmation module

Multi-Level Workflow

LevelOrderAction
Self Assessment1Employee self-review
Supervisor2Direct manager evaluation
Dept Head3Department head review
HR Review4HR department assessment
GM5General Manager approval
Managing Director6Final approval (last level)

Key Tables

TablePurpose
probation_appraisalsemployee_id (→PBI_ID), joining_date, probation_months, end_date, overall_score, recommendation, status
probation_categoriesname, weight %, sort_order
probation_scoresappraisal_id FK, category_id FK, score, comments
probation_workflowappraisal_id FK, level, status (Pending/Approved/Sent Back/Rejected), approved_by, comments

Key Files

FilePurpose
probation/list.phpAppraisal list page
probation/approve.phpMulti-level approval page with accordion UI
probation/ajax/eligible_employees.phpEmployees where candidate_id IS NOT NULL AND EMPLOYMENT_TYPE='Probationer'
probation/ajax/employees_list.phpSame filter + appraisal count
probation/ajax/appraisals_get.phpFull join through PBI + offers, screenings via pbi.candidate_id
probation/ajax/appraisals_submit.phpSubmits scores + advances workflow
probation/ajax/approval_action.phpApprove/sendback/reject workflow level
probation/ajax/approval_list.phpPending approvals with next workflow level

Module 9: Confirmation

Workflow

confirmation/list.php → shows employees with probation_appraisals.status='Completed' ↓ "Generate Letter" confirmation/generate.php?employee_id=X&appraisal_id=Y 1. Fetch employee details from personnel_basic_info 2. Load templates (type=Confirmation) from letter_templates 3. Select employee type (Casual/Permanent/Regular/etc.) 4. User selects template → AJAX: render_template.php { employee_id, content: templateHTML } 5. Resolves 15 {{TAGS}} from getConfirmationTagMap() 6. Quill editor → "Generate Letter" 7. AJAX: letter_generate.php → INSERT confirmation_letters (status='Generated') ↓ confirmation/confirmation_letters.php → shows Generated letters ↓ "Approve" letter_approve.php → status='Approved' ↓ "Send" Send modal (auto-filled with employee email from PBI_EMAIL) ↓ letter_send.php → status='Sent', sent_at, sent_to_email

Template Merge Tags (Confirmation)

TagSource
{{EMPLOYEE_NAME}}pbi.PBI_NAME + last_name
{{EMPLOYEE_CODE}}pbi.PBI_CODE
{{DESIGNATION}}designations.name
{{DEPARTMENT}}departments.name
{{SALARY}}offers.salary or salary_info.gross_salary
{{JOINING_DATE}}offers.joining_date or PBI_DOJ
{{CONFIRMATION_DATE}}joining_date + probation_months
{{PROBATION_MONTHS}}offers.probation_months
{{COMPANY_NAME}}Hardcoded: TechCorp International
{{HR_NAME}}Hardcoded: HR Department
{{DATE}}Current date
{{PHONE}}pbi.PBI_MOBILE
{{EMAIL}}pbi.PBI_EMAIL
{{GENDER}}pbi.PBI_SEX
{{SALARY_BREAKDOWN}}HTML table from salary_info

Confirmation Status Flow

Draft → Generated → Approved → Sent

Key Files

FilePurpose
confirmation/list.phpEligible employees (probation completed)
confirmation/generate.phpLetter generation with Quill + template + employee type
confirmation/confirmation_letters.phpLetter list with Preview/Approve/Send actions
confirmation/ajax/migrate.phpCreates confirmation_letters table
confirmation/ajax/list_eligible.phpCompleted probation employees
confirmation/ajax/list_letters.phpConfirmation letters with employee data
confirmation/ajax/letter_generate.phpSave/update generated letter
confirmation/ajax/letter_view.phpFetch letter for preview
confirmation/ajax/letter_approve.phpApprove/reject letter
confirmation/ajax/letter_send.phpMark as sent with email
confirmation/ajax/render_template.phpResolve {{TAGS}} for confirmation
templates/render/confirmation.phpgetConfirmationTagMap() — 15 tags

Template Engine System

Architecture

letter_templates table stores HTML content with {{TAG}} placeholders ↓ templates/ajax/render.php receives { module, record_id, content } ↓ 1. SELECT render_file FROM template_modules WHERE module_name = :module 2. require_once render_file (e.g. templates/render/offer.php) 3. Call getTagMap(pdo, record_id) → Each render file queries DB, returns [ 'TAG' => 'value', ... ] 4. preg_replace /{{([A-Z_][A-Z0-9_]*)}}/ → value 5. Return { rendered_content, tag_count }

Registered Modules

ModuleRender FileFunctionTags
Offertemplates/render/offer.phpgetOfferTagMap()12 tags
Confirmationtemplates/render/confirmation.phpgetConfirmationTagMap()15 tags
Probationtemplates/render/probation.phpgetProbationTagMap()TBD
Generaltemplates/render/general.phpgetGeneralTagMap()TBD

Default Templates

NameTypeSeeded By
Standard Offer LetterOffertemplates/ajax/migrate.php
Confirmation Letter TemplateConfirmationtemplates/ajax/seed_confirmation.php

Salary Calculation Logic

Auto-Calculation Formula

ComponentFormulaExample (Gross=50,000)
Basic SalaryGross × 0.57142528,571.25
House RentBasic × 0.514,285.63
Medical AllowanceBasic × 0.12,857.13
Conveyance AllowanceBasic × 0.154,285.69
Total Salary= Gross50,000.00
Total PayableTotal Salary − Personal PF − PF Deductible − Monthly TaxVaries

Tax Calculation (Bangladesh FY 2024-25)

Endpoint: GET offer_management/ajax/get_taxinfo_ajx.php?gross_salary=X&basic_salary=Y&gender=male|female

Response

{ "success": true, "tax": 500.00, "annual_tax": 6000.00, "taxable_income": 60000.00 }

Logic

Lifecycle Logging

All key actions are logged via addCandidateLog($pdo, $candidateId, $action, $from, $to, $notes) in includes/functions.php.

ActionModuleWhen
offer_createdOfferOffer created for candidate
offer_approvedOfferAll approval levels passed
offer_rejectedOfferRejected at any approval level
offer_letter_generatedLetterLetter content saved
offer_sentLetterEmail logged as sent
offer_acceptedResponseCandidate accepted offer
offer_rejected_candidateResponseCandidate rejected offer
probation_approvedProbationApproved at a workflow level
probation_completedProbationAll levels approved
probation_sentbackProbationSent back to previous level
probation_rejectedProbationRejected at any level

Lifecycle timeline viewable at lifecycle/view.php.

API Endpoints Reference

Offer Management

POST offer_management/ajax/create.php — Create offer + first approval
POST offer_management/ajax/approve.php — Approve/reject offer
GET offer_management/ajax/list_offers.php — Central offer list (status, response_status, letter_status, with_letter params)
POST offer_management/ajax/letter_generate.php — Save offer letter
GET offer_management/ajax/letter_view.php — Preview offer letter
POST offer_management/ajax/letter_send.php — Send offer letter email
POST offer_management/ajax/respond.php — Record candidate response
POST offer_management/ajax/proposal_create.php — Create salary proposal
POST offer_management/ajax/proposal_submit.php — Submit for approval
POST offer_management/ajax/proposal_approve.php — Approve/reject proposal
POST offer_management/ajax/proposal_finalize.php — Finalize proposal
GET offer_management/ajax/get_taxinfo_ajx.php — Tax calculation

Employee

POST employee/ajax/save.php — Create employee (personnel_basic_info)
POST employee/ajax/save_salary.php — Save salary info
GET employee/ajax/get_candidate.php — Get offer + employee + salary data
GET employee/ajax/list_offers.php — List accepted offers ready for employee creation

Probation

GET probation/ajax/eligible_employees.php — Probationer employees
GET probation/ajax/employees_list.php — Employees + appraisal count
GET probation/ajax/appraisals_list.php — Appraisals with scores
GET probation/ajax/appraisals_get.php — Full appraisal detail
POST probation/ajax/appraisals_submit.php — Submit scores + advance workflow
POST probation/ajax/appraisals_update.php — Update scores
POST probation/ajax/approval_action.php — Approve/sendback/reject level
GET probation/ajax/approval_list.php — Pending approvals

Confirmation

GET confirmation/ajax/list_eligible.php — Completed probation employees
POST confirmation/ajax/letter_generate.php — Generate confirmation letter
GET confirmation/ajax/list_letters.php — List confirmation letters
GET confirmation/ajax/letter_view.php — Preview confirmation letter
POST confirmation/ajax/letter_approve.php — Approve/reject letter
POST confirmation/ajax/letter_send.php — Send confirmation letter
POST confirmation/ajax/render_template.php — Resolve confirmation tags

Templates

GET templates/ajax/templates_list.php — List templates (type param)
POST templates/ajax/render.php — Render template tags (module, record_id, content)

File Structure

ELMS-final/
├── ajax/common.js              # apiGet(), apiPost(), formatCurrency(), filterTable()
├── includes/
│   ├── config.php              # getDB(), ROOT_PATH, APP_SHORT
│   ├── functions.php           # addCandidateLog()
│   ├── layout.php              # Master layout (sidebar + content)
│   └── sidebar.php             # Navigation with all modules
├── candidates/                 # Candidate CRUD
├── screening/                  # Screening forms
├── interview/                  # Interview rounds
├── requisition/                # Job requisitions
├── offer_management/
│   ├── index.php               # Overview dashboard
│   ├── proposal.php            # Salary proposal list
│   ├── salary_breakdown.php    # Interactive salary calculator
│   ├── proposal_approval.php   # Proposal approval (Pending/Finalized/Rejected)
│   ├── approval.php            # Offer approval (Pending/Ready/History)
│   ├── letter.php              # Offer letter list + send
│   ├── generate_letter.php     # Letter generation (Quill + templates)
│   ├── response.php            # Candidate response (Pending/Responded)
│   └── ajax/                   # 12+ AJAX endpoints
├── employee/
│   ├── list.php                # Offers ready for employee creation
│   ├── create.php              # 6-step wizard
│   ├── view.php                # Employee profile (6 tabs including Salary)
│   ├── salary_information.php  # Standalone salary form
│   └── ajax/                   # save.php, save_salary.php, get_candidate.php
├── probation/
│   ├── list.php                # Appraisal list
│   ├── approve.php             # Multi-level approval
│   └── ajax/                   # 8 AJAX endpoints
├── confirmation/
│   ├── list.php                # Eligible employees
│   ├── generate.php            # Letter generation (Quill + templates + emp type)
│   ├── confirmation_letters.php # Letter list (Preview/Approve/Send)
│   └── ajax/                   # 7 AJAX endpoints
├── templates/
│   ├── list.php                # Template CRUD
│   ├── tags.php                # Merge tag management
│   ├── render/                 # Module-specific tag resolvers
│   │   ├── offer.php           # getOfferTagMap() — 12 tags
│   │   ├── confirmation.php    # getConfirmationTagMap() — 15 tags
│   │   └── probation.php       # getProbationTagMap()
│   └── ajax/                   # render.php, templates_list.php, migrate.php
├── lifecycle/
│   └── view.php                # Timeline view of all candidate actions
└── docs/
    ├── system-logic.md         # Phase-by-phase system logic
    ├── database-erd.md         # Full ERD + table schemas
    ├── elms-erd.dbml           # DBML format ERD
    └── documentation.html      # This file

Status State Machines

Candidate Status

Applied → Screened → Shortlisted
→ Interviewed → Selected → Offered → Hired
↗ Rejected (at any stage)

Offer Status

Pending → Approved → (letter flow)
       ↘ Rejected

Offer Response

Pending → Accepted
       ↘ Rejected

Offer Letter

Draft → Generated → Sent

Salary Proposal

Draft → Proposed → Pending_Approval
→ Approved → Finalized
↗ Rejected (can revise)

Probation Appraisal

Draft → In Progress → Completed
         ↘ Rejected
↗ Sent Back (to Draft)

Probation Workflow

Pending → Approved
       ↘ Rejected
       ↘ Sent Back

Confirmation Letter

Draft → Generated → Approved → Sent
                       ↘ Rejected

Documentation Files

Download or view the full documentation files for deeper reference. These files contain detailed schemas, complete system logic diagrams, and importable ERD definitions.

System Logic Diagram

Markdown

Phase-by-phase system flow with ASCII diagrams covering all 9 modules: Recruitment, Screening, Salary Proposal, Offer, Letter Generation, Response, Template Engine, Probation, and Confirmation.

  • 9 phase diagrams with file references
  • Data flow summary
  • All status state machines
View File Download

Database ERD

Markdown

Full entity relationship diagram with all 23 tables, complete field schemas, foreign key constraints, and ASCII ERD visualization.

  • 23 table schemas with types and keys
  • 20 foreign key constraints
  • ASCII ERD with relationships
View File Download

DBML ERD Definition

DBML

Importable DBML file for dbdiagram.io. Paste this code to generate a visual, shareable ERD diagram instantly.

  • All 23 tables with column types
  • FK references between tables
  • Ready to paste into dbdiagram.io
View File Download

Full Documentation

HTML

This documentation page itself. A self-contained HTML file with inline styles — works offline, no server required. Share it with anyone.

  • 9 module breakdowns with workflows
  • API endpoint reference
  • Salary & tax calculation formulas
View File Download

For more details, download and view the files above. The DBML file can be imported directly into dbdiagram.io to generate an interactive ERD.


ELMS Documentation — Generated July 2026