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
This commit is contained in:
adametz 2018-09-07 13:40:11 +00:00
parent 3cb28e108b
commit ee98d2faa3
2 changed files with 41 additions and 4 deletions

View file

@ -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']);
}

View file

@ -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
*