@extends('layouts.app') @section('title', 'Recovery of Electricity Charges') @section('content')
@php // Group bills by TenantName $groupedBills = $bills->groupBy('TenantName'); @endphp @foreach($groupedBills as $tenantName => $tenantBills) @php $firstBill = $tenantBills->first(); $totalConsumption = $tenantBills->sum('ConsumptionBilled'); $totalBill = $tenantBills->sum('TotalBill'); @endphp

C/o

{{ $company->CompanyName ?? 'Company Name' }}

P.O. Box {{ $company->PostalCode ?? '00000' }} {{ $company->City ?? 'Nairobi' }}, {{ $company->Country ?? 'Kenya' }}

@if(!empty($company->Phone))

Tel: {{ $company->Phone }}

@endif @if(!empty($company->Email))

Email: {{ $company->Email }}

@endif

{{ $firstBill->PropName }}

Recovery of Electricity Charges - {{ $tenantName }}
TO
{{ $firstBill->TenantName }}
{{ $firstBill->AddressLine }}
{{ $firstBill->PropName }}
Ndoto Road, Karen
Nairobi
{{ $firstBill->AddressLine}}
Number of Meters {{ $firstBill->NoOfBills }}
Billing Date {{ \Carbon\Carbon::parse($firstBill->BillingDate)->format('d-M-Y') }}
Billing Period {{ $firstBill->BillMonth }}
CONSUMPTION DATA
@foreach($tenantBills as $bill) @endforeach
Account No Meter No Suite Reading Date Prev Read Curr Read Cons (kWh)
{{ $bill->AccountNo }} {{ $bill->EMeterNo }} {{ $bill->NoOfBills }} {{ \Carbon\Carbon::parse($bill->CurrentReadingDate)->format('d-M-Y') }} {{ number_format($bill->PreviousReading) }} {{ number_format($bill->CurrentReading) }} {{ number_format($bill->ConsumptionBilled) }}
Total Consumption (kWh) {{ number_format($totalConsumption) }}
BILLING DETAILS
@php // Get the first bill's billing details $firstBill = $tenantBills->first(); $billingDetails = []; $descriptions = explode(', ', $firstBill->AllBLineDescriptions); $amounts = explode(', ', $firstBill->AllBLineAmounts); for ($i = 0; $i < count($descriptions); $i++) { $billingDetails[] = [ 'Description' => $descriptions[$i], 'Amount' => floatval($amounts[$i] ?? 0) ]; } $subTotal = collect($billingDetails)->sum('Amount') / 1.16; // Remove VAT to get subtotal $vat = $subTotal * 0.16; // Calculate VAT $totalBilling = $subTotal + $vat; // Total including VAT @endphp @foreach($billingDetails as $d) @endforeach
Description Amount Kshs
{{ $d['Description'] }} {{ number_format($d['Amount'], 2) }}
TOTAL CURRENT BILL {{ number_format($totalBilling, 2) }}
{{-- Payable Box --}}
TOTAL AMOUNT PAYABLE :    Kshs {{ number_format($firstBill->BalanceCF, 2) }}
{{-- Footer --}}
Cheques to be made payable to: {{ $firstBill->CustomerName }}
Powered by Mijics ยท a SULIS Product   |   +254 20 387 2607   sulis@sulis.co.ke
{{-- DETACHABLE SLIP --}}
To be attached to payment {{ $firstBill->PropName }}
{{ $firstBill->TenantName }}
{{ $firstBill->NoOfBills }}
{{ $firstBill->Court }}
{{ $firstBill->PropName }}
Ndoto Road, Karen
{{ $firstBill->Court }}
Number of Meters {{ $tenantBills->count() }}
Amount Due Kshs {{ number_format($firstBill->BalanceCF, 2) }}
Due Date {{ \Carbon\Carbon::parse($firstBill->DueDate)->format('d-M-Y') }}
@endforeach
@endsection