last changes since 6-2023
This commit is contained in:
parent
0341c9c189
commit
04d677d37a
142 changed files with 7895 additions and 2855 deletions
|
|
@ -1,9 +1,10 @@
|
|||
<?php
|
||||
namespace App\Services\BusinessPlan;
|
||||
|
||||
use App\Models\UserBusinessStructure;
|
||||
use App\User;
|
||||
use stdClass;
|
||||
use Carbon;
|
||||
use App\Models\UserBusinessStructure;
|
||||
|
||||
class TreeCalcBot
|
||||
{
|
||||
|
|
@ -24,7 +25,7 @@ class TreeCalcBot
|
|||
public function __construct($month, $year, $init_from = 'member')
|
||||
{
|
||||
$this->date = new stdClass();
|
||||
$date = \Carbon::parse($year.'-'.$month.'-1');
|
||||
$date = Carbon::parse($year.'-'.$month.'-1');
|
||||
$this->date->month = $month;
|
||||
$this->date->year = $year;
|
||||
$this->date->start_date = $date->format('Y-m-d H:i:s');
|
||||
|
|
@ -49,7 +50,7 @@ class TreeCalcBot
|
|||
|
||||
public function initStructureUser($user_id)
|
||||
{
|
||||
|
||||
|
||||
$BusinessUserItem = new BusinessUserItem($this->date);
|
||||
$BusinessUserItem->makeUser($user_id);
|
||||
$BusinessUserItem->addUserID();
|
||||
|
|
@ -63,13 +64,10 @@ class TreeCalcBot
|
|||
$this->readStoredSponsorUser($this->business_users[0]->sponsor->user_id);
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
$this->readParentsUsers();
|
||||
$this->readSponsorUser($user_id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -79,12 +77,14 @@ class TreeCalcBot
|
|||
$this->business_user->makeUser($user->id);
|
||||
$this->business_user->checkSponsor($user);
|
||||
if(!$this->business_user->isSave()){
|
||||
//Aufbau der Struktur für den User in die unendliche Tiefe.
|
||||
$this->business_user->readParentsBusinessUsers();
|
||||
//calculate Lines
|
||||
//calculate Points in Lines
|
||||
if(count($this->business_user->businessUserItems) > 0){
|
||||
$this->calcUserTP($this->business_user->businessUserItems, 1);
|
||||
$this->calcUserPoints($this->business_user->businessUserItems, 1);
|
||||
}
|
||||
$this->business_user->calcQualTP();
|
||||
//qualifikation nach qual_kp (KundenPoints) und qual_pp (PaylinePoints)
|
||||
$this->business_user->calcQualPP();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ class TreeCalcBot
|
|||
return false;
|
||||
}
|
||||
|
||||
private function calcUserTP($businessUserItems, $line){
|
||||
private function calcUserPoints($businessUserItems, $line){
|
||||
if(!isset($this->business_user->business_lines[$line])){
|
||||
$obj = new stdClass();
|
||||
$obj->points = 0;
|
||||
|
|
@ -110,10 +110,12 @@ class TreeCalcBot
|
|||
}
|
||||
foreach($businessUserItems as $business_user_item){
|
||||
if(count($business_user_item->businessUserItems) > 0){
|
||||
$this->calcUserTP($business_user_item->businessUserItems, $line+1);
|
||||
$this->calcUserPoints($business_user_item->businessUserItems, $line+1);
|
||||
}
|
||||
$this->business_user->addBusinessLinePoints($line, $business_user_item->sales_volume_points_sum);
|
||||
$this->business_user->addTotalTP($business_user_item->sales_volume_points_sum);
|
||||
//business_lines points nach line
|
||||
$this->business_user->addBusinessLinePoints($line, $business_user_item->sales_volume_points_TP_sum); //TP + Shop Points
|
||||
//total_pp gesamte Punkte
|
||||
$this->business_user->addTotalTP($business_user_item->sales_volume_points_TP_sum); //TP + Shop Points
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -259,7 +261,8 @@ class TreeCalcBot
|
|||
private function addItem($item, $deep){
|
||||
|
||||
$button = '';
|
||||
if(($this->init_from === 'admin' && \Auth::user()->isAdmin()) || ($this->init_from === 'member' && \Auth::user()->id === $item->user_id)){
|
||||
|
||||
if(($this->init_from === 'admin' && \Auth::user()->isAdmin()) || ($this->init_from === 'member')){ // && \Auth::user()->id === $item->user_id
|
||||
$button = ' | <button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
|
||||
data-id="'.$item->user_id.'"
|
||||
data-action="business-user-detail"
|
||||
|
|
@ -280,7 +283,7 @@ class TreeCalcBot
|
|||
<strong>'.$item->first_name.' '.$item->last_name.'</strong> <a href="mailto: '.$item->email.'">'.$item->email.'</a> <span class="badge badge-outline-default '.($item->active_account ? '' : 'text-muted').'">'.$item->user_level_name.' | '.$item->m_account.'</span>
|
||||
<br><span class="small">'.
|
||||
($item->active_account ?
|
||||
'<strong>Gesamte Points: '.$item->sales_volume_points_sum.'</strong> | E: '.$item->sales_volume_points.' | S: '.$item->sales_volume_points_shop.' <strong>
|
||||
'<strong>Gesamte Points: '.$item->sales_volume_points_sum.'</strong> | E: '.$item->sales_volume_KP_points.' | S: '.$item->sales_volume_points_shop.' <strong>
|
||||
| Umsatz netto: '.formatNumber($item->sales_volume_total_sum).' €</strong> | E: '.formatNumber($item->sales_volume_total).' € | S: '.formatNumber($item->sales_volume_total_shop).' €'.
|
||||
$button
|
||||
:
|
||||
|
|
@ -324,7 +327,7 @@ class TreeCalcBot
|
|||
<strong>'.$item->first_name.' '.$item->last_name.'</strong> <a href="mailto: '.$item->email.'">'.$item->email.'</a> <span class="badge badge-outline-default '.($item->active_account ? '' : 'text-muted').'">'.$item->user_level_name.' | '.$item->m_account.'</span>
|
||||
<br><span class="small">'.
|
||||
($item->active_account ?
|
||||
'<strong>Gesamte Points: '.$item->sales_volume_points_sum.'</strong> | E: '.$item->sales_volume_points.' | S: '.$item->sales_volume_points_shop.' <strong>
|
||||
'<strong>Gesamte Points: '.$item->sales_volume_points_sum.'</strong> | E: '.$item->sales_volume_KP_points.' | S: '.$item->sales_volume_points_shop.' <strong>
|
||||
| Umsatz netto: '.formatNumber($item->sales_volume_total_sum).' €</strong> | E: '.formatNumber($item->sales_volume_total).' € | S: '.formatNumber($item->sales_volume_total_shop).' €'.
|
||||
' | <button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
|
||||
data-id="'.$item->user_id.'"
|
||||
|
|
@ -356,7 +359,7 @@ class TreeCalcBot
|
|||
if($this->init_from === 'admin'){
|
||||
$ret .= '<br><span class="small">'.
|
||||
($this->sponsor->active_account ?
|
||||
'<strong>Gesamte Points: '.$this->sponsor->sales_volume_points_sum.'</strong> | E: '.$this->sponsor->sales_volume_points.' | S: '.$this->sponsor->sales_volume_points_shop.' <strong>
|
||||
'<strong>Gesamte Points: '.$this->sponsor->sales_volume_points_sum.'</strong> | E: '.$this->sponsor->sales_volume_KP_points.' | S: '.$this->sponsor->sales_volume_points_shop.' <strong>
|
||||
| Umsatz netto: '.formatNumber($this->sponsor->sales_volume_total_sum).' €</strong> | E: '.formatNumber($this->sponsor->sales_volume_total).' € | S: '.formatNumber($this->sponsor->sales_volume_total_shop).' €'
|
||||
:
|
||||
'Account bis: '.$this->sponsor->payment_account_date).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue