@extends('layouts.pdf') @section('title') {{ $extra['module_name'] }} @endsection @section('content')
@include('admin.partials.header', ['extra' => $extra]) @foreach ($months as $month) @endforeach @php $total_sale_amount = 0; $total_balance_amount = 0; $total_received_amount = 0; $total_due_amount = 0; $total_last_paid_amount = 0; $total_month_amount = []; @endphp @foreach ($sells as $sell ) @php $schedules = $sell->ScheduleReceivableWithoutDiscount; $till_month_schedules = $sell->all_till_month_due; $last_receipt = $sell->lastActualReceivedByDate(); $last_payment_amount = $last_receipt ? $last_receipt->actualReceivedItem->sum('received_amount') : 0; $last_payment_date = $last_receipt->date_of_collection_new; $sale_amount = $schedules->sum('payable_amount') + $schedules->sum('unofficial_payable_amount'); $received_amount = $schedules->sum('payment_received_amount') + $schedules->sum('unofficial_payment_received_amount'); $balance_amount = $sale_amount - $received_amount; $received_amt_per = $sale_amount ? ($received_amount * 100) / $sale_amount : 0; $till_month_received_amount = $till_month_schedules->sum('payment_received_amount') + $till_month_schedules->sum('unofficial_payment_received_amount'); $till_month_due_amount = $till_month_schedules->sum('payable_amount') - $till_month_received_amount; $total_sale_amount += $sale_amount; $total_balance_amount += $balance_amount; $total_received_amount += $received_amount; $total_due_amount += $till_month_due_amount; $total_last_paid_amount += $last_payment_amount; @endphp @foreach ($months as $month) @php $schedule_receivable_month = $sell->getScheduleReceivableByMonth($month); $month_payable = $schedule_receivable_month->sum('payable_amount') + $schedule_receivable_month->sum('unofficial_payable_amount'); $total_month_amount[$loop->iteration] += $month_payable; @endphp @endforeach @endforeach @foreach ($total_month_amount as $amount) @endforeach
{{__('lang.sno')}} {{__('lang.registration_no')}} {{__('lang.unit_no')}} {{__('lang.dealer')}} {{__('lang.customer')}} {{__('lang.status')}} {{__('lang.sale_date')}} {{__('lang.sale_amount')}} {{__('lang.received')}} {{__('lang.balance')}} {{__('lang.received_percentage')}} {{__('lang.last_payment_date')}} {{__('lang.last_paid_amount')}}{{ date('M-Y', strtotime($month)) }}{{__('lang.till_month_due')}}
{{ $loop->iteration }} {{ $sell->registration_no }} {{ $sell->product->product_unique_id }} {!! $sell->dealers->implode('DealerName.name', ',
') !!}
{{ $sell->customer->name }} {{ $sell->status }} {{ $transaction->date_format($sell->sale_date_v2) }} {{ $transaction->convert_money_format($sale_amount) }} {{ $transaction->convert_money_format($received_amount) }} {{ $transaction->convert_money_format($balance_amount) }} {{ round( $received_amt_per, 2 ) }} {{ $transaction->date_format($last_payment_date) ?? '-' }} {{ $transaction->convert_money_format($last_payment_amount) }}{{ $transaction->convert_money_format($month_payable) }}{{ $transaction->convert_money_format($till_month_due_amount) }}
{{__('lang.total')}} {{ $transaction->convert_money_format($total_sale_amount) }} {{ $transaction->convert_money_format($total_balance_amount) }} {{ $transaction->convert_money_format($total_received_amount) }} {{ $transaction->convert_money_format($total_last_paid_amount) }}{{ $transaction->convert_money_format($amount) }}{{ $transaction->convert_money_format($total_due_amount) }}
@stop