Patch to update reciept PDF generated by payment.blade.php to include Invoice Total, Balance Due, and Invoice Status

This commit is contained in:
klittle81
2026-02-27 22:06:27 -05:00
committed by GitHub
parent 48abd9020d
commit fc05cf61fa
2 changed files with 22 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ class Invoice extends Model implements HasMedia
'formattedCreatedAt',
'formattedInvoiceDate',
'formattedDueDate',
'formattedDueAmount',
'invoicePdfUrl',
];
@@ -190,6 +191,17 @@ class Invoice extends Model implements HasMedia
return Carbon::parse($this->due_date)->translatedFormat($dateFormat);
}
public function getFormattedDueAmountAttribute($value)
{
$currency = $this->currency;
if (! $currency) {
$currency = Currency::findOrFail(CompanySetting::getSetting('currency', $this->company_id));
}
return format_money_pdf($this->due_amount, $currency);
}
public function getFormattedInvoiceDateAttribute($value)
{
$dateFormat = CompanySetting::getSetting('carbon_date_format', $this->company_id);

View File

@@ -343,6 +343,10 @@
<td class="attribute-label">@lang('pdf_invoice_label')</td>
<td class="attribute-value"> &nbsp;{{ $payment->invoice->invoice_number }}</td>
</tr>
<tr>
<td class="attribute-label">Invoice Amount</td>
<td class="attribute-value"> &nbsp;{!! format_money_pdf($payment->invoice->total, $payment->invoice->currency) !!}</td>
</tr>
@endif
</table>
</div>
@@ -352,6 +356,12 @@
<div class="total-display-box">
<p class="total-display-label">@lang('pdf_payment_amount_received_label')</p>
<span class="amount">{!! format_money_pdf($payment->amount, $payment->customer->currency) !!}</span>
@if ($payment->invoice && $payment->invoice->invoice_number)
<br><p class="total-display-label">Balance Due</p>
<span class="amount">{!! $payment->invoice->formattedDueAmount !!}</span><br>
<br><p class="total-display-label">Invoice Status</p>
<span class="amount">{{ str_replace('_', ' ', optional($payment->invoice)->paid_status ?? optional($payment->invoice)->status) }}</span>
@endif
</div>
<div class="notes">
@if ($notes)