@extends('layouts.app') @section('title', 'Invoice ' . $company->name . ' - MCU Klinik Mustika') @section('breadcrumb')

Invoice {{ $company->name }}

@endsection @section('content') @if (session('success')) @endif @if (session('error')) @endif

{{ $company->name }}

Alamat
{{ $company->address ?? '-' }}
Telepon
{{ $company->phone ?? '-' }}
Email
{{ $company->email ?? '-' }}
PIC
{{ $company->pic_name ?? '-' }}
@canRoute ('companies.show') Detail Perusahaan @endcanRoute
Total Invoice

{{ $companyStats['total_invoices'] }}

Invoice perusahaan
Total Nilai

Rp {{ number_format($companyStats['total_amount'], 0, ',', '.') }}

Nilai semua invoice
Belum Lunas

Rp {{ number_format($companyStats['pending_amount'], 0, ',', '.') }}

Invoice draft & terkirim
Jatuh Tempo

{{ $companyStats['overdue_count'] }}

Invoice jatuh tempo
@canRoute ('invoices.index') Kembali ke Daftar Invoice @endcanRoute
@canRoute ('invoices.company')
@canRoute ('invoices.company') @endcanRoute
@endcanRoute
Invoice Per Booking MCU
@foreach ($perBookingInvoices as $index => $invoice) @endforeach
No. No. Invoice Tanggal MCU Jumlah Pasien Total Amount Status Jatuh Tempo Aksi
{{ $perBookingInvoices->firstItem() + $index }}
{{ $invoice->invoice_number }} {{ \App\Helpers\DateHelper::formatShort( $invoice->invoice_date, ) }}
@if ($invoice->corporate_invitation_id) {{ \App\Helpers\DateHelper::formatShort( $invoice->corporateInvitation->mcu_date, ) }} Corporate MCU @else {{ \App\Helpers\DateHelper::formatShort($invoice->period_start) }} - {{ \App\Helpers\DateHelper::formatShort($invoice->period_end) }} Periode @endif
{{ $invoice->total_patients }} pasien {{ $invoice->formatted_total_amount }}
{{ $invoice->status_text }} @if ($invoice->status === 'draft' && !$invoice->needs_regeneration) @canRoute ('invoices.mark-sent')
@csrf
@endcanRoute @elseif ($invoice->status === 'draft' && $invoice->needs_regeneration) Perlu Regenerate @elseif ($invoice->status === 'sent') @canRoute ('invoices.mark-paid')
@csrf @method ('PATCH')
@endcanRoute @endif
{{ \App\Helpers\DateHelper::formatShort( $invoice->due_date, ) }} @if ($invoice->due_date < now() && $invoice->status !== 'paid') @php $diff = $invoice->due_date->diff(now()); $daysLate = (int) $diff->days; $hoursLate = (int) $diff->h; $minutesLate = (int) $diff->i; if ($daysLate >= 1) { $lateText = 'Terlambat ' . $daysLate . ' hari'; if ($hoursLate > 0) { $lateText .= ' ' . $hoursLate . ' jam'; } } elseif ($hoursLate >= 1) { $lateText = 'Terlambat ' . $hoursLate . ' jam'; if ($minutesLate > 0) { $lateText .= ' ' . $minutesLate . ' menit'; } } else { $lateText = 'Terlambat ' . $minutesLate . ' menit'; } @endphp {{ $lateText }} @endif
@canRoute ('invoices.show') @endcanRoute @canRoute ('invoices.pdf') @endcanRoute @if ($company->pic_phone) @canRoute ('invoices.whatsapp') @endcanRoute @endif @if ($invoice->status === 'draft') @if (app(\App\Services\RoleAccess::class)->allows(auth()->user(), 'invoices.edit-packages')) @canRoute ('invoices.edit-packages') @endcanRoute @endif @canRoute ('invoices.edit') @endcanRoute @endif
Invoice Rekap
@foreach ($summaryInvoices as $index => $invoice) @endforeach
No. No. Invoice Periode Jumlah Pasien Total Amount Status Jatuh Tempo Aksi
{{ $summaryInvoices->firstItem() + $index }}
{{ $invoice->invoice_number }} {{ \App\Helpers\DateHelper::formatShort( $invoice->invoice_date, ) }}
{{ \App\Helpers\DateHelper::formatShort($invoice->period_start) }} - {{ \App\Helpers\DateHelper::formatShort($invoice->period_end) }} Periode Rekap
{{ $invoice->total_patients }} pasien {{ $invoice->formatted_total_amount }}
{{ $invoice->status_text }} @if ($invoice->needs_regeneration && $invoice->status !== 'paid') Perlu Regenerate @endif @if ($invoice->status === 'draft' && !$invoice->needs_regeneration) @canRoute ('invoices.mark-sent')
@csrf
@endcanRoute @elseif ($invoice->status === 'sent') @canRoute ('invoices.mark-paid')
@csrf @method ('PATCH')
@endcanRoute @endif
{{ \App\Helpers\DateHelper::formatShort( $invoice->due_date, ) }} @if ($invoice->due_date < now() && $invoice->status !== 'paid') @php $diff = $invoice->due_date->diff(now()); $daysLate = (int) $diff->days; $hoursLate = (int) $diff->h; $minutesLate = (int) $diff->i; if ($daysLate >= 1) { $lateText = 'Terlambat ' . $daysLate . ' hari'; if ($hoursLate > 0) { $lateText .= ' ' . $hoursLate . ' jam'; } } elseif ($hoursLate >= 1) { $lateText = 'Terlambat ' . $hoursLate . ' jam'; if ($minutesLate > 0) { $lateText .= ' ' . $minutesLate . ' menit'; } } else { $lateText = 'Terlambat ' . $minutesLate . ' menit'; } @endphp {{ $lateText }} @endif
@canRoute ('invoices.show') @endcanRoute @canRoute ('invoices.pdf') @endcanRoute @if ($company->pic_phone) @canRoute ('invoices.whatsapp') @endcanRoute @endif @if ($invoice->status === 'draft') @if (app(\App\Services\RoleAccess::class)->allows(auth()->user(), 'invoices.edit-packages')) @canRoute ('invoices.edit-packages') @endcanRoute @endif @canRoute ('invoices.edit') @endcanRoute @endif
@if (isset($letterInvoices) && $letterInvoices->isNotEmpty())
Invoice Surat
@foreach ($letterInvoices as $index => $item) @php /** @var \App\Models\Invoice $baseInvoice */ $baseInvoice = $item['invoice']; $data = $item['data']; $type = $item['type']; $letterTitle = $type === 'health' ? 'Surat Keterangan Sehat' : 'Surat Pemeriksaan Narkoba'; @endphp @endforeach
No. No. Invoice Jenis Surat Periode Jumlah Pasien Total Amount Status Jatuh Tempo Aksi
{{ $index + 1 }}
{{ $data['invoice_number'] }} Invoice Rekap: {{ $baseInvoice->invoice_number }}
{{ $letterTitle }}
{{ \App\Helpers\DateHelper::formatShort($data['period_start']) }} - {{ \App\Helpers\DateHelper::formatShort($data['period_end']) }} Periode Invoice
{{ $data['count'] }} pasien {{ 'Rp ' . number_format($data['total_amount'], 0, ',', '.') }} @php $letterStatusField = $type === 'health' ? 'health_letter_status' : 'drug_letter_status'; $letterStatus = $baseInvoice->{$letterStatusField} ?? 'draft'; $letterStatusText = [ 'draft' => 'Draft', 'sent' => 'Terkirim', 'paid' => 'Lunas', 'overdue' => 'Jatuh Tempo', ][$letterStatus] ?? 'Draft'; $letterStatusBadgeClass = [ 'draft' => 'bg-secondary', 'sent' => 'bg-warning', 'paid' => 'bg-success', 'overdue' => 'bg-danger', ][$letterStatus] ?? 'bg-secondary'; $letterStatusTextColor = [ 'draft' => 'secondary', 'sent' => 'warning', 'paid' => 'success', 'overdue' => 'danger', ][$letterStatus] ?? 'secondary'; @endphp
{{ $letterStatusText }} @if ($letterStatus === 'draft') @canRoute ('invoices.letter.mark-sent')
@csrf
@endcanRoute @elseif ($letterStatus === 'sent') @canRoute ('invoices.letter.mark-paid')
@csrf @method ('PATCH')
@endcanRoute @endif
{{ \App\Helpers\DateHelper::formatShort( $baseInvoice->due_date, ) }} @if ($baseInvoice->due_date < now() && $baseInvoice->status !== 'paid') @php $diff = $baseInvoice->due_date->diff(now()); $daysLate = (int) $diff->days; $hoursLate = (int) $diff->h; $minutesLate = (int) $diff->i; if ($daysLate >= 1) { $lateText = 'Terlambat ' . $daysLate . ' hari'; if ($hoursLate > 0) { $lateText .= ' ' . $hoursLate . ' jam'; } } elseif ($hoursLate >= 1) { $lateText = 'Terlambat ' . $hoursLate . ' jam'; if ($minutesLate > 0) { $lateText .= ' ' . $minutesLate . ' menit'; } } else { $lateText = 'Terlambat ' . $minutesLate . ' menit'; } @endphp {{ $lateText }} @endif
@canRoute ('invoices.show-letter') @endcanRoute @if ($company->pic_phone) @canRoute ('invoices.whatsapp') @endcanRoute @endif @if ($baseInvoice->status !== 'paid') @canRoute ('invoices.edit') @endcanRoute @endif
@endif @endsection @push('styles') @endpush @push('scripts') @endpush