fixed tax calculate issue
This commit is contained in:
parent
51d2097cd6
commit
502c7b0d31
|
|
@ -238,11 +238,11 @@ class CreateDocumentItemsAndTotals extends Job implements HasOwner, HasSource, S
|
|||
// Set taxes
|
||||
foreach ((array) $document_item->item_taxes as $item_tax) {
|
||||
if (array_key_exists($item_tax['tax_id'], $taxes)) {
|
||||
$taxes[$item_tax['tax_id']]['amount'] += number_format($item_tax['amount'], $this->document->currency->precision);
|
||||
$taxes[$item_tax['tax_id']]['amount'] += round((float) $item_tax['amount'], $this->document->currency->precision);
|
||||
} else {
|
||||
$taxes[$item_tax['tax_id']] = [
|
||||
'name' => $item_tax['name'],
|
||||
'amount' => number_format($item_tax['amount'], $this->document->currency->precision),
|
||||
'amount' => round((float) $item_tax['amount'], $this->document->currency->precision),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -888,24 +888,14 @@ const app = new Vue({
|
|||
this.onSubmit();
|
||||
},
|
||||
|
||||
numberFormat(number, decimals = 0, decPoint = '.', thousandsSep = ',') {
|
||||
numberFormat(number, decimals = 0) {
|
||||
number = parseFloat(number);
|
||||
|
||||
if (isNaN(number)) return '0';
|
||||
if (isNaN(number)) return parseFloat('0');
|
||||
|
||||
// Ondalık basamakları ayarla
|
||||
number = number.toFixed(decimals);
|
||||
|
||||
// Sayıyı parçalara ayır
|
||||
let parts = number.split('.');
|
||||
let integerPart = parts[0];
|
||||
let decimalPart = parts[1] || '';
|
||||
|
||||
// Binlik ayıracı ekle
|
||||
integerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSep);
|
||||
|
||||
// Sonucu birleştir
|
||||
return decimals > 0 ? parseFloat(integerPart + decPoint + decimalPart) : parseFloat(integerPart);
|
||||
return parseFloat(number);
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue