Actually very simple. Setup efficiency is just average efficiency weighted on cost.
Arbitrary example:
------------------------
Gun cost per shot(ammo+decay): 14.5pec
Gun efficiency: 67.8%
Amp cost per shot(ammo+decay): 3.903pec
Amp efficiency: 83.6%
Total cost per shot: 18.403pec
(GUN COST * GUN EFFICIENCY) + (AMP COST * AMP EFFICIENCY) / TOTAL COST = Setup Efficiency.
((14.5×67.8) + (3.903×83.6) ) / 18.403 ~ 71.15%
For additional attachments, just add them the same way
(GUN COST * GUN EFFICIENCY) + (AMP COST * AMP EFFICIENCY) + (ATTACHMENT COST * ATTACHMENT EFFICIENCY) / TOTAL COST = Setup Efficiency.
For damage enhancers increase the gun cost portion by the percentage that the damage enhancers increase your cost.
EDIT: Added by request
(GUN COST * ENHANCERINCREASE% * GUN EFFICIENCY) + (AMP COST * AMP EFFICIENCY) / TOTAL COST = Setup Efficiency.
so for same setup as before, adding 5 damage enhancers,
TOTALCOST = 14.5×1.5 + 3.903 = 25,653
((14.5×1.5×67.8) + (3.903×83.6) ) / 25,653 = 70,20%
Damage enhancers increase efficiency on a setup when gun efficiency is higher than attachment efficiency. This is not an increase in efficiency per se, it is an increase in the weight of the cost of the gun shot. for instance, if we have the same setup as before, but the gun has 95 efficiency instead:
((14.5 * 95) + (3.903×83.6) ) / 18.403 = 92,58% Setup base efficiency
Add 10 damage enhancers:
((14.5 * 2 * 95) + (3.903×83.6) ) /32,903 = 93,65% Setup efficiency with enhancers
------------------------------
If you want to factor in any markup you simply increase the TOTAL COST by the effective markup per shot and leave everything else untouched.
If you are paying markup only on gun and gun cost distribution looks like the following :
Gun decay: 7 pec
Gun ammo: 7.5 pec
Gun MU: 110%
TOTAL COST = GUN(14.5 + (7*0.10)) + AMP(3.903) = 18.403 + 0.7 = 19.103 pec per shot.
((14.5×67.8) + (3.903×83.6) ) / 19.103 ~ 68,54% Effective Efficiency
SAME GUN COST + SAME AMP COST / TOTAL COST WITH MARKUP ADDED.
Now if you play around a bit with the gun decay portion of this ,while keeping total gun cost per shot the same you can easily see why higher ammo consumption is advantageous.
if for instance the decay portion of the gun above was 0.5 pec the effective efficiency would end up at 71.13% which is very close to the 71.15% without markup.