@php
$info_right_column = '';
$info_left_column = '';
// 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
$client_info = '
' . trans('crm.statement_bill_to') . '';
$client_info .= '
';
$client_info .= format_customer_info($statement['client'], 'statement', 'billing');
$client_info .= '
';
$summary = '';
$summary .= '
' . trans('crm.account_summary') . '
';
$summary .= '
' . vsprintf(trans('crm.statement_from_to'), [
\Carbon\Carbon::parse($statement['from'])->toDateString(),
\Carbon\Carbon::parse($statement['to'])->toDateString(),
]) . '
';
$summary .= '
';
$summary .= '
' . trans('crm.statement_beginning_balance') . ': |
' . app_format_money($statement['beginning_balance'], $statement['currency']) . ' |
' . trans('crm.invoiced_amount') . ': |
' . app_format_money($statement['invoiced_amount'], $statement['currency']) . ' |
' . trans('crm.amount_paid') . ': |
' . app_format_money($statement['amount_paid'], $statement['currency']) . ' |
' . trans('crm.balance_due') . ': |
' . app_format_money($statement['balance_due'], $statement['currency']) . ' |
';
@endphp
{!! $info_left_column !!}
|
{!! $organization_info !!}
|
| |
{!! $client_info !!}
|
{!! $summary !!}
|
{{ vsprintf(trans('crm.customer_statement_info'), array(\Carbon\Carbon::parse($statement['from'])->toDateString(), \Carbon\Carbon::parse($statement['to'])->toDateString())) }}
@lang('crm.statement_heading_date') |
@lang('crm.statement_heading_details') |
@lang('crm.statement_heading_amount') |
@lang('crm.statement_heading_payments') |
@lang('crm.statement_heading_balance') |
@foreach($statement['result'] as $item)
index % 2) bgcolor="#f6f5f5" @endif>
{{ local_date_format($item['date']) }} |
{!! $item['detail'] !!}
|
@php
if(isset($item['invoice_id'])) {
echo app_format_money($item['invoice_amount'], $statement['currency'], true);
} else if(isset($item['credit_note_id'])) {
echo app_format_money($item['credit_note_amount'], $statement['currency'], true);
}
@endphp
|
@php
if(isset($item['payment_id'])) {
echo app_format_money($item['payment_total'], $statement['currency'], true);
} else if(isset($item['credit_note_refund_id'])) {
echo app_format_money($item['refund_amount'], $statement['currency'], true);
}
@endphp
|
@php
$tmpBeginningBalance = 0;
if(isset($item['invoice_id'])) {
$tmpBeginningBalance = ($tmpBeginningBalance + $item['invoice_amount']);
} else if(isset($item['payment_id'])){
$tmpBeginningBalance = ($tmpBeginningBalance - $item['payment_total']);
} else if(isset($item['credit_note_id'])) {
$tmpBeginningBalance = ($tmpBeginningBalance - $item['credit_note_amount']);
} else if(isset($item['credit_note_refund_id'])) {
$tmpBeginningBalance = ($tmpBeginningBalance + $item['refund_amount']);
}
if(!isset($item['credit_id'])){
echo app_format_money($tmpBeginningBalance, $statement['currency'], true);
}
@endphp
|
@endforeach
|
|
@lang('crm.balance_due') |
|
{{ app_format_money($statement['balance_due'], $statement['currency']) }}
|