@extends('layouts.app') @section('title', __('Payment Slip')) @section('content') @php $businessName = $appSettings['business_name'] ?? 'TradeERP'; $supplierName = $supplierPayment->supplier?->name ?? '-'; $supplierPhone = $supplierPayment->supplier?->phone; $paymentNo = 'SP-'.str_pad($supplierPayment->id,5,'0',STR_PAD_LEFT); $openingAmount = max(0, (float) $supplierPayment->amount - (float) $supplierPayment->allocations->sum('amount')); $purchaseLabel = $supplierPayment->allocations->count() > 1 ? __('Multiple purchases') : ($supplierPayment->purchase?->purchase_number ?? $supplierPayment->allocations->first()?->purchase?->purchase_number ?? ($openingAmount > 0 ? __('Opening Balance') : '-')); $qrEnabled = ($appSettings['qr_enabled'] ?? '1') !== '0'; $qrData = route('payments.supplier-payments.show', $supplierPayment); $waMessage = $businessName."\n".__('Payment Slip').': '.$paymentNo."\n".__('Paid To').': '.$supplierName."\n".__('Amount').': '.number_format($supplierPayment->amount,2).' '.$supplierPayment->currency_code."\n".__('Purchase').': '.$purchaseLabel."\n".($appSettings['whatsapp_footer'] ?? 'Thank you for your business.'); $waLink = \App\Support\WhatsApp::link($waMessage, $appSettings, $supplierPhone, false); @endphp
{{ __('Supplier Payments') }} @if($waLink){{ __('Send WhatsApp') }}@endif
@endsection