Fix Pint formatting
This commit is contained in:
@@ -8,9 +8,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class FinancialUnpaidParentsService
|
||||
{
|
||||
public function __construct(private FinancialSchoolYearService $schoolYears)
|
||||
{
|
||||
}
|
||||
public function __construct(private FinancialSchoolYearService $schoolYears) {}
|
||||
|
||||
public function getUnpaidParents(?string $schoolYear): array
|
||||
{
|
||||
@@ -76,7 +74,7 @@ class FinancialUnpaidParentsService
|
||||
$total = (float) ($row['total_amount'] ?? 0);
|
||||
$balance = max(0.0, round($total - $discSum - $paidSum - $refSum, 2));
|
||||
|
||||
if (!isset($byParent[$parentId])) {
|
||||
if (! isset($byParent[$parentId])) {
|
||||
$byParent[$parentId] = [
|
||||
'parent_id' => $parentId,
|
||||
'firstname' => (string) ($row['firstname'] ?? ''),
|
||||
@@ -96,7 +94,7 @@ class FinancialUnpaidParentsService
|
||||
}
|
||||
|
||||
$extraRows = DB::table('additional_charges as ac')
|
||||
->selectRaw("ac.parent_id, u.firstname, u.lastname, u.email, COALESCE(SUM(ac.amount), 0) AS total_extra")
|
||||
->selectRaw('ac.parent_id, u.firstname, u.lastname, u.email, COALESCE(SUM(ac.amount), 0) AS total_extra')
|
||||
->leftJoin('users as u', 'u.id', '=', 'ac.parent_id')
|
||||
->where('ac.school_year', $schoolYear)
|
||||
->where('ac.status', '!=', 'void')
|
||||
@@ -119,7 +117,7 @@ class FinancialUnpaidParentsService
|
||||
if (abs($extra) < 0.00001) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($byParent[$parentId])) {
|
||||
if (! isset($byParent[$parentId])) {
|
||||
$byParent[$parentId] = [
|
||||
'parent_id' => $parentId,
|
||||
'firstname' => (string) ($row['firstname'] ?? ''),
|
||||
@@ -150,8 +148,8 @@ class FinancialUnpaidParentsService
|
||||
}
|
||||
}
|
||||
|
||||
$monthsUntil = static function (? \DateTimeImmutable $end) use ($today): int {
|
||||
if (!$end) {
|
||||
$monthsUntil = static function (?\DateTimeImmutable $end) use ($today): int {
|
||||
if (! $end) {
|
||||
return 0;
|
||||
}
|
||||
$y = (int) $end->format('Y') - (int) $today->format('Y');
|
||||
@@ -160,6 +158,7 @@ class FinancialUnpaidParentsService
|
||||
if ((int) $end->format('j') > (int) $today->format('j')) {
|
||||
$months += 1;
|
||||
}
|
||||
|
||||
return max(0, $months);
|
||||
};
|
||||
|
||||
@@ -195,7 +194,7 @@ class FinancialUnpaidParentsService
|
||||
$hasPayments = [];
|
||||
$paidTotals = [];
|
||||
$paymentCounts = [];
|
||||
if (!empty($parentIds)) {
|
||||
if (! empty($parentIds)) {
|
||||
$pRows = DB::table('payments')
|
||||
->selectRaw('parent_id, SUM(paid_amount) AS total_paid, COUNT(*) AS payment_count')
|
||||
->whereIn('parent_id', $parentIds)
|
||||
@@ -217,7 +216,8 @@ class FinancialUnpaidParentsService
|
||||
|
||||
$results = array_map(function (array $row) use ($hasPayments, $paidTotals, $paymentCounts, $nextInstallment) {
|
||||
$parentId = (int) ($row['parent_id'] ?? 0);
|
||||
$name = trim((string) ($row['firstname'] ?? '') . ' ' . (string) ($row['lastname'] ?? ''));
|
||||
$name = trim((string) ($row['firstname'] ?? '').' '.(string) ($row['lastname'] ?? ''));
|
||||
|
||||
return [
|
||||
'parent_id' => $parentId,
|
||||
'parent_name' => $name,
|
||||
|
||||
Reference in New Issue
Block a user