AnsweredAssumed Answered

Help with calculation

Question asked by dmpjporter on Feb 12, 2010
Latest reply on Feb 12, 2010 by comment_1

Title

Help with calculation

Post

I am having trouble with a calculation and I think I am going to need to use a variable or something else a little more advanced than just a simple calc. I pasted a screen shot below of what I am using.

 

What I am trying to accomplish is this: I have an Order Total field that calculates any discounts and sales tax and displays the total of the order. Under that field, I have a Payments field that adds any payments that are made using the Portal for the payments and lastly the remaining balance. This all works out great but I run into trouble when I start working for a more detailed sales tax summary.

 

I want to be able to show how much tax was collected when a payment was made. As you can see in the portal, I have three fields. One is the payment made, the next is how much of that payment goes towards the purchase and then how much goes towards sales tax. This appears to work at first, but once the payments are complete and the balance is at 0, the numbers are not adding up, in this case it is three dollars off, $3 too much in sales tax and $3 too little in purchase. Overall, the numbers still add up, but it is not correct. I created the sum(calc) fields below the portal just to see what was going on and there you can see the 3 dollar problem.

 

Now for a quci breakdown of the calculations I used.

 

Round ( (Payment * (Finance::orderSalesTaxPercent / 100)); 2)

 

This takes the payment amount made and figures out what the sales tax is based on the sales tax field, 10 percent in this case. I am thinking that I need to somehow account for taxes and payments already made, but after trying several different times, I was un-successful. Can

 

Can anyone help me out here? As I had said, I am guessing I will need something a little more advanced, I just can't think of what it is.

 

Thanks.

Dave 

 

 

 

Order Form

Outcomes