mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
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 rate = $("input[name='"+npRate+"']:first");
|
||||
if (rate.val() == '') return true;
|
||||
if (rate.val() == '' || (typeof rate.val()) == 'undefined' ) return true;
|
||||
|
||||
if (! $.isNumeric(rate.val().replace(',','.')))
|
||||
{
|
||||
|
|
@ -287,7 +287,7 @@ if (! empty($conf->margin->enabled))
|
|||
setTimeout(function () { rate.focus() }, 50);
|
||||
return false;
|
||||
}
|
||||
if (npRate == "markRate" && rate.val() >= 100)
|
||||
if (npRate == "np_markRate" && rate.val() >= 100)
|
||||
{
|
||||
alert('<?php echo $langs->trans("markRateShouldBeLesserThan100"); ?>');
|
||||
e.stopPropagation();
|
||||
|
|
@ -303,9 +303,11 @@ if (! empty($conf->margin->enabled))
|
|||
bpjs=price2numjs(buying_price.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));
|
||||
else if (npRate == "markRate")
|
||||
else if (npRate == "np_markRate")
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user