@extends('layouts.pdf-layout') @section('letter_title')

{{ strtoupper($letter_title) }}


REPORT DATE: {{ $selectedDateRange }}
PRINTED AT: {{ $print_time }}
@endsection @section('content') @php $grandTotalParcels = 0; $grandTotalSales = 0; function renderSection($data, $title, &$grandTotalParcels, &$grandTotalSales) { if (!empty($data['with_parcels'])) { echo "'; $sectionTotalParcels = 0; $sectionTotalSales = 0; foreach ($data['with_parcels'] as $index => $agent) { echo ""; $sectionTotalParcels += $agent->total_parcels_count; $sectionTotalSales += $agent->total_agent_sales; } echo ""; $grandTotalParcels += $sectionTotalParcels; $grandTotalSales += $sectionTotalSales; } else { } if (!empty($data['without_parcels'])) { echo "'; foreach ($data['without_parcels'] as $index => $agent) { echo ""; } } else { echo "'; echo ""; } } renderSection($darData, 'Dar es Saalam', $grandTotalParcels, $grandTotalSales); renderSection($moroData, 'Morogoro', $grandTotalParcels, $grandTotalSales); renderSection($upcountryData, 'Upcountry Branches', $grandTotalParcels, $grandTotalSales); @endphp @if ($grandTotalParcels > 0 || $grandTotalSales > 0) @endif
S.N AGENT NAME BRANCH OFFICE CONTACTS NO NO OF PARCELS TOTAL SALES(TZS)
" . strtoupper($title) . ' - SALES
" . htmlspecialchars($index + 1) . " " . htmlspecialchars(strtoupper($agent->agent_name)) . " " . htmlspecialchars($agent->branch_name) . " " . htmlspecialchars($agent->office_name) . " " . htmlspecialchars($agent->agent_contacts) . " " . number_format($agent->total_parcels_count, 0) . " " . number_format($agent->total_agent_sales, 0) . "
" . strtoupper($title) . " TOTAL " . number_format($sectionTotalParcels, 0) . " " . number_format($sectionTotalSales, 0) . "
" . strtoupper($title) . '- NO SALES
" . htmlspecialchars($index + 1) . " " . htmlspecialchars(strtoupper($agent->agent_name)) . " " . htmlspecialchars($agent->branch_name) . " " . htmlspecialchars($agent->office_name ?? 'N/A') . " " . htmlspecialchars($agent->agent_contacts) . " 0 0
" . strtoupper($title) . ' - NO SALES
No data available
GROUND TOTAL {{ number_format($grandTotalParcels, 0) }} {{ number_format($grandTotalSales, 0) }}
@endsection