@php if(Auth::user()->franchise && Auth::user()->franchise->countries && Auth::user()->franchise->countries->currency_code) $currencyCode = Auth::user()->franchise->countries->currency_code; else $currencyCode = 'TZS'; @endphp @php $i = 0; @endphp @while ($i < 10) @php $i++; @endphp @endwhile @foreach($departmentList as $department) @endforeach @php $i = 0; @endphp @while ($i < 15) @php $i++; @endphp @endwhile @foreach($departmentList as $department) @if($department->subdepts->count() != 0) @foreach($department->subdepts as $sub_dept) @endforeach @else @endif @endforeach @foreach($taxList as $tax) @if(($tax->tax_title == 'Withholding Tax')) @endif @endforeach @foreach($departmentList as $department) @if($department->subdepts->count() != 0) @foreach($department->subdepts as $sub_dept) @endforeach @else @endif @endforeach @foreach ($userList as $user) @endforeach @php $bgclr = ''; @endphp @foreach($invoiceList as $invoice) @php $deptTZS = 0; $deptUSD = 0; $deptTotal = 0; $totalInvoiceSplitAmount = 0; $totalAmount = $invoice->total_amount; $convertedTotalAmount = $invoice->currency == 'USD' ? $invoice->total_amount_converted : $invoice->total_amount; $convertedSubTotalAmount = $invoice->currency == 'USD' ? $invoice->sub_total_amount_converted : $invoice->sub_total_amount; @endphp @if($invoice->taxes->where('tax_title', $taxList[0]->tax_title)->pluck('tax_value')->first()) @if($invoice->certificate) @php $bgclr = '#c3e6cb'; @endphp @else @php $bgclr = '#ffeeba'; @endphp @endif @else @php $bgclr = '#c3e6cb'; @endphp @endif @foreach($taxList as $tax) @if(($tax->tax_title == 'Withholding Tax')) @endif @endforeach @foreach($departmentList as $department) @php $printEmptyTd = true; @endphp @if($department->subdepts->count() != 0) @foreach($department->subdepts as $sub_dept) @if($invoice->subsplits()->where('sub_department_id', $sub_dept->id)->count() != 0) @php $groupBySplits = $invoice->subSplits->groupBy('sub_department_id'); @endphp @foreach($groupBySplits as $key => $split) @if($key == $sub_dept->id) @php $printEmptyTd = false; $splitAmount = $invoice->subSplits->where('sub_department_id', $key)->sum('amount'); if($invoice->currency == 'USD') { $deptUSD += $splitAmount; $deptTotal += $splitAmount * $invoice->conversion_rate; }else { $deptTZS += $splitAmount; $deptTotal += $splitAmount; } @endphp @if($invoice->currency == $franchiseCurrency) @elseif($invoice->currency == 'USD') @endif @endif @endforeach @else @php $printEmptyTd = false; @endphp @endif @endforeach @if($printEmptyTd) @endif @elseif($invoice->splits()->whereType('dept')->whereDepartmentId($department->id)->count() != 0) @php $deptsplitAmount = $invoice->splits->where('department_id', $department->id)->sum('amount'); if($invoice->currency == 'USD'){ $deptUSD += $deptsplitAmount; $deptTotal += $deptsplitAmount * $invoice->conversion_rate; } else { $deptTZS += $deptsplitAmount; $deptTotal += $deptsplitAmount; } @endphp @if($invoice->currency == $franchiseCurrency) @elseif($invoice->currency == 'USD') @endif @else @endif @endforeach @if($invoice->currency != 'USD') @else @endif @foreach ($userList as $user) @php $memberSplitAmount = $invoice->splits->where('user_id', $user->id)->sum('amount'); if($invoice->currency == 'USD') $memberSplitAmount = $memberSplitAmount * $invoice->conversion_rate; $totalInvoiceSplitAmount += $memberSplitAmount; @endphp @endforeach @endforeach
Start Date {{ $dates[0] }} End Date {{ $dates[1] }} {{ $department->name }} Total
{{ $sub_dept->name }}-{{ $currencyCode }} USD Staff Allocation
Inv Date Payment Received Date Payment Terms Days to Payment Inv No Company Project Title Project Owner Category Industry Short Description{{ ($tax->tax_title == 'Withholding Tax') ? 'WHT' : $tax->tax_title }} (%)WHT StatusXrate{{ $sub_dept->name }} {{ $currencyCode }} {{ $sub_dept->name }} USD {{ $sub_dept->name }} TOTAL {{ $currencyCode }}{{ $department->name }} {{ $currencyCode }} {{ $department->name }} USD {{ $department->name }} TOTAL {{ $currencyCode }}EMPOWER TZS EMPOWER USD EMPOWER TOTAL TZS{{ $user->full_name }}Total
{{ $invoice->tax_invoice_date_formatted_full }} {{ $invoice->date_collected_formatted ?? '-' }} {{ $invoice->payment_days_term }} @if($invoice->status == 'paid') {{ Carbon\Carbon::parse($invoice->tax_invoice_date)->diffInDays($invoice->date_collected) }} @else - @endif {{ $invoice->ti_serial_number }} {{ $invoice->company->name }} {{ $invoice->project->name ?? '-' }} {{ ($invoice->project && $invoice->project->projectOwner && $invoice->project->projectOwner->first() && $invoice->project->projectOwner->first()->full_name) ? $invoice->project->projectOwner->first()->full_name : '-' }} {{ $invoice->company->industries_formatted ?? '-' }} {{ $invoice->description }} {{ $invoice->taxes->where('tax_title', $tax->tax_title)->pluck('tax_value')->first() ?? '-' }} @if($invoice->taxes->where('tax_title', $tax->tax_title)->pluck('tax_value')->first()) @if($invoice->certificate) {{ 'Paid' }} @else {{ 'Not Paid' }} @endif @else {{ '-' }} @endif @if($invoice->currency == 'USD') {{ $invoice->conversion_rate ?? '-' }} @else - @endif {{ round($splitAmount,2) }} {{ round($splitAmount,2) }} {{ round($splitAmount,2) }} {{ round($splitAmount * $invoice->conversion_rate,2) }} {{ round($deptsplitAmount,2) }} {{ round($deptsplitAmount,2) }} {{ round($deptsplitAmount,2) }} {{ round($deptsplitAmount * $invoice->conversion_rate,2) }} {{ round($deptTZS, 2) }} {{ round($deptUSD, 2) }}{{ round($deptTotal, 2) }}{{ ($memberSplitAmount != 0) ? round($memberSplitAmount, 2) : '' }}{{ round($totalInvoiceSplitAmount, 2) }}