FWIW ... The reason "Splitcheck.item_price + round((subtotal*dining_tax),2)
+ round((subtotal*fixedtip),2)" is coming up wrong is that you have a
cumulative effect. All variables are processed each time a detail record is
processed. For each detail record, "Subtotal" is updated to add that item's
price. Then the "Grand Total" variable is processed with the "item Price"
AND the tax and tip .. but the tax and tip is using SUBTOTAL which is
cumulative. So on the first record, item_price and SUBTOTAL are the same so
tax and tip is added for that one item .. but on the second record, the tax
and tip calculation is using the total from both item 1 and item 2 so the
tax and tip is calculated higher than it should be. With each detail item in
the check, the tax and tip keeps creeping higher and higher.
I'm assuming the dining_tax and fixedtip numbers don't change throughout the
report. If that's the case ... here's how you could solve this situation
with some trickiness.
REPORT VARIABLES
rnSubtotal Value to store Splitcheck.item_price
Reset value based on Group: Splitcheck.checkno
Calculation Type = Sum
rntotal Value to store Splitcheck.item_price
Reset value based on Group: End of Report
Calculation Type = Sum
rnTax Value to store 0 (I know this looks odd .. but trust me!)
Reset value based on Group: End of Report
Calculation Type = Sum
rnTip Value to store 0 (I know this looks odd .. but trust me!)
Reset value based on Group: End of Report
Calculation Type = Sum
In the group footer band ... print the values as follows (don't set any
calculate options on the fields):
For Subtotal: rnSubtotal
For Tax Amt: round((rnsubtotal*dining_tax),2)
For Tip: round((rnsubtotal*fixedtip),2)
In the On Exit expression of the group footer, put the following:
_VFP.SetVar('rnTax', rnTax + round((rnsubtotal*dining_tax),2)) AND
_VFP.SetVar('rnTip', rnTip + round((rnsubtotal*fixedtip),2))
In the summary band ... print the values as follows (don't set any calculate
options on the fields):
For Subtotal: rnTotal
For Tax Amt: tnTax
For Tip: rnTip
I hope this helps!
Cathy Pountney
-------
> My report --totals show
> 6.00 subtotal
> 0.45 tax amt
> 1.08 fixed tip
> ----
> 7.53
>
> 4.50 subtotal
> 0.34 tax amt
> 0.81 fixed tip
> ----
> 5.65
>
> 3.50 subtotal
> 0.26 tax amt
> 0.63 fixed tip
> ----
> 4.39
>
>
> this totals to 17.57
>
> the report grand total returns 19.61
>
> a difference of 2.04
> Its driving me nuts, I just cannot see what I have wrong
>
> Thanks Jerry
>
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
> Of Alan Bourke
> Sent: Friday, June 12, 2009 1:34 PM
> To: [email protected]
> Subject: Re: Problems with grand total in report
>
> If you are resetting Subtotal, TaxAmount and FixedTip on the checkno
> changing, I would guess you would need to set up a new Grandtotal report
> variable as:
>
> Splitcheck.item_price + round((subtotal*dining_tax),2) +
> round((subtotal*fixedtip),2)
>
> and have it reset at end of report.
> --
> Alan Bourke
> alanpbourke (at) fastmail (dot) fm
>
>
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/003401c9eca7$1b092ed0$511b8c...@com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.