If I were you, I really wouldn´t re-code webERP. Margin and Gross Profit are directly linked, you just need to modify the value. The formula to calculate the Gross Margin from a given Markup is this:
Gross Margin = Markup / (1 + Markup)
In your example:
Gross Margin = 0.3 / (1 + 0.3)
Gross Margin = 0.3 / 1.3
Gross Margin = 23.08 %
In other words, Markup 30 % = Gross Margin 23.08 %.
For some more detailed information, have a look here:
http://en.wikipedia.org/wiki/Gross_margin
Close to the end of the article they explain the conversion between Markup and Gross Margin.