Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Totalling a report variable
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Totalling a report variable
Miscellaneous
Thread ID:
00580088
Message ID:
00580088
Views:
50
Hi,

I have a report that prints lists of invoices by client; kinda like a credit card statement where you only see a list of invoice-totals and a total at the bottom.

In this report the invoice totals are calculated on the fly and placed on a report variable called lyInvoiceTotal.

The report is grouped by client, and each group prints on a new page. It looks a bit like this:
Date:     Description:               Charges:  Shipping:   Total(lyInvoiceTotal) 
10/01/01  Order placed by Hillary    $150.00      $20.00   $170.00
10/05/01  Flowers for Susy           $200.00      $45.00   $245.00

Total:                                                     $415.00 
(The grand total ($415) is giving me a grand headache).
Then another page is printed for another client
I finally got it to work, but it's not pretty and much less intuitive, which means that if I have to change anything to this report in 3 weeks I'll probably go nuts. Here's what I've done:

- Created report variable called lyInvoiceTotal with the following:
- Value To Store: 0
- Initial value: 0
- Reset at: same field used for grouping (v_caseinvoices_to_print.iCaseID)

- Created another report variable called lyPageTotal with the following:
- Value To Store: lyInvoiceTotal
- Initial value: 0
- Reset at: same field used for grouping (v_caseinvoices_to_print.iCaseID)

- The charges and shipping fields are actually return values from function that also update the lyInvoiceTotal variable (i.e. lyInvoiceTotal = lyInvoiceTotal + lyReturnValue)

- In the detail band's entry event I call a function that sets lyInvoiceTotal to zero.

- In the detail band's exit event I call a function that does just this:
lyPageTotal = lyPageTotal + lyInvoiceTotal


There has to be a more straight forward way to total report-variables than this. Any ideas?

Thanks!

Alex
Low-carb diet not working? Try the Low-food diet instead!
Next
Reply
Map
View

Click here to load this message in the networking platform