KLINIK MUSTIKA SANGSAKA KALIORANG
Jl. Ery Soeparjan, Desa Bukit Makmur, Kec. Kaliorang, Kab. Kutai Timur 75617, Kalimantan Timur
Telpon: 08575168765 | Email: mustikasangsakaklinik@gmail.com
{{--
Hasil Medical Check Up
--}}
INVOICE
{{-- @if($invoice->status === 'overdue' || ($invoice->due_date < now() && $invoice->status !== 'paid'))
⚠️ INVOICE JATUH TEMPO - Pembayaran Terlambat {{ $invoice->due_date->diffInDays(now()) }} Hari
@endif --}}

Kepada:

Perusahaan: {{ $invoice->company->name }}
@if ($invoice->company->address)
Alamat: {{ $invoice->company->address }}
@endif @if ($invoice->company->phone)
Telepon: {{ $invoice->company->phone }}
@endif @if ($invoice->company->email)
Email: {{ $invoice->company->email }}
@endif

Detail Invoice:

No. Invoice: {{ $invoice->invoice_number }}
Tanggal Invoice: {{ \App\Helpers\DateHelper::formatDate( $invoice->invoice_date, ) }}
Jatuh Tempo: {{ \App\Helpers\DateHelper::formatDate( $invoice->due_date, ) }}
@if ($invoice->corporate_invitation_id) Tanggal MCU: @else Periode: @endif @if ($invoice->corporate_invitation_id) {{ \App\Helpers\DateHelper::formatShort( $invoice->corporateInvitation->mcu_date, ) }} @else {{ \App\Helpers\DateHelper::formatShort( $invoice->period_start, ) }} - {{ \App\Helpers\DateHelper::formatShort( $invoice->period_end, ) }} @endif
@php // Group items by date, package name, and package price // Gunakan nama paket dari appointment jika tersedia, jika tidak gunakan dari invoice item // Ini penting karena bisa ada paket dengan nama sama tapi harga berbeda // atau paket berbeda dengan harga sama $groupedItems = $invoice->items ->where('excluded_from_invoice', false) ->groupBy(function ($item) { $packageName = $item->appointment && $item->appointment->mcuPackage ? $item->appointment->mcuPackage->name : $item->mcu_package_name; return $item->mcu_date->format('Y-m-d') . '|' . $packageName . '|' . $item->package_price; }) ->map(function ($items, $key) { $parts = explode('|', $key); $firstItem = $items->first(); $packageName = $firstItem->appointment && $firstItem->appointment->mcuPackage ? $firstItem->appointment->mcuPackage->name : $parts[1]; return [ 'date' => $parts[0], 'package_name' => $packageName, 'package_price' => floatval($parts[2]), 'items' => $items, 'total_price' => $items->sum('total_amount'), 'employee_count' => $items->count(), ]; }) ->groupBy('date'); $globalRowNumber = 1; @endphp @foreach ($groupedItems as $date => $packages) @php $dateFormatted = \App\Helpers\DateHelper::formatShort(\Carbon\Carbon::parse($date)); $totalDatePrice = $packages->sum('total_price'); $totalDateEmployees = $packages->sum('employee_count'); @endphp
Tanggal MCU: {{ $dateFormatted }} {{ $totalDateEmployees }} karyawan Total: Rp {{ number_format($totalDatePrice, 0, ',', '.') }}
@foreach ($packages as $package)
{{ $package['employee_count'] }} orang {{ $package['package_name'] }} Harga: Rp {{ number_format($package['package_price'], 0, ',', '.') }} Rp {{ number_format($package['total_price'], 0, ',', '.') }}
@foreach ($package['items'] as $item) @php // Ambil nama paket dari appointment jika tersedia $displayPackageName = $item->appointment && $item->appointment->mcuPackage ? $item->appointment->mcuPackage->name : $item->mcu_package_name; @endphp @endforeach
No Nama Pasien NIK Jenis Kelamin No. Rekam Medis Harga
{{ $globalRowNumber++ }} {{ mb_strtoupper($item->display_patient_name) }} {{ $item->patient_nik ?? '-' }} @if ($item->patient_gender === 'female') Perempuan @else Laki-laki @endif {{ $item->medical_record_number ?? '-' }} Rp {{ number_format($item->package_price, 0, ',', '.') }}
Subtotal Paket: Rp {{ number_format($package['total_price'], 0, ',', '.') }}
@endforeach
@endforeach
Jumlah Pasien: {{ $invoice->total_patients }} orang
Subtotal: Rp {{ number_format($invoice->total_amount, 0, ',', '.') }}
{{--
Pajak (0%): Rp 0
Diskon (0%): Rp 0
--}}
TOTAL: Rp {{ number_format($invoice->total_amount, 0, ',', '.') }}
@if ($invoice->notes)

Catatan:

{{ $invoice->notes }}

@endif

Mengetahui,

Direktur

@php $signaturePath = public_path('assets/images/ttd/dr.said.jpg'); $signatureImageData = null; if (file_exists($signaturePath)) { try { $signatureImageData = base64_encode(file_get_contents($signaturePath)); } catch (Exception $e) { $signatureImageData = null; } } @endphp @if ($signatureImageData) Tanda Tangan dr. Said @endif
dr. Said. M. Bin. Smith. MAP
Direktur

Informasi Pembayaran:

Bank: Bank BNI Cabang Bontang
No. Rekening: 0461060204
Atas Nama: Mustika Sangsaka Medika

Catatan: Mohon transfer sesuai dengan nominal yang tertera dan sertakan nomor invoice pada keterangan transfer.