Mobile optimization

This commit is contained in:
Peter Papp
2021-05-04 16:39:59 +02:00
parent 0332f8b1fb
commit 7cc27938bf
6 changed files with 550 additions and 312 deletions

View File

@@ -71,11 +71,12 @@ function invoice_tax_base($invoice)
// Count tax base
foreach ($invoice['items'] as $item) {
if ($bag->whereNotIn('rate', $item['tax_rate'])) {
if (! $bag->firstWhere('rate', $item['tax_rate'])) {
$bag->push([
'rate' => $item['tax_rate'],
'total' => $item['price'] * $item['amount'],
]);
} else {
$bag->map(function ($bagItem) use ($item) {
if ($bagItem['rate'] === $item['tax_rate']) {
@@ -115,7 +116,7 @@ function invoice_tax_summary($invoice)
// Count tax base
foreach ($invoice['items'] as $item) {
if ($bag->whereNotIn('rate', $item['tax_rate'])) {
if (! $bag->firstWhere('rate', $item['tax_rate'])) {
$bag->push([
'rate' => $item['tax_rate'],
'total' => ($item['price'] * $item['amount']) * ($item['tax_rate'] / 100),