@php $pivotTaxes = $invoice->allPivotTaxes; @endphp @if(count($pivotTaxes->where('category', 1)) > 0 && $tab == 'tax-report') {{-- category 1 --}} @include('admin.pages.invoices.items.show.tax-report-row', ['taxes' => $pivotTaxes->where('category', 1)]) {{__('Value Added Tax')}} @cMoney($pivotTaxes->where('category', 1)->sum(function($tax) use ($invoice) { return cMoney($tax->manual_amount ? $tax->manual_amount : $tax->calculated_amount, $invoice->currency, true)->getAmount(); }), $invoice->currency, false) {{count($pivotTaxes->where('category', 1))}} {{-- --}} @cMoney($pivotTaxes->where('category', 1)->sum(function($tax) use ($invoice) { return cMoney($tax->manual_amount ? $tax->manual_amount : $tax->calculated_amount, $invoice->currency, true)->getAmount(); }), $invoice->currency, false) @endif @if(count($pivotTaxes->where('category', 2)) > 0) {{-- category 2 --}} @include('admin.pages.invoices.items.show.tax-report-row', ['taxes' => $pivotTaxes->where('category', 2)]) {{__('Withholding Tax')}} @cMoney($pivotTaxes->where('category', 2)->sum(function($tax) use ($invoice) { return cMoney($tax->manual_amount ? $tax->manual_amount : $tax->calculated_amount, $invoice->currency, true)->getAmount(); }), $invoice->currency, false) {{count($pivotTaxes->where('category', 2))}} {{-- --}} @cMoney($pivotTaxes->where('category', 2)->sum(function($tax) use ($invoice) { return cMoney($tax->manual_amount ? $tax->manual_amount : $tax->calculated_amount, $invoice->currency, true)->getAmount(); }), $invoice->currency, false) @endif @if(count($pivotTaxes->where('category', 3)) > 0) {{-- category 3 --}} @include('admin.pages.invoices.items.show.tax-report-row', ['taxes' => $pivotTaxes->where('category', 3)]) {{__('Reverse Charge')}} @cMoney($pivotTaxes->where('category', 3)->sum(function($tax) use ($invoice) { return cMoney($tax->manual_amount ? $tax->manual_amount : $tax->calculated_amount, $invoice->currency, true)->getAmount(); }), $invoice->currency, false) {{count($pivotTaxes->where('category', 3))}} {{-- --}} @cMoney($pivotTaxes->where('category', 3)->sum(function($tax) use ($invoice) { return cMoney($tax->manual_amount ? $tax->manual_amount : $tax->calculated_amount, $invoice->currency, true)->getAmount(); }), $invoice->currency, false) @endif