08 2024
This commit is contained in:
parent
c1c613a4b9
commit
881fc84207
384 changed files with 50679 additions and 990 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\Util;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
|
@ -69,4 +70,72 @@ class BookingStorno extends Model
|
|||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
|
||||
public function booking_document()
|
||||
{
|
||||
return $this->hasOne(BookingDocument::class, 'booking_storno_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function getTotalFormatted()
|
||||
{
|
||||
return Util::_number_format($this->attributes['total']);
|
||||
}
|
||||
|
||||
public function getTotalRaw()
|
||||
{
|
||||
return $this->attributes['total'];
|
||||
}
|
||||
|
||||
public function setTotalAttribute($value)
|
||||
{
|
||||
$this->attributes['total'] = Util::_clean_float($value);
|
||||
}
|
||||
|
||||
|
||||
public function getStornoFormatted()
|
||||
{
|
||||
return Util::_number_format($this->attributes['storno']);
|
||||
}
|
||||
|
||||
public function getStornoRaw()
|
||||
{
|
||||
return $this->attributes['storno'];
|
||||
}
|
||||
|
||||
public function setStornoAttribute($value)
|
||||
{
|
||||
$this->attributes['storno'] = Util::_clean_float($value);
|
||||
}
|
||||
|
||||
|
||||
public function getStornoDateFormatted()
|
||||
{
|
||||
return isset($this->attributes['storno_date']) ? Carbon::parse($this->attributes['storno_date'])->format('d.m.Y') : '';
|
||||
}
|
||||
|
||||
public function setStornoDateAttribute($value)
|
||||
{
|
||||
if (!$value) {
|
||||
$this->attributes['storno_date'] = null;
|
||||
} else {
|
||||
$this->attributes['storno_date'] = Carbon::parse($value)->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
|
||||
public function getStornoPrintFormatted()
|
||||
{
|
||||
return isset($this->attributes['storno_print']) ? Carbon::parse($this->attributes['storno_print'])->format('d.m.Y') : '';
|
||||
}
|
||||
|
||||
public function setStornoPrintAttribute($value)
|
||||
{
|
||||
if (!$value) {
|
||||
$this->attributes['storno_print'] = null;
|
||||
} else {
|
||||
$this->attributes['storno_print'] = Carbon::parse($value)->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue