Reputation: 71
I was be able to output a crystal report and this is about accounting logic.
some of the column appear in my crystal report is eg.
accountname debit credit
cash..........1000...300
I want the column debit minus column credit (1000-300) if the result is positive (+) then 700 will appear in that debit column If the result is negative (-) then the value appear in credit column and i wan to remove the negative sign. So above value 1000 and 300 is not what i wan to show and debit or credit will be 0 eg
accountname debit credit
cash...........700......0
Above case is ok so far and now i end up like this In crystal report formula editor i have @creditbalance, and inside it has formula:
if Sum ({Entries.Debit}, {Entries.AccountName})>Sum ({Entries.Credit}, {Entries.AccountName}) then formula= Sum ({Entries.Debit}, {Entries.AccountName})-Sum ({Entries.Credit}, {Entries.AccountName}) end if
So it can give me as i wanted to show (the 700 and 0 part) The problem is i create another formula @TotalDebitBalance
Sum ({@DebitBalance})
It error said "This field cannot be summarized", Then how to sum up the value i get from @debitBalance.
Note: @TotalDebitBalance i plan to put it at report footer section where all grant total usually placed there, where @debitbalance i put it at Group Header section.
Upvotes: 0
Views: 13064
Reputation: 321
It doesn't say but I'm assuming the report is grouped by {Entries.AccountName}. In addition to Waqar's solution, I'd replace the formula with something easier.
{@DebitBalance}
IF {Entries.Debit} > {Entries.Credit} THEN
{Entries.Debit} - {Entries.Credit}
ELSE
0
{@CreditBalance}
IF {Entries.Debit} < {Entries.Credit} THEN
ABS({Entries.Debit} - {Entries.Credit})
ELSE
0
In the details section, replace the {Entries.Debit} and {Entries.Credit} with {@DebitBalance} and {@CreditBalance} repectively. This will give you the
cash...........700......0
Then do as Waqar mentioned to summarize the formula. It's easier to use the Group... and Summary... features than to do it manually in the formulas.
Upvotes: 0
Reputation: 226
You will have two fields, one for the group footer and other for report footer, hope this helps.
Upvotes: 1