Fix balance

This commit is contained in:
Laurent Destailleur 2018-07-17 21:39:41 +02:00
parent a7853211d6
commit 7662f8f25c

View File

@ -990,15 +990,15 @@ if ($resql)
$objforbalance = $db->fetch_object($resqlforbalance); $objforbalance = $db->fetch_object($resqlforbalance);
if ($objforbalance) if ($objforbalance)
{ {
// If sort is desc,desc,desc then total of previous date is balance of the line to show // If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show
if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc')
{ {
$balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount); $balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
} }
// If sort is asc,asc,asc then total of previous date is balancebefore of the line to show // If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
else else
{ {
$balancebefore = $objforbalance->previoustotal; $balance = $objforbalance->previoustotal;
} }
} }
} }