From 7b488dfd3964fbf6877b95d222fb6a4876093e03 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 8 Jan 2019 17:53:22 +0100 Subject: [PATCH] New function findSide return D if number is <0 --- include/lib/ac_common.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php index c57d20a8d..ca7d65492 100644 --- a/include/lib/ac_common.php +++ b/include/lib/ac_common.php @@ -113,6 +113,22 @@ function nb($p_number) return $r; } +/** + * return D if the number is smaller than 0 , C if bigger and an empty string if + * equal to 0. Used for displaying saldo D / C (debit / credit ) + * @param float $p_number + */ +function findSide($p_number) +{ + $return =''; + if ( $p_number > 0 ) { + $return ='D'; + }else { + $return =($p_number== 0)?"":"C"; + } + return $return; +} + /** * format the number with a sep. for the thousand * @param $p_number number