EU Reiserecht - Booking

git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3419 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
adametz 2018-06-30 12:44:31 +00:00
parent 8fd6f63403
commit 2360290f06
25 changed files with 1089 additions and 229 deletions

View file

@ -77,11 +77,9 @@ class BookingController extends Controller
}
$htmlSummary = [];
$bookingPriceInfo = [];
$totalPrice = $this->calculatePrice($travelDate, $bookingRequest, $htmlSummary, $bookingPriceInfo);
$totalPrice = $this->calculatePrice($travelDate, $bookingRequest, $travelProgram->getCategory()->getId(), $htmlSummary, $bookingPriceInfo);
if ($action == '/buchen')
{
$breadcrumbEntries = Util::createBreadcrumb($travelProgramPage);
$breadcrumbEntries[] = new BreadcrumbEntry('Buchen');
@ -156,6 +154,8 @@ class BookingController extends Controller
'travel_program' => $travelProgram,
'summary' => $htmlSummary,
'total_price' => $totalPrice,
'booking_price_info' => $bookingPriceInfo,
]);
}
@ -175,6 +175,7 @@ class BookingController extends Controller
'price_type_by_id' => $this->priceTypeById,
'summary' => $htmlSummary,
'total_price' => $totalPrice,
'booking_price_info' => $bookingPriceInfo,
'mediator_terms_filename' => $travelProgram->getIsMediated()
? $this->getDoctrine()->getRepository('AppBundle:TravelOrganizer')->find(1)->getFileName()
: null
@ -185,7 +186,10 @@ class BookingController extends Controller
return $this->render('default/components/booking/summary.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
'summary' => $htmlSummary,
'total_price' => $totalPrice
'total_price' => $totalPrice,
'booking_price_info' => $bookingPriceInfo,
'show_detail' => true,
]);
}
throw new \Exception('Unknow BookingController action: '. $action);
@ -200,8 +204,7 @@ class BookingController extends Controller
return $ret;
}
public function calculatePrice(TravelDate $travelDate, BookingRequest $bookingRequest, &$outHtmlSummary = null,
&$outPriceInfo = null)
public function calculatePrice(TravelDate $travelDate, BookingRequest $bookingRequest, $categoryId, &$outHtmlSummary = null, &$outPriceInfo = null)
{
$ret = 0;
$insuranceAssessmentBasis = 0;
@ -220,8 +223,12 @@ class BookingController extends Controller
$outPriceInfo['insurances'] = [];
$outPriceInfo['options'] = [];
$outPriceInfo['classOptions'] = [];
$outPriceInfo['departure'] = 0;
$outPriceInfo['departure_extra'] = 0;
$outPriceInfo['flight_price'] = 0;
$outPriceInfo['final_payment_date'] = $travelDate->getFinalPaymentDate();
}
if($bookingRequest->getDeparture() != null)
{
$departure = Util\DepartureUtil::limitIndividualArrivalPrice($bookingRequest->getDeparture(),
@ -236,6 +243,7 @@ class BookingController extends Controller
$insuranceAssessmentBasis += $departure->getExtraCharge();
$a = $travelerCount * $departure->getExtraCharge();
$ret += $a;
$outPriceInfo['departure_extra'] += $a;
if (isset($outHtmlSummary))
{
$outHtmlSummary[] = [
@ -268,8 +276,6 @@ class BookingController extends Controller
}
}
$persons = [
'total' => $travelerCount,
'adults' => $travelerCount,
@ -320,6 +326,10 @@ class BookingController extends Controller
: ($adultCount * ($singleDiscountPrice - $singleFullPrice));
$ret += $roomPrice + $discount;
$singel_flight_price = $travelDate->getFlightCalcPrice();
$outPriceInfo['flight_price'] += (($singel_flight_price * $adultCount) + ($singel_flight_price * $room['persons']['children']));
if (isset($outPriceInfo))
{
$outPriceInfo['rooms'][] = [
@ -396,6 +406,24 @@ class BookingController extends Controller
{
$outPriceInfo['total'] = $ret;
$outPriceInfo['totalWithoutInsurance'] = $ret - $insuranceTotal;
if($outPriceInfo['departure_extra'] >= 0){
$outPriceInfo['flight_price'] = $outPriceInfo['flight_price'] + $outPriceInfo['departure_extra'];
}else{
$outPriceInfo['flight_price'] = 0;
}
//Aeqypten (20% from price)
if($categoryId == 1){
$deposit = ($outPriceInfo['total'] / 100 * 20);
$outPriceInfo['deposit_total'] = $deposit;
$outPriceInfo['final_payment'] = ($outPriceInfo['total'] - $outPriceInfo['deposit_total']);
}else{
//all 100% vom Flugpreis und 20% von der Landleistung.
$deposit = (($outPriceInfo['total'] - $outPriceInfo['flight_price']) / 100 * 20);
$outPriceInfo['deposit_total'] = ($deposit + $outPriceInfo['flight_price']);
$outPriceInfo['final_payment'] = ($outPriceInfo['total'] - $outPriceInfo['deposit_total']);
}
}
return $ret;