selectSum('refund_paid_amount', 'total_paid') ->where('parent_id', $parentId) ->where('school_year', $schoolYear) ->whereIn('status', ['Partial', 'Paid']) ->get() ->getRowArray(); return $result && isset($result['total_paid']) ? (float) $result['total_paid'] : 0.00; } }