diff --git a/app/Http/helpers.php b/app/Http/helpers.php
index 8d8cf10..87cf47b 100644
--- a/app/Http/helpers.php
+++ b/app/Http/helpers.php
@@ -1,6 +1,6 @@
startOfMonth()->format('Y-m-d');
+}
+
+/**
+ * Return the string that is the last day of the month, given by the year and
+ * the month.
+ *
+ * @param string $year
+ * @param string $month
+ * @return string
+ */
+function endOfMonth($year, $month) {
+ return Carbon\Carbon::createFromDate($year, $month)
+ ->endOfMonth()->format('Y-m-d');
+}
diff --git a/resources/views/bookings/index.blade.php b/resources/views/bookings/index.blade.php
index 1c2f4d2..39a05a2 100644
--- a/resources/views/bookings/index.blade.php
+++ b/resources/views/bookings/index.blade.php
@@ -29,7 +29,7 @@
|
|
- {{ $year . '-' . sprintf('%02d', $month) . '-01'}} |
+ {{ startOfMonth($year, $month) }} |
Saldo |
|
|
@@ -71,7 +71,7 @@
@if (!$booking->isSimple())
- @foreach ($booking->subBookings() as $subBooking)
+ @foreach ($booking->subBookings as $subBooking)
| + |
|
@@ -80,12 +80,12 @@
|
@if ($subBooking->signedAmount() < 0)
- {{ formatAmount($subBooking->signedAmount) }}
+ {{ formatAmount($subBooking->signedAmount()) }}
@endif
|
@if ($subBooking->signedAmount() >= 0)
- {{ formatAmount($subBooking->signedAmount) }}
+ {{ formatAmount($subBooking->signedAmount()) }}
@endif
|
@@ -103,8 +103,7 @@
| |
|
- {{ $year . '-' . sprintf('%02d', $month) . '-' .
- cal_days_in_month(CAL_GREGORIAN, $month, $year) }}
+ {{ endOfMonth($year, $month) }}
|
Monatsabschluss |
|
@@ -117,8 +116,7 @@
|
|
- {{ $year . '-' . sprintf('%02d', $month) . '-' .
- cal_days_in_month(CAL_GREGORIAN, $month, $year) }}
+ {{ endOfMonth($year, $month) }}
|
Saldo |
|