diff --git a/htdocs/marges/tabs/productMargins.php b/htdocs/marges/tabs/productMargins.php
index c17f7471a19..29c6897bb6b 100644
--- a/htdocs/marges/tabs/productMargins.php
+++ b/htdocs/marges/tabs/productMargins.php
@@ -22,15 +22,15 @@
* \version $Id: facture.php,v 1.84 2011/08/08 16:07:47 eldy Exp $
*/
-require("../../../main.inc.php");
-require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
+require("../../main.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
$langs->load("companies");
$langs->load("bills");
$langs->load("products");
-$langs->load("marges@marges");
+$langs->load("marges");
// Security check
if (isset($_GET["id"]) || isset($_GET["ref"]))
@@ -133,7 +133,7 @@ if ($_GET["id"] || $_GET["ref"])
$sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,";
$sql.= " f.facnumber, f.total as total_ht,";
- $sql.= " (d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price, (d.pa_ht * d.qty) as buying_price, d.qty, ((d.subprice - d.pa_ht) * d.qty) as marge," ;
+ $sql.= " (d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price, (d.buy_price_ht * d.qty) as buying_price, d.qty, ((d.subprice - d.buy_price_ht) * d.qty) as marge," ;
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@@ -189,7 +189,6 @@ if ($_GET["id"] || $_GET["ref"])
$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)):'' ;
-
print "
";
print '| ';
$invoicestatic->id=$objp->facid;
@@ -205,9 +204,9 @@ if ($_GET["id"] || $_GET["ref"])
print " | ".price($objp->qty)." | \n";
print "".price($objp->marge)." | \n";
if ($conf->global->DISPLAY_MARGIN_RATES)
- print "".(($marginRate == '')?'n/a':price($marginRate)."%")." | \n";
+ print "".(($marginRate === '')?'n/a':price($marginRate)."%")." | \n";
if ($conf->global->DISPLAY_MARK_RATES)
- print "".(($markRate == '')?'n/a':price($markRate)."%")." | \n";
+ print "".(($markRate === '')?'n/a':price($markRate)."%")." | \n";
print ''.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).' | ';
print "
\n";
$i++;
@@ -229,9 +228,9 @@ if ($_GET["id"] || $_GET["ref"])
print "".price($cumul_qty)." | \n";
print "".price($totalMargin)." | \n";
if ($conf->global->DISPLAY_MARGIN_RATES)
- print "".(($marginRate == '')?'n/a':price($marginRate)."%")." | \n";
+ print "".(($marginRate === '')?'n/a':price($marginRate)."%")." | \n";
if ($conf->global->DISPLAY_MARK_RATES)
- print "".(($markRate == '')?'n/a':price($markRate)."%")." | \n";
+ print "".(($markRate === '')?'n/a':price($markRate)."%")." | \n";
print ' | ';
print "\n";
}
diff --git a/htdocs/marges/tabs/thirdpartyMargins.php b/htdocs/marges/tabs/thirdpartyMargins.php
index 545bc530198..04776ccf275 100644
--- a/htdocs/marges/tabs/thirdpartyMargins.php
+++ b/htdocs/marges/tabs/thirdpartyMargins.php
@@ -22,15 +22,15 @@
* \version $Id: facture.php,v 1.84 2011/08/08 16:07:47 eldy Exp $
*/
-require("../../../main.inc.php");
-require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
+require("../../main.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
$langs->load("companies");
$langs->load("bills");
$langs->load("products");
-$langs->load("marges@marges");
+$langs->load("marges");
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
@@ -129,7 +129,7 @@ if ($socid > 0)
$sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,";
$sql.= " f.facnumber, f.total as total_ht,";
- $sql.= " sum(d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price, sum(d.pa_ht * d.qty) as buying_price, sum(((d.subprice * (1 - d.remise_percent / 100)) - d.pa_ht) * d.qty) as marge," ;
+ $sql.= " sum(d.subprice * d.qty * (1 - d.remise_percent / 100)) as selling_price, sum(d.buy_price_ht * d.qty) as buying_price, sum(((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) as marge," ;
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
@@ -193,9 +193,9 @@ if ($socid > 0)
print "".price($objp->buying_price)." | \n";
print "".price($objp->marge)." | \n";
if ($conf->global->DISPLAY_MARGIN_RATES)
- print "".(($marginRate == '')?'n/a':price($marginRate)."%")." | \n";
+ print "".(($marginRate === '')?'n/a':price($marginRate)."%")." | \n";
if ($conf->global->DISPLAY_MARK_RATES)
- print "".(($markRate == '')?'n/a':price($markRate)."%")." | \n";
+ print "".(($markRate === '')?'n/a':price($markRate)."%")." | \n";
print ''.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).' | ';
print "\n";
$i++;
@@ -215,9 +215,9 @@ if ($socid > 0)
print "".price($cumul_achat)." | \n";
print "".price($totalMargin)." | \n";
if ($conf->global->DISPLAY_MARGIN_RATES)
- print "".(($marginRate == '')?'n/a':price($marginRate)."%")." | \n";
+ print "".(($marginRate === '')?'n/a':price($marginRate)."%")." | \n";
if ($conf->global->DISPLAY_MARK_RATES)
- print "".(($markRate == '')?'n/a':price($markRate)."%")." | \n";
+ print "".(($markRate === '')?'n/a':price($markRate)."%")." | \n";
print ' | ';
print "\n";
}