PHPExcel overwrites the rows

Topics: Developer Forum
Sep 5, 2014 at 2:51 PM
I have a table, which is sorted out by item_code and status. I have 3 statuses = 0,1 and 2. I want to make some calculations when each status is finished.

Basically, PXPExcel overwrites the last row of each status category. According to the database there is: 4 rows with status 0, 1 row with status 1 and 5 rows with status 2. I'm stuck on this part already for couple of days, so any help would be appreciated.

Here is my code:

http://pastebin.com/4FZjZmt4

Here is the export file output:

http://imgur.com/xR5nP3Q

What I've already tried to do:
   /*
    *   Add +1 to each count so it could count last row as well.
    *       1. Start adding +1 to each count outside the main loop.
    *       2. $newCountOne = $countZero + ($countOne +1);
    *       3. $newCountTwo = $newCountOne + ($countTwo +1);
    *       4. if ( $loopCounter == ($countZero +1 ) )
    *       5. To raise $key parameter in "total" row.
    *
    */

After asking question on SO, I managed to ugrade my code and it's look like this now, but it still not working as I expected.

This is how it's looks now - http://imgur.com/TTw1KIp

New code - http://pastebin.com/1HC5rgf7