last 12.21

This commit is contained in:
Kevin Adametz 2021-12-25 02:53:44 +01:00
parent 73e38a006e
commit 3df0e93c2c
14 changed files with 395 additions and 43 deletions

View file

@ -695,29 +695,37 @@ class Booking extends Model
$travel_price_children = 0;
$total_adult = 0;
$total_children = 0;
$travel_adult = 0;
$travel_children = 0;
foreach ($this->booking_draft_items as $booking_draft_item) {
//24 Rundreise
//24 Rundreise ist der Grundeintrag für die Reise
if($booking_draft_item->draft_type_id == 24){
$travel_draft_item = $booking_draft_item;
continue;
}
$prices = $booking_draft_item->getItemPrice();
//Grundpreis Reise
//Grundpreis Reise //pro Persopn im Zimmer
if($booking_draft_item->draft_type_id == 30){
$travel_price_adult += $prices['adult'];
$travel_price_children += $prices['children'];
$travel_adult += $booking_draft_item->adult;
$travel_children += $booking_draft_item->children;
}
$total_adult += $prices['adult'];
$total_children += $prices['children'];
}
if($travel_draft_item){
$travel_draft_item->setPriceAdultRaw($travel_price_adult);
$travel_draft_item->setPriceChildrenRaw($travel_price_children);
$travel_draft_item->adult = $travel_adult;
$travel_draft_item->children = $travel_children;
$travel_draft_item->save();
}
$this->price = $total_adult + $total_children;
$this->price_total = $this->getPriceRaw() + $this->getServiceTotal(true);
$this->save();
}