Booking, QI Content, Trees, Media
This commit is contained in:
parent
1f340e96fa
commit
7fbac395a9
260 changed files with 27160 additions and 3773 deletions
|
|
@ -129,7 +129,49 @@ class Booking extends Model
|
|||
}
|
||||
|
||||
|
||||
public function calculate_price_total()
|
||||
{
|
||||
$travel_draft_item = false;
|
||||
$travel_price_adult = 0;
|
||||
$travel_price_children = 0;
|
||||
$total_adult = 0;
|
||||
$total_children = 0;
|
||||
foreach ($this->booking_draft_items as $booking_draft_item) {
|
||||
//24 Rundreise
|
||||
if($booking_draft_item->draft_type_id == 24){
|
||||
$travel_draft_item = $booking_draft_item;
|
||||
continue;
|
||||
}
|
||||
$prices = $booking_draft_item->getItemPrice();
|
||||
//Grundpreis Reise
|
||||
if($booking_draft_item->draft_type_id == 30){
|
||||
$travel_price_adult += $prices['adult'];
|
||||
$travel_price_children += $prices['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->save();
|
||||
}
|
||||
|
||||
$this->price = $total_adult + $total_children;
|
||||
$this->save();
|
||||
|
||||
}
|
||||
|
||||
public function _format_number($value){
|
||||
return preg_replace("/[^0-9,]/", "", $value);
|
||||
}
|
||||
|
||||
public function getPriceAttribute()
|
||||
{
|
||||
// 2 = decimal places | '.' = decimal seperator | ',' = thousand seperator
|
||||
return number_format(($this->attributes['price']), 2, ',', '.');
|
||||
}
|
||||
|
||||
public function findBeforeDraftItemRelation($reid)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue