@php $monthName = (isset($isInvoice)) ? 'tax_date_month_name' : (isset($is_payment_voucher) ? 'pv_date_month_name' :'date_month_name'); $monthNo = (isset($isInvoice)) ? 'tax_date_month_no' : (isset($is_payment_voucher) ? 'pv_date_month_no' : 'date_month_no'); $year = (isset($isInvoice)) ? 'tax_date_year' : (isset($is_payment_voucher) ? 'pv_date_year' : 'date_year'); @endphp {{ $order->$monthName }} {{ $order->$year }} Total @foreach($departments as $department) @php $printEmptyTd = true @endphp @if(isset($splitData[$order->$year][$order->$monthNo])) @foreach($splitData[$order->$year][$order->$monthNo] as $key => $val) @if($department->id == $key) @foreach($splitData[$order->$year][$order->$monthNo][$key] 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 @endif

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) @if($department->subdepts->count() != 0) @foreach($department->subdepts as $sub_dept) @endforeach @else @endif @endif @endforeach @if(isset($monthlyData[$order->$year][$order->$monthNo][$franchiseCurrency]))

ST: {{ number_format($monthlyData[$order->$year][$order->$monthNo][$franchiseCurrency]['totalAmount'], 2) }}

@isset($monthlyData[$order->$year][$order->$monthNo][$franchiseCurrency]['taxAmount']) @foreach($monthlyData[$order->$year][$order->$monthNo][$franchiseCurrency]['taxAmount'] as $key => $tax) @if($tax != 0)

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

@endif @endforeach @endisset

GT: {{ number_format($monthlyData[$order->$year][$order->$monthNo][$franchiseCurrency]['subTotalAmount'], 2) }}

@else @endif @if(isset($monthlyData[$order->$year][$order->$monthNo]['USD']))

ST: {{ number_format($monthlyData[$order->$year][$order->$monthNo]['USD']['totalAmount'], 2) }}

@isset($monthlyData[$order->$year][$order->$monthNo]['USD']['taxAmount']) @foreach($monthlyData[$order->$year][$order->$monthNo]['USD']['taxAmount'] as $key => $tax) @if($tax != 0)

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

@endif @endforeach @endisset

GT: {{ number_format($monthlyData[$order->$year][$order->$monthNo]['USD']['subTotalAmount'], 2) }}

@else @endif @if(!isset($isInvoice)) @endif {{ $order->$monthName }} {{ $order->$year }} Total in {{ $franchiseCurrency }} (USD + {{ $franchiseCurrency }}) @foreach($departments as $department) @php $printEmptyTd = true @endphp @if(isset($splitData[$order->$year][$order->$monthNo])) @foreach($splitData[$order->$year][$order->$monthNo] as $key => $val) @if($department->id == $key) @foreach($splitData[$order->$year][$order->$monthNo][$key] 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) @if($department->subdepts->count() != 0) @foreach($department->subdepts as $sub_dept) @endforeach @else @endif @endif @endforeach @if(!isset($isInvoice)) @endif @foreach($departments as $department) @php $printEmptyTd = true @endphp @if(isset($deptSplitData[$order->$year][$order->$monthNo])) @foreach($deptSplitData[$order->$year][$order->$monthNo]['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) @if($department->subdepts->count() != 0) @else @endif @endif @endforeach

ST: {{ number_format($monthlyData[$order->$year][$order->$monthNo]['allCurrency']['totalAmount'],2) }}

@isset($monthlyData[$order->$year][$order->$monthNo]['allCurrency']['taxAmount']) @foreach($monthlyData[$order->$year][$order->$monthNo]['allCurrency']['taxAmount'] as $key => $tax) @if($tax != 0)

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

@endif @endforeach @endisset

GT: {{ number_format($monthlyData[$order->$year][$order->$monthNo]['allCurrency']['subTotalAmount'],2) }}

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