mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-10 15:04:46 +00:00
Patch to update reciept PDF generated by payment.blade.php to include Invoice Total, Balance Due, and Invoice Status
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -343,6 +343,10 @@
|
||||
<td class="attribute-label">@lang('pdf_invoice_label')</td>
|
||||
<td class="attribute-value"> {{ $payment->invoice->invoice_number }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="attribute-label">Invoice Amount</td>
|
||||
<td class="attribute-value"> {!! 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)
|
||||
|
||||
Reference in New Issue
Block a user