minus discount on invoice

Gazza2

Registered User.
Local time
Today, 08:35
Joined
Nov 25, 2004
Messages
184
What should have been a simple task is now a pain in the rear end.

I have an invoice form(InvoiceHeader) with a continuous subform(InvoiceSub) to enter goods into which works great. After i enter a product the retail price is automatically filled in TxtRetailPrice and then i enter a quantity that the customer wants, after that there is a discount field where i enter an amount which is shown in percent format.

All works fine so far until it comes to calculating the line total.

so if the price of part1 is £12 and quantity is 2 total is £24

If discount = 5% then line total should be £22.80

the totals i get is £23.50 ,£0.01 or £0.00 depending on which of the following formula i have in the txtLineTotal textboxes control source:-

= [discount]/100 * ([TxtRetail] * [Quantity])

= (([discount]/100) *([txtretail]*[Quantity]))

= ([txtretail] * [Quantity]) * ([discount]/100)

obviously im doing something wrong but for the life of me i cant find out where.

Thanks in advance for any help
Gareth
 
Gareth,

Try it like this:
= [txtretail] * [Quantity] * (1 - [discount]/100)
 
Try this out:

= (1-([discount]/100)) * ([Quantity] * [txtRetail])

so for 5% you would have

1 - (5/100) * (2 * 12)

(1 - .05) * (24)

.95 * 24 = 22.80
 
Darn, I'm just too slow typing today.

headinhands.jpg
 
Thanks for the quick replies steve and bob

I tried both options and now its getting stranger as it just takes £0.01 of the total giving me the value £23.99.
 
Thanks for the quick replies steve and bob

I tried both options and now its getting stranger as it just takes £0.01 of the total giving me the value £23.99.

Post what you used EXACTLY, please.
 
here is the exact code i used in the txtlinetotal textboxes control source

= [txtretail] * [Movement] * (1 - [discount]/100)

AND

= (1-([discount]/100)) * ([Movement] * [txtRetail])

I had to change the name of quantity to movement as this is the name of my textbox and table field, i just used quantity to try and better explain myself.

As for the discount, it is stored as 5.00% when i look at the table.

Thanks again
 
As it is showing as 5% in the table, then elminate the /100. So try this:

= [txtretail] * [Movement] * (1 - [discount])
 
Gareth,

As for the discount, it is stored as 5.00% when i look at the table.

I think Bob has put his finger on the problem here. If you see 5% then the actual value of the field is 0.05

Therefore, try it like this:
= [txtretail] * [Quantity] * (1 - [discount])
 
Item quanity Total Discount discount amount
10 2 20.00 5%



((10*2)/100) *(100-discount)
that should do it --


oops slow fingers
 
thanks for the replies

= [txtretail] * [Movement] * (1 - [discount])

works like a charm
 

Users who are viewing this thread

Back
Top Bottom