Solved

Crystal Reports -How to run totals

Posted on 2007-04-11
8
263 Views
Last Modified: 2012-06-27
Hi,

I have a SQL Db. I am running crystal 9.

I want a simple report like this

Period : 1/1/2007 to 31/1/2007

Group #1 : Warehouse
 Group #2 : Product Code        
                                                              Opening:  Qty Value

    Details:  Doc. No.          Details.    In Quanitity   Value   Out Qty Value

Group #2 : fotter:                                 Closing : Qty Value

I have got the report formatted, sorted accordinly. The details part is not a proble. The opening and closing balances i have problems. Not getting results.  I have used formulas and various tricks. I have got parameters as input for the date from to.  But i am beaten. Need Help urgently.

Gururag



         
0
Comment
Question by:Gururagguru
  • 5
  • 3
8 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 18890813
What information is in the database?

Do you have a field that shows the currentqty or is this calculated based on a starting qty of 0 then change records added to show the changes?

mlmcc
0
 

Author Comment

by:Gururagguru
ID: 18890877
Hi, I have the fields  InQty, OutQty, TransactionValue. There are no calculated fields

+G
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18891021
How do you know how many you started with on 1 Jan 2007?

mlmcc
0
 

Author Comment

by:Gururagguru
ID: 18891088
Hi,

Ok. let me put it this way, The table has transactions for all months, say from Oct 2006 till date.
The fields  warehouse, itemcode,trdate, inqty,outqty,trvalue

Now I am using parameters to specify the fromdate and ToDate to determine the month of the report.
So if I specifiy say 1/1/2007 to 31/1/2007, then I need to have the OpBal= Opbal+Inqty-Outqty from Oct 2006  till 31st Dec 2006. This will be opening. Then I need to print the details where only the data between trdate >=fromdate And trdate <=ToDate.
Next is to have the total on the details for Inqty and outqty. Finally need the Closing qty and value.


+G
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 100

Expert Comment

by:mlmcc
ID: 18892004
You need to get the opening balance in someway.

One way to do this is through SQL and an SQL expression.

Another way would be to use a subreport in the group header that calculates the opening balance and returns that value to the main report using a shared variable.

The details section would show the information and calculate the closing balance

Another way would be to calculate in the main report but suppress the details until you get to the start date.

mlmcc
0
 

Author Comment

by:Gururagguru
ID: 18896479
Thanks.

I have been trying to use formulas.

I have a formula called Op_Qty and have put it in the detail column.

WhilePrintingRecords;
If {OINM.DocDate} < DateTime({?FrmDt}) And {OINM.InQty} <> 0 Then
numbervar Op_qty_sum:= (Op_qty_sum+{OINM.InQty});
If {OINM.DocDate} < DateTime({?FrmDt}) And {OINM.OutQty} <> 0 Then
numbervar Op_qty_sum:= (Op_qty_sum-{OINM.OutQty})

The problem is when the group ie. the Itemcode changes, the Op_qty_sum does not get
initialized to Zero 0. If you could help me with this, I think my problem is sorted.

+G
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
ID: 18897593
Try this

In the report header add a formula to declare the variables
WhilePrintingrecords;
Global NumberVar Op_qty_sum:= 0;

In the group header add a formula
WhilePrintingrecords;
Global NumberVar Op_qty_sum;
Op_qty_sum:= 0;

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18898856
Glad i could help

mlmcc
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now