@extends('layouts.print') @section('title', 'طباعة مصروف ' . ($expense->expense_number ?? $expense->id) . ' - '.config('app.name')) @section('company_name', $company?->name ?? config('app.name')) @section('company_tax', ($company && $company->tax_number) ? 'الرقم الضريبي: ' . $company->tax_number : 'الرقم الضريبي: —') @section('company_logo') @if($company && $company->logo_url) @if(str_starts_with($company->logo_url, 'company/')) @else @endif @elseif(file_exists(public_path('images/logo.png'))) @endif @endsection @push('print_styles') @endpush @php $tax = (float) ($expense->tax_amount ?? 0); $grand = (float) $expense->amount + $tax; $posted = ($expense->status ?? '') === 'posted' || $expense->journal_entry_id; $categoryLabel = $expense->expenseCategory?->name_ar ?? ($expense->expenseAccount?->name_ar ?? '—'); $firstImageAtt = ($expense->attachments ?? collect())->sortBy('id')->first(function ($a) { $m = strtolower((string) ($a->file_type ?? '')); return $m !== '' && str_starts_with($m, 'image/'); }); $receiptUrl = ($firstImageAtt && $firstImageAtt->file_path) ? asset('storage/'.ltrim($firstImageAtt->file_path, '/')) : null; @endphp @section('doc_type', 'سند مصروف') @section('document_meta') @if($expense->supplier) @endif @if($expense->reference) @endif @endsection @section('document_table') @if($receiptUrl) @endif @endsection @section('document_footer') @endsection