39 $head[$h][0] = DOL_URL_ROOT.
"/margin/admin/margin.php";
40 $head[$h][1] = $langs->trans(
"Parameters");
41 $head[$h][2] =
'parameters';
62 global $langs,
$conf, $user;
63 $langs->load(
"margins");
68 if ($user->hasRight(
'produit',
'lire')) {
69 $head[$h][0] = DOL_URL_ROOT.
"/margin/productMargins.php";
70 $head[$h][1] = $langs->trans(
"ProductMargins");
71 $head[$h][2] =
'productMargins';
75 if ($user->hasRight(
'societe',
'lire')) {
76 $head[$h][0] = DOL_URL_ROOT.
"/margin/customerMargins.php";
77 $head[$h][1] = $langs->trans(
"CustomerMargins");
78 $head[$h][2] =
'customerMargins';
82 if ($user->hasRight(
'margins',
'read',
'all')) {
83 $title =
'UserMargins';
85 $title =
'SalesRepresentativeMargins';
88 $head[$h][0] = DOL_URL_ROOT.
"/margin/agentMargins.php";
89 $head[$h][1] = $langs->trans($title);
90 $head[$h][2] =
'agentMargins';
93 if ($user->hasRight(
'margins',
'creer')) {
95 $head[$h][0] = DOL_URL_ROOT.
"/margin/checkMargins.php";
96 $head[$h][1] = $langs->trans(
'CheckMargins');
97 $head[$h][2] =
'checkMargins';
119function getMarginInfos($pv_ht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $pa_ht)
126 if ($fk_pa > 0 && empty($pa_ht)) {
127 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
129 if ($product->fetch_product_fournisseur_price($fk_pa)) {
130 $pa_ht_ret = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100);
141 $pu_ht_remise = $pv_ht * (1 - ($remise_percent / 100));
142 $pu_ht_remise =
price2num($pu_ht_remise,
'MU');
145 if ($pu_ht_remise < 0) {
146 $marge = -1 * (abs((
float) $pu_ht_remise) - $pa_ht_ret);
148 $marge = (float) $pu_ht_remise - $pa_ht_ret;
152 if ($pa_ht_ret != 0) {
153 $marge_tx_ret = (100 * $marge) / $pa_ht_ret;
156 if ($pu_ht_remise != 0) {
157 $marque_tx_ret = (100 * $marge) / (
float) $pu_ht_remise;
160 return array($pa_ht_ret, $marge_tx_ret, $marque_tx_ret);
Class to manage predefined suppliers products.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getMarginInfos($pv_ht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $pa_ht)
Return an array with margins information of a line.
marges_admin_prepare_head()
Define head array for tabs of marges tools setup pages.
marges_prepare_head()
Return array of tabs to used on pages for third parties cards.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...