show costprice instead of buyingprice if setup of margin module is costprice

This commit is contained in:
Christophe Battarel 2013-01-11 15:39:11 +01:00
parent ee0db5f67b
commit 49703240f7
4 changed files with 22 additions and 10 deletions

View File

@ -2629,7 +2629,7 @@ abstract class CommonObject
if ($conf->global->MARGIN_TYPE == "1")
print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
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))
print '<td align="right" width="50">'.$langs->trans('MarginRate').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES))
@ -3029,7 +3029,10 @@ abstract class CommonObject
print '<tr class="liste_titre">';
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('BuyingPrice').'</td>';
if ($conf->global->MARGIN_TYPE == "1")
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>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
print '<td align="right">'.$langs->trans('MarginRate').'</td>';

View File

@ -44,7 +44,13 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
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');
?>
<?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;

View File

@ -50,8 +50,14 @@ if (! empty($usemargins))
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
?>
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
<?php
<td align="right">
<?php
if ($conf->global->MARGIN_TYPE == "1")
echo $langs->trans('BuyingPrice');
else
echo $langs->trans('CostPrice');
?>
<?php
}
?>
<td colspan="<?php echo $colspan; ?>">&nbsp;</td>

View File

@ -73,12 +73,9 @@ if (! empty($idprod))
$objp = $db->fetch_object($result);
$title = $objp->nom.' - '.$objp->ref_fourn.' - ';
$label = '';
if ($objp->quantity == 1)
{
$label.= price($objp->fprice).getCurrencySymbol($conf->currency)."/".strtolower($langs->trans("Unit"));
$title.= price($objp->fprice);
$title.= getCurrencySymbol($conf->currency)."/";
@ -100,8 +97,6 @@ if (! empty($idprod))
$title.=" - ";
$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;
}
if ($objp->unitcharges > 0 && ($conf->global->MARGIN_TYPE == "2")) {
@ -111,6 +106,8 @@ if (! empty($idprod))
}
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);
$i++;
}