CREATE TABLE IF NOT EXISTS employee_reconciliations (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    employee_id BIGINT UNSIGNED NOT NULL,
    expected_cash DECIMAL(14,2) NOT NULL,
    counted_cash DECIMAL(14,2) NOT NULL,
    difference_amount DECIMAL(14,2) NOT NULL,
    notes TEXT NULL,
    counted_by BIGINT UNSIGNED NOT NULL,
    counted_at DATETIME NOT NULL,
    created_at DATETIME NOT NULL,
    KEY employee_reconciliations_employee_date_index (employee_id, counted_at),
    CONSTRAINT employee_reconciliations_employee_fk FOREIGN KEY (employee_id) REFERENCES users(id),
    CONSTRAINT employee_reconciliations_manager_fk FOREIGN KEY (counted_by) REFERENCES users(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
