reverd document discount changes..
This commit is contained in:
parent
8ef6f743bd
commit
daf2228725
@ -45,16 +45,13 @@ class CreateDocumentItem extends Job implements HasOwner, HasSource, ShouldCreat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply total discount to amount
|
// Apply total discount to amount
|
||||||
/*
|
if (! empty($this->request['global_discount'])) {
|
||||||
// Disabled this block because broken line item amount..
|
|
||||||
if (!empty($this->request['global_discount'])) {
|
|
||||||
if ($this->request['global_discount_type'] === 'percentage') {
|
if ($this->request['global_discount_type'] === 'percentage') {
|
||||||
//$item_discounted_amount -= $item_discounted_amount * ($this->request['global_discount'] / 100);
|
$item_discounted_amount -= $item_discounted_amount * ($this->request['global_discount'] / 100);
|
||||||
} else {
|
} else {
|
||||||
//$item_discounted_amount -= $this->request['global_discount'];
|
$item_discounted_amount -= $this->request['global_discount'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
$tax_amount = 0;
|
$tax_amount = 0;
|
||||||
$item_tax_total = 0;
|
$item_tax_total = 0;
|
||||||
@ -155,12 +152,12 @@ class CreateDocumentItem extends Job implements HasOwner, HasSource, ShouldCreat
|
|||||||
$this->request['document_id'] = $this->document->id;
|
$this->request['document_id'] = $this->document->id;
|
||||||
$this->request['item_id'] = $item_id;
|
$this->request['item_id'] = $item_id;
|
||||||
$this->request['name'] = Str::limit($this->request['name'], 180, '');
|
$this->request['name'] = Str::limit($this->request['name'], 180, '');
|
||||||
$this->request['description'] = !empty($this->request['description']) ? $this->request['description'] : '';
|
$this->request['description'] = ! empty($this->request['description']) ? $this->request['description'] : '';
|
||||||
$this->request['quantity'] = (double) $this->request['quantity'];
|
$this->request['quantity'] = (double) $this->request['quantity'];
|
||||||
$this->request['price'] = round($this->request['price'], $precision);
|
$this->request['price'] = round($this->request['price'], $precision);
|
||||||
$this->request['tax'] = round($item_tax_total, $precision);
|
$this->request['tax'] = round($item_tax_total, $precision);
|
||||||
$this->request['discount_type'] = ! empty($this->request['discount_type']) ? $this->request['discount_type'] : null;
|
$this->request['discount_type'] = ! empty($this->request['discount_type']) ? $this->request['discount_type'] : 'percent';
|
||||||
$this->request['discount_rate'] = !empty($this->request['discount']) ? $this->request['discount'] : 0;
|
$this->request['discount_rate'] = ! empty($this->request['discount']) ? $this->request['discount'] : 0;
|
||||||
$this->request['total'] = round($actual_price_item, $precision);
|
$this->request['total'] = round($actual_price_item, $precision);
|
||||||
$this->request['created_from'] = $this->request['created_from'];
|
$this->request['created_from'] = $this->request['created_from'];
|
||||||
$this->request['created_by'] = $this->request['created_by'];
|
$this->request['created_by'] = $this->request['created_by'];
|
||||||
|
@ -227,17 +227,6 @@ class CreateDocumentItemsAndTotals extends Job implements HasOwner, HasSource, S
|
|||||||
|
|
||||||
$discount_amount_total += $discount_amount;
|
$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) {
|
if (! $document_item->item_taxes) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user