fix customer export

This commit is contained in:
omair saleh
2022-07-04 10:57:30 +08:00
parent 797748b16d
commit f67e2cf54d
@@ -50,6 +50,7 @@ class ExportsCustomers implements FromQuery, WithHeadings, WithHeadingRow, WithM
{
$employee = $company->employees()->first();
$lastBooking = $company->bookings()->orderByDesc('id')->first();
return [
$company->reference,
@@ -59,7 +60,7 @@ class ExportsCustomers implements FromQuery, WithHeadings, WithHeadingRow, WithM
$company->contacts()->first() ? $company->contacts()->first()->phone : '',
$company->type === CompanyType::COMPANY_BUSINESS ? 'Company' : 'individual',
count($company->bookings),
$company->bookings()->orderByDesc('id')->first()->created_at,
$lastBooking ? $lastBooking->created_at : '',
$company->bookings()->sum('fix_amount'),
\PhpOffice\PhpSpreadsheet\Shared\Date::dateTimeToExcel($company->created_at),
count($company->segments()->where('segment_id', '=', 5)->get()) ? 'Exchange 1.0' : 'Exchange 2.0'