Reiseland Kontaktdaten, Rabatt API

This commit is contained in:
Kevin Adametz 2019-11-07 17:08:16 +01:00
parent 8f29c15a2b
commit 70704be1ea
30 changed files with 471 additions and 95 deletions

View file

@ -162,8 +162,8 @@ class DraftController extends Controller
$room_adult += $room['adult'];
$room_children += $room['children'];
$room_price_adult += ($room['price_adult'] * $room['adult']);
$room_price_children += ($room['price_children'] * $room['children']);
$room_price_adult += ($room['price_adult_full'] * $room['adult']);
$room_price_children += ($room['price_children_full'] * $room['children']);
if(isset($room_names[$room['name']])){
$room_names[$room['name']] = $room_names[$room['name']]+1;
@ -188,9 +188,9 @@ class DraftController extends Controller
'start_date' => $data['startDateStr'],
'end_date' => $data['endDateStr'],
'service' => $service,
'price_adult' => $room['price_adult'],
'price_adult' => $room['price_adult_full'],
'adult' => $room['adult'],
'price_children' => $room['price_children'],
'price_children' => $room['price_children_full'],
'children' => $room['children'],
'pos' => 0,
'in_pdf' => true,
@ -375,6 +375,41 @@ class DraftController extends Controller
'comfort' => $data['comfort']
];
}
$price_info_travel_discounts = [];
foreach ($data['discount'] as $travel_discount){
$service = trans('_vorlagen.aufpreis_option');
$this->option = "";
$service = $this->replaceService($service);
if($travel_discount['price'] > 0){
$travel_discount['price'] = $travel_discount['price']*-1;
}
$price_info_travel_options[] = [
'booking_id' => $data['booking_id'],
'travel_program_id' => $data['travel_program_id'],
'fewo_lodging_id' => null,
'travel_class_id' => null,
'draft_item_id' => null,
'draft_type_id' => 42,
'request_date' => $data['request_date'],
'days_start' => null,
'days_duration' => null,
'start_date' => null,
'end_date' => null,
'service' => $service,
'price_adult' => $travel_discount['price'],
'adult' => $travel_discount['count'],
'price_children' => 0,
'children' => 0,
'pos' => 0,
'in_pdf' => true,
'comfort' => $data['comfort']
];
}
$info_texts = [];
$last_post = 0;
foreach ($draft->draft_items as $draft_item){
@ -522,6 +557,15 @@ class DraftController extends Controller
}
}
//set travel discount prices
if(count($price_info_travel_discounts)){
foreach ($price_info_travel_discounts as $price_info_travel_discount){
$last_post ++;
$price_info_travel_option['pos'] = $last_post;
BookingDraftItem::create($price_info_travel_option);
}
}
//set travel options prices
if(count($info_texts)){
foreach ($info_texts as $info_text){