Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
One function twice?
Message
From
28/09/2004 19:11:34
 
 
To
28/09/2004 18:58:26
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00947006
Message ID:
00947009
Views:
18
< 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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform