$productOrderArray[$productOrder->id_product] = [ | $productOrderArray[$productOrder->id_product] = [ | ||||
'quantity' => $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'], | 'quantity' => $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'], | ||||
'unit' => $productOrder->unit, | 'unit' => $productOrder->unit, | ||||
'price' => number_format($productOrder->price, 3), | |||||
'invoice_price' => number_format($productOrder->invoice_price, 3), | |||||
'price' => number_format($productOrder->price, 5), | |||||
'invoice_price' => number_format($productOrder->invoice_price, 5), | |||||
'price_with_tax' => Price::getPriceWithTax($productOrder->price, $productOrder->taxRate->value), | 'price_with_tax' => Price::getPriceWithTax($productOrder->price, $productOrder->taxRate->value), | ||||
]; | ]; | ||||
} | } |
if (price) { | if (price) { | ||||
$('#product-price-with-tax').val(getPriceWithTax(price, taxRateSelected)); | $('#product-price-with-tax').val(getPriceWithTax(price, taxRateSelected)); | ||||
// formattage | // formattage | ||||
$('#product-price').val(parseFloat(price).toFixed(3)); | |||||
$('#product-price').val(parseFloat(price).toFixed(5)); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
if (price) { | if (price) { | ||||
$('#productprice-price-with-tax').val(getPriceWithTax(price, taxRateValue)); | $('#productprice-price-with-tax').val(getPriceWithTax(price, taxRateValue)); | ||||
// formattage | // formattage | ||||
$('#productprice-price').val(parseFloat(price).toFixed(3)); | |||||
$('#productprice-price').val(parseFloat(price).toFixed(5)); | |||||
} | } | ||||
} | } | ||||
* @returns {string} | * @returns {string} | ||||
*/ | */ | ||||
function getPrice(priceWithTax, taxRate) { | function getPrice(priceWithTax, taxRate) { | ||||
return numberDecimals(parseFloat(parseFloat(priceWithTax) / (taxRate + 1)), 3); | |||||
return numberDecimals(parseFloat(parseFloat(priceWithTax) / (taxRate + 1)), 5); | |||||
} | } | ||||
/** | /** |