This commit is contained in:
Kevin Adametz 2024-08-05 12:05:24 +02:00
parent 04d677d37a
commit bfa3bb1df4
1191 changed files with 637397 additions and 10619 deletions

View file

@ -61,6 +61,12 @@ use App\User;
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereSyslog($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereInfo($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereStatusPoints($value)
* @property int|null $month_KP_points
* @property int|null $month_TP_points
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereMonthKPPoints($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereMonthTPPoints($value)
* @property int|null $status_turnover
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereStatusTurnover($value)
* @mixin \Eloquent
*/
class UserSalesVolume extends Model
@ -78,6 +84,7 @@ class UserSalesVolume extends Model
'month_TP_points' => 'int',
'month_shop_points' => 'int',
'status_points' => 'int',
'status_turnover' => 'int',
'total_net' => 'float',
'month_total_net' => 'float',
'month_shop_total_net' => 'float',
@ -101,6 +108,7 @@ class UserSalesVolume extends Model
'month_TP_points',
'month_shop_points',
'status_points',
'status_turnover',
'total_net',
'month_total_net',
'month_shop_total_net',
@ -112,18 +120,23 @@ class UserSalesVolume extends Model
public static $statusPointsTypes = [
1 => 'KP + TP', //Eigene + Team
2 => 'KP', //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
];
public static $statusTypes = [
0 => 'nicht zugewiesen',
1 => 'Beraterbestellung', //hinzugefügt aus
2 => 'Shopbestellung', //hinzugefügt aus
3 => 'Shopbestellung / pending', //hinzugefügt aus
4 => 'Gutschrift', //hinzugefügt aus
5 => 'Registrierung', //hinzugefügt aus
10 => ''
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 => ''
];
public static $statusColors = [
@ -173,7 +186,23 @@ class UserSalesVolume extends Model
}
public function getStatusType(){
return isset(self::$statusTypes[$this->status]) ? self::$statusTypes[$this->status] : "";
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);
}
return $ret;
}
public static function getTransTurnoverTypes(){
$ret = [];
foreach(self::$statusTurnoverTypes as $key=>$val){
$ret[$key] = trans('payment.'.$val);
}
return $ret;
}
public function getStatusColor(){
@ -187,6 +216,43 @@ class UserSalesVolume extends Model
return isset(self::$statusColors[$this->status_points]) ? self::$statusColors[$this->status_points] : "default";
}
public function getStatusTurnoverType(){
switch ($this->status) {
case 1: //Bestellung Berater
return 'E';
case 2: //Shop
return 'S';
case 4: //Gutschrift
if($this->status_turnover === 2){
return 'S';
}else{
return 'E';
}
case 5: //Registrierung
return 'E';
}
return "";
}
public function getStatusTurnoverColor(){
switch ($this->status) {
case 1: //Bestellung Berater
return 'success';
case 2: //Shop
return 'secondary';
case 4: //Gutschrift
if($this->status_turnover === 2){
return 'secondary';
}else{
return 'success';
}
case 5: //Registrierung
return 'success';
}
return "default";
}
public function getFormatedMonthYear(){
return str_pad($this->month, 2, "0", STR_PAD_LEFT)."/".$this->year;
}
@ -197,4 +263,11 @@ class UserSalesVolume extends Model
}
return false;
}
public function caluCommissonTotalNet($margin){
if($this->total_net > 0 && $margin > 0){
return $this->total_net / 100 * $margin;
}
return 0;
}
}