Try a better fix to replace PR #3297
This commit is contained in:
parent
8f32e8ace8
commit
c3fb14855b
@ -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))
|
|||||||
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))
|
|||||||
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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user