fixed document total issue
This commit is contained in:
parent
3af0787775
commit
c3c866580a
@ -159,7 +159,7 @@ class CreateDocumentItem extends Job implements HasOwner, HasSource, ShouldCreat
|
||||
$this->request['quantity'] = (double) $this->request['quantity'];
|
||||
$this->request['price'] = round($this->request['price'], $precision);
|
||||
$this->request['tax'] = round($item_tax_total, $precision);
|
||||
$this->request['discount_type'] = !empty($this->request['discount_type']) ? $this->request['discount_type'] : 'percentage';
|
||||
$this->request['discount_type'] = ! empty($this->request['discount_type']) ? $this->request['discount_type'] : null;
|
||||
$this->request['discount_rate'] = !empty($this->request['discount']) ? $this->request['discount'] : 0;
|
||||
$this->request['total'] = round($actual_price_item, $precision);
|
||||
$this->request['created_from'] = $this->request['created_from'];
|
||||
|
@ -227,6 +227,17 @@ class CreateDocumentItemsAndTotals extends Job implements HasOwner, HasSource, S
|
||||
|
||||
$discount_amount_total += $discount_amount;
|
||||
|
||||
// Calculate global discount total
|
||||
if (! empty($item['global_discount'])) {
|
||||
if ($item['global_discount_type'] === 'percentage') {
|
||||
$global_discount_amount = $document_item->total * ($item['global_discount'] / 100);
|
||||
} else {
|
||||
$global_discount_amount = $item['global_discount'];
|
||||
}
|
||||
|
||||
$actual_total -= $global_discount_amount;
|
||||
}
|
||||
|
||||
if (! $document_item->item_taxes) {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user