@php
                        // dd($shop_transactions);
                    @endphp
                        @if(count($roomrates) > 0 || count($shop_transactions) > 0 || count($transactions) > 0 || count($pembayaranpos) > 0)
                            @php
                            $grandtotal_amount = 0;
                            $grandtotal_qty = 0;
                            @endphp
                            
                            @foreach($roomrates as $group_roomrate)
                                @php
                                $total_amount = 0;
                                $total_qty = 0;
                                $roomrates_checker = false;
                                @endphp
                                @foreach($group_roomrate as $roomrate)
                                @if ($roomrate->bookingDetail)
                                @php
                                    $roomrates_checker = true;
                                @endphp
                                
                                    |  | {{ formatDate($roomrate->date) }} | {{ @$roomrate->foliodummy->no_bill }} | {{ $custom_filter == 1 ? 'Lodging' : ($custom_filter == 2 ? 'Roomcharge' : $roomrate->description) }} | FO | {{ $roomrate->qty }}@php
                                        // Assign tax dan services
                                        $tax             = round((@$roomrate->bookingDetail->per_item * $tax_global)/(100+$tax_global));//Find tax from normal price, without arrangement price
                                        $harga_min_t     = ((@$roomrate->bookingDetail->per_item) - $tax);//price minus total tax
                                        $services        = round(($harga_min_t * $services_global)/(100+$services_global));//Find service from normal price, without arrangement price
                                        $harga_item_real = (int)((@$roomrate->bookingDetail->per_item) - ($tax) - ($services));//input per item real, without arrangement price
                                        // lodging include tax services.
                                        $lodging         = (int)($roomrate->bookingDetail->per_item - $roomrate->bookingDetail->per_item_arr);
                                    @endphp
                                    @if ($exclude == 1) | {{ ribuanWithComma($custom_filter == 1 ? @$roomrate->bookingDetail->per_item_real : @$harga_item_real) }}@else | {{ ribuanWithComma($custom_filter == 1 ? @$lodging : @$roomrate->total) }}@endif | {{ $roomrate->created_at ? $roomrate->created_at->format('H:i:s') : '' }} | {{ @$roomrate->foliodummy->guestProfile->name }} | 
                                    @php
                                    // $total_amount += $roomrate->total;
                                    $total_qty += $roomrate->qty;
                                    if ($exclude == 1){
                                        $total_amount += ($custom_filter == 1 ?  @$roomrate->bookingDetail->per_item_real : @$harga_item_real);
                                        $grandtotal_amount += ($custom_filter == 1 ?  @$roomrate->bookingDetail->per_item_real : @$harga_item_real);
                                    }
                                    else{
                                        $total_amount += ($custom_filter == 1 ? @$lodging : @$roomrate->total);
                                        $grandtotal_amount += ($custom_filter == 1 ? @$lodging : @$roomrate->total);
                                    }
                                    $grandtotal_qty += $roomrate->qty;
                                    @endphp
                                @endif
                                @endforeach
                                @if ($roomrates_checker == true)
                                    
                                        |  |  |  |  | TOTAL | {{$total_qty}} | {{ribuanWithComma($total_amount)}} |  |  | 
                                @endif
                            @endforeach
                            
                            @foreach($shop_transactions as $group_shop_transaction)
                                @php
                                $total_amount = 0;
                                $total_qty = 0;
                                $shop_transactions_checker = false;
                                @endphp
                                @foreach($group_shop_transaction as $shop_transaction)
                                    @php
                                        $shop_transactions_checker = true;
                                    @endphp
                                    @if(@$shop_transaction->tipeMenu->split_revenue < 100)
                                        @php
                                        $split_percentage = @$shop_transaction->tipeMenu->split_revenue / 100;
                                        $split_partner    = $shop_transaction->tipemenu ? (100 - $shop_transaction->tipemenu->split_revenue) : 0; //custom menu
                                        // partner revenue
                                        $partner_label = @$shop_transaction->tipeMenu->revenue_partner_label;
                                        // $partner_revenue = $shop_transaction->total_biaya - $own_revenue;
                                        // $partner_revenue_pph = $shop_transaction->grand_total - $own_revenue_pph;
                                        $partner_revenue = round((int)($shop_transaction->total_biaya) * ($split_partner / 100));
                                        $partner_revenue_pph = round((int)($shop_transaction->grand_total) * ($split_partner / 100));
                                        $partner_raw_rev     = $partner_revenue;
                                        $partner_raw_rev_pph = $partner_revenue_pph;
                                        if (@$shop_transaction->tipeMenu->partner_services == 1) {
                                            $service_payable = @$shop_transaction->service * ($split_partner/100);
                                        }
                                        else{
                                            $service_payable = 0;
                                        }
                                        if (@$shop_transaction->tipeMenu->partner_tax == 1) {
                                            $tax_payable = @$shop_transaction->ppn * ($split_partner/100);
                                        }
                                        else{
                                            $tax_payable = 0;
                                        }
                                        // $partner_revenue = $partner_raw_rev + $service_payable + $tax_payable;
                                        $partner_revenue = $partner_raw_rev;
                                        $partner_revenue_pph = $partner_raw_rev + $service_payable + $tax_payable;
                                        // own revenue
                                        $own_label = @$shop_transaction->tipeMenu->revenue_hotel_label;
                                        // $own_revenue = round($shop_transaction->total_biaya * $split_percentage);
                                        // $own_revenue_pph = round($shop_transaction->grand_total * $split_percentage);
                                        $own_revenue = round($shop_transaction->total_biaya - $partner_revenue);
                                        $own_revenue_pph = round($shop_transaction->grand_total - $partner_revenue_pph);
                                        @endphp
                                        
                                            |  | {{ formatDate($shop_transaction->transaction_date) }} | {{ @$shop_transaction->folioDummy->no_bill }} | {{ $own_label }} {{$shop_transaction->description ? ' - '.$shop_transaction->description : ''}} | FO | {{@$shop_transaction->jenis_transaksi == 0 ? '-' : ''}} {{ $shop_transaction->jumlah }}@if ($exclude == 1) | {{@$shop_transaction->jenis_transaksi == 0 ? '-' : ''}}{{ ribuanWithComma($own_revenue) }}@else | {{@$shop_transaction->jenis_transaksi == 0 ? '-' : ''}}{{ ribuanWithComma($own_revenue_pph) }}@endif | {{ $shop_transaction->created_at ? $shop_transaction->created_at->format('H:i:s') : '' }} | {{ @$shop_transaction->folioDummy->guestProfile->name }} | 
                                        
                                            |  | {{ formatDate($shop_transaction->transaction_date) }} | {{ @$shop_transaction->folioDummy->no_bill }} | {{ $partner_label }} {{$shop_transaction->description ? ' - '.$shop_transaction->description : ''}} | FO | {{@$shop_transaction->jenis_transaksi == 0 ? '-' : ''}}{{ $shop_transaction->jumlah }}@if ($exclude == 1) | {{@$shop_transaction->jenis_transaksi == 0 ? '-' : ''}}{{ ribuanWithComma($partner_revenue) }}@else | {{@$shop_transaction->jenis_transaksi == 0 ? '-' : ''}}{{ ribuanWithComma($partner_revenue_pph) }}@endif | {{ $shop_transaction->created_at ? $shop_transaction->created_at->format('H:i:s') : '' }} | {{ @$shop_transaction->folioDummy->guestProfile->name }} | 
                                    @else
                                        
                                            |  | {{ formatDate($shop_transaction->transaction_date) }} | {{ @$shop_transaction->folioDummy->no_bill }} | {{ @$shop_transaction->menu->nama }} {{$shop_transaction->description ? ' - '.$shop_transaction->description : ''}} | FO | {{@$shop_transaction->jenis_transaksi == 0 ? '-' : ''}}{{ $shop_transaction->jumlah }}@if ($exclude == 1) | {{@$shop_transaction->jenis_transaksi == 0 ? '-' : ''}}{{ ribuanWithComma(@$shop_transaction->total_biaya) }}@else | {{@$shop_transaction->jenis_transaksi == 0 ? '-' : ''}}{{ ribuanWithComma($shop_transaction->grand_total) }}@endif | {{ $shop_transaction->created_at ? $shop_transaction->created_at->format('H:i:s') : '' }} | {{ @$shop_transaction->folioDummy->guestProfile->name }} | 
                                    @endif
                                    @php
                                    if ($shop_transaction->jenis_transaksi == 1) {
                                        $total_amount += $exclude ? $shop_transaction->total_biaya : $shop_transaction->grand_total;
                                        $total_qty += $shop_transaction->jumlah;
                                        $grandtotal_amount += $exclude ? $shop_transaction->total_biaya : $shop_transaction->grand_total;
                                        $grandtotal_qty += $shop_transaction->jumlah;
                                    }elseif($shop_transaction->jenis_transaksi == 0){
                                        $total_amount -= $exclude ? $shop_transaction->total_biaya : $shop_transaction->grand_total;
                                        $total_qty -= $shop_transaction->jumlah;
                                        $grandtotal_amount -= $exclude ? $shop_transaction->total_biaya : $shop_transaction->grand_total;
                                        $grandtotal_qty -= $shop_transaction->jumlah;
                                    }
                                    @endphp
                                @endforeach
                                @if ($shop_transactions_checker == true)
                                    
                                        |  |  |  |  | TOTAL | {{$total_qty}} | {{ribuanWithComma($total_amount)}} |  |  | 
                                @endif
                            @endforeach
                            
                            @foreach($transactions as $transaction)
                                @php
                                $total_qty = 0;
                                $total_amount = 0;
                                $transactions_checker = false;
                                @endphp
                                @foreach($transaction as $item_transaction)
                                    
                                    @if($item_transaction->jenis_pembayaran_id)
                                    @php
                                        $transactions_checker = true;
                                    @endphp
                                    
                                        |  | {{ formatDate($item_transaction->transaction_date) }} | {{ @$item_transaction->folioDummy->no_bill }} | {{$item_transaction->tipe_pembayaran == 1 ? 'Pembayaran' : 'Refund'}} {{ config('custom.jenis_pembayaran')[$item_transaction->jenis_pembayaran_id].' '.$item_transaction->bank }} A.N. {{ @$item_transaction->folioDummy->nama }} | FO | 1 | {{$item_transaction->tipe_pembayaran == 1 ? '-' : ''}}{{ ribuanWithComma($item_transaction->nominal) }} | {{ $item_transaction->created_at ? $item_transaction->created_at->format('H:i:s') : '' }} | {{ @$item_transaction->folioDummy->guestProfile->name }} | 
                                        @php
                                        if($item_transaction->tipe_pembayaran == 1){
                                            $total_amount -= $item_transaction->nominal;
                                            $total_qty += 1;
                                            $grandtotal_amount -= $item_transaction->nominal;
                                            $grandtotal_qty += 1;
                                        }
                                        else{
                                            $total_amount += $item_transaction->nominal;
                                            $total_qty += 1;
                                            $grandtotal_amount += $item_transaction->nominal;
                                            $grandtotal_qty += 1;
                                        }
                                        @endphp
                                    @endif
                                    
                                    @if($item_transaction->jenis_deposit)
                                    @php
                                        $transactions_checker = true;
                                    @endphp
                                    
                                        |  | {{ formatDate($item_transaction->transaction_date) }} | {{ @$item_transaction->folioDummy->no_bill }}@if($item_transaction->deposit_reservasi) | Pembayaran {{ config('custom.jenis_deposit')[$item_transaction->jenis_deposit].' '.$item_transaction->bank }} A.N. {{ $item_transaction->nama }}@else | Pembayaran Deposit Reservasi A.N. {{ $item_transaction->nama }} {{$item_transaction->description ? ' - '.$item_transaction->description : ''}}@endif | FO | {{ @$item_transaction->jenis_transaksi == 0 ? '' : '-'}}1 | {{ @$item_transaction->jenis_transaksi == 0 ? '' : '-'}}{{ ribuanWithComma($item_transaction->nominal) }} | {{ $item_transaction->created_at ? $item_transaction->created_at->format('H:i:s') : '' }} | {{ @$item_transaction->folioDummy->guestProfile->name }} | 
                                        @php
                                        if (@$item_transaction->jenis_transaksi == 1) {
                                            $total_amount -= $item_transaction->nominal;
                                            $total_qty += 1;
                                            $grandtotal_amount -= $item_transaction->nominal;
                                            $grandtotal_qty += 1;
                                        }elseif(@$item_transaction->jenis_transaksi == 0){
                                            $total_amount += $item_transaction->nominal;
                                            $total_qty -= 1;
                                            $grandtotal_amount += $item_transaction->nominal;
                                            $grandtotal_qty -= 1;
                                        }
                                        @endphp
                                    @endif
                                @endforeach
                                @if ($transactions_checker == true)
                                    
                                        |  |  |  |  | TOTAL | {{$total_qty}} | {{ribuanWithComma($total_amount)}} |  |  | 
                                @endif
                            @endforeach
                            
                            @foreach($pembayaranpos as $transaction)
                                @php
                                $total_qty = 0;
                                $total_amount = 0;
                                $pembayaranpos_checker = false;
                                @endphp
                                @foreach($transaction as $item_transaction)
                                    
                                    @if($item_transaction->jenis_pembayaran_id)
                                    @php
                                        $pembayaranpos_checker = true;
                                    @endphp
                                    
                                        |  | {{ formatDate($item_transaction->transaction_date) }} | {{ @$item_transaction->folioDummy->no_bill }} | Outlet Bill : {{@$item_transaction->cart->order_flag}} | POS | 1 | {{ ribuanWithComma($item_transaction->nominal) }} | {{ $item_transaction->created_at ? $item_transaction->created_at->format('H:i:s') : '' }} | {{ @$item_transaction->folioDummy->guestProfile->name }} | 
                                        @php
                                            $total_amount += $item_transaction->nominal;
                                            $total_qty += 1;
                                            $grandtotal_amount += $item_transaction->nominal;
                                            $grandtotal_qty += 1;
                                        @endphp
                                    @endif
                                @endforeach
                                @if ($pembayaranpos_checker == true)
                                    
                                        |  |  |  |  | TOTAL | {{$total_qty}} | {{ribuanWithComma($total_amount)}} |  |  | 
                                @endif
                            @endforeach
                            
                                |  |  |  |  | Grand Total | {{$grandtotal_qty}} | {{ribuanWithComma($grandtotal_amount)}} |  |  | 
                        @else
                        
                            | NO DATA | 
                        @endif