Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Total on last detail line
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01014348
Message ID:
01014843
Vues:
22
>Hi Cathy:
>
>I know that you are the expert on VFP reporting (I attended some of your presentations at GLGDW), but your solution went over my head. Could you be a little more detailed?
>
>Sorry,
>
>Yossi
>


Hi Yossi,

I'll try to clarify. I went back and reread this thread and realized that I completely missed the point that you want the subtotals on the same line as the last detail line of each invoice. The solution I provided wouldn't exactly do this, so here's an altered suggestion.

1. Create a data group with an expression of MyTable.InvoiceNumber

2. Create a report variable called rnSubtotal. Initialize it as 0, set the expression to MyTable.InvoiceAmount, set the calculate option to SUM, set the ResetAt value to InvoiceNumber.

3. Create a report variable called rnGrandTotal. Initialize it as 0, set the expression to MyTable.InvoiceAmount, set the calculate option to SUM, set the ResetAt value to EndOfReport.

4. Create a report variable called rlEndOfInvoice. Initialize it to .f., set the expression to IsLastInvoice().

5. In the program that calls the report (or in a program that is in the SET PROCEDURE TO path), create a new UDF called IsLastInvoice.
FUNCTION IsLastInvoice
LOCAL lEnd, lnInvoice
lEnd = .t.
lnInvoice = MyTable.InvoiceNumber
IF NOT EOF('MyTable')
  SKIP IN MyTable
  lEnd = (m.lnInvoice <> MyTable.InvoiceNumber)
  SKIP -1 IN MyTable
ENDIF
RETURN m.lEnd
6. In your detail band, use rnSubtotal as the expression for the subtotal object. Set the Print When logic of this object to rlEndOfInvoice so it only prints when it's the last item.

7. Create a summary band and print rnGrandTotal.


I hope this helps!
Cathy
Cathy Pountney, Microsoft Visual FoxPro MVP
Memorial Business Systems, Inc. (www.mbs-intl.com)

My Website: (www.frontier2000.com)
My Blog: (www.cathypountney.blogspot.com)
My Book: The Visual FoxPro Report Writer - Pushing it to the Limit and Beyond
Free MSDN Article: What's New in the VFP 9.0 Report Writer
Free MSDN Article: The VFP 9.0 Report Writer In Action
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform