@extends('layouts.app') @section('title','التحصيل الشهري') @section('content') @php $monthNames=[1=>'يناير',2=>'فبراير',3=>'مارس',4=>'أبريل',5=>'مايو',6=>'يونيو',7=>'يوليو',8=>'أغسطس',9=>'سبتمبر',10=>'أكتوبر',11=>'نوفمبر',12=>'ديسمبر']; $columns=$period ? $period->accounts->flatMap->lines->unique('charge_definition_id')->values() : collect(); $paidCount=$period?->accounts->where('payment_status','paid')->count()??0; $totalCount=$period?->accounts->count()??0; $totalDue=$period?->accounts->sum('total_due')??0; $totalPaid=$period?->accounts->where('payment_status','paid')->sum('total_due')??0; $receiptCount=$period?->accounts->flatMap->receipts->where('status','active')->count()??0; @endphp
المحاسبة الشهرية

التحصيل الشهري

عدّل الرسوم وسجّل السداد واطبع الإيصالات من شاشة واحدة.

@if($period && $receiptCount)
طباعة ورقة A4PDF كل الإيصالات
@endif
@if(!$period)

لم يتم إنشاء حساب {{ $monthNames[$month] }} {{ $year }}

سينسخ النظام الرسوم المتكررة من الشهر السابق ويطبق زيادات الإيجار المستحقة.

@csrf
@else
إجمالي المستحق{{ number_format($totalDue,2) }}جنيه مصري
المحصل{{ number_format($totalPaid,2) }}{{ $paidCount }} من {{ $totalCount }} وحدة
غير المحصل{{ number_format($totalDue-$totalPaid,2) }}{{ $totalCount-$paidCount }} وحدة
حالة الشهر{{ $period->status==='draft'?'مسودة قابلة للتعديل':'تم اعتماد الرسوم' }}{{ $building->name }} — {{ $monthNames[$month] }} {{ $year }}
@if($period->status==='draft')
@csrf
@else
@csrf
@endif

المصروفات المشتركة

@if($period->status==='draft')
@csrf
@endif @foreach($period->sharedCharges as $shared)
{{ (float)$shared->difference!==0.0?'!':'✓' }}
{{ $shared->chargeDefinition?->name }} — الإجمالي {{ number_format($shared->total_amount,2) }}، الحصة القياسية {{ number_format($shared->standard_allocation,2) }}، الموزع {{ number_format($shared->distributed_total,2) }}، الفرق {{ number_format($shared->difference,2) }}.
@if($period->status==='draft')
@csrf @method('put')
@endif
@endforeach

حسابات الشقق

@foreach($columns as $column)@endforeach @forelse($period->accounts as $account) @foreach($columns as $column) @php $line=$account->lines->firstWhere('charge_definition_id',$column->charge_definition_id); @endphp @endforeach @empty@endforelse
الشقةالمسؤول{{ $column->name_snapshot }}الإجماليالحالةالإجراء
{{ $account->apartment_number }}{{ $account->payer_name ?: '—' }}@if($line)status!=='draft')>@else@endif{{ number_format($account->total_due,2) }} {{ $account->payment_status==='paid'?'مدفوع':'غير مدفوع' }} @if($account->payment_status==='unpaid')
@if($period->status==='draft')
@csrf @method('put')
@endif
@csrf
@else @php $activeReceipt=$account->receipts->firstWhere('status','active'); @endphp
@if($activeReceipt)الإيصال {{ $activeReceipt->number }}@endif
@csrf @method('delete')
@endif
لا توجد شقق نشطة لهذا الشهر.
@endif @endsection