Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running total

Status
Not open for further replies.

Anoli

Programmer
Jan 26, 2001
13
CA
I have done a report in which I linked OE history detail (I need to report payments by item category) to AR receipt.
There are invoices that do not have a payment attached and also because an invoice has more than one detail line I want the payment amount to be added into an accumulator only once per invoice.
Here is the formula I used.
NumberVar Runtotal;
-Runtotal:=Runtotal+tonumber(if isnull({AROBP.AMTPAYMHC}) then 0 else {AROBP.AMTPAYMHC}*if ( recordnumber=1 or Previous ({OESHDT.TRANNUM}) <>{OESHDT.TRANNUM}) then 1 else 0)
If I place the field in the detail section of the report, the very last detail reports a correct running total.
My problem is that I will have to hide the detail of the report (since I want to use it as a sub-report and the client is interested only in the receipt total).
If I copy and paste the formula field in the report's footer the running total seems to be incorrect, specifically the amount field of the very last record gets added to the running total twice. How can I fix this issue?
 
Hi,

Wow, thats sounds like a big job. Why dont you just use the ar tables for the invoices and the receipts? If the only problem is a doubling of the total, edit the formula to divide by 2? Or make the original the sub-report.

Regards

e
 
Leave the original on the detail band.
Put a 'display' formula on the report footer:

WhilePrintingRecords;
NumberVar Runtotal

You might want to check out the 3-Formula technique described in faq149-182. (The Crystal Reports forum) Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top