From ee98d2faa3aaa7723b3cfb252511d48fb0e64d10 Mon Sep 17 00:00:00 2001 From: adametz Date: Fri, 7 Sep 2018 13:40:11 +0000 Subject: [PATCH] deposit percent in programm for caluclate price git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3465 f459cee4-fb09-11de-96c3-f9c5f16c3c76 --- .../Controller/BookingController.php | 11 +++--- trunk/src/AppBundle/Entity/TravelProgram.php | 34 +++++++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/trunk/src/AppBundle/Controller/BookingController.php b/trunk/src/AppBundle/Controller/BookingController.php index 40528f0c..584221f4 100644 --- a/trunk/src/AppBundle/Controller/BookingController.php +++ b/trunk/src/AppBundle/Controller/BookingController.php @@ -103,7 +103,7 @@ class BookingController extends Controller } $htmlSummary = []; $bookingPriceInfo = []; - $totalPrice = $this->calculatePrice($travelDate, $bookingRequest, $travelProgram->getCategory()->getId(), $htmlSummary, $bookingPriceInfo); + $totalPrice = $this->calculatePrice($travelDate, $bookingRequest, $travelProgram->getCategory()->getId(), $travelProgram->getDepositPercent(), $htmlSummary, $bookingPriceInfo); if ($action == '/buchen') { @@ -252,7 +252,7 @@ class BookingController extends Controller return $ret; } - public function calculatePrice(TravelDate $travelDate, BookingRequest $bookingRequest, $categoryId, &$outHtmlSummary = null, &$outPriceInfo = null) + public function calculatePrice(TravelDate $travelDate, BookingRequest $bookingRequest, $categoryId, $depositPercent = null, &$outHtmlSummary = null, &$outPriceInfo = null) { $ret = 0; $insuranceAssessmentBasis = 0; @@ -713,14 +713,17 @@ class BookingController extends Controller $outPriceInfo['flight_price'] = 0; } + if($depositPercent === null) { + $depositPercent = 20; + } //Aeqypten (20% from price) if($categoryId == 1){ - $deposit = ($outPriceInfo['total'] / 100 * 20); + $deposit = ($outPriceInfo['total'] / 100 * $depositPercent); $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); + $deposit = (($outPriceInfo['total'] - $outPriceInfo['flight_price']) / 100 * $depositPercent); $outPriceInfo['deposit_total'] = ($deposit + $outPriceInfo['flight_price']); $outPriceInfo['final_payment'] = ($outPriceInfo['total'] - $outPriceInfo['deposit_total']); } diff --git a/trunk/src/AppBundle/Entity/TravelProgram.php b/trunk/src/AppBundle/Entity/TravelProgram.php index 2892c3e9..3bd88ded 100644 --- a/trunk/src/AppBundle/Entity/TravelProgram.php +++ b/trunk/src/AppBundle/Entity/TravelProgram.php @@ -198,6 +198,14 @@ class TravelProgram */ private $travelAgenda; + /** + * @var integer + * + * @ORM\Column(name="deposit_percent", type="integer", nullable=true) + */ + + private $depositPercent; + /** * @var boolean * @@ -1057,6 +1065,32 @@ class TravelProgram return $this->travelAgenda; } + /** + * Set travelAgenda + * + * @param integer $depositPercent + * + * @return TravelProgram + */ + public function setDepositPercent($depositPercent) + { + $this->depositPercent = $depositPercent; + + return $this; + } + + /** + * Get depositPercent + * + * @return integer + */ + public function getDepositPercent() + { + return $this->depositPercent; + } + + + /** * Set nettoPricesInEuro *