@extends('layouts.vertical') @section('css') @endsection @php $PaymentMethod = config('constant.PaymentMethod'); $invoicePaidStatus = config('constant.invoicePaidStatus'); $billingCycle = config('constant.billingCycle'); $invoiceMethod = config('constant.invoiceMethod'); function num_format($number,$precision=0) { $precision = ($precision == 0 ? 1 : $precision); $pow = pow(10, $precision); $value = (int)((trim($number)*$pow))/$pow; return number_format($value,$precision); } $is_paid_partial = false; if((isset($invoice->invoiceInfo->paidPartially) && $invoice->invoiceInfo->paidPartially == true && $invoice->invoiceInfo->partialPaymentCompleted == false)){ $is_paid_partial = true; } $invoiceNotes = $invoice->billingSettings->invoiceNotes ?? ''; $is_custom_note = false; if(isset($invoice->invoiceInfo->invoiceNotes)) { $is_custom_note = true; $invoiceNotes = $invoice->invoiceInfo->invoiceNotes ?? ''; } @endphp @section('breadcrumb')

Invoice: {{$invoice->invoiceInfo->invoiceKey}}

@if($invoice->invoiceInfo->status == 2 || $is_paid_partial) Mark as Paid @elseif($invoice->invoiceInfo->status == 1) Refund payment @endif Download invoice
@endsection @section('content')

{{$invoice->child->name}}

Invoice
Date: {{\Carbon\Carbon::parse($invoice->invoiceInfo->invoiceGeneratedAt)->format('d/m/Y')}}
@if($invoice->invoiceInfo->type != "i1")
Billing period: {{\Carbon\Carbon::parse($invoice->invoiceInfo->chargeFromDate)->format('d/m/Y')}} to {{\Carbon\Carbon::parse($invoice->invoiceInfo->chargeToDate)->format('d/m/Y')}} ({{isset($billingCycle[$invoice->invoiceInfo->billCycle]) ? $billingCycle[$invoice->invoiceInfo->billCycle] : '-'}} | {{ isset($invoiceMethod[$invoice->invoiceInfo->invoiceMethod]) ? $invoiceMethod[$invoice->invoiceInfo->invoiceMethod] : '-' }})
@endif @if($invoice->invoiceInfo->type == "i3") @if(isset($invoice->invoiceInfo->useSession) && $invoice->invoiceInfo->useSession == false)
Attendance hours rate: {{$invoice->invoiceInfo->currency}}{{$invoice->invoiceContents->packagePrice}}/hour
@endif @elseif($invoice->invoiceInfo->type == "i4")
Rate per day: {{$invoice->invoiceInfo->currency}}{{$invoice->invoiceContents->packagePrice}}
@endif
Invoice: {{$invoice->invoiceInfo->invoiceKey}}
@if($invoice->invoiceInfo->type == "i3" && isset($invoice->invoiceInfo->useSession) && $invoice->invoiceInfo->useSession == true)

Note: If a child attends schedules which doesn’t have a session rate then the hourly rate will be applied.

@endif
@if($invoice->invoiceInfo->type == "i4" || ($invoice->invoiceInfo->type == "i3" && isset($invoice->invoiceInfo->useSession) && $invoice->invoiceInfo->useSession == true)) @endif @if(($invoice->invoiceInfo->type == "i3" && isset($invoice->invoiceInfo->useSession) && $invoice->invoiceInfo->useSession == true)) @endif @if($invoice->invoiceInfo->type == "i2") @if($invoice->invoiceInfo->billCycle == 3 && isset($invoice->billingSettings->hideWeekPrice) && $invoice->billingSettings->hideWeekPrice == true) @else @endif @elseif($invoice->invoiceInfo->type == "i3") @if(isset($invoice->invoiceInfo->useSession) && $invoice->invoiceInfo->useSession == true) @else @endif @endif @if($invoice->invoiceInfo->type == "i1") @elseif($invoice->invoiceInfo->type == "i2") @if(isset($invoice->invoiceContents->attendance)) @foreach ($invoice->invoiceContents->attendance->contents as $content) @if($invoice->invoiceInfo->billCycle == 3 && isset($invoice->billingSettings->hideWeekPrice) && $invoice->billingSettings->hideWeekPrice == true) @else @endif @endforeach @endif @if(isset($invoice->invoiceContents->priceAddOns)) @foreach ($invoice->invoiceContents->priceAddOns->contents as $content) @if($invoice->invoiceInfo->billCycle == 3 && isset($invoice->billingSettings->hideWeekPrice) && $invoice->billingSettings->hideWeekPrice == true) @else @endif @endforeach @endif @elseif($invoice->invoiceInfo->type == "i3") @if(isset($invoice->invoiceContents->attendance)) @foreach ($invoice->invoiceContents->attendance->contents as $content) @if(isset($invoice->invoiceInfo->useSession) && $invoice->invoiceInfo->useSession == true) @foreach($content->rooms as $keyr => $room) @if($keyr == 0) @endif @if($keyr == 0) @endif @if($keyr == 0) @endif @endforeach @else @endif @endforeach @endif @if(isset($invoice->invoiceContents->priceAddOns)) @foreach ($invoice->invoiceContents->priceAddOns->contents as $content) @if(isset($invoice->invoiceInfo->useSession) && $invoice->invoiceInfo->useSession == true) @else {{-- --}} @endif @endforeach @endif @elseif($invoice->invoiceInfo->type == "i4") @if(isset($invoice->invoiceContents->attendance)) @foreach ($invoice->invoiceContents->attendance->contents as $content) @endforeach @endif @if(isset($invoice->invoiceContents->priceAddOns)) @foreach ($invoice->invoiceContents->priceAddOns->contents as $content) @endforeach @endif @endif @php $colspan = 3; @endphp @if(isset($invoice->invoiceInfo->useSession) && $invoice->invoiceInfo->useSession == true) @php $colspan = 5; @endphp @endif @if($invoice->invoiceInfo->type == "i1") @else @endif @if(isset($invoice->invoiceContents->discountAddOns)) @foreach ($invoice->invoiceContents->discountAddOns->contents as $content) @endforeach @endif @if(isset($invoice->invoiceContents->subsidyAddOns)) @foreach ($invoice->invoiceContents->subsidyAddOns->contents as $content) @endforeach @endif @if(isset($invoice->invoiceContents->fundedSchemes)) @foreach ($invoice->invoiceContents->fundedSchemes->contents as $content) @endforeach @endif @if($invoice->invoiceContents->schoolTaxCharge > 0) @endif @if($invoice->invoiceContents->overdueCharge > 0 && $invoice->invoiceInfo->removeOverdue == false) @endif @if(isset($invoice->invoiceContents->utilizedCredits) && $invoice->invoiceContents->utilizedCredits > 0) @endif @if($invoice->invoiceInfo->status == 1 && ($is_paid_partial && isset($invoice->invoiceInfo->partialPayments))) @php $partialPayments = collect($invoice->invoiceInfo->partialPayments)->sum('charge'); @endphp @endif @if($invoice->invoiceInfo->status == 1 && isset($invoice->invoiceInfo->paymentMethod) && $invoice->invoiceInfo->paymentMethod != "" && $invoice->invoiceInfo->paymentMethod == 1) @endif
Date/Days DescriptionHours Rate/week Rate Hours/Rate Total
{{$invoice->invoiceContents->manualInvoice->title}} @if($invoice->invoiceContents->installmentNumber>0) ({{Helper::getOrdinal($invoice->invoiceContents->installmentNumber)}} Instalment) @endif
{{$invoice->invoiceContents->manualInvoice->description}}.
{{$invoice->invoiceInfo->currency}}{{$invoice->invoiceContents->charge}}
{{$content->name}}{{$invoice->invoiceInfo->currency}}{{$content->weeklyPrice}}{{$invoice->invoiceInfo->currency}}{{$content->total}}
Extra: {{$content->name}}{{$invoice->invoiceInfo->currency}}{{num_format($content->perDayPrice*7,2)}}{{$invoice->invoiceInfo->currency}}{{$content->total}}
{{\Carbon\Carbon::parse($content->date)->format('d/m/Y')}} {{$room->title}} @if($room->session == false) Hourly rate applied ({{$invoice->invoiceInfo->currency}}{{$room->hourly}}/hour) @endif {{Helper::getHoursStr($content->totalDurationOfSchedule)}}{{$invoice->invoiceInfo->currency}}{{$room->rate}}{{$invoice->invoiceInfo->currency}}{{$content->total}}
{{$content->roomName}} {{Helper::getHoursStr($content->minutes)}} @if(isset($invoice->invoiceInfo->useSession) && $invoice->invoiceInfo->useSession == false) ({{$invoice->invoiceInfo->currency}}{{round(60*$content->minutePrice, 2)}}/h) @endif {{$invoice->invoiceInfo->currency}}{{$content->total}}
Extra: {{$content->name}} x {{count($content->dates)}} daysExtra: {{$content->name}} x {{count($content->dates)}} days{{$invoice->invoiceInfo->currency}}{{$content->perDayPrice}}{{$invoice->invoiceInfo->currency}}{{$content->total}}
{{\Carbon\Carbon::parse($content->date)->format('d/m/Y')}} {{$content->description}} {{$invoice->invoiceInfo->currency}}{{$content->total}}
{{count($content->dates)}} days Extra: {{$content->name}} x {{count($content->dates)}} days {{$invoice->invoiceInfo->currency}}{{$content->total}}
Sub-total: {{$invoice->invoiceInfo->currency}}{{$invoice->invoiceContents->charge}}Sub-total: {{$invoice->invoiceInfo->currency}}{{$invoice->invoiceContents->subTotal}}
{{$content->name}} ({{$content->percentage}}%): {{$invoice->invoiceInfo->currency}}{{$content->total}}
{{$content->name}}: -{{$invoice->invoiceInfo->currency}}{{$content->total}}
{{$content->name}}
@if(isset($content->sessions)) {{ $content->sessions->roomName }} ({{Helper::getTimeFromMinute($content->sessions->fromTime)}} - {{Helper::getTimeFromMinute($content->sessions->toTime)}}) @endif ({{$content->fundedHrs}} hours/week - {{$invoice->invoiceInfo->currency}}{{$content->amount}}/hour) ({{Helper::getHoursStr($content->coveredMinutes)}} consumed):
-{{$invoice->invoiceInfo->currency}}{{$content->consumedAmount}}
Tax ({{$invoice->invoiceContents->schoolTaxPer}}%): {{$invoice->invoiceInfo->currency}}{{$invoice->invoiceContents->schoolTaxCharge}}
Payment due charge ({{$invoice->invoiceContents->overduePercentage}}%): {{$invoice->invoiceInfo->currency}}{{$invoice->invoiceContents->overdueCharge}}
Total amount: {{$invoice->invoiceInfo->currency}}{{$invoice->invoiceContents->totalInvoiceAmount}}
Credit balance applied: -{{$invoice->invoiceInfo->currency}}{{number_format($invoice->invoiceContents->utilizedCredits,2)}}
Total amount after credit balance applied: {{$invoice->invoiceInfo->currency}}{{number_format($invoice->invoiceContents->totalInvoiceAmountAfterCredits,2)}}
Remaining amount: {{$invoice->invoiceInfo->currency}}{{number_format($invoice->invoiceContents->totalInvoiceAmountAfterCredits-$partialPayments,2)}}
Transaction fee ({{$invoice->invoiceContents->adminFeesPercentage}}%): {{$invoice->invoiceInfo->currency}}{{$invoice->invoiceContents->adminFeesAmount}}
Amount paid: {{$invoice->invoiceInfo->currency}}{{$invoice->invoiceContents->totalInvoiceAmountAfterCredits+$invoice->invoiceContents->adminFeesAmount}}
@if($invoice->invoiceInfo->status == 2)
Payment status: Not paid
Due date: {{\Carbon\Carbon::parse($invoice->invoiceInfo->dueDate)->format('d/m/Y')}}
@elseif($invoice->invoiceInfo->status == 3)
Payment status: Cancelled
Due date: {{\Carbon\Carbon::parse($invoice->invoiceInfo->dueDate)->format('d/m/Y')}}
@elseif($invoice->invoiceInfo->status == 1) @if($is_paid_partial) @php $fistPartialPayment = collect($invoice->invoiceInfo->partialPayments)->first(); @endphp
Payment status: Paid partially
Paid by {{ isset($PaymentMethod[$fistPartialPayment->paymentMethod]) ? $PaymentMethod[$fistPartialPayment->paymentMethod] : '' }} on the {{date('d/m/Y, h:i a', strtotime($fistPartialPayment->completedAt))}}
Due date: {{\Carbon\Carbon::parse($invoice->invoiceInfo->dueDate)->format('d/m/Y')}}
@else
@if($invoice->invoiceInfo->paymentMethod == 6)
Payment status: Paid
Paid by {{$PaymentMethod[$invoice->invoiceInfo->paymentMethod]}} {!! isset($invoice->invoiceInfo->completedBySystem) && $invoice->invoiceInfo->completedBySystem == true ? '' : " on the ". date('d/m/Y, h:i a', strtotime($invoice->invoiceInfo->completedAt)) . "" !!}
@else
Payment status: Paid
Paid {{ isset($invoice->invoiceInfo->paymentMethod) && isset($PaymentMethod[$invoice->invoiceInfo->paymentMethod]) ? ' by ' . $PaymentMethod[$invoice->invoiceInfo->paymentMethod] : '' }} on the {{date('d/m/Y, h:i a', strtotime($invoice->invoiceInfo->completedAt))}}
Due date: {{\Carbon\Carbon::parse($invoice->invoiceInfo->dueDate)->format('d/m/Y')}}
@endif
@endif @elseif($invoice->invoiceInfo->status == 4)
Payment status: Refunded
Paid by {{$PaymentMethod[$invoice->invoiceInfo->paymentMethod]}} {!! isset($invoice->invoiceInfo->completedBySystem) && $invoice->invoiceInfo->completedBySystem == true ? '' : " on the ". date('d/m/Y, h:i a', strtotime($invoice->invoiceInfo->completedAt)) . "" !!}
Refunded on {{date('d/m/Y, h:i a', strtotime($invoice->invoiceInfo->refundedAt))}}
Due date: {{\Carbon\Carbon::parse($invoice->invoiceInfo->dueDate)->format('d/m/Y')}}
@endif @if(($is_paid_partial || $invoice->invoiceInfo->status == 2) && isset($invoice->invoiceInfo->overdueStatus->isOverdue) && $invoice->invoiceInfo->overdueStatus->isOverdue == true)
This invoice is overdue by ({{$invoice->invoiceInfo->overdueStatus->overdueDays}}). An overdue payment fee of ({{$invoice->invoiceContents->overduePercentage}}%) has been {{ $invoice->invoiceInfo->removeOverdue == true ? 'removed' : 'added' }}. You can manage overdue payment fees in the payment terms section.
@if($invoice->invoiceContents->overdueCharge > 0) @endif
@endif @if($invoice->invoiceInfo->status == 1 && (isset($invoice->invoiceInfo->partialPayments) && !empty($invoice->invoiceInfo->partialPayments)))
Partial payment details:
@foreach($invoice->invoiceInfo->partialPayments as $partial) @endforeach
Date of payment Amount Payment method
{{ date('d/m/Y, h:i a', strtotime($partial->completedAt)) }} {{$invoice->invoiceInfo->currency}}{{ $partial->charge }} Paid by {{ isset($PaymentMethod[$partial->paymentMethod]) ? $PaymentMethod[$partial->paymentMethod] : '' }}
@endif
@if($invoiceNotes)

Notes: {{ $invoiceNotes ?? "" }}

@endif
@endsection @section('script-bottom') @endsection