@php $en = ($lang ?? 'tr') === 'en'; $accent = $branding->primary_color ?: '#4F46E5'; $officeName = $branding->office_name ?: $tenant->name; $t = fn ($tr, $enText) => $en ? $enText : $tr; $fmt = function ($amount) use ($statement) { $symbols = ['TRY' => '₺', 'USD' => '$', 'EUR' => '€', 'GBP' => '£']; $symbol = $symbols[$statement->currency] ?? $statement->currency; return $symbol . number_format((float) $amount, 2, ',', '.'); }; $dur = function ($minutes) use ($en) { $h = intdiv($minutes, 60); $m = $minutes % 60; if ($h === 0) return $m . ($en ? 'm' : 'dk'); if ($m === 0) return $h . ($en ? 'h' : 'sa'); return $h . ($en ? 'h ' : 'sa ') . $m . ($en ? 'm' : 'dk'); }; @endphp @php // Kalemler dosyaya göre gruplanır; dönem ve toplam süre üst blokta yazılır. $groups = $statement->items->groupBy(fn ($i) => $i->timelog?->case_id ?? 0); $dates = $statement->items->map(fn ($i) => $i->timelog?->date)->filter()->sort()->values(); $totalMinutes = (int) $statement->items->sum('quantity_minutes'); @endphp
@if ($logoData)
@endif
{{ $officeName }}
@if ($branding->address)
{!! nl2br(e($branding->address)) !!}
@endif @if ($branding->phone)
{{ $branding->phone }}
@endif @if ($branding->email)
{{ $branding->email }}
@endif @if ($branding->website)
{{ $branding->website }}
@endif
{{ $t('HİZMET DÖKÜMÜ', 'STATEMENT OF SERVICES') }}
{{ $t('Belge No', 'Reference') }}: {{ $statement->statement_no }}
{{ $t('Tarih', 'Date') }}: {{ $statement->issue_date->format('d.m.Y') }}
@if ($statement->due_date)
{{ $t('Son Ödeme', 'Due Date') }}: {{ $statement->due_date->format('d.m.Y') }}
@endif @if ($dates->isNotEmpty())
{{ $t('Dönem', 'Period') }}: {{ $dates->first()->format('d.m.Y') }}@if ($dates->last()->ne($dates->first())) – {{ $dates->last()->format('d.m.Y') }}@endif
@endif @if ($totalMinutes > 0)
{{ $t('Toplam süre', 'Total time') }}: {{ $dur($totalMinutes) }}
@endif
{{ $t('Müvekkil', 'Client') }}
{{ $statement->client->name }}
@if ($statement->client->address)
{!! nl2br(e($statement->client->address)) !!}
@endif @if ($statement->client->identity_no)
{{ $statement->client->type === 'corporate' ? $t('Vergi No', 'Tax ID') : $t('TC Kimlik No', 'National ID') }}: {{ $statement->client->identity_no }}
@endif @foreach ($groups as $caseId => $items) @php $case = $items->first()->timelog?->case; @endphp @foreach ($items as $item) @endforeach @if ($groups->count() > 1) @endif @endforeach
{{ $t('Açıklama', 'Description') }} {{ $t('Süre', 'Time') }} {{ $t('Birim Ücret', 'Rate') }} {{ $t('Tutar', 'Amount') }}
{{ $case?->title ?? $t('Dosya dışı', 'Not case related') }} @if ($case?->case_no)· {{ $case->case_no }}@endif
{{ $en ? ($item->description_en ?: $item->description) : $item->description }} @if ($item->covered_minutes > 0)
{{ $dur($item->covered_minutes) }} {{ $t('ön ödemeli kota kapsamında', 'covered by prepaid retainer') }}
@endif @if ($item->is_waived)
{{ $t('Ücretlendirilmedi', 'Not charged') }}
@endif
{{ $item->quantity_minutes > 0 ? $dur($item->quantity_minutes) : '—' }} {{ $item->kind === 'time' && $item->unit_rate > 0 ? $fmt($item->unit_rate) : '—' }} {{ $fmt($item->line_total) }}
{{ $t('Dosya toplamı', 'Case subtotal') }} {{ $dur($items->sum('quantity_minutes')) }} {{ $fmt($items->sum('line_total')) }}
@if ((float) $statement->discount_amount > 0) @endif @php $paid = $statement->paidAmount(); @endphp @if ($paid > 0) {{-- Kısmi tahsilatta müvekkil kalan bakiyeyi belgede görsün. --}} @endif
{{ $t('Ara Toplam', 'Subtotal') }} {{ $fmt($statement->subtotal) }}
{{ $t('İskonto', 'Discount') }} @if ($statement->discount_type === 'percent') @php // Yüzde işareti Türkçede önce (%10), İngilizcede sonra (10%) yazılır. $pct = rtrim(rtrim(number_format((float) $statement->discount_value, 2, ',', '.'), '0'), ','); @endphp ({{ $en ? $pct.'%' : '%'.$pct }}) @endif -{{ $fmt($statement->discount_amount) }}
{{ $t('Genel Toplam', 'Total') }} {{ $fmt($statement->total) }}
{{ $t('Tahsil Edilen', 'Amount Paid') }} -{{ $fmt($paid) }}
{{ $t('Kalan Bakiye', 'Balance Due') }} {{ $fmt($statement->remainingAmount()) }}
@if ($statement->payments->isNotEmpty()) @php $methodLabels = [ 'transfer' => ['Havale/EFT', 'Bank transfer'], 'cash' => ['Nakit', 'Cash'], 'card' => ['Kredi kartı', 'Credit card'], 'check' => ['Çek', 'Check'], 'other' => ['Diğer', 'Other'], ]; @endphp
{{ $t('Tahsilatlar', 'Payments Received') }}
@foreach ($statement->payments->sortBy('paid_at') as $payment) {{ $payment->paid_at->format('d.m.Y') }} — {{ $fmt($payment->amount) }} ({{ $t($methodLabels[$payment->method][0], $methodLabels[$payment->method][1]) }}@if ($payment->reference), {{ $payment->reference }}@endif)
@endforeach
@endif @if ($statement->notes)
{{ $t('Not', 'Notes') }}
{!! nl2br(e($statement->notes)) !!}
@endif