@extends('reports.report', ['report' => $report])
@section('content')
@foreach ($client_debtors as $client_debtor)
@include('reports.company_details')
{{ $report->title }}
as at {!! $report->as_at_date->format('j F Y') !!}
{{ $client_debtor->debtor_name}}
{{ $client_debtor->post_address1 }}
{{ $client_debtor->post_address2 }}
{{ $client_debtor->post_address3 }}
{{ $client_debtor->post_postalcode }}
| Debtor Code : | {{ $client_debtor->debtor_code }} |
| Agreement Type : | {{ $client_debtor->agreement_type }} |
| Cut off date : | {{ $client_debtor->cut_off_day }} |
|
| Terms : | {{ ucfirst($client_debtor->payment_terms) }} |
| Invoice bought : | {!! DisplayHelper::formatCurrency($client_debtor->invoice_bought_amount) !!} |
| Balance o/s : | {!! DisplayHelper::formatCurrency($client_debtor->balance_outstanding) !!} |
|
@if(count($client_debtor->agreements) > 0)
| Agreement # |
Date |
Supplier |
Debtor |
Description |
Due on |
Inv # |
Ref # |
Comment |
Inv Amount VAT incl (DR) |
CR |
Balance |
Total Due |
@endif
@php
$totalCount = 0 ;
$openning_balance = 0.0 ;
$cumulative_balance = 0.0;
@endphp
@foreach ($client_debtor->agreements as $key => $agreement)
@if ($totalCount)
|
|
|
|
|
|
|
|
|
|
|
|
|
@endif
|
|
|
{{ $client_debtor->debtor_name }} |
Opening Balance |
|
|
|
|
|
|
{!! DisplayHelper::formatCurrency($openning_balance) !!} |
{!! DisplayHelper::formatCurrency($cumulative_balance) !!} |
@foreach ($agreement['line_items'] as $line_item)
| {{ $line_item['agreement_code'] }} |
{!! DateHelper::stringifyWithTime($line_item['effective_date']) !!} |
{{ $line_item['supplier'] }} |
{{ $client_debtor->debtor_name }} |
{{ $line_item['description'] }} |
{!! DateHelper::stringifyWithTime($line_item['due_date']) !!} |
{{ $line_item['invoice_no'] }} |
{{ $line_item['reference'] }} |
{{ $line_item['comment'] }} |
{!! $line_item['amount'] >= 0 ? DisplayHelper::formatCurrency($line_item['amount']) : "" !!} |
{!! $line_item['amount'] < 0 ? DisplayHelper::formatCurrency($line_item['amount']) : "" !!} |
{!! DisplayHelper::formatCurrency($line_item['balance_os']) !!} |
|
@php
$closingBalance = $line_item['balance_os'];
@endphp
@endforeach
|
|
|
{{ $client_debtor->debtor_name }} |
Closing Balance |
|
|
|
|
|
|
{!! DisplayHelper::formatCurrency($closingBalance) !!} |
{!! DisplayHelper::formatCurrency($closingBalance + $cumulative_balance) !!} |
@php
$totalCount++;
$openning_balance = $closingBalance;
$cumulative_balance += $openning_balance;
@endphp
@endforeach
@if(count($client_debtor->periods) > 0)
@endif
|
Total |
@foreach ($client_debtor->periods as $period)
@php
$enddiffdate = DateHelper::stringifyWithTime($period['end_date']);
$explodediffdate = explode('/', $enddiffdate);
$startdate = explode('-', $report->as_at_date->format('Y-m-d'));
$month = $startdate[1] - $explodediffdate[1];
@endphp
| {{$period['summary_description']}} : {!! DateHelper::stringifyWithTime($period['end_date']) !!} {{ $month ? ' ( >' . $month * 30 . ' days )' : '' }} |
{!! App\Helpers\DisplayHelper::formatCurrency($period['due']) !!} |
@endforeach
| TOTAL DUE IMMEDIATELY |
{!! App\Helpers\DisplayHelper::formatCurrency($client_debtor->now_due) !!} |
@endforeach
@stop