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

Try a better fix to replace PR #3297

parent 8f32e8ac
Branches
Tags
No related merge requests found
...@@ -278,7 +278,7 @@ if (! empty($conf->margin->enabled)) ...@@ -278,7 +278,7 @@ if (! empty($conf->margin->enabled))
var remise = $("input[name='remise_percent']:first"); var remise = $("input[name='remise_percent']:first");
var rate = $("input[name='"+npRate+"']:first"); var rate = $("input[name='"+npRate+"']:first");
if (rate.val() == '') return true; if (rate.val() == '' || (typeof rate.val()) == 'undefined' ) return true;
if (! $.isNumeric(rate.val().replace(',','.'))) if (! $.isNumeric(rate.val().replace(',','.')))
{ {
...@@ -287,7 +287,7 @@ if (! empty($conf->margin->enabled)) ...@@ -287,7 +287,7 @@ if (! empty($conf->margin->enabled))
setTimeout(function () { rate.focus() }, 50); setTimeout(function () { rate.focus() }, 50);
return false; return false;
} }
if (npRate == "markRate" && rate.val() >= 100) if (npRate == "np_markRate" && rate.val() >= 100)
{ {
alert('<?php echo $langs->trans("markRateShouldBeLesserThan100"); ?>'); alert('<?php echo $langs->trans("markRateShouldBeLesserThan100"); ?>');
e.stopPropagation(); e.stopPropagation();
...@@ -303,9 +303,11 @@ if (! empty($conf->margin->enabled)) ...@@ -303,9 +303,11 @@ if (! empty($conf->margin->enabled))
bpjs=price2numjs(buying_price.val()); bpjs=price2numjs(buying_price.val());
ratejs=price2numjs(rate.val()); ratejs=price2numjs(rate.val());
if (npRate == "marginRate") /* console.log(npRate+" - "+bpjs+" - "+ratejs); */
if (npRate == "np_marginRate")
price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100)); price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
else if (npRate == "markRate") else if (npRate == "np_markRate")
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
} }
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment