Here are more links and a short explanation of damage (see links if you need explanation of the hit chance formula).
If you hit the damage is directly calculated from the same server generated number (a seven digit number between 0-1) as the hit chance formula is tested against. If the random number is below 0.01 then it's a perfect hit and 3 times base damage. Otherwise you take the random number and add 0.49 and then multiply that with the base damage.
Then for final damage you of course have to factor in the resistance of the target. Base damage is what your ammo does multiplied by the Damage Modifier (look in the info of the turret).
Eve Uni got a good wiki. Evelopedia is also ok.
These are the hit notifications you get, info from Eve Uni:
Hit description Random damage modifier Random server number
Wrecking 0.490 to 0.500 (special case, 3x the base damage instead) 0 to 0.01
Barely scratches 0.500 to 0.625 0.01 to 0.135
Hits lightly 0.625 to 0.750 0.135 to 0.26
Hits 0.750 to 1.000 0.26 to 0.51
Well aimed 1.000 to 1.250 0.51 to 0.76
Excellent 1.250 to 1.490 0.76 to 1