|
|
@@ -262,6 +262,9 @@ function opendistrib_product_prices() { |
|
|
|
opendistrib_product_prices_event_price_with_tax(); |
|
|
|
$('#productprice-price').change(opendistrib_product_prices_event_price_with_tax); |
|
|
|
$('#productprice-price-with-tax').change(opendistrib_product_prices_event_price); |
|
|
|
$('#reduction-increase-percent').change(function() { |
|
|
|
opendistrib_product_prices_event_reduction_increase(); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -272,6 +275,8 @@ function opendistrib_product_prices_event_price_with_tax() { |
|
|
|
$('#productprice-price-with-tax').val(getPriceWithTax(price, taxRateValue)); |
|
|
|
// formattage |
|
|
|
$('#productprice-price').val(parseFloat(price).toFixed(5)); |
|
|
|
|
|
|
|
opendistrib_product_prices_update_reduction_increase(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -282,6 +287,24 @@ function opendistrib_product_prices_event_price() { |
|
|
|
$('#productprice-price').val(getPrice(priceWithTax, taxRateValue)); |
|
|
|
// formattage |
|
|
|
$('#productprice-price-with-tax').val(parseFloat(priceWithTax).toFixed(2)); |
|
|
|
|
|
|
|
opendistrib_product_prices_update_reduction_increase(); |
|
|
|
} |
|
|
|
} |
|
|
|
function opendistrib_product_prices_update_reduction_increase() { |
|
|
|
var productPriceBase = $('#reduction-increase-percent').data('price-base'); |
|
|
|
var productPriceSpecific = $('#productprice-price').val().replace(',', '.'); |
|
|
|
var reductionIncreasePercent = (productPriceSpecific / productPriceBase) * 100 - 100; |
|
|
|
$('#reduction-increase-percent').val(parseFloat(reductionIncreasePercent).toFixed(5)); |
|
|
|
} |
|
|
|
|
|
|
|
function opendistrib_product_prices_event_reduction_increase() { |
|
|
|
var productPriceBase = $('#reduction-increase-percent').data('price-base'); |
|
|
|
var reductionIncreasePercent = $('#reduction-increase-percent').val(); |
|
|
|
if(reductionIncreasePercent) { |
|
|
|
var newPrice = productPriceBase + productPriceBase * (reductionIncreasePercent / 100); |
|
|
|
$('#productprice-price').val(parseFloat(newPrice).toFixed(5)); |
|
|
|
opendistrib_product_prices_event_price_with_tax(); |
|
|
|
} |
|
|
|
} |
|
|
|
|