SR4A 149:
Modified Armor Value = armor value +/- the attacks AP modifier.
Modified Damage Value = Base Damage + DV from net hits, aim, ammo type, etc (everything but extra DV from narrow burst).
If Modified Armor Value > Modified Damage Value, attack does S instead of P.
Damage resistance is done after that calculation.
So for example, firing a heavy pistol with ex-ex, 2 net hits: 5P + 1DV + 2DV = MDV 8P
Target has Armor Jacket: Base 8 Ballistic. Ex-Ex makes MAV 7.
MAV < MDV, so attack does P damage.
Damage resist: Body 5 + MAV 7 = 12 dice, 4 hits. Attack does 4 damage, but it's still P(hysical), not S(tun).
The test to see if the armor was pierced was done earlier. (Hits from) Damage Resistance test doesn't change that anymore.
Had the same attack been done with regular ammo: Mod. Dam. Val. would have been 7P, Mod. Arm. Val. would have stayed 8. The attack would have done stun damage instead.