Solidmark Payroll, Schedule, and Account Integrity Fixes

Implementation report for the Solidmark repository

Source: Solidmark
Repository: Solidmark
Components: Schedule Management, Attendance, Payroll, Contributions, Employee Accounts, Brand Access
Completed: Sep 23, 2026 at 02:25 PM PHT

Summary

A coordinated integrity update was completed across employee creation, authentication, schedule management, attendance credit, government contributions, payroll calculations, and brand-scoped data access. The work removed calculation inconsistencies between attendance entry points, repaired contribution settings that incorrectly produced zero deductions for regular employees, and reconciled the live payroll cache against the corrected formulas.

Brand and Schedule Management

Attendance Credit Calculations

Employee Accounts and Credentials

Payroll and Contribution Calculations

Contribution Override Behavior

Data Reconciliation

Validation

Code Validation

Implementation Proof — Solidmark (Code Changes)

1. Contribution Cutoff Correction (payroll_recalculate_helper.php)

- if ($untilDay >= 11 && $untilDay <= 19) {
+ if ($untilDay >= 1 && $untilDay <= 19) {
      return 'semi-monthly';
  }

2. Scoped Contribution Override Recalculation (update_contribution_override.php)

- payroll_recalculate_employee_live_cache($conn, $employee_id, null, null);
+ $liveSql = 'SELECT * FROM payroll_live_cache
+     WHERE employee_id = ? AND company_id = ? AND brand_id = ?';
+ payroll_recalculate_employee_live_cache(
+     $conn, $employeeId,
+     (string)$liveRow['date_from'],
+     (string)$liveRow['date_until']
+ );

3. Schedule Changes Recalculate Attendance and Payroll (work_schedule_helper.php)

+ function work_schedule_recalculate_attendance_range(
+     mysqli $conn, string $employeeId,
+     string $dateFrom, ?string $dateUntil = null
+ ): int {
+     $dirtySql = "UPDATE payroll_live_cache
+         SET needs_recalc = 1
+         WHERE employee_id = ? AND date_until >= ?";
+ }

4. Employee Credential Integrity (add_employee.php)

- $employeePassword = hash('sha256', $employee_id);
+ $initialPassword = trim((string)($data['password'] ?? ''));
+ if ($initialPassword === '') $initialPassword = $employee_id;
+ $employeePassword = password_hash($initialPassword, PASSWORD_BCRYPT);

5. Final Payroll Totals Protected from Legacy Triggers (payroll_recalculate_helper.php)

+ 'gross_salary' => (float)$payload['gross_salary'],
+ 'total_salary_after_late' => (float)$payload['total_salary_after_late'],
+ 'net_salary_cached' => (float)$payload['net_salary_cached'],
+ 'employer_contribution_total_cached' =>
+     round($sssEmployerApplied + $pagibigEmployerApplied
+         + $philhealthEmployerApplied, 2),

Source and Tracking

Source: Solidmark repository
Scope: Schedule Management, Attendance, Payroll, Contributions, Employee Accounts, and Brand Isolation