Fix: [ bug #1372 ] Margin calculation does not work in proposals
This commit is contained in:
parent
3fd7e18c08
commit
7bb24969d8
@ -21,6 +21,7 @@ Fix: [ bug #1362 ] Note is not saved.
|
|||||||
Fix: tr/td balance.
|
Fix: tr/td balance.
|
||||||
Fix: [ bug #1360 ] note indicator for member tab.
|
Fix: [ bug #1360 ] note indicator for member tab.
|
||||||
Fix: Nb of notes and doc not visible onto tasks.
|
Fix: Nb of notes and doc not visible onto tasks.
|
||||||
|
Fix: [ bug #1372 ] Margin calculation does not work in proposals
|
||||||
|
|
||||||
***** ChangeLog for 3.5.2 compared to 3.5.1 *****
|
***** ChangeLog for 3.5.2 compared to 3.5.1 *****
|
||||||
Fix: Can't add user for a task.
|
Fix: Can't add user for a task.
|
||||||
|
|||||||
@ -252,8 +252,10 @@ if (! empty($usemargins) && $user->rights->margins->creer)
|
|||||||
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() == '')
|
if (rate.val() == '')
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (! $.isNumeric(rate.val().replace(',','.')))
|
if (! $.isNumeric(rate.val().replace(',','.')))
|
||||||
{
|
{
|
||||||
alert('<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
|
alert('<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
|
||||||
@ -274,12 +276,13 @@ if (! empty($usemargins) && $user->rights->margins->creer)
|
|||||||
|
|
||||||
if (remisejs != 100)
|
if (remisejs != 100)
|
||||||
{
|
{
|
||||||
|
if (remisejs == '') remisejs=0;
|
||||||
|
|
||||||
bpjs=price2numjs(buying_price.val());
|
bpjs=price2numjs(buying_price.val());
|
||||||
ratejs=price2numjs(rate.val());
|
ratejs=price2numjs(rate.val());
|
||||||
|
if (npRate == "np_marginRate")
|
||||||
if (npRate == "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
|
||||||
@ -291,6 +294,8 @@ if (! empty($usemargins) && $user->rights->margins->creer)
|
|||||||
/* Function similar to price2num in PHP */
|
/* Function similar to price2num in PHP */
|
||||||
function price2numjs(num)
|
function price2numjs(num)
|
||||||
{
|
{
|
||||||
|
if (num == '') return '';
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$dec=','; $thousand=' ';
|
$dec=','; $thousand=' ';
|
||||||
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
|
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
|
||||||
|
|||||||
@ -298,6 +298,8 @@ if (! empty($usemargins) && $user->rights->margins->creer)
|
|||||||
/* Function similar to price2num in PHP */
|
/* Function similar to price2num in PHP */
|
||||||
function price2numjs(num)
|
function price2numjs(num)
|
||||||
{
|
{
|
||||||
|
if (num == '') return '';
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$dec=','; $thousand=' ';
|
$dec=','; $thousand=' ';
|
||||||
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
|
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user