-- Slice 8Z-b · Split overhead value into `amount` (original / estimate) + `amount_actual` (live committed).
-- `amount` is set once (from tender pricing on seed, or PC's initial number on manual add) and never
-- edited after — it's the reference value for variance analysis. `amount_actual` is nullable and PC/Proc
-- refine it as real supplier quotes land. When `amount_actual` is NULL, treat estimate as current value.

SET @c := (SELECT COUNT(*) FROM information_schema.columns
            WHERE table_schema = DATABASE() AND table_name = 'c_project_overheads'
              AND column_name = 'amount_actual');
SET @sql := IF(@c = 0,
    "ALTER TABLE c_project_overheads
        ADD COLUMN amount_actual DECIMAL(20,2) NULL AFTER amount",
    'SELECT 1');
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
