### Title

A different kind of percentage calculation??

### Post

Hi,

Im pulling my hair out with this and the few vodkas ive had probably are not helping too.

I need some assistance on how to set this up.

I have the following fields.

Sub total

Discount

freight

total

new total

What im trying to do is when the order is setup correctly the subtotal is filled in, the discount and total but ive added discount and new total as i keep rounding jobs off for customers.

I want it to, say the sub total is $103frieght is $40 and the total is $143, i want to be able to put in $140 in the new total and it calculates the percentage difference between new total and subtotal and put the percentage in discount and adjusts the total to the new.

i tried.

discount = new total / subtotal as percentage

Total = subtotal - discount

but no joy.

Hopefully ive not confused anyone and someone can help.

cheers

Stuart

So you would have a starting point of:

Sub total 100

Discount

Nett 100

freight 25

total 125

new total

And you want to enter a over-written total to be, say 120, so it would look like this:

Sub total 100

Discount 5%

Nett 95

freight 25

total 120

(new total 120)

I believe the calculation you want is:

( (SubTotal + Freight ) - NewTotal ) / SubTotal

This will show the discount as if it entirely came off the SubTotal, ie: the discount was not applied to the freight.