@php $tanggalCetak = now('Asia/Jakarta'); $customerName = $user->orders->first()->customer_name ?? $user->name; $targetInvoices = ($status_filter === 'all' && isset($invoices_grouped['unpaid'])) ? $invoices_grouped['unpaid'] : $invoices; $totalSubtotal = 0; $totalSeluruhDiskon = 0; $totalSeluruhDP = 0; $totalGrandTagihan = 0; $firstInv = $targetInvoices->first(); $jatuhTempoDefault = ($firstInv && $firstInv->type == 'gps') ? $tanggalCetak->format('d F Y') : $tanggalCetak->copy()->addDays(7)->format('d F Y'); // Logic WhatsApp Gabungan $unitPlates = []; $tempGrandTotal = 0; $tempTotalDP = 0; foreach($targetInvoices as $inv) { $tempGrandTotal += (($inv->amount + ($inv->extra_cost ?? 0)) - ($inv->discount ?? 0) - ($inv->down_payment ?? 0)); $tempTotalDP += ($inv->down_payment ?? 0); if($inv->order->plat_number) $unitPlates[] = $inv->order->plat_number; } $daftarNopol = implode(", ", array_unique($unitPlates)); $labelTotal = ($tempTotalDP > 0) ? 'TOTAL SISA TAGIHAN' : 'TOTAL AKHIR'; $pesanWa = "Halo *" . $customerName . "*,\n\nBerikut rincian tagihan Gabungan *Bams GPS Tracker*:\n"; $pesanWa .= "📌 *No. Nota Master:* " . ($firstInv->no_invoicemaster ?? '-') . "\n"; $pesanWa .= "🚗 *Unit Kendaraan:* " . ($daftarNopol ?: '-') . "\n"; if ($tempTotalDP > 0) { $pesanWa .= "✅ *Total Sudah DP:* Rp " . number_format($tempTotalDP, 0, ',', '.') . "\n"; } $pesanWa .= "🔥 *" . $labelTotal . ":* Rp " . number_format($tempGrandTotal, 0, ',', '.') . "\n\n"; $pesanWa .= "Terima kasih."; $phone = preg_replace('/[^0-9]/', '', $user->orders->first()->customer_phone ?? ''); $urlWa = "https://wa.me/" . $phone . "?text=" . urlencode($pesanWa); @endphp
Kirim WhatsApp
@include('invoices.svg')

Jln. Gunung Agung Barat No. 177A
(Belakang Bengkel Dewa Motor / Bunda Grosir)

Denpasar - Bali

HP: 08113668377

Email: adm.bamsgpstracker01@gmail.com
Invoice

Ditagihkan Kepada:

{{ $customerName }}

{{ $user->orders->first()->customer_address ?? 'Alamat tidak tersedia' }}

Telp: {{ $user->orders->first()->customer_phone ?? '-' }}

Status Pembayaran:

{{ $status_filter == 'paid' ? 'Lunas' : 'Belum Lunas' }} @if($status_filter == 'paid' && $targetInvoices->first() && $targetInvoices->first()->paid_date) ({{ \Carbon\Carbon::parse($targetInvoices->first()->paid_date)->format('d/m/Y') }}) @endif

Informasi Nota:

Tanggal Cetak: {{ $tanggalCetak->format('d F Y') }}

Jatuh Tempo:

No. Nota Master: {{ $firstInv->no_invoicemaster ?? '-' }}

@foreach($targetInvoices as $index => $invoice) @php $subtotalItem = ($invoice->amount + ($invoice->extra_cost ?? 0)); $diskonItem = ($invoice->discount ?? 0); $dpItem = ($invoice->down_payment ?? 0); $netPerUnit = $subtotalItem - $diskonItem - $dpItem; $totalSubtotal += $subtotalItem; $totalSeluruhDiskon += $diskonItem; $totalSeluruhDP += $dpItem; $totalGrandTagihan += $netPerUnit; @endphp @endforeach
# UNIT / KENDARAAN & RINCIAN BIAYA TIPE JUMLAH TAGIHAN
{{ $loop->iteration }} {{-- JUDUL LAYANAN EDITABLE --}} {{ $invoice->order->plat_number ?? '-' }} {{ $invoice->order->stockGps->type_produk ?? 'GPS Tracker' }} | IMEI: ****{{ substr($invoice->order->stockGps->imei ?? '0000', -4) }}
@if($invoice->warranty)🛡️ Garansi: {{ $invoice->warranty }}@endif @if($invoice->description) @endif
Harga: Rp {{ number_format($invoice->amount, 0, ',', '.') }} + Lain: {{ number_format($invoice->extra_cost ?? 0, 0, ',', '.') }} - Potongan: {{ number_format($diskonItem, 0, ',', '.') }} - Sudah DP: {{ number_format($dpItem, 0, ',', '.') }}
{{ $invoice->type }} Rp {{ number_format($netPerUnit, 0, ',', '.') }}
Subtotal Seluruh Unit Rp {{ number_format($totalSubtotal, 0, ',', '.') }}
Total Potongan Diskon - Rp {{ number_format($totalSeluruhDiskon, 0, ',', '.') }}
Total Pembayaran Uang Muka (DP) - Rp {{ number_format($totalSeluruhDP, 0, ',', '.') }}
TOTAL SISA TAGIHAN AKHIR Rp {{ number_format($totalGrandTagihan, 0, ',', '.') }}

Metode Pembayaran (Transfer Bank):

Bank BCA: 6115169975 a/n BAMBANG HERMANTO

Bank BRI: 471601012480536 a/n BAMBANG HERMANTO

Bank BCA (CV): 1462407381 a/n ZARA ZAYA GROUP CV

* Harap kirimkan bukti transfer ke WhatsApp 08113668377 untuk konfirmasi.

Denpasar, {{ $tanggalCetak->format('d F Y') }}

Customer / Penerima,

( {{ $customerName }} )

Denpasar, {{ $tanggalCetak->format('d F Y') }}

Hormat Kami,

Bams GPS Tracker

Terima kasih telah mempercayakan keamanan kendaraan Anda kepada Bams GPS Tracker.