@extends('layouts.app') @section('title', 'Piutang & Invoice (AR)') @section('breadcrumb') Keuangan Piutang (AR) @endsection @section('content')

Piutang & Invoice (AR)

Kelola invoice, pembayaran, dan piutang pelanggan

Buat Invoice
{{-- ===== AGING AR SUMMARY ===== --}}
@php $aging = [ ['label'=>'Belum Jatuh Tempo', 'val'=> $ar['belum_jatuh'] ?? 0, 'color'=>'#1B4FD8','bg'=>'#EEF3FF','icon'=>'bi-clock'], ['label'=>'1 - 30 Hari', 'val'=> $ar['aging_30'] ?? 0, 'color'=>'#059669','bg'=>'#D1FAE5','icon'=>'bi-calendar-check'], ['label'=>'31 - 60 Hari', 'val'=> $ar['aging_60'] ?? 0, 'color'=>'#D97706','bg'=>'#FEF3C7','icon'=>'bi-calendar-event'], ['label'=>'> 60 Hari', 'val'=> $ar['aging_over60'] ?? 0, 'color'=>'#DC2626','bg'=>'#FEE2E2','icon'=>'bi-calendar-x'], ['label'=>'Total Outstanding', 'val'=> $ar['total'] ?? 0, 'color'=>'#0F172A','bg'=>'#F1F5F9','icon'=>'bi-cash-stack'], ]; @endphp @foreach($aging as $s)
{{ $s['label'] }}
Rp {{ number_format($s['val'], 0, ',', '.') }}
@endforeach
{{-- AR Chart --}}
Aging Piutang
Tren Penerimaan (6 Bulan)
{{-- Filter --}}
{{-- Invoice Table --}}
@foreach($invoices as $inv) @php $sisa = $inv->total_invoice - $inv->total_bayar; $isOverdue = $sisa > 0 && $inv->tgl_jatuh_tempo < now()->toDateString(); $statusCls = $sisa <= 0 ? 'pf-status-selesai' : ($isOverdue ? 'pf-status-batal' : ($inv->total_bayar > 0 ? 'pf-status-pending' : 'pf-status-draft')); $statusLbl = $sisa <= 0 ? 'Lunas' : ($isOverdue ? 'Overdue' : ($inv->total_bayar > 0 ? 'Partial' : 'Unpaid')); @endphp @endforeach
No. Invoice Sales Order Pelanggan Tgl Invoice Jatuh Tempo Total Invoice Sudah Dibayar Sisa Tagihan Status Aksi
{{ $inv->no_invoice }} {{ $inv->salesOrder?->no_so ?? '-' }}
{{ $inv->pelanggan->nama ?? '-' }}
{{ $inv->pelanggan->telepon ?? '' }}
{{ $inv->tgl_invoice?->format('d/m/Y') }} {{ $inv->tgl_jatuh_tempo?->format('d/m/Y') }} @if($isOverdue)
{{ now()->diffInDays($inv->tgl_jatuh_tempo) }} hari lalu
@endif
Rp {{ number_format($inv->total_invoice, 0, ',', '.') }} Rp {{ number_format($inv->total_bayar, 0, ',', '.') }} Rp {{ number_format($sisa, 0, ',', '.') }} {{ $statusLbl }}
@if($sisa > 0) @endif
{{-- Modal Catat Pembayaran --}} @endsection @push('scripts') @endpush