{{ config('settings.company_name') }}
{{ config('settings.address_1') }}
{{ $heading }}
@if ($search_by['from'] && $search_by['to']) From: {{ $transaction->date_format($search_by['from']) }} To: {{ $transaction->date_format($search_by['to']) }} @else {{ 'Upto ' . $transaction->date_format(now()) }} @endif
@if ($type > 0) @foreach ($type as $key => $item) @php $balance = $total_received_per = $total_dues_per = $total_balance_per = $dues_total= $total_cost = $total_received_off = $total_received_un = $total_balance = $total_dues_bf_this = $total_dues_till_month = $total_dues = $total_advance = $total_received_per_all = $total_dues_per_all = $total_balance_per_all = $last_paid= 0; @endphp @if(count($sells[$item->id]) > 0) @if(userAllowedUnofficial() == 1) @endif @if(userAllowedUnofficial() == 1) @else @endif @foreach ($sells[$item->id] as $key => $sell) @if(userAllowedUnofficial() == 1) @endif @php $balance = $sell['total_schedule_amount'] - ($sell['total_paid_official']+$sell['total_paid_un_official']); $total_cost += $sell['total_schedule_amount']; $total_received_off += $sell['total_paid_official']; $total_received_un += $sell['total_paid_un_official']; $total_balance += $balance; @endphp @php $dues_total = $sell['total_till_month_due'] + $sell['total_till_month_due_before_this_period'] ?? 0; $total_dues_bf_this += $sell['total_till_month_due_before_this_period'] ?? 0; $total_dues_till_month += $sell['total_till_month_due']; $total_dues += $dues_total; @endphp @php $total_received_per = ($sell['total_schedule_amount'] == 0) ? 0 : ((($sell['total_paid_off']+$sell['total_paid_un'])/$sell['total_schedule_amount'])*100); $total_dues_per = ($sell['total_schedule_amount'] == 0) ? 0 : ((($dues_total)/$sell['total_schedule_amount'])*100); $total_balance_per = ($sell['total_schedule_amount'] == 0) ? 0 : ((($balance)/$sell['total_schedule_amount'])*100); $total_advance += $sell['total_advance_amount']; @endphp @php if(count($sell['actual_received']) > 0){ end($sell['actual_received']); $last_index = key($sell['actual_received']); } if(count($sell['actual_received_item']) > 0){ end($sell['actual_received_item']); $last_index_items = key($sell['actual_received_item']); } $last_pay_amount = end($sell['actual_received'])['actual_amount'] ?? 0; @endphp @php $last_paid += $last_pay_amount; @endphp @endforeach @if(userAllowedUnofficial() == 1) @endif @php $total_received_per_all = ($total_cost == 0) ? 0 : ((($total_received_off+$total_received_un)/$total_cost)*100); $total_dues_per_all = ($total_cost == 0) ? 0 : (($total_dues/$total_cost)*100); $total_balance_per_all = ($total_cost == 0) ? 0 : (($total_balance/$total_cost)*100); @endphp
{{__('lang.type')}}: {{ $item->name }}
{{__('lang.serial_no')}} {{__('lang.unit')}} # {{__('lang.customer')}} {{__('lang.contact')}} # {{__('lang.booking_date')}} {{__('lang.advance_receiving')}} {{__('lang.total')}} {{__('lang.sale')}}{{__('lang.receiving')}}{{__('lang.total_received')}} {{__('lang.balance')}} {{__('lang.dues')}} % {{__('lang.of')}} {{__('lang.last_pay_date')}} {{__('lang.last_pay')}} {{$transaction->systemSettingCurrency()}}
{{__('lang.off')}} {{__('lang.un')}}{{__('lang.bf_this_period')}} {{__('lang.this_period')}} {{__('lang.total')}} {{__('lang.recvd')}} % {{__('lang.dues_upper')}} % {{__('lang.balance_upper')}} %
{{ $loop->iteration }} {{ $sell['product']['product_unique_id'] }} {{ $sell['customer']['name'] }} {{ $sell['customer']['phone'] }}
{{ $sell['customer']['residential_phone'] }}
{{ $transaction->date_format($sell['sale_date_v2']) }} {{ number_format($sell['total_advance_amount'],2) }} {{ number_format($sell['total_schedule_amount'],2) }}{{ number_format($sell['total_paid_official'],2) }} {{ number_format($sell['total_paid_un_official'],2) }}{{ number_format($sell['total_paid_off'] + $sell['total_paid_un'],2) }} {{ number_format($balance,2) }} {{ isset($sell['total_till_month_due_before_this_period']) ? number_format($sell['total_till_month_due_before_this_period'],2) : 0 }} {{ number_format($sell['total_till_month_due'],2) }}{{ number_format($dues_total, 2) }}{{ number_format($total_received_per,2) }}% {{ number_format($total_dues_per,2) }}% {{ number_format($total_balance_per,2) }}%{{ (count($sell['actual_received']) > 0) ? $transaction->date_format($sell['actual_received'][$last_index]['date_of_collection_new']) : "-" }} {{ number_format($last_pay_amount,2) }}
{{__('lang.total')}} {{ number_format($total_advance,2) }} {{ number_format($total_cost,2) }}{{ number_format($total_received_off,2) }} {{ number_format($total_received_un,2) }}{{ number_format(($total_received_off+$total_received_un),2) }} {{ number_format($total_balance,2) }} {{ number_format($total_dues_bf_this, 2) }} {{ number_format($total_dues_till_month, 2) }} {{ number_format($total_dues,2) }}{{ number_format($total_received_per_all,2) }}% {{ number_format($total_dues_per_all,2) }}% {{ number_format($total_balance_per_all,2) }}% {{ number_format($last_paid,2) }}

@php $total_cost_grand += $total_cost; $total_received_off_grand += $total_received_off; $total_received_un_grand += $total_received_un; $total_received_grand += $total_received_off+$total_received_un; $total_balance_grand += $total_balance; $total_dues_bf_this_grand += $total_dues_bf_this; $total_dues_till_month_grand += $total_dues_till_month; $total_dues_grand += $total_dues; $total_advance_grand += $total_advance; $total_dues_grand += $total_dues; @endphp @endif @endforeach @elseif ($block > 0) @foreach ($block as $key => $item) @php $balance = $total_received_per = $total_dues_per = $total_balance_per = $dues_total= $total_cost = $total_received_off = $total_received_un = $total_balance = $total_dues_bf_this = $total_dues_till_month = $total_dues = $total_advance = $total_received_per_all = $total_dues_per_all = $total_balance_per_all = $last_paid= 0; @endphp @if(count($sells[$item->id]) > 0) @if(userAllowedUnofficial() == 1) @endif @if(userAllowedUnofficial() == 1) @else @endif @foreach ($sells[$item->id] as $key => $sell) @if(userAllowedUnofficial() == 1) @endif @php $balance = $sell['total_schedule_amount'] - ($sell['total_paid_official']+$sell['total_paid_un_official']); $total_cost += $sell['total_schedule_amount']; $total_received_off += $sell['total_paid_official']; $total_received_un += $sell['total_paid_un_official']; $total_balance += $balance; @endphp @php $dues_total = $sell['total_till_month_due'] + $sell['total_till_month_due_before_this_period'] ?? 0; $total_dues_bf_this += $sell['total_till_month_due_before_this_period'] ?? 0; $total_dues_till_month += $sell['total_till_month_due']; $total_dues += $dues_total; @endphp @php $total_received_per = ($sell['total_schedule_amount'] == 0) ? 0 : ((($sell['total_paid_off']+$sell['total_paid_un'])/$sell['total_schedule_amount'])*100); $total_dues_per = ($sell['total_schedule_amount'] == 0) ? 0 : ((($dues_total)/$sell['total_schedule_amount'])*100); $total_balance_per = ($sell['total_schedule_amount'] == 0) ? 0 : ((($balance)/$sell['total_schedule_amount'])*100); $total_advance += $sell['total_advance_amount']; @endphp @php if(count($sell['actual_received']) > 0){ end($sell['actual_received']); $last_index = key($sell['actual_received']); } if(count($sell['actual_received_item']) > 0){ end($sell['actual_received_item']); $last_index_items = key($sell['actual_received_item']); } $last_pay_amount = end($sell['actual_received'])['actual_amount'] ?? 0; @endphp @php $last_paid += $last_pay_amount; @endphp @endforeach @if(userAllowedUnofficial() == 1) @endif @php $total_received_per_all = ($total_cost == 0) ? 0 : ((($total_received_off+$total_received_un)/$total_cost)*100); $total_dues_per_all = ($total_cost == 0) ? 0 : (($total_dues/$total_cost)*100); $total_balance_per_all = ($total_cost == 0) ? 0 : (($total_balance/$total_cost)*100); @endphp
{{__('lang.block')}}: {{ $item->name }}
{{__('lang.serial_no')}} {{__('lang.unit')}} # {{__('lang.customer')}} {{__('lang.contact')}} # {{__('lang.booking_date')}} {{__('lang.advance_receiving')}} {{__('lang.total')}} {{__('lang.sale')}}{{__('lang.receiving')}}{{__('lang.total_received')}} {{__('lang.balance')}} {{__('lang.dues')}} % {{__('lang.of')}} {{__('lang.last_pay_date')}} {{__('lang.last_pay')}} {{$transaction->systemSettingCurrency()}}
{{__('lang.off')}} {{__('lang.un')}}{{__('lang.bf_this_period')}} {{__('lang.this_period')}} {{__('lang.total')}} {{__('lang.recvd')}} % {{__('lang.dues_upper')}} % {{__('lang.balance_upper')}} %
{{ $loop->iteration }} {{ $sell['product']['product_unique_id'] }} {{ $sell['customer']['name'] }} {{ $sell['customer']['phone'] }}
{{ $sell['customer']['residential_phone'] }}
{{ $transaction->date_format($sell['sale_date_v2']) }} {{ number_format($sell['total_advance_amount'],2) }} {{ number_format($sell['total_schedule_amount'],2) }}{{ number_format($sell['total_paid_official'],2) }} {{ number_format($sell['total_paid_un_official'],2) }}{{ number_format($sell['total_paid_off'] + $sell['total_paid_un'],2) }} {{ number_format($balance,2) }} {{ isset($sell['total_till_month_due_before_this_period']) ? number_format($sell['total_till_month_due_before_this_period'],2) : 0 }} {{ number_format($sell['total_till_month_due'],2) }}{{ number_format($dues_total, 2) }}{{ number_format($total_received_per,2) }}% {{ number_format($total_dues_per,2) }}% {{ number_format($total_balance_per,2) }}%{{ (count($sell['actual_received']) > 0) ? $transaction->date_format($sell['actual_received'][$last_index]['date_of_collection_new']) : "-" }} {{ number_format( $last_pay_amount,2) }}
{{__('lang.total')}} {{ number_format($total_advance,2) }} {{ number_format($total_cost,2) }}{{ number_format($total_received_off,2) }} {{ number_format($total_received_un,2) }}{{ number_format(($total_received_off+$total_received_un),2) }} {{ number_format($total_balance,2) }} {{ number_format($total_dues_bf_this, 2) }} {{ number_format($total_dues_till_month, 2) }} {{ number_format($total_dues,2) }}{{ number_format($total_received_per_all,2) }}% {{ number_format($total_dues_per_all,2) }}% {{ number_format($total_balance_per_all,2) }}% {{ number_format($last_paid,2) }}

@php $total_cost_grand += $total_cost; $total_received_off_grand += $total_received_off; $total_received_un_grand += $total_received_un; $total_received_grand += $total_received_off+$total_received_un; $total_balance_grand += $total_balance; $total_dues_bf_this_grand += $total_dues_bf_this; $total_dues_till_month_grand += $total_dues_till_month; $total_dues_grand += $total_dues; $total_advance_grand += $total_advance; $total_dues_grand += $total_dues; @endphp @endif @endforeach @else @foreach ($category as $key => $item) @php $balance = $total_received_per = $total_dues_per = $total_balance_per = $dues_total= $total_cost = $total_received_off = $total_received_un = $total_balance = $total_dues_bf_this = $total_dues_till_month = $total_dues = $total_advance = $total_received_per_all = $total_dues_per_all = $total_balance_per_all = $last_paid = 0; /* echo "
";
        print_r($sells);exit; */
    @endphp

    @if(count($sells[$item->id]) > 0)
        

                    @if(userAllowedUnofficial() == 1)
                        
                    @endif

                    
                    @if(userAllowedUnofficial() == 1)
                        
                    @else
                        
                    @endif
                    

                    @if(userAllowedUnofficial() == 1)
                        
                    @endif

                    
                    @if(userAllowedUnofficial() == 1)
                        
                    @else
                        
                    @endif
                    
                
                
                @foreach ($sells[$item->id] as $key => $sell)
                    


                        @if(userAllowedUnofficial() == 1)
                            
                        @endif

                        

                        @php
                            $balance = $sell['total_schedule_amount'] - ($sell['total_paid_official']+$sell['total_paid_un_official']);

                            $total_cost += $sell['total_schedule_amount'];

                            $total_received_off += $sell['total_paid_official'];
                            $total_received_un += $sell['total_paid_un_official'];

                            $total_balance += $balance;


                        @endphp

                        
                        @php

                            $dues_total = $sell['total_till_month_due'] + $sell['total_till_month_due_before_this_period'] ?? 0;


                            $total_dues_bf_this += $sell['total_till_month_due_before_this_period'] ?? 0;

                            $total_dues_till_month += $sell['total_till_month_due'];

                            $total_dues += $dues_total;



                        @endphp
                        

                        


                        @php

                            $total_received_per = ($sell['total_schedule_amount'] == 0) ? 0 : ((($sell['total_paid_off']+$sell['total_paid_un'])/$sell['total_schedule_amount'])*100);

                            $total_dues_per = ($sell['total_schedule_amount'] == 0) ? 0 : ((($dues_total)/$sell['total_schedule_amount'])*100);
                            $total_balance_per = ($sell['total_schedule_amount'] == 0) ? 0 : ((($balance)/$sell['total_schedule_amount'])*100);



                            $total_advance += $sell['total_advance_amount'];

                        @endphp
                        

                        
                        

                        @php
                            if(count($sell['actual_received']) > 0){
                                end($sell['actual_received']);
                                $last_index = key($sell['actual_received']);
                            }
                            if(count($sell['actual_received_item']) > 0){
                                end($sell['actual_received_item']);
                                $last_index_items = key($sell['actual_received_item']);
                            }
                            $last_pay_amount = end($sell['actual_received'])['actual_amount'] ?? 0;
                        @endphp
                        

                        @php
                            $last_paid += $last_pay_amount;
                        @endphp
                        
                    
                @endforeach
                
            

                    @if(userAllowedUnofficial() == 1)
                        
                    @endif
                    

                    @php

                        $total_received_per_all = ($total_cost == 0) ? 0 : ((($total_received_off+$total_received_un)/$total_cost)*100);
                        $total_dues_per_all = ($total_cost == 0) ? 0 : (($total_dues/$total_cost)*100);
                        $total_balance_per_all = ($total_cost == 0) ? 0 : (($total_balance/$total_cost)*100);
                    @endphp
                    
{{__('lang.category')}}: {{ $item->name }}
{{__('lang.serial_no')}} {{__('lang.unit')}} # {{__('lang.booking_date')}} {{__('lang.customer')}} {{__('lang.total')}} {{__('lang.sale')}}{{__('lang.receiving')}}{{__('lang.total_received')}} {{__('lang.balance')}} {{__('lang.dues')}} {{__('lang.advance_receiving')}} % {{__('lang.of')}} {{__('lang.contact')}} # {{__('lang.last_pay_date')}} {{__('lang.remarks')}}
{{__('lang.off')}} {{__('lang.un')}}{{__('lang.bf_this_period')}} {{__('lang.this_period')}} {{__('lang.total')}} {{__('lang.recvd')}} % {{__('lang.dues_upper')}} % {{__('lang.balance_upper')}} %
{{__('lang.serial_no')}} {{__('lang.unit')}} # {{__('lang.customer')}} {{__('lang.contact')}} # {{__('lang.booking_date')}} {{__('lang.advance_receiving')}} {{__('lang.total')}} {{__('lang.sale')}}{{__('lang.receiving')}}{{__('lang.total_received')}} {{__('lang.balance')}} {{__('lang.dues')}} % {{__('lang.of')}} {{__('lang.last_pay_date')}} {{__('lang.last_pay')}} {{$transaction->systemSettingCurrency()}}
{{__('lang.off')}} {{__('lang.un')}}{{__('lang.bf_this_period')}} {{__('lang.this_period')}} {{__('lang.total')}} {{__('lang.recvd')}} % {{__('lang.dues_upper')}} % {{__('lang.balance_upper')}} %
{{ $loop->iteration }} {{ $sell['product']['product_unique_id'] }} {{ $sell['customer']['name'] }} {{ $sell['customer']['phone'] }}
{{ $sell['customer']['residential_phone'] }}
{{ $transaction->date_format($sell['sale_date_v2']) }} {{ number_format($sell['total_advance_amount'],2) }} {{ number_format($sell['total_schedule_amount'],2) }}{{ number_format($sell['total_paid_official'],2) }} {{ number_format($sell['total_paid_un_official'],2) }}{{ number_format($sell['total_paid_off'] + $sell['total_paid_un'],2) }} {{ number_format($balance,2) }} {{ isset($sell['total_till_month_due_before_this_period']) ? number_format($sell['total_till_month_due_before_this_period'],2) : 0 }} {{ number_format($sell['total_till_month_due'],2) }}{{ number_format($dues_total, 2) }}{{ number_format($total_received_per,2) }}% {{ number_format($total_dues_per,2) }}% {{ number_format($total_balance_per,2) }}%{{ (count($sell['actual_received']) > 0) ? $transaction->date_format($sell['actual_received'][$last_index]['date_of_collection_new']) : "-" }} {{ number_format( $last_pay_amount,2) }}
{{__('lang.total')}} {{ number_format($total_advance,2) }} {{ number_format($total_cost,2) }}{{ number_format($total_received_off,2) }} {{ number_format($total_received_un,2) }}{{ number_format(($total_received_off+$total_received_un),2) }} {{ number_format($total_balance,2) }} {{ number_format($total_dues_bf_this, 2) }} {{ number_format($total_dues_till_month, 2) }} {{ number_format($total_dues,2) }}{{ number_format($total_received_per_all,2) }}% {{ number_format($total_dues_per_all,2) }}% {{ number_format($total_balance_per_all,2) }}% {{ number_format($last_paid,2) }}

@php $total_cost_grand += $total_cost; $total_received_off_grand += $total_received_off; $total_received_un_grand += $total_received_un; $total_received_grand += $total_received_off+$total_received_un; $total_balance_grand += $total_balance; $total_dues_bf_this_grand += $total_dues_bf_this; $total_dues_till_month_grand += $total_dues_till_month; $total_dues_grand += $total_dues; $total_advance_grand += $total_advance; $total_dues_grand += $total_dues; @endphp @endif @endforeach @endif @if(userAllowedUnofficial() == 1) @endif @php $total_received_per_grand = ($total_cost_grand == 0) ? 0 : ((($total_received_grand)/$total_cost_grand)*100); $total_dues_per_grand = ($total_cost_grand == 0) ? 0 : (($total_dues_grand/$total_cost_grand)*100); $total_balance_per_grand = ($total_cost_grand == 0) ? 0 : (($total_balance_grand/$total_cost_grand)*100); @endphp
{{__('lang.grand_total')}}
{{__('lang.total_sale')}} {{ number_format($total_cost_grand,2) }}
{{__('lang.received_off')}} {{ number_format($total_received_off_grand,2) }}
{{__('lang.received_un')}} {{ number_format($total_received_un_grand,2) }}
{{__('lang.total_received')}} @if(userAllowedUnofficial() == 1) OFF/UN @endif {{ number_format($total_received_grand,2) }}
{{__('lang.balance')}} {{ number_format($total_balance_grand,2) }}
{{__('lang.total_bf_this_period')}} {{ number_format($total_dues_bf_this_grand,2) }}
{{__('lang.total_this_period')}} {{ number_format($total_dues_till_month_grand,2) }}
{{__('lang.total_dues')}} {{ number_format($total_dues_grand,2) }}
{{__('lang.total_advance_receiving')}} {{ number_format($total_advance_grand,2) }}
{{__('lang.total_received')}} % {{ number_format($total_received_per_grand,2) }}%
{{__('lang.total_dues')}} % {{ number_format($total_dues_per_grand,2) }}%
{{__('lang.total_balance_lowercase')}} % {{ number_format($total_balance_per_grand,2) }}%