Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One function twice?
Message
 
 
À
28/09/2004 18:58:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00947006
Message ID:
00947008
Vues:
23
This message has been marked as a message which has helped to the initial question of the thread.
Chris,
* Get total for Invoice in Progress
lnTotal = GetInvoiceTotal()
* Get total for specific Invoice 
lnTotal = GetInvoiceTotal(46546546)
...
PROCEDURE GetInvoiceTotal(InvoiceID)
IF PCOUNT() = 1 
 This.GetInvoiceLines(InvoiceID)
ENDIF
This.SelectAlias("Invoice")
SUM Amount TO Total
RETURN Total
>I have a function like the following, used to get the total for a single invoice.
>
>PROCEDURE GetInvoiceTotal()
>This.SelectAlias("Invoice")
>SUM Amount TO Total
>RETURN Total
>
>
>Now, I want to call GetInvoiceTotal() from a global object, and specify the invoice it should total. If I change the function to the one below,
>
>PROCEDURE GetInvoiceTotal(InvoiceID)
>This.GetInvoiceLines(InvoiceID)
>This.SelectAlias("Invoice")
>SUM Amount TO Total
>RETURN Total
>
>the problem is that GetInvoiceLines() by definition reloads the Invoice cursor, destroying any pending changes. This means I can't use it within the context of a single invoice anymore.
>
>I need to be able to total an invoice in progress without losing changes, but I'd also like to be able to total a specified invoice at will. What's the easiest/best way to get the best of both worlds?
>
>Chris.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform