38 $head[$h][0] = DOL_URL_ROOT.
"/margin/admin/margin.php";
39 $head[$h][1] = $langs->trans(
"Parameters");
40 $head[$h][2] =
'parameters';
61 global $langs, $conf, $user;
62 $langs->load(
"margins");
67 if ($user->rights->produit->lire) {
68 $head[$h][0] = DOL_URL_ROOT.
"/margin/productMargins.php";
69 $head[$h][1] = $langs->trans(
"ProductMargins");
70 $head[$h][2] =
'productMargins';
74 if ($user->hasRight(
'societe',
'lire')) {
75 $head[$h][0] = DOL_URL_ROOT.
"/margin/customerMargins.php";
76 $head[$h][1] = $langs->trans(
"CustomerMargins");
77 $head[$h][2] =
'customerMargins';
81 if ($user->rights->margins->read->all) {
82 $title =
'UserMargins';
84 $title =
'SalesRepresentativeMargins';
87 $head[$h][0] = DOL_URL_ROOT.
"/margin/agentMargins.php";
88 $head[$h][1] = $langs->trans($title);
89 $head[$h][2] =
'agentMargins';
92 if ($user->rights->margins->creer) {
94 $head[$h][0] = DOL_URL_ROOT.
"/margin/checkMargins.php";
95 $head[$h][1] = $langs->trans(
'CheckMargins');
96 $head[$h][2] =
'checkMargins';
118function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $paht)
125 if ($fk_pa > 0 && empty($paht)) {
126 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.product.class.php';
128 if ($product->fetch_product_fournisseur_price($fk_pa)) {
129 $paht_ret = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100);
140 $pu_ht_remise = $pvht * (1 - ($remise_percent / 100));
141 $pu_ht_remise =
price2num($pu_ht_remise,
'MU');
144 if ($pu_ht_remise < 0) {
145 $marge = -1 * (abs($pu_ht_remise) - $paht_ret);
147 $marge = $pu_ht_remise - $paht_ret;
151 if ($paht_ret != 0) {
152 $marge_tx_ret = (100 * $marge) / $paht_ret;
155 if ($pu_ht_remise != 0) {
156 $marque_tx_ret = (100 * $marge) / $pu_ht_remise;
159 return array($paht_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).
marges_admin_prepare_head()
Define head array for tabs of marges tools setup pages.
getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $paht)
Return an array with margins information of a line.
marges_prepare_head()
Return array of tabs to used on pages for third parties cards.