I am trying to show calculated profit from income and expenses, but for some reason CC only calculates and show part of the database rows. I put it in a custom list:
Header code:
Body code:
Footer code:
The rows Amount_inc and Amount_exp is coming from same tabble jos_account_exp but it seems i can only get onw row value calculated at a time, and the loop simply stops after about 30 rows.
What do i do wrong?
Header code:
<?php
$totalexp=0;
$totalinc=0;
$totaltotal=0;
?>
Body code:
<?php
$totalinc=$totalinc+$row['totalinc']['Amount_inc'];
$totalexp=$totalexp+$row['totalinc']['Amount_exp'];
?>
Footer code:
<?php
echo "<b>";
echo "Total income";
echo $totalinc;
echo "</b>";
echo "<b>";
echo "Total Expenses";
echo $totalexp;
echo "</b>";
$totaltotal=$totalinc-$totalexp;
echo "Total profit";
echo $totaltotal;
echo "</b>";
?>
The rows Amount_inc and Amount_exp is coming from same tabble jos_account_exp but it seems i can only get onw row value calculated at a time, and the loop simply stops after about 30 rows.
What do i do wrong?
Hello ChrisDK,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How do I prevent a list of previous results showing?
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How do I prevent a list of previous results showing?
P.S: I'm just an automated service😉
Hi ChrisDK,
This may be a scope problem. I suspect that the variables you set in the header don't exist when the body and footer code runs. That was true for CFV4. What worked then was to define them as global variables in the header, then repeat the global definition before using them in the body or footer.
Bob
This may be a scope problem. I suspect that the variables you set in the header don't exist when the body and footer code runs. That was true for CFV4. What worked then was to define them as global variables in the header, then repeat the global definition before using them in the body or footer.
Bob
This topic is locked and no more replies can be posted.