23-01-2026

This commit is contained in:
Kevin Adametz 2026-01-23 17:35:23 +01:00
parent a939cd51ef
commit a8b395e20d
248 changed files with 29342 additions and 4805 deletions

View file

@ -79,10 +79,10 @@ class UserSalesVolume extends Model
'user_invoice_id' => 'int',
'month' => 'int',
'year' => 'int',
'points' => 'int',
'month_KP_points' => 'int',
'month_TP_points' => 'int',
'month_shop_points' => 'int',
'points' => 'float',
'month_KP_points' => 'float',
'month_TP_points' => 'float',
'month_shop_points' => 'float',
'status_points' => 'int',
'status_turnover' => 'int',
'total_net' => 'float',
@ -120,34 +120,34 @@ class UserSalesVolume extends Model
public static $statusPointsTypes = [
1 => 'KU + TP', //Eigene + Team
2 => 'KU', //nur Eigene nicht Team
];
1 => 'KU + TP', //Eigene + Team
2 => 'KU', //nur Eigene nicht Team
];
public static $statusTurnoverTypes = [
1 => 'advisor_order', //hinzugefügt aus
2 => 'shoporder', //hinzugefügt aus
];
1 => 'advisor_order', //hinzugefügt aus
2 => 'shoporder', //hinzugefügt aus
];
public static $statusTypes = [
0 => 'not_assigned',
1 => 'advisor_order', //hinzugefügt aus
2 => 'shoporder', //hinzugefügt aus
3 => 'shoporder_pending', //hinzugefügt aus
0 => 'not_assigned',
1 => 'advisor_order', //hinzugefügt aus
2 => 'shoporder', //hinzugefügt aus
3 => 'shoporder_pending', //hinzugefügt aus
4 => 'credit', //hinzugefügt aus
5 => 'registration', //hinzugefügt aus
// 10 => ''
];
// 10 => ''
];
public static $statusColors = [
0 => 'warning',
0 => 'warning',
1 => 'success',
2 => 'secondary',
2 => 'secondary',
3 => 'warning',
4 => 'info',
5 => 'info',
10 => 'danger',
];
];
public function shopping_order()
{
@ -164,110 +164,168 @@ class UserSalesVolume extends Model
return $this->belongsTo(UserInvoice::class);
}
public function getDateAttribute(){
return $this->attributes['date'] ? Carbon::parse($this->attributes['date'])->format(\Util::formatDateDB()) : '';
}
public function setDateAttribute( $value ) {
$this->attributes['date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
}
public function getDateRaw(){
return isset($this->attributes['date']) ? $this->attributes['date'] : NULL;
}
public function getDateAttribute()
{
return $this->attributes['date'] ? Carbon::parse($this->attributes['date'])->format(\Util::formatDateDB()) : '';
}
public function setDateAttribute($value)
{
$this->attributes['date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
}
public function getDateRaw()
{
return isset($this->attributes['date']) ? $this->attributes['date'] : NULL;
}
public function getPointsKPSum(){
// Points Setter/Getter für deutsches Zahlenformat
public function setPointsAttribute($value)
{
$this->attributes['points'] = $value !== null ? \Util::reFormatNumber($value) : null;
}
public function setMonthKPPointsAttribute($value)
{
$this->attributes['month_KP_points'] = $value !== null ? \Util::reFormatNumber($value) : null;
}
public function setMonthTPPointsAttribute($value)
{
$this->attributes['month_TP_points'] = $value !== null ? \Util::reFormatNumber($value) : null;
}
public function setMonthShopPointsAttribute($value)
{
$this->attributes['month_shop_points'] = $value !== null ? \Util::reFormatNumber($value) : null;
}
public function getFormattedPoints()
{
return isset($this->attributes['points']) ? \Util::formatNumber($this->attributes['points']) : "";
}
public function getFormattedMonthKPPoints()
{
return isset($this->attributes['month_KP_points']) ? \Util::formatNumber($this->attributes['month_KP_points']) : 0;
}
public function getFormattedMonthTPPoints()
{
return isset($this->attributes['month_TP_points']) ? \Util::formatNumber($this->attributes['month_TP_points']) : 0;
}
public function getFormattedMonthShopPoints()
{
return isset($this->attributes['month_shop_points']) ? \Util::formatNumber($this->attributes['month_shop_points']) : 0;
}
public function getPointsKPSum()
{
return $this->month_KP_points + $this->month_shop_points; //only KP für SUM - KP is for User
}
public function getPointsTPSum(){
public function getPointsTPSum()
{
return $this->month_TP_points + $this->month_shop_points; //only TP für SUM - TP is only for Payline
}
public function getTotalNetSum(){
public function getTotalNetSum()
{
return $this->month_total_net + $this->month_shop_total_net;
}
public function getStatusType(){
return isset(self::$statusTypes[$this->status]) ? __('payment.'.self::$statusTypes[$this->status]) : "";
}
public static function getTransStatusType(){
public function getStatusType()
{
return isset(self::$statusTypes[$this->status]) ? __('payment.' . self::$statusTypes[$this->status]) : "";
}
public static function getTransStatusType()
{
$ret = [];
foreach(self::$statusTypes as $key=>$val){
$ret[$key] = trans('payment.'.$val);
foreach (self::$statusTypes as $key => $val) {
$ret[$key] = trans('payment.' . $val);
}
return $ret;
}
}
public static function getTransTurnoverTypes(){
public static function getTransTurnoverTypes()
{
$ret = [];
foreach(self::$statusTurnoverTypes as $key=>$val){
$ret[$key] = trans('payment.'.$val);
foreach (self::$statusTurnoverTypes as $key => $val) {
$ret[$key] = trans('payment.' . $val);
}
return $ret;
}
}
public function getStatusColor(){
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : "default";
}
public function getStatusColor()
{
return isset(self::$statusColors[$this->status]) ? self::$statusColors[$this->status] : "default";
}
public function getStatusPointsType(){
return isset(self::$statusPointsTypes[$this->status_points]) ? self::$statusPointsTypes[$this->status_points] : "";
}
public function getStatusPointsColor(){
return isset(self::$statusColors[$this->status_points]) ? self::$statusColors[$this->status_points] : "default";
}
public function getStatusPointsType()
{
return isset(self::$statusPointsTypes[$this->status_points]) ? self::$statusPointsTypes[$this->status_points] : "";
}
public function getStatusPointsColor()
{
return isset(self::$statusColors[$this->status_points]) ? self::$statusColors[$this->status_points] : "default";
}
public function getStatusTurnoverType(){
public function getStatusTurnoverType()
{
switch ($this->status) {
case 1: //Bestellung Berater
return 'E';
return 'E';
case 2: //Shop
return 'S';
case 4: //Gutschrift
if($this->status_turnover === 2){
return 'S';
}else{
if ($this->status_turnover === 2) {
return 'S';
} else {
return 'E';
}
}
case 5: //Registrierung
return 'E';
return 'E';
}
return "";
}
public function getStatusTurnoverColor(){
return "";
}
public function getStatusTurnoverColor()
{
switch ($this->status) {
case 1: //Bestellung Berater
return 'success';
return 'success';
case 2: //Shop
return 'secondary';
case 4: //Gutschrift
if($this->status_turnover === 2){
return 'secondary';
}else{
if ($this->status_turnover === 2) {
return 'secondary';
} else {
return 'success';
}
}
case 5: //Registrierung
return 'success';
return 'success';
}
return "default";
}
public function getFormatedMonthYear(){
return str_pad($this->month, 2, "0", STR_PAD_LEFT)."/".$this->year;
return "default";
}
public function isCurrentMonthYear(){
if($this->month === intval(date('m')) && $this->year === intval(date('Y'))){
public function getFormatedMonthYear()
{
return str_pad($this->month, 2, "0", STR_PAD_LEFT) . "/" . $this->year;
}
public function isCurrentMonthYear()
{
if ($this->month === intval(date('m')) && $this->year === intval(date('Y'))) {
return true;
}
return false;
}
public function caluCommissonTotalNet($margin){
if($this->total_net > 0 && $margin > 0){
public function caluCommissonTotalNet($margin)
{
if ($this->total_net > 0 && $margin > 0) {
return $this->total_net / 100 * $margin;
}
return 0;
}
}
}