A metalwork casting and machining company has been fined for unsafe work practices after an employee almost fell through a fragile roof.