Document subtotal calculation error fixed..

This commit is contained in:
Cüneyt Şentürk 2022-09-13 16:06:15 +03:00
parent 64b7a98ad6
commit 3af0787775
2 changed files with 22 additions and 3 deletions

View File

@ -45,13 +45,16 @@ class CreateDocumentItem extends Job implements HasOwner, HasSource, ShouldCreat
}
// Apply total discount to amount
/*
// Disabled this block because broken line item amount..
if (!empty($this->request['global_discount'])) {
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 {
$item_discounted_amount -= $this->request['global_discount'];
//$item_discounted_amount -= $this->request['global_discount'];
}
}
*/
$tax_amount = 0;
$item_tax_total = 0;

View File

@ -36,7 +36,23 @@
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_td_start')
@if ($item->discount_type === 'percentage')
<td class="discount text text-alignment-right text-right">{{ $item->discount }}</td>
<td class="discount text text-alignment-right text-right">
@php
$text_discount = '';
if (setting('localisation.percent_position') == 'before') {
$text_discount .= '%';
}
$text_discount .= $item->discount;
if (setting('localisation.percent_position') == 'after') {
$text_discount .= '%';
}
@endphp
{{ $text_discount }}
</td>
@else
<td class="discount text text-alignment-right text-right">@money($item->discount, $document->currency_code, true)</td>
@endif