diff --git a/htdocs/marges/agentMargins.php b/htdocs/marges/agentMargins.php
index 476207c952c..8501f50b5cd 100644
--- a/htdocs/marges/agentMargins.php
+++ b/htdocs/marges/agentMargins.php
@@ -194,8 +194,8 @@ if ($result)
{
$objp = $db->fetch_object($result);
- $marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price ,5)):0 ;
- $markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price ,5)):0 ;
+ $marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price ,5)):'' ;
+ $markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price ,5)):'' ;
$var=!$var;
@@ -215,9 +215,9 @@ if ($result)
print "
".price($objp->buying_price)." | \n";
print "".price($objp->marge)." | \n";
if ($conf->global->DISPLAY_MARGIN_RATES)
- print "".price($marginRate)."% | \n";
+ print "".(($marginRate === '')?'n/a':price($marginRate)."%")." | \n";
if ($conf->global->DISPLAY_MARK_RATES)
- print "".price($markRate)."% | \n";
+ print "".(($markRate === '')?'n/a':price($markRate)."%")." | \n";
print "\n";
$i++;
$cumul_achat += $objp->buying_price;
@@ -228,8 +228,8 @@ if ($result)
// affichage totaux marges
$var=!$var;
$totalMargin = $cumul_vente - $cumul_achat;
- $marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):0 ;
- $markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):0 ;
+ $marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):'' ;
+ $markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'' ;
print '';
if ($client)
print '| ';
@@ -240,9 +240,9 @@ if ($result)
print " | ".price($cumul_achat)." | \n";
print "".price($totalMargin)." | \n";
if ($conf->global->DISPLAY_MARGIN_RATES)
- print "".price($marginRate)."% | \n";
+ print "".(($marginRate === '')?'n/a':price($marginRate)."%")." | \n";
if ($conf->global->DISPLAY_MARK_RATES)
- print "".price($markRate)."% | \n";
+ print "".(($markRate === '')?'n/a':price($markRate)."%")." | \n";
print "
\n";
print "";
@@ -266,8 +266,8 @@ $(document).ready(function() {
});
$("#totalMargin").html("");
- $("#marginRate").html("%");
- $("#markRate").html("%");
+ $("#marginRate").html("");
+ $("#markRate").html("");
});
diff --git a/htdocs/marges/customerMargins.php b/htdocs/marges/customerMargins.php
index 68902c25034..13594f0aff1 100644
--- a/htdocs/marges/customerMargins.php
+++ b/htdocs/marges/customerMargins.php
@@ -201,8 +201,8 @@ if ($result)
{
$objp = $db->fetch_object($result);
- $marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price ,5)):0 ;
- $markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price ,5)):0 ;
+ $marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price ,5)):'' ;
+ $markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price ,5)):'' ;
$var=!$var;
@@ -226,9 +226,9 @@ if ($result)
print "".price($objp->buying_price)." | \n";
print "".price($objp->marge)." | \n";
if ($conf->global->DISPLAY_MARGIN_RATES)
- print "".price($marginRate)."% | \n";
+ print "".(($marginRate === '')?'n/a':price($marginRate)."%")." | \n";
if ($conf->global->DISPLAY_MARK_RATES)
- print "".price($markRate)."% | \n";
+ print "".(($markRate === '')?'n/a':price($markRate)."%")." | \n";
print "\n";
$i++;
$cumul_achat += $objp->buying_price;
@@ -239,8 +239,8 @@ if ($result)
// affichage totaux marges
$var=!$var;
$totalMargin = $cumul_vente - $cumul_achat;
- $marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):0 ;
- $markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):0 ;
+ $marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):'' ;
+ $markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'' ;
print '';
if ($client)
print '| ';
@@ -251,9 +251,9 @@ if ($result)
print " | ".price($cumul_achat)." | \n";
print "".price($totalMargin)." | \n";
if ($conf->global->DISPLAY_MARGIN_RATES)
- print "".price($marginRate)."% | \n";
+ print "".(($marginRate === '')?'n/a':price($marginRate)."%")." | \n";
if ($conf->global->DISPLAY_MARK_RATES)
- print "".price($markRate)."% | \n";
+ print "".(($markRate === '')?'n/a':price($markRate)."%")." | \n";
print "
\n";
print "";
@@ -279,8 +279,8 @@ $(document).ready(function() {
});
$("#totalMargin").html("");
- $("#marginRate").html("%");
- $("#markRate").html("%");
+ $("#marginRate").html("");
+ $("#markRate").html("");
});
diff --git a/htdocs/marges/productMargins.php b/htdocs/marges/productMargins.php
index 58dc2c0e41f..d9e5a6af2df 100644
--- a/htdocs/marges/productMargins.php
+++ b/htdocs/marges/productMargins.php
@@ -205,8 +205,8 @@ if ($result)
{
$objp = $db->fetch_object($result);
- $marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price ,5)):0 ;
- $markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price ,5)):0 ;
+ $marginRate = ($objp->buying_price != 0)?(100 * round($objp->marge / $objp->buying_price ,5)):'' ;
+ $markRate = ($objp->selling_price != 0)?(100 * round($objp->marge / $objp->selling_price ,5)):'' ;
$var=!$var;
@@ -233,9 +233,9 @@ if ($result)
print "".price($objp->buying_price)." | \n";
print "".price($objp->marge)." | \n";
if ($conf->global->DISPLAY_MARGIN_RATES)
- print "".price($marginRate)."% | \n";
+ print "".(($marginRate === '')?'n/a':price($marginRate)."%")." | \n";
if ($conf->global->DISPLAY_MARK_RATES)
- print "".price($markRate)."% | \n";
+ print "".(($markRate === '')?'n/a':price($markRate)."%")." | \n";
print "\n";
$i++;
$cumul_achat += $objp->buying_price;
@@ -246,8 +246,8 @@ if ($result)
// affichage totaux marges
$var=!$var;
$totalMargin = $cumul_vente - $cumul_achat;
- $marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):0 ;
- $markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):0 ;
+ $marginRate = ($cumul_achat != 0)?(100 * round($totalMargin / $cumul_achat, 5)):'' ;
+ $markRate = ($cumul_vente != 0)?(100 * round($totalMargin / $cumul_vente, 5)):'' ;
print '';
if ($id > 0)
print '| ';
@@ -258,9 +258,9 @@ if ($result)
print " | ".price($cumul_achat)." | \n";
print "".price($totalMargin)." | \n";
if ($conf->global->DISPLAY_MARGIN_RATES)
- print "".price($marginRate)."% | \n";
+ print "".(($marginRate === '')?'n/a':price($marginRate)."%")." | \n";
if ($conf->global->DISPLAY_MARK_RATES)
- print "".price($markRate)."% | \n";
+ print "".(($markRate === '')?'n/a':price($markRate)."%")." | \n";
print "
\n";
print "";
@@ -288,8 +288,8 @@ $(document).ready(function() {
});
$("#totalMargin").html("");
- $("#marginRate").html("%");
- $("#markRate").html("%");
+ $("#marginRate").html("");
+ $("#markRate").html("");
});
diff --git a/htdocs/marges/tabs/productMargins.php b/htdocs/marges/tabs/productMargins.php
index 29c6897bb6b..3b109b9b77c 100644
--- a/htdocs/marges/tabs/productMargins.php
+++ b/htdocs/marges/tabs/productMargins.php
@@ -255,7 +255,7 @@ llxFooter('$Date: 2011/08/08 16:07:47 $ - $Revision: 1.84 $');
\ No newline at end of file
diff --git a/htdocs/marges/tabs/thirdpartyMargins.php b/htdocs/marges/tabs/thirdpartyMargins.php
index 04776ccf275..a4cc52c89df 100644
--- a/htdocs/marges/tabs/thirdpartyMargins.php
+++ b/htdocs/marges/tabs/thirdpartyMargins.php
@@ -241,7 +241,7 @@ llxFooter('$Date: 2011/08/08 16:07:47 $ - $Revision: 1.84 $');
\ No newline at end of file