Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One function twice?
Message
De
28/09/2004 19:11:34
 
 
À
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:
00947009
Vues:
17
< update >
Or you can use Sergey's suggestion :)
< /update >

In what context do you need to globally query to get an invoice total? Do you store the invoice total in the invoice header?

If you don't store the total in the header, you can have a function that queries the total without messing with other cursors. If necessary, you can save the current work area and set it back within the function. Calling this function would probably less efficient than the case where you already have the line items loaded for the current invoice.
procedure getinvoicetotal
lparameters invoiceID

    local lnTotal

    select invNum, sum(amount) as total ;
        from invoiceLines where invNum = invoiceID ;
        group by invNum ;
        into cursor invoiceLinesTemp
    
    lnTotal = invoiceLinesTemp.total
    use in invoiceLinesTemp
    return lnTotal    

endproc
>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?
Steve Gibson
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform