KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Running Total #227

Open Rehan Anis opened this topic on on Mar 8, 2018 - 8 comments

R
Rehan Anis commented on Mar 8, 2018

I would to create running total. I don't know how I can achieve it

K
KoolReport commented on Mar 8, 2018

Could you please explain further. If you could give an example or image to illustrate, that would be great!

R
Rehan Anis commented on Mar 8, 2018

This is my report output

I want to calculate the Total Column using report functions because it fails miserably on grouping as follows.

K
KoolReport commented on Mar 9, 2018

So you want the result to show like the first table? Total = Previous Total + Debit - Credit

R
Rehan Anis commented on Mar 9, 2018

Yes, exactly that's what I need.

K
KoolReport commented on Mar 9, 2018

You do as following:

...
->pipe(new CalculatedColumn(array(
    "debit_minus_credit"=>"{debit} - {credit}"
)))
->pipe(new AccumulativeColumn(array(
    "total"=>"debit_minus_credit"
)))
->pipe(new RemoveColumn(array(
    "debit_minus_credit"
)))
...

What above code will do is that it created a temporary debit_minus_credit column then it use the Accumulative Column to accumulate that temporarily column as save to column total. At the end we use RemoveColumn process to remove the temporary debit_minus_credit column.

Note: Assume that you have two columns with name debit and credit

R
Rehan Anis commented on Mar 10, 2018

Thanks That Resolved my problem.

K
KoolReport commented on Mar 10, 2018

Awesome :)

R
Rehan Anis commented on Jul 13, 2020

Hello after a long time my situation is slightly changed and I want to display records of multiple accounts on the same page. Now I am using Table::grouping and creating a nice Opening Balance and Closing Balance lines are header and footer. However I want the AccumulativeColumn to reset for each group. How this can be achieved?

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

None