Teilnahmerechnungen erstellen
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Enumerations\ParticipationFeeType;
|
||||
use App\Enumerations\ParticipationType;
|
||||
use App\Enumerations\VatPricingMode;
|
||||
use App\Models\Event;
|
||||
use App\Support\DateRange;
|
||||
use App\ValueObjects\Amount;
|
||||
use DateTime;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -20,7 +21,7 @@ class EventResource extends JsonResource{
|
||||
|
||||
public function toArray(Request $request) : array
|
||||
{
|
||||
$duration = $this->event->end_date->diff($this->event->start_date)->days + 1;
|
||||
$duration = DateRange::inclusiveDays($this->event->start_date, $this->event->end_date);
|
||||
|
||||
$returnArray = [
|
||||
'id' => $this->event->id,
|
||||
@@ -352,8 +353,7 @@ class EventResource extends JsonResource{
|
||||
$basicFee = $basicFee->multiply($this->getMultiplier());
|
||||
|
||||
if ($this->event->pay_per_day) {
|
||||
$days = $arrival->diff($departure)->days + 1;
|
||||
$basicFee = $basicFee->multiply($days);
|
||||
$basicFee = $basicFee->multiply(DateRange::inclusiveDays($arrival, $departure));
|
||||
}
|
||||
|
||||
if ($hasSibling && $this->event->sibling_reduction) {
|
||||
@@ -380,7 +380,7 @@ class EventResource extends JsonResource{
|
||||
*/
|
||||
public function resolveAddons(array $selectedKeys, DateTime $arrival, DateTime $departure): array
|
||||
{
|
||||
$days = $arrival->diff($departure)->days + 1;
|
||||
$days = DateRange::inclusiveDays($arrival, $departure);
|
||||
$addsVat = $this->event->tax_liable && $this->event->vat_pricing_mode === VatPricingMode::AddOn->value;
|
||||
|
||||
$items = [];
|
||||
|
||||
Reference in New Issue
Block a user