Booking, QI Content, Trees, Media

This commit is contained in:
Kevin Adametz 2019-10-02 20:03:55 +02:00
parent 1f340e96fa
commit 7fbac395a9
260 changed files with 27160 additions and 3773 deletions

View file

@ -429,6 +429,12 @@ class TravelUserBookingFewo extends Model
return isset($this->attributes['price_total']) ? $this->attributes['price_total'] : 0;
}
public function calculate_price(){
$this->attributes['price_travel_total'] = $this->getPriceTravelRaw() + $this->getPriceBalanceRaw() + $this->getPriceExtraRaw();
$this->attributes['price_total'] = $this->getPriceTravelTotalRaw() + $this->getPriceServiceRaw() + $this->getPriceDepositRaw();
}
public function getPriceTravelTotalFirstPay(){
if($this->attributes['price_travel'] == 0){
return 0;
@ -469,6 +475,10 @@ class TravelUserBookingFewo extends Model
}
public function getLastChangeAt(){
if(!isset($this->attributes['last_change_at']) || !$this->attributes['last_change_at']){ return ""; }
return Carbon::parse($this->attributes['last_change_at'])->format("H:i d.m.Y");
}
public function getBookingDateYear(){
return Carbon::parse($this->booking_date)->format('Y');
@ -530,7 +540,19 @@ class TravelUserBookingFewo extends Model
return false;
}
//get TravelInfos Name / Paths / ...
public function isChangeLowerInvoiceCreate(){
$dir = $this->getBookingDateYear()."/";
$filename = $this->getInvoiceFileName();
if(Storage::disk('fewo_invoices')->exists( $dir.$filename )){
return Carbon::createFromTimestamp(Storage::disk('fewo_invoices')->lastModified($dir.$filename))->gt($this->last_change_at);
}
return false;
}
//get TravelInfos Name / Paths / ...
public function getTravelInfoFileName(){
if($this->invoice_number) {
return "Anreiseinfo-".Util::sanitize($this->invoice_number).".pdf";
@ -581,7 +603,15 @@ class TravelUserBookingFewo extends Model
$filename = $this->getTravelInfoFileName();
if(Storage::disk('fewo_infos')->exists( $dir.$filename )){
return Carbon::createFromTimestamp(Storage::disk('fewo_infos')->lastModified($dir.$filename))->format("H:i d.m.Y");
}
return false;
}
public function isChangeLowerTravelInfoCreate(){
$dir = $this->getBookingDateYear()."/";
$filename = $this->getTravelInfoFileName();
if(Storage::disk('fewo_invoices')->exists( $dir.$filename )){
return Carbon::createFromTimestamp(Storage::disk('fewo_infos')->lastModified($dir.$filename))->gt($this->last_change_at);
}
return false;
}