cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal reports- Calculation between two reports

Former Member
0 Kudos

Hi Experts

I have designed a sales and purchase transaction report using crystal reports and i have designed another report for accounting transactions like Excise Duty payable and receivables, Vat payable and receivables, Expenses(like EB, Maintenance) and so on. Finally I added accounting report as sub-report into First Report.

My question is, is it possible to made some calculations between sub-report and main report.

Hope some solutions from you.

By

Kala

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Morning,

Yes! you can do that by using a sharedvar formula between the two calculations. For example, if you want to calculate VAT in both, then you will be creating a formula

First one will be done in main report


Whileprintingrecords;
Shared Numbervar x:= {VAT field}
.....

2nd one will be done in sub report


Whileprintingrecords;
Shared Numbervar x:={VAT field}
....

The "shared" will be used to calculate.

Additionally you have to link a Main report field with Sub report field. Right click on the Subreport and click on "Change Subreport link", from there you choose the fields which needs to be linked between sub report and main report, in the above case VAT field.

Hope this helps

Regards

jehanzeb

Former Member
0 Kudos

Hi thanks for your reply

I didn't get u clearly. Links wise ok. but where to give the Shared Numbervar x:= {VAT field}.

My requirement is for e.g i derived a value in report1

Group1-Sum of OINV.DocTotal

similarly in report2 Total expenses

Now I want to calculate

OINV.Doctotal-Total Expenses =Profit

can u show some samples like this.

By

Kalai

Former Member
0 Kudos

Hello,

right upto the linking is good?

Right now you have to create a formula (which you might have already done for "Total expenses", you just need to alternate it slightly.

Example:

On 2nd report (subreport) You might have a formula like given below.

Instead of Numbervar CAvg, which is the last shown value in the below formula, you have to make it like Shared Numbervar CAvg.


Whileprintingrecords;
Numbervar TJs;
Numbervar TotalJobs=0;
Shared Numbervar CAvg;
Shared Numbervar CAvg=0;
TotalJobs := DistinctCount({lab_credits.credit_no},{lab_credits.reason_code});  
CAvg:= TotalJobs /{@WorkingDays};
TJs:=TJs + CAvg;
CAvg

Do your calculation above.

Now in the main report you will create another formula which will look like below.


Whileprintingrecords;
Shared Numbervar CAvg;
Numbervar TAvg:=fieldname;
Numbervar TotalBoth:= Shared Numbervar CAvg+ Numbervar TAvg;
TotalBoth;

You will have a reset formula which will be placed ontop of the report header , group header if you are using grouping like this


Whileprintingrecords;
Shared Numbervar CAvg:=0;
SHared Numbervar TAvg:=0;

bearing in mind that we do not have to declare CAvg field here as it is being shared.

Hope this helps

Regards

Jehanzeb

Answers (0)