>To correctly calculate the negative margin of sales when the cost is greater than the price.
Sounds like you need an Economist, not a Mathematician (which I am, but have not seen anything like this since college Economics classes :)
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.