From 115777f05dcdc42c6b757e33527dfa5fe7163086 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 2 Apr 2015 06:54:04 +0200 Subject: [PATCH] New: Module project - Elements - Show detail of amounts with a minus when the amount decrease margin --- htdocs/projet/element.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 8abddb18ce9..7e3f9d671b1 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -623,13 +623,8 @@ foreach ($listofreferent as $key => $value) $total_ht = $total_ht + $element->total_ht; $total_ttc = $total_ttc + $element->total_ttc; } - - print ''; - print ''.$name.''; - print ''.$i.''; - print ''.price($total_ht).''; - print ''.price($total_ttc).''; - print ''; + + // Calculate margin if ($margin=="add") { $margin_ht+= $total_ht; @@ -640,8 +635,21 @@ foreach ($listofreferent as $key => $value) $margin_ht-= $total_ht; $margin_ttc-= $total_ttc; } - } + + // Show $total_ht & $total_ttc -- add a minus when necessary + if ($margin!="add") + { + $total_ht = -$total_ht; + $total_ttc = -$total_ttc; + } + print ''; + print ''.$name.''; + print ''.$i.''; + print ''.price($total_ht).''; + print ''.price($total_ttc).''; + print ''; + } } } // and the margin amount total