on 10-21-2008 6:42 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.