Update Framework, Invoices
This commit is contained in:
parent
cc5c147c27
commit
9b0b5feb7e
174 changed files with 28356 additions and 8093 deletions
229
app/Models/UserInvoiceCredit.php
Normal file
229
app/Models/UserInvoiceCredit.php
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class UserInvoiceCredit
|
||||
*
|
||||
* @property int $id
|
||||
* @property int|null $auth_user_id
|
||||
* @property int|null $shopping_order_id
|
||||
* @property int|null $shopping_user_id
|
||||
* @property string $type
|
||||
* @property string|null $full_number
|
||||
* @property int|null $number
|
||||
* @property float|null $net
|
||||
* @property float|null $tax_rate
|
||||
* @property float|null $tax
|
||||
* @property float|null $total
|
||||
* @property string|null $file
|
||||
* @property string|null $contents
|
||||
* @property string|null $infos
|
||||
* @property string|null $subject
|
||||
* @property string|null $address
|
||||
* @property bool $paid
|
||||
* @property Carbon|null $paid_date
|
||||
* @property int|null $cancellation_id
|
||||
* @property Carbon|null $cancellation_date
|
||||
* @property int $status
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property string|null $deleted_at
|
||||
* @property User|null $user
|
||||
* @property UserInvoiceCredit|null $user_invoice_credit
|
||||
* @property ShoppingOrder|null $shopping_order
|
||||
* @property ShoppingUser|null $shopping_user
|
||||
* @property Collection|UserInvoiceCredit[] $user_invoice_credits
|
||||
* @package App\Models
|
||||
* @property-read int|null $user_invoice_credits_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|UserInvoiceCredit onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereAddress($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereAuthUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereCancellationDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereCancellationId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereContents($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereFile($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereFullNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereInfos($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereNet($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit wherePaid($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit wherePaidDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereShoppingOrderId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereShoppingUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereSubject($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereTax($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereTaxRate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserInvoiceCredit whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|UserInvoiceCredit withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|UserInvoiceCredit withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserInvoiceCredit extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $table = 'user_invoice_credits';
|
||||
|
||||
protected $casts = [
|
||||
'auth_user_id' => 'int',
|
||||
'shopping_order_id' => 'int',
|
||||
'shopping_user_id' => 'int',
|
||||
'number' => 'int',
|
||||
'year' => 'int',
|
||||
'month' => 'int',
|
||||
'net' => 'float',
|
||||
'tax_rate' => 'float',
|
||||
'tax' => 'float',
|
||||
'total' => 'float',
|
||||
'paid' => 'bool',
|
||||
'cancellation_id' => 'int',
|
||||
'status' => 'int',
|
||||
'file' => 'array',
|
||||
'contents' => 'array',
|
||||
'infos' => 'array',
|
||||
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'paid_date',
|
||||
'cancellation_date'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'auth_user_id',
|
||||
'shopping_order_id',
|
||||
'shopping_user_id',
|
||||
'type',
|
||||
'year',
|
||||
'month',
|
||||
'full_number',
|
||||
'number',
|
||||
'net',
|
||||
'tax_rate',
|
||||
'tax',
|
||||
'total',
|
||||
'file',
|
||||
'contents',
|
||||
'infos',
|
||||
'subject',
|
||||
'address',
|
||||
'paid',
|
||||
'paid_date',
|
||||
'cancellation_id',
|
||||
'cancellation_date',
|
||||
'status'
|
||||
];
|
||||
|
||||
public static $monthNames = [
|
||||
1 => 'Januar',
|
||||
2 => 'Februar',
|
||||
3 => 'März',
|
||||
4 => 'April',
|
||||
5 => 'Mai',
|
||||
6 => 'Juni',
|
||||
7 => 'Juli',
|
||||
8 => 'August',
|
||||
9 => 'September',
|
||||
10 => 'Oktober',
|
||||
11 => 'November',
|
||||
12 => 'Dezember'
|
||||
];
|
||||
|
||||
public static $statusTypes = [
|
||||
0 => 'offen',
|
||||
1 => 'bezahlt',
|
||||
2 => 'prüfen',
|
||||
10 => 'storniert'
|
||||
];
|
||||
|
||||
public static $statusColors = [
|
||||
0 => 'warning',
|
||||
1 => 'success',
|
||||
2 => 'secondary',
|
||||
10 => 'danger',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(\App\User::class, 'auth_user_id');
|
||||
}
|
||||
|
||||
public function user_invoice_credit()
|
||||
{
|
||||
return $this->belongsTo(UserInvoiceCredit::class, 'cancellation_id');
|
||||
}
|
||||
|
||||
public function shopping_order()
|
||||
{
|
||||
return $this->belongsTo(ShoppingOrder::class);
|
||||
}
|
||||
|
||||
public function shopping_user()
|
||||
{
|
||||
return $this->belongsTo(ShoppingUser::class);
|
||||
}
|
||||
|
||||
public function user_invoice_credits()
|
||||
{
|
||||
return $this->hasMany(UserInvoiceCredit::class, 'cancellation_id');
|
||||
}
|
||||
|
||||
public function getPaidDateAttribute($value){
|
||||
return $this->attributes['paid_date'] ? Carbon::parse($this->attributes['paid_date'])->format(\Util::formatDateDB()) : '';
|
||||
}
|
||||
public function setPaidDateAttribute( $value ) {
|
||||
$this->attributes['paid_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function getPaidDateRaw(){
|
||||
return isset($this->attributes['paid_date']) ? $this->attributes['paid_date'] : NULL;
|
||||
}
|
||||
|
||||
public function getCancellationDateAttribute($value){
|
||||
return $this->attributes['cancellation_date'] ? Carbon::parse($this->attributes['cancellation_date'])->format(\Util::formatDateDB()) : '';
|
||||
}
|
||||
public function setCancellationDateAttribute( $value ) {
|
||||
$this->attributes['cancellation_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
|
||||
}
|
||||
public function getCancellationDateRaw(){
|
||||
return isset($this->attributes['cancellation_date']) ? $this->attributes['cancellation_date'] : NULL;
|
||||
}
|
||||
|
||||
public static function getYearRange()
|
||||
{
|
||||
$start = 2021;
|
||||
$end = date("Y");
|
||||
return array_reverse(range($start, $end));
|
||||
}
|
||||
|
||||
public static function getMonthName($month)
|
||||
{
|
||||
return isset(self::$monthNames[$month]) ? self::$monthNames[$month] : $month;
|
||||
}
|
||||
|
||||
public function getStatusType(){
|
||||
return isset(self::$statusTypes[$this->status]) ? self::$statusTypes[$this->status] : "";
|
||||
}
|
||||
|
||||
public function getStatusColor(){
|
||||
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : "default";
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue