@php $customerName = (string) ($transaction->member?->name ?? $transaction->name ?? '-'); $orderType = (string) ($transaction->order_type ?? ''); $paymentMethodKey = (string) ($transaction->payment_method ?? ''); $paymentMethodLabel = \App\Helpers\DataLabelHelper::enum($paymentMethodKey !== '' ? $paymentMethodKey : null, 'payment_method'); $paymentStatusKey = (string) ($transaction->payment_status ?? ''); $paymentStatusLabel = \App\Helpers\DataLabelHelper::enum($paymentStatusKey !== '' ? $paymentStatusKey : null, 'payment_status'); $inventoryApplied = $transaction->inventory_applied_at !== null; $user = auth()->user(); $voidQuickMaxCount = (int) ($correctionRules['void_quick_max_count_per_day'] ?? 0); $voidWindowMinutes = (int) ($correctionRules['void_quick_window_minutes'] ?? 0); $voidQuickUsedToday = (int) ($voidQuickUsedToday ?? 0); $refundQuickMaxAmount = (int) ($correctionRules['refund_quick_max_amount'] ?? 0); $refundQuickMaxCount = (int) ($correctionRules['refund_quick_max_count_per_day'] ?? 0); $refundQuickUsedToday = (int) ($refundQuickUsedToday ?? 0); $voidNeedsApproval = (bool) ($voidNeedsApproval ?? false); $refundNeedsApproval = (bool) ($refundNeedsApproval ?? false); $fmtCurrency = fn ($value) => 'Rp'.number_format((float) $value, 0, ',', '.'); $voucherDiscount = (int) ($transaction->voucher_discount_amount ?? 0); $manualDiscount = (int) ($transaction->manual_discount_amount ?? 0); $pointDiscount = (int) ($transaction->point_discount_amount ?? 0); $discountTotal = (int) ($transaction->discount_total_amount ?? ($voucherDiscount + $manualDiscount + $pointDiscount)); $netSubtotal = max(0, (int) ($transaction->subtotal ?? 0) - $discountTotal); $displayItems = $transaction->transactionItems->whereNull('parent_transaction_item_id')->values(); @endphp
Kembali

{{ $transaction->code }}

{{ optional($transaction->created_at)->format('d M Y, H:i') }} · {{ $paymentMethodLabel }} · {{ $paymentStatusLabel }}

@can('transactions.print') @endcan @if ($paymentStatusKey === 'pending') @can('transactions.void') @endcan @endif @if (in_array($paymentStatusKey, ['paid', 'partial_refund'], true)) @can('transactions.refund') @endcan @endif

Subtotal

{{ $fmtCurrency((int) $transaction->subtotal) }}

Total Diskon

{{ $discountTotal > 0 ? '-'.$fmtCurrency($discountTotal) : '-' }}

Pajak PB1

{{ $fmtCurrency((int) ($transaction->tax_amount ?? 0)) }}

Total

{{ $fmtCurrency((int) $transaction->total) }}

Ringkasan

Pelanggan
{{ $customerName }}
Tipe Pesanan
{{ $orderType === 'dine_in' ? 'Dine in' : 'Take away' }}
Meja
{{ $transaction->diningTable?->name ?? '-' }}
Metode
{{ $paymentMethodLabel }}
Status
{{ $paymentStatusLabel }}
@if ($discountTotal > 0)
Subtotal Bersih
{{ $fmtCurrency($netSubtotal) }}
@endif
Refund
{{ $fmtCurrency((int) ($transaction->refunded_amount ?? 0)) }}
@if ((int) ($transaction->voucher_discount_amount ?? 0) > 0)
Voucher
{{ (string) ($transaction->voucher_code ?? '-') }}
{{ $transaction->voucherCampaign?->name ?? '-' }} · -{{ $fmtCurrency((int) ($transaction->voucher_discount_amount ?? 0)) }}
@endif @if ((int) ($transaction->manual_discount_amount ?? 0) > 0)
Diskon Manual
-{{ $fmtCurrency((int) ($transaction->manual_discount_amount ?? 0)) }}
@if ($transaction->manual_discount_type && $transaction->manual_discount_value) {{ $transaction->manual_discount_type === 'percent' ? ($transaction->manual_discount_value.'%') : ('Rp'.number_format((int) $transaction->manual_discount_value, 0, ',', '.')) }} @endif @if ($transaction->manual_discount_note) · {{ $transaction->manual_discount_note }} @endif
@if ($transaction->manualDiscountByUser)
Oleh: {{ $transaction->manualDiscountByUser->name }}
@endif
@endif @if ((int) ($transaction->point_discount_amount ?? 0) > 0 || (int) ($transaction->points_redeemed ?? 0) > 0 || (int) ($transaction->points_earned ?? 0) > 0)
Poin
@if ((int) ($transaction->point_discount_amount ?? 0) > 0)
-{{ $fmtCurrency((int) ($transaction->point_discount_amount ?? 0)) }}
@endif @if ((int) ($transaction->points_redeemed ?? 0) > 0)
Dipakai: {{ number_format((int) ($transaction->points_redeemed ?? 0), 0, ',', '.') }}
@endif @if ((int) ($transaction->points_earned ?? 0) > 0)
Didapat: {{ number_format((int) ($transaction->points_earned ?? 0), 0, ',', '.') }}
@endif
@endif
Inventory
{{ $inventoryApplied ? 'Applied' : 'Pending' }}
Cash diterima
{{ $fmtCurrency((int) ($transaction->cash_received ?? 0)) }}
Kembalian
{{ $fmtCurrency((int) ($transaction->cash_change ?? 0)) }}
External ID
@can('transactions.pii.view') {{ $transaction->external_id }} @else - @endcan
@if (! $inventoryApplied) @can('inventory.manage') @endcan @endif

Item Transaksi

@foreach ($displayItems as $item) @php $hppTotal = (float) ($item->hpp_total ?? 0); $voucherItemDiscount = (int) ($item->voucher_discount_amount ?? 0); $manualItemDiscount = (int) ($item->manual_discount_amount ?? 0); $netLineSubtotal = (float) $item->subtotal - $voucherItemDiscount - $manualItemDiscount; $profit = $netLineSubtotal - $hppTotal; $inventoryApplied = $transaction->inventory_applied_at !== null; $children = $transaction->transactionItems->where('parent_transaction_item_id', (int) $item->id)->values(); $variantDisplay = \App\Support\Products\ItemNameFormatter::displayVariantName((int) $item->product_id, $item->variant?->name); @endphp @endforeach
Produk Varian Qty Harga Subtotal HPP Laba

{{ $item->product?->name ?? '-' }}

@if ($item->note)

{{ $item->note }}

@endif @if ($children->isNotEmpty())
@foreach ($children as $child) @php $childVariant = \App\Support\Products\ItemNameFormatter::displayVariantName((int) $child->product_id, $child->variant?->name); @endphp

• {{ (string) ($child->product?->name ?? 'Produk') }}{{ $childVariant !== '' ? ' - '.$childVariant : '' }} x{{ number_format((int) ($child->quantity ?? 0), 0, ',', '.') }}

@endforeach
@endif

{{ $variantDisplay !== '' ? $variantDisplay : '-' }}

{{ number_format((int) $item->quantity, 0, ',', '.') }}

{{ $fmtCurrency((float) $item->price) }}

{{ $fmtCurrency((float) $item->subtotal) }}

@if ($voucherItemDiscount > 0 || $manualItemDiscount > 0)

Diskon: @if ($voucherItemDiscount > 0) Voucher {{ $fmtCurrency($voucherItemDiscount) }} @endif @if ($manualItemDiscount > 0) {{ $voucherItemDiscount > 0 ? '·' : '' }} Manual {{ $fmtCurrency($manualItemDiscount) }} @endif

Net: {{ $fmtCurrency($netLineSubtotal) }}

@endif

{{ $inventoryApplied ? $fmtCurrency($hppTotal) : '-' }}

{{ $inventoryApplied ? $fmtCurrency($profit) : '-' }}

@php $totalHpp = (float) $displayItems->sum('hpp_total'); $totalProfit = (float) $netSubtotal - $totalHpp; $inventoryApplied = $transaction->inventory_applied_at !== null; $feeAmount = (int) ($transaction->payment_fee_amount ?? 0); $pointDiscountAmount = (int) ($transaction->point_discount_amount ?? 0); $roundingAmount = (int) ($transaction->rounding_amount ?? 0); @endphp
Subtotal {{ $fmtCurrency((int) $transaction->subtotal) }}
@if ($discountTotal > 0)
Total Diskon -{{ $fmtCurrency($discountTotal) }}
@endif @if ((int) ($transaction->voucher_discount_amount ?? 0) > 0)
Diskon Voucher -{{ $fmtCurrency((int) $transaction->voucher_discount_amount) }}
@endif @if ((int) ($transaction->manual_discount_amount ?? 0) > 0)
Diskon Manual -{{ $fmtCurrency((int) $transaction->manual_discount_amount) }}
@endif @if ($pointDiscountAmount > 0)
Diskon Poin -{{ $fmtCurrency($pointDiscountAmount) }}
@endif @if ($discountTotal > 0)
Subtotal Bersih {{ $fmtCurrency((int) $netSubtotal) }}
@endif @if ((int) ($transaction->points_redeemed ?? 0) > 0 || (int) ($transaction->points_earned ?? 0) > 0)
Poin Dipakai {{ number_format((int) ($transaction->points_redeemed ?? 0), 0, ',', '.') }}
Poin Didapat {{ number_format((int) ($transaction->points_earned ?? 0), 0, ',', '.') }}
@endif
Total HPP {{ $inventoryApplied ? $fmtCurrency($totalHpp) : 'Belum diproses' }}
Estimasi Laba {{ $inventoryApplied ? $fmtCurrency($totalProfit) : '-' }}
Pajak PB1 {{ $fmtCurrency((int) ($transaction->tax_amount ?? 0)) }}
Biaya Admin {{ $feeAmount > 0 ? $fmtCurrency($feeAmount) : '-' }}
Pembulatan {{ $fmtCurrency($roundingAmount) }}
Total {{ $fmtCurrency((int) $transaction->total) }}

Riwayat Aktivitas

@forelse ($transaction->events as $event)
{{ strtoupper((string) $event->action) }}

{{ $event->actor?->name ?? 'System' }}

{{ optional($event->created_at)->format('d M Y, H:i') }}

@php $meta = (array) ($event->meta ?? []); @endphp
@if (! empty($meta['reason']))

Alasan: {{ $meta['reason'] }}

@endif @if (! empty($meta['amount']))

Nominal: {{ $fmtCurrency((int) $meta['amount']) }}

@endif @if ($event->action === 'voucher_redeem') @if (! empty($meta['voucher_code']))

Voucher: {{ (string) $meta['voucher_code'] }}

@endif @if (! empty($meta['discount_amount']))

Diskon: {{ $fmtCurrency((int) $meta['discount_amount']) }}

@endif @endif @if ($event->action === 'manual_discount') @if (! empty($meta['amount']))

Diskon: {{ $fmtCurrency((int) $meta['amount']) }}

@endif @if (! empty($meta['type']) && ! empty($meta['value']))

Aturan: {{ $meta['type'] === 'percent' ? ((int) $meta['value']).'%' : $fmtCurrency((int) $meta['value']) }}

@endif @endif @if ($event->action === 'point_redeem') @if (! empty($meta['points_redeemed']))

Poin dipakai: {{ number_format((int) $meta['points_redeemed'], 0, ',', '.') }}

@endif @if (! empty($meta['point_discount_amount']))

Diskon poin: {{ $fmtCurrency((int) $meta['point_discount_amount']) }}

@endif @endif @if (! empty($meta['approval_required'])) @php($approvedName = ! empty($meta['approved_by_user_id']) ? ($approvedBy[(int) $meta['approved_by_user_id']] ?? null) : null)

Approval: {{ $approvedName ? 'Disetujui oleh '.$approvedName : 'Dibutuhkan' }}

@endif @if (! empty($meta['previous_payment_status']) || ! empty($meta['new_payment_status']))

Status: {{ \App\Helpers\DataLabelHelper::enum($meta['previous_payment_status'] ?? null, 'payment_status') }} → {{ \App\Helpers\DataLabelHelper::enum($meta['new_payment_status'] ?? null, 'payment_status') }}

@endif @if (array_key_exists('revert_inventory', $meta))

Revert stok: {{ (bool) $meta['revert_inventory'] ? 'Ya' : 'Tidak' }}

@endif
@empty

Belum ada koreksi.

@endforelse
@if ($voidModalOpen) @endif @if ($refundModalOpen) @endif