Skip to content
Snippets Groups Projects
Commit a30dd12c authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge pull request #598 from cbattarel/3.3

show costprice instead of buyingprice if setup of margin module is costprice
parents 37b6bab8 38e92907
Branches
Tags
No related merge requests found
...@@ -2649,7 +2649,7 @@ abstract class CommonObject ...@@ -2649,7 +2649,7 @@ abstract class CommonObject
if ($conf->global->MARGIN_TYPE == "1") if ($conf->global->MARGIN_TYPE == "1")
print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>'; print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
else else
print '<td align="right" width="80">'.$langs->trans('BuyingCost').'</td>'; print '<td align="right" width="80">'.$langs->trans('CostPrice').'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right" width="50">'.$langs->trans('MarginRate').'</td>'; print '<td align="right" width="50">'.$langs->trans('MarginRate').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES)) if (! empty($conf->global->DISPLAY_MARK_RATES))
...@@ -3049,7 +3049,10 @@ abstract class CommonObject ...@@ -3049,7 +3049,10 @@ abstract class CommonObject
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width="30%">'.$langs->trans('Margins').'</td>'; print '<td width="30%">'.$langs->trans('Margins').'</td>';
print '<td width="20%" align="right">'.$langs->trans('SellingPrice').'</td>'; print '<td width="20%" align="right">'.$langs->trans('SellingPrice').'</td>';
if ($conf->global->MARGIN_TYPE == "1")
print '<td width="20%" align="right">'.$langs->trans('BuyingPrice').'</td>'; print '<td width="20%" align="right">'.$langs->trans('BuyingPrice').'</td>';
else
print '<td width="20%" align="right">'.$langs->trans('CostPrice').'</td>';
print '<td width="20%" align="right">'.$langs->trans('Margin').'</td>'; print '<td width="20%" align="right">'.$langs->trans('Margin').'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.$langs->trans('MarginRate').'</td>'; print '<td align="right">'.$langs->trans('MarginRate').'</td>';
......
...@@ -44,7 +44,14 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob ...@@ -44,7 +44,14 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
if (! empty($usemargins)) if (! empty($usemargins))
{ {
?> ?>
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td> <td align="right">
<?php
if ($conf->global->MARGIN_TYPE == "1")
echo $langs->trans('BuyingPrice');
else
echo $langs->trans('CostPrice');
?>
</td>
<?php <?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
......
...@@ -50,7 +50,14 @@ if (! empty($usemargins)) ...@@ -50,7 +50,14 @@ if (! empty($usemargins))
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
?> ?>
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td> <td align="right">
<?php
if ($conf->global->MARGIN_TYPE == "1")
echo $langs->trans('BuyingPrice');
else
echo $langs->trans('CostPrice');
?>
</td>
<?php <?php
} }
?> ?>
......
...@@ -73,12 +73,9 @@ if (! empty($idprod)) ...@@ -73,12 +73,9 @@ if (! empty($idprod))
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$title = $objp->nom.' - '.$objp->ref_fourn.' - '; $title = $objp->nom.' - '.$objp->ref_fourn.' - ';
$label = '';
if ($objp->quantity == 1) if ($objp->quantity == 1)
{ {
$label.= price($objp->fprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
$title.= price($objp->fprice); $title.= price($objp->fprice);
$title.= getCurrencySymbol($conf->currency)."/"; $title.= getCurrencySymbol($conf->currency)."/";
...@@ -100,8 +97,6 @@ if (! empty($idprod)) ...@@ -100,8 +97,6 @@ if (! empty($idprod))
$title.=" - "; $title.=" - ";
$title.= price($objp->unitprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit")); $title.= price($objp->unitprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
$label.= price($objp->unitprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
$price = $objp->unitprice; $price = $objp->unitprice;
} }
if ($objp->unitcharges > 0 && ($conf->global->MARGIN_TYPE == "2")) { if ($objp->unitcharges > 0 && ($conf->global->MARGIN_TYPE == "2")) {
...@@ -111,6 +106,8 @@ if (! empty($idprod)) ...@@ -111,6 +106,8 @@ if (! empty($idprod))
} }
if ($objp->duration) $label .= " - ".$objp->duration; if ($objp->duration) $label .= " - ".$objp->duration;
$label = price($price).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
$prices[] = array("id" => $objp->idprodfournprice, "price" => price($price,0,'',0), "label" => $label, "title" => $title); $prices[] = array("id" => $objp->idprodfournprice, "price" => price($price,0,'',0), "label" => $label, "title" => $title);
$i++; $i++;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment