@php
$info_right_column = '';
$info_left_column = '';
$info_right_column .= '
' . trans('crm.invoice_pdf_heading') . '';
$info_right_column .= '
# ' . $invoice_number . '';
$status = $invoice->status;
if (get_option('show_status_on_pdf_ei') == 1) {
$info_right_column .= '
' . format_invoice_status($status, '', false) . '';
}
if ($status != \CRM\Support\Enum\InvoiceStatus::STATUS_PAID && $status != \CRM\Support\Enum\InvoiceStatus::STATUS_CANCELLED && get_option('show_pay_link_to_invoice_pdf') == 1
&& found_invoice_mode($payment_modes, $invoice->id, false)) {
$info_right_column .= ' -
<1b>' . trans('crm.view_invoice_pdf_link_pay') . '1b>';
}
// Add logo
$company_logo = get_option('company_logo_dark') ? public_path('upload/company/'.get_option('company_logo_dark')) : '';
$info_left_column .= '

';
// Write top left logo and right column info/text
$organization_info = '
';
$organization_info .= format_organization_info();
$organization_info .= '
';
// Bill to
$invoice_info = '
' . trans('crm.invoice_bill_to') . '';
$invoice_info .= '
';
$invoice_info .= format_customer_info($invoice, 'invoice', 'billing');
$invoice_info .= '
';
// ship to to
if ($invoice->include_shipping == 1 && $invoice->show_shipping_on_invoice == 1) {
$invoice_info .= '
' . trans('crm.ship_to') . '';
$invoice_info .= '
';
$invoice_info .= format_customer_info($invoice, 'invoice', 'shipping');
$invoice_info .= '
';
}
$invoice_info .= '
' . trans('crm.invoice_data_date') . ' ' . local_date_format($invoice->date) . '
';
if (!empty($invoice->duedate)) {
$invoice_info .= trans('crm.invoice_data_duedate') . ' ' . local_date_format($invoice->duedate) . '
';
}
if ($invoice->sale_agent != 0 && get_option('show_sale_agent_on_invoices') == 1) {
$invoice_info .= trans('crm.sale_agent_string') . ': ' . get_staff_full_name($invoice->sale_agent) . '
';
}
@endphp
{!! $info_left_column !!}
|
{!! $info_right_column !!}
|
| |
{!! $organization_info !!}
|
{!! $invoice_info !!}
|
# |
Item |
Qty |
Rate |
Amount |
@foreach($invoice->items as $item)
1 |
{{ $item->description }}
|
{{ $item->qty }} |
{{ $item->rate }} |
{{ $item->qty * $item->rate }} |
@endforeach
@php
$tbltotal = '';
$tbltotal .= '
';
$tbltotal .= '
' . trans('crm.invoice_subtotal') . ' |
' . app_format_money($invoice->subtotal, $invoice->currency) . ' |
';
$tbltotal .= '
' . trans('crm.invoice_total') . ' |
' . app_format_money($invoice->total, $invoice->currency) . ' |
';
if (count($invoice->payments) > 0 && get_option('show_total_paid_on_invoice') == 1) {
$tbltotal .= '
' . trans('crm.invoice_total_paid') . ' |
-' . app_format_money($invoice->paid, $invoice->currency) . ' |
';
}
if (get_option('show_amount_due_on_invoice') == 1 && $invoice->status != \CRM\Support\Enum\InvoiceStatus::STATUS_CANCELLED) {
$tbltotal .= '
' . trans('crm.invoice_amount_due') . ' |
' . app_format_money($invoice->total_left_to_pay, $invoice->currency) . ' |
';
}
$tbltotal .= '
';
echo $tbltotal;
if (count($invoice->payments) > 0 && get_option('show_transactions_on_invoice_pdf') == 1) {
echo "
".trans('crm.invoice_received_payments')."
";
$border = 'border-bottom-color:#000000;border-bottom-width:1px;border-bottom-style:solid; 1px solid black;';
$tblhtml = '
' . trans('crm.invoice_payments_table_number_heading') . ' |
' . trans('crm.invoice_payments_table_mode_heading') . ' |
' . trans('crm.invoice_payments_table_date_heading') . ' |
' . trans('crm.invoice_payments_table_amount_heading') . ' |
';
$tblhtml .= '';
foreach ($invoice->payments as $payment) {
$payment_name = $payment['name'];
if (!empty($payment['paymentmethod'])) {
$payment_name .= ' - ' . $payment['paymentmethod'];
}
$tblhtml .= '
' . $payment['id'] . ' |
' . $payment_name . ' |
' . local_date_format($payment['date']) . ' |
' . app_format_money($payment['amount'], $invoice->currency) . ' |
';
}
$tblhtml .= '';
$tblhtml .= '
';
echo $tblhtml;
}
if (found_invoice_mode($payment_modes, $invoice->id, true, true)) {
foreach ($payment_modes as $mode) {
if (is_numeric($mode['id'])) {
if (!is_payment_mode_allowed_for_invoice($mode['id'], $invoice->id)) {
continue;
}
}
if (isset($mode['show_on_pdf']) && $mode['show_on_pdf'] == 1) {
echo "
".$mode['name']."
".$mode['description']."
";
}
}
}
@endphp
@if(!empty($invoice->clientnote))
{!! trans('crm.invoice_note') !!}
{!! $invoice->clientnote !!}
@endif
@if(!empty($invoice->terms))
{!! trans('crm.terms_and_conditions') !!}
{!! $invoice->terms !!}
@endif