Grand Total @foreach($departments as $department) @php $printEmptyTd = true @endphp @if(isset($grandTotalSplit)) @foreach($grandTotalSplit as $key => $val) @if($department->id == $key) @foreach($val as $key1 => $val1) @if($key1 != 'dept') @foreach($department->subdepts as $sub_dept) @if($sub_dept->id == $key1) @if($val1 != null) @php $printEmptyTd = false @endphp @if(isset($val1[$franchiseCurrency]) && isset($val1['USD']))

ST: {{ number_format($val1[$franchiseCurrency]['totalAmount'],2) }}

@isset($val1[$franchiseCurrency]['taxAmount']) @foreach($val1[$franchiseCurrency]['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax,2) }}

@endif @endforeach @endisset

GT: {{ number_format($val1[$franchiseCurrency]['subTotalAmount'],2) }}

ST: {{ number_format($val1['USD']['totalAmount'],2) }}

@isset($val1['USD']['taxAmount']) @foreach($val1['USD']['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax,2) }}

@endif @endforeach @endisset

GT: {{ number_format($val1['USD']['subTotalAmount'],2) }}

@elseif(isset($val1[$franchiseCurrency]) && !isset($val1['USD']))

ST: {{ number_format($val1[$franchiseCurrency]['totalAmount'],2) }}

@isset($val1[$franchiseCurrency]['taxAmount']) @foreach($val1[$franchiseCurrency]['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax,2) }}

@endif @endforeach @endisset

GT: {{ number_format($val1[$franchiseCurrency]['subTotalAmount'],2) }}

@elseif(!isset($val1[$franchiseCurrency]) && isset($val1['USD']))

ST: {{ number_format($val1['USD']['totalAmount'], 2) }}

@isset($val1['USD']['taxAmount']) @foreach($val1['USD']['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax,2) }}

@endif @endforeach @endisset

GT: {{ number_format($val1['USD']['subTotalAmount'], 2) }}

@endif @else @php $printEmptyTd = false @endphp @endif @endif @endforeach @elseif($key1 == 'dept') @php $printEmptyTd = false @endphp @if(isset($val1[$franchiseCurrency]) && isset($val1['USD']))

ST: {{ number_format($val1[$franchiseCurrency]['totalAmount'],2) }}

@isset($val1[$franchiseCurrency]['taxAmount']) @foreach($val1[$franchiseCurrency]['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax,2) }}

@endif @endforeach @endisset

GT: {{ number_format($val1[$franchiseCurrency]['subTotalAmount'],2) }}

ST: {{ number_format($val1['USD']['totalAmount'],2) }}

@isset($val1['USD']['taxAmount']) @foreach($val1['USD']['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax,2) }}

@endif @endforeach @endisset

GT: {{ number_format($val1['USD']['subTotalAmount'],2) }}

@elseif(isset($val1[$franchiseCurrency]) && !isset($val1['USD']))

ST: {{ number_format($val1[$franchiseCurrency]['totalAmount'],2) }}

@isset($val1[$franchiseCurrency]['taxAmount']) @foreach($val1[$franchiseCurrency]['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax,2) }}

@endif @endforeach @endisset

GT: {{ number_format($val1[$franchiseCurrency]['subTotalAmount'],2) }}

@elseif(!isset($val1[$franchiseCurrency]) && isset($val1['USD']))

ST: {{ number_format($val1['USD']['totalAmount'], 2) }}

@isset($val1['USD']['taxAmount']) @foreach($val1['USD']['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax,2) }}

@endif @endforeach @endisset

GT: {{ number_format($val1['USD']['subTotalAmount'], 2) }}

@endif @endif @endforeach @endif @endforeach @endif @if($printEmptyTd) @endif @endforeach @if(isset($grandTotal[$franchiseCurrency]))

ST: {{ number_format($grandTotal[$franchiseCurrency]['totalAmount'],2) }}

@isset($grandTotal[$franchiseCurrency]['taxAmount']) @foreach($grandTotal[$franchiseCurrency]['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax,2) }}

@endif @endforeach @endisset

GT: {{ number_format($grandTotal[$franchiseCurrency]['subTotalAmount'],2) }}

@else @endif @if(isset($grandTotal['USD']))

ST: {{ number_format($grandTotal['USD']['totalAmount'],2) }}

@isset($grandTotal['USD']['taxAmount']) @foreach($grandTotal['USD']['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax,2) }}

@endif @endforeach @endisset

GT: {{ number_format($grandTotal['USD']['subTotalAmount'],2) }}

@else @endif @if(!isset($isInvoice)) @endif Grand Total in {{ $franchiseCurrency }} (USD + {{ $franchiseCurrency }}) @foreach($departments as $department) @php $printEmptyTd = true @endphp @if(isset($grandTotalSplit)) @foreach($grandTotalSplit as $key => $val) @if($department->id == $key) @foreach($val as $key1 => $val1) @if($key1 != 'dept') @foreach($department->subdepts as $sub_dept) @if($sub_dept->id == $key1) @if($val1 != null) @php $printEmptyTd = false @endphp

ST: {{ number_format($val1['allCurrency']['totalAmount'],2) }}

@isset($val1['allCurrency']['taxAmount']) @foreach($val1['allCurrency']['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax, 2) }}

@endif @endforeach @endisset

GT: {{ number_format($val1['allCurrency']['subTotalAmount'],2) }}

@else @php $printEmptyTd = false @endphp @endif @endif @endforeach @elseif($key1 == 'dept') @php $printEmptyTd = false @endphp

ST: {{ number_format($val1['allCurrency']['totalAmount'],2) }}

@isset($val1['allCurrency']['taxAmount']) @foreach($val1['allCurrency']['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax, 2) }}

@endif @endforeach @endisset

GT: {{ number_format($val1['allCurrency']['subTotalAmount'],2) }}

@endif @endforeach @endif @endforeach @endif @if($printEmptyTd) @endif @endforeach @if(!isset($isInvoice)) @endif @foreach($departments as $department) @php $printEmptyTd = true @endphp @if(isset($deptgrandTotalSplit)) @foreach($deptgrandTotalSplit['allSubDept'] as $key => $val) @if($department->id == $key) @php $printEmptyTd = false @endphp

ST: {{ number_format($val['totalAmount'],2) }}

@isset($val['taxAmount']) @foreach($val['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax, 2) }}

@endif @endforeach @endisset

GT: {{ number_format($val['subTotalAmount'],2) }}

@endif @endforeach @endif @if($printEmptyTd) @endif @endforeach

ST: {{ number_format($grandTotal['allCurrency']['totalAmount'],2) }}

@isset($grandTotal['allCurrency']['taxAmount']) @foreach($grandTotal['allCurrency']['taxAmount'] as $key => $tax) @if($tax != 0)

{{ $key }}: {{ number_format($tax,2) }}

@endif @endforeach @endisset

GT: {{ number_format($grandTotal['allCurrency']['subTotalAmount'],2) }}

@if(!isset($isInvoice)) @endif