Date of Booking: {{ $plotAssignment->created_at->format('d M Y') }}
Plot Price:
Rs. {{ number_format($plot->base_plot_price, 0, '.', ',') }}/- ({{ $plot->plotSize->size ?? 'N/A' }})
Discount:
Rs. {{ number_format($plot->discount, 0, '.', ',') }}/-
Total Cost:
Rs. {{ number_format($plotAssignment->total_price, 0, '.', ',') }}/-
@if($plot->down_payment > 0)
Booking ({{ $plotAssignment->created_at->format('d/m/Y') }})
{{ number_format($plot->down_payment, 0, '.', ',') }}
{{ number_format($plot->down_payment, 0, '.', ',') }}
@endif
@php
$possessionFeeRecord = \App\Models\Charge::where('charge_type','Possession Fee')->first();
if($possessionFeeRecord){
$possessionFee = \App\Models\PlotCharge::select('amount')->where([
'plot_id' => $plot->id,
'charge_id' => $possessionFeeRecord->id,
])->first();
}else{
$possessionFee['amount'] = 0;
}
@endphp
Possession Fee
{{ number_format($possessionFee['amount'] ?? 0, 0, '.', ',') }}
{{ number_format($possessionFee['amount'] ?? 0, 0, '.', ',') }}
@php
use Carbon\Carbon;
// Fetch Plot Installments (unpaid)
$plotInstallmentsByYear = $plotAssignment->plotInstallments
->where('is_paid', false)
->groupBy(function ($installment) {
try {
return Carbon::createFromFormat('d-m-Y', $installment->due_date)->year;
} catch (\Exception $e) {
return 'Unknown';
}
});
// Fetch Development Charge Installments (unpaid)
$developmentChargeInstallments = \App\Models\ChargeInstallment::whereIn('plot_charge_id', function ($query) use ($plot) {
$query->select('id')
->from('plot_charges')
->where('plot_id', $plot->id)
->whereIn('charge_id', function ($subQuery) {
$subQuery->select('id')
->from('charges')
->where('charge_type', 'Development Fee');
});
})
->where('is_paid', false)
->get()
->groupBy(function ($chargeInstallment) {
try {
return Carbon::createFromFormat('d-m-Y', $chargeInstallment->due_date)->year;
} catch (\Exception $e) {
return 'Unknown';
}
});
// Remove 'Unknown' groups if they exist
if (isset($plotInstallmentsByYear['Unknown'])) {
unset($plotInstallmentsByYear['Unknown']);
}
if (isset($developmentChargeInstallments['Unknown'])) {
unset($developmentChargeInstallments['Unknown']);
}
// Get all unique years from both Plot and Development Charge Installments
$years = array_unique(
array_merge(
array_keys($plotInstallmentsByYear->toArray()),
array_keys($developmentChargeInstallments->toArray())
)
);
sort($years); // Sort years in ascending order
$grandTotal = $plotAssignment->total_price;
@endphp
@forelse($years as $year)
@php
$plotInstallments = $plotInstallmentsByYear[$year] ?? collect([]);
$devInstallments = $developmentChargeInstallments[$year] ?? collect([]);
// Combine installments by due_date for parallel display
$combinedInstallments = [];
$plotInstallmentDates = $plotInstallments->pluck('due_date')->unique()->toArray();
$devInstallmentDates = $devInstallments->pluck('due_date')->unique()->toArray();
$allDates = array_unique(array_merge($plotInstallmentDates, $devInstallmentDates));
sort($allDates); // Sort dates for chronological order
foreach ($allDates as $date) {
$combinedInstallments[] = [
'due_date' => $date,
'plot_amount' => $plotInstallments->where('due_date', $date)->sum('amount'),
'dev_amount' => $devInstallments->where('due_date', $date)->sum('amount'),
];
}
@endphp
Date Of Payment
Development Installment
Plot Installment
Total
@forelse($combinedInstallments as $installment)
{{ Carbon::createFromFormat('d-m-Y', $installment['due_date'])->format('d/m/Y') }}
{{ $installment['dev_amount'] > 0 ? number_format($installment['dev_amount'], 0, '.', ',') : '' }}
{{ $installment['plot_amount'] > 0 ? number_format($installment['plot_amount'], 0, '.', ',') : '' }}
{{ number_format($installment['plot_amount'] + $installment['dev_amount'], 0, '.', ',') }}
@empty
NO RECORDS
@endforelse
{{ $year }} Total Installment
{{ number_format($devInstallments->sum('amount'), 0, '.', ',') }}
{{ number_format($plotInstallments->sum('amount'), 0, '.', ',') }}
{{ number_format($plotInstallments->sum('amount') + $devInstallments->sum('amount'), 0, '.', ',') }}
@if(!$loop->last)
{{--
--}}
@endif
@empty
NO RECORD FOUND
@endforelse
{{-- --}}
{{-- Date Of Payment --}}
{{-- Development Installment --}}
{{-- Plot Installment --}}
{{-- Total --}}
{{-- --}}
Grand Total Amount
{{ number_format($developmentChargeInstallments->flatten()->sum('amount'), 0, '.', ',') }}
{{ number_format($plotInstallmentsByYear->flatten()->sum('amount'), 0, '.', ',') }}
{{ number_format($plotInstallmentsByYear->flatten()->sum('amount') + $developmentChargeInstallments->flatten()->sum('amount'), 0, '.', ',') }}
@forelse($plot->preferredCategories as $category)
{{ strtoupper($category->name ?? 'N/A') }}
@empty
NO RECORD FOUND
@endforelse
IMPORTANT NOTES:
* Corner, West Open, Park Facing & Wide Road Charges are 10% Each & 15% For 100' Wide Road
is Charged Separately.
* All Extras will be payable within 180 days from the date of booking.
* Installments Start from the date of booking.
* All Installments must be deposited by 10th of each month.
* Documentation Charges, Lease Charges, Development Charges (Internal & External), Road,
Sewerage, Connection Charges for Gas, Water, Surveyor Charges & Electricity will be charged
separately from Plot Price and must be payable as and when demanded by the company.
* Any discount if given shall only remain if payments are made according to the agreed schedule.
* For booking of plot or any amendment in documents, processing fees is Rs.10,000/- (Non Refundable)
* The Terms & Conditions given above are the essence of this Payment Schedule and buyer
undertakes to abide by the same.
Name: {{ $plotAssignment->customer->name ?? 'N/A' }}
Plot No: {{ $plot->name }}
Type: {{ $plot->plotType->type ?? 'N/A' }}
Block: {{ $plot->block->name ?? 'N/A' }}
No Of Reschedule
Status: {{ optional($plotAssignment->plotInstallmentLogs)->count() }}
Booked By: {{ $plotAssignment->user->name ?? 'N/A' }}
Dealer Name: N/A
Through: -
Read And Understood
CNIC
NO: {{ $plotAssignment->customer->cnic_no ?? 'N/A' }}