#51 Festschreiben der Points, Gutschriftenmodul

This commit is contained in:
Kevin Adametz 2022-07-29 18:18:05 +02:00
parent dfd049aaa9
commit 3f2fbd6d5b
63 changed files with 4610 additions and 971 deletions

2
.env
View file

@ -21,7 +21,7 @@ APP_CHECKOUT_TEST_MAIL=kevin.adametz@me.com
APP_INFO_TEST_MAIL=kevin.adametz@me.com
APP_MAIN_TAX = 1.19
APP_SHIPPING_TAX = 19
APP_MAIN_TAX_RATE = 19
LOG_CHANNEL=stack

View file

@ -0,0 +1,78 @@
<?php
namespace App\Console\Commands;
use App\Models\Setting;
use Illuminate\Console\Command;
use App\Cron\BusinessUsersStore;
class BusinessStore extends Command
{
/**
* php artisan business:store month year
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'business:store {month} {year}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create Business Structur and UserDetails';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$day = (int) Setting::getContentBySlug('day-exectute-business-structur');
$this->info('RUN Command BusinessStore on Day '. $day);
$timeStart = microtime(true);
$this->info('RUN Command BusinessStore');
$month = $this->argument('month');
$year = $this->argument('year');
if(!$month || !$year){
$this->info('need arguments month & year');
return 0;
}
//$this->info('month: '.$month.' year:'.$year);
for($i = 1; $i<=6; $i++){
$month = $i;
$this->info('month: '.$month.' year:'.$year);
$businessUsersStore = new BusinessUsersStore($month, $year);
$businessUsersStore->storeUserBusinessStructure();
$businessUsersStore->storeBusinessUsersDetail();
$bool = $businessUsersStore->storeBusinessCompleted();
$diff = microtime(true) - $timeStart;
$sec = intval($diff);
$micro = $diff - $sec;
$this->info('BusinessStore: '.$bool. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
}
//$this->info('END Command BusinessStore: '.$bool. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
// \Log::info('Cron is running');
//return 0;
}
}

View file

@ -2,6 +2,7 @@
namespace App\Console;
use App\Console\Commands\BusinessStore;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
@ -13,7 +14,7 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
//
BusinessStore::class,
];
/**

View file

@ -0,0 +1,159 @@
<?php
namespace App\Cron;
use App\User;
use stdClass;
use App\Models\UserBusinessStructure;
use App\Services\BusinessPlan\TreeCalcBot;
class BusinessUsersStore
{
private $month;
private $year;
private $user_business_structure;
private $users_structure = [];
public function __construct($month, $year)
{
$this->month = $month;
$this->year = $year;
}
public function getStoreUserBusinessStructure(){
return UserBusinessStructure::where('year', $this->year)->where('month', $this->month)->first();
}
public function storeUserBusinessStructure()
{
if($this->user_business_structure = $this->getStoreUserBusinessStructure()){
return $this->user_business_structure;
}
$treeCalcBot = new TreeCalcBot($this->month, $this->year, 'admin');
//only load, when no structur is save
$treeCalcBot->initStructureAdmin(false);
$this->storeStructure($treeCalcBot);
}
public function storeBusinessUsersDetail()
{
if(!$this->user_business_structure){
$this->user_business_structure = $this->getStoreUserBusinessStructure();
if(!$this->user_business_structure){
abort(403, 'not found UserBusinessStructure');
}
}
foreach($this->user_business_structure->users as $user_id=>$completed){
if($completed === 0){
$user = User::findOrFail($user_id);
$TreeCalcBot = new TreeCalcBot($this->month, $this->year, 'admin');
$TreeCalcBot->initBusinesslUserDetail($user);
if(!$TreeCalcBot->business_user){
abort(403, 'not found TreeCalcBot->business_user');
}
$this->storeBusinesslUser($TreeCalcBot->business_user);
$users = $this->user_business_structure->users;
$users[$user_id] = 1;
$this->user_business_structure->users = $users;
$this->user_business_structure->save();
}
}
}
public function storeBusinesslUser($business_user){
$b_user = $business_user->getBUser();
$b_user->user_items = $this->storeUserItems($business_user->businessUserItems, 1);
$b_user->b_structure_id = $this->user_business_structure->id;
$b_user->save();
}
public function storeBusinessCompleted(){
if(!$this->user_business_structure){
$this->user_business_structure = $this->getStoreUserBusinessStructure();
}
foreach($this->user_business_structure->users as $user_id=>$completed){
if($completed === 0){
return false;
}
$this->user_business_structure->completed = 1;
$this->user_business_structure->save();
}
return true;
}
private function storeUserItems($userItems, $line){
$ret = [];
foreach($userItems as $userItem){
$temp = null;
if(count($userItem->businessUserItems) > 0){
$temp = $this->storeUserItems($userItem->businessUserItems, $line+1);
}
$obj = new stdClass();
$obj->user_id = $userItem->user_id;
$obj->line = $line;
$obj->points = $userItem->sales_volume_points_sum;
$obj->parents = $temp;
$ret[] = $obj;
}
return $ret;
}
private function storeStructure($treeCalcBot)
{
/*if($this->user_business_structure = $this->getStoreUserBusinessStructure()){
return $this->user_business_structure;
}*/
$structure = [];
foreach($treeCalcBot->business_users as $business_user){
$structure[] = $this->storeStructureItem($business_user, 0);
}
$parentless = [];
if($treeCalcBot->parentless){
foreach($treeCalcBot->parentless as $pless){
$parentless[] = $this->storeStructureItem($pless, 0);
}
}
$fill = [
'month' => $this->month,
'year' => $this->year,
'structure' => $structure,
'parentless' => $parentless,
'users' => $this->users_structure,
'completed' => false,
'status' => 0
];
$this->user_business_structure = UserBusinessStructure::create($fill);
return $this->user_business_structure;
}
private function storeStructureItem($item, $deep){
$temp = null;
if($item->businessUserItems){
foreach($item->businessUserItems as $parent){
$temp[] = $this->storeStructureItem($parent, $deep+1);
}
}
$this->users_structure[$item->user_id] = 0;
$obj = new stdClass();
$obj->user_id = $item->user_id;
//$obj->name = $item->first_name .' '. $item->last_name ;
$obj->email = $item->email;
$obj->deep = $deep;
//$obj->points = $item->sales_volume_points_sum;
$obj->parents = $temp;
return $obj;
}
}

View file

@ -2,11 +2,13 @@
namespace App\Http\Controllers;
use App\Services\BusinessPlan\TreeCalcBot;
use Request;
use App\User;
use Carbon\Carbon;
use App\Models\UserBusiness;
use App\Services\HTMLHelper;
use App\Models\UserBusinessStructure;
use App\Services\BusinessPlan\TreeCalcBot;
class BusinessController extends Controller
@ -21,7 +23,6 @@ class BusinessController extends Controller
public function show()
{
$this->setFilterVars();
$data = [
'filter_months' => HTMLHelper::$months,
'filter_years' => HTMLHelper::getYearRange(),
@ -31,12 +32,15 @@ class BusinessController extends Controller
return view('admin.business.show', $data);
}
public function structure()
{
$this->setFilterVars();
$TreeCalcBot = new TreeCalcBot(session('business_user_filter_month'), session('business_user_filter_year'), 'admin');
$TreeCalcBot->initMain();
$this->month = session('business_user_filter_month');
$this->year = session('business_user_filter_year');
$TreeCalcBot = new TreeCalcBot($this->month, $this->year, 'admin');
$TreeCalcBot->initStructureAdmin();
$data = [
'filter_months' => HTMLHelper::$months,
'filter_years' => HTMLHelper::getYearRange(),
@ -50,18 +54,31 @@ class BusinessController extends Controller
$user = User::findOrFail($user_id);
$this->setFilterVars();
$TreeCalcBot = new TreeCalcBot(session('business_user_filter_month'), session('business_user_filter_year'), 'admin');
$TreeCalcBot->initDetailUser($user);
if(!$TreeCalcBot->user){
$data = [];
$data['month'] = session('business_user_filter_month');
$data['year'] = session('business_user_filter_year');
$TreeCalcBot = new TreeCalcBot($data['month'], $data['year'], 'admin');
$TreeCalcBot->initBusinesslUserDetail($user);
if(!$TreeCalcBot->business_user){
abort(403, 'no user found');
}
$data = [
'month' => HTMLHelper::getMonth(session('business_user_filter_month')),
'year' => session('business_user_filter_year'),
'TreeCalcBot' => $TreeCalcBot,
'user' => $user,
];
return view('admin.business.user_detail', $data);
return view('admin.business.user_detail', compact('TreeCalcBot', 'user', 'data'));
}
public function userStore($user_id)
{
dd('function on: App\Console\Commands\BusinessStore');
/*$data = Request::all();
$user = User::findOrFail($data['user_id']);
$TreeCalcBot = new TreeCalcBot($data['month'], $data['year'], 'admin');
$TreeCalcBot->initBusinesslUserDetail($user);
if(!$TreeCalcBot->business_user){
abort(403, 'no user found');
}
//$TreeCalcBot->storeBusinesslUser();*/
//return back();
}
private function setFilterVars(){
@ -90,12 +107,123 @@ class BusinessController extends Controller
}
}
private function initSearch($archive = false, $request = true)
public function userDatatable()
{
$this->setFilterVars();
$this->month = Request::get('business_user_filter_month');
$this->year = Request::get('business_user_filter_year');
//only the currently month get from Users -> older month from UserBusiness
//return $this->userCurrentlyDatatable();
if(TreeCalcBot::isFromStored($this->month, $this->year)){
return $this->userStoredDatatable();
}else{
return $this->userCurrentlyDatatable();
}
}
private function initStoredSearch($archive = false, $request = true)
{
$this->setFilterVars();
$query = UserBusiness::select('user_businesses.*')->where('month', $this->month)->where('year', $this->year);
if(Request::get('business_user_filter_active')){
if(Request::get('business_user_filter_active') == 1){
$query->where('user_businesses.active_account', 1);
}
if(Request::get('business_user_filter_active') == 2){
$query->where('user_businesses.active_account', 0);
}
if(Request::get('business_user_filter_active') == 3){
//both -> payment_account only not null
}
}
return $query;
}
private function userStoredDatatable()
{
$query = $this->initStoredSearch();
return \DataTables::eloquent($query)
->addColumn('id', function (UserBusiness $userBusiness) {
return '<button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="'.$userBusiness->user_id.'"
data-action="business-user-detail"
data-back=""
data-modal="modal-xl"
data-init_from="admin"
data-route="'.route('modal_load').'"><span class="far fa-calculator"></span></button>';
//.'<a href="' . route('admin_business_user_detail', [$userBusiness->user_id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-calculator"></span></a>';
})
->addColumn('m_account', function (UserBusiness $userBusiness) {
return $userBusiness->m_account;
})
->addColumn('user_level', function (UserBusiness $userBusiness) {
return $userBusiness->user_level_name;
})
->addColumn('is_qual_kp', function (UserBusiness $userBusiness) {
if($userBusiness->m_level_id){
$isQualKP = ($userBusiness->sales_volume_points_sum >= $userBusiness->qual_kp) ? true : false;
return '<span class="badge '.($isQualKP ? 'badge-outline-success' : 'badge-outline-danger').'"> KD '.$userBusiness->qual_kp.'</span>';
}
return '-';
})
->addColumn('sales_volume_points', function (UserBusiness $userBusiness) {
return '<div class="no-line-break">'.$userBusiness->sales_volume_points_sum.'</div>'.
'<span class="small no-line-break">B: '.$userBusiness->sales_volume_points.' | S: '.$userBusiness->sales_volume_points_shop.'</span>';
})
->addColumn('sales_volume_total', function (UserBusiness $userBusiness) {
return '<div class="no-line-break">'.formatNumber($userBusiness->sales_volume_total_sum).' &euro;</div>'.
'<span class="small no-line-break">B: '.formatNumber($userBusiness->sales_volume_total).' | S: '.formatNumber($userBusiness->sales_volume_total_shop).'</span>';
})
->addColumn('email', function (UserBusiness $userBusiness) {
return $userBusiness->email;
})
->addColumn('first_name', function (UserBusiness $userBusiness) {
return $userBusiness->first_name;
})
->addColumn('last_name', function (UserBusiness $userBusiness) {
return $userBusiness->last_name;
})
->addColumn('sponsor', function (UserBusiness $userBusiness) {
if($userBusiness->sponsor){
$sponsor = "";
if($userBusiness->sponsor->is_sponsor){
$sponsor .= $userBusiness->sponsor->first_name." ".$userBusiness->sponsor->last_name;
$sponsor .= " &nbsp;".'<button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="'.$userBusiness->sponsor->user_id.'"
data-action="business-user-detail"
data-back=""
data-modal="modal-xl"
data-init_from="admin"
data-route="'.route('modal_load').'"><span class="far fa-calculator"></span></button><br>';
$sponsor .= '<span class="small no-line-break">'.$userBusiness->sponsor->email;
$sponsor .= ' | '.$userBusiness->sponsor->m_account;
$sponsor .= '</span>';
}
return $sponsor;
}
return '-';
})
->addColumn('active_account', function (UserBusiness $userBusiness) {
return get_active_badge($userBusiness->active_account);
})
->addColumn('payment_account_date', function (UserBusiness $userBusiness) {
return $userBusiness->active_date ? formatDate($userBusiness->active_date) : "-";
})
->orderColumn('id', 'id $1')
->orderColumn('active_account', 'payment_account $1')
->rawColumns(['id', 'is_qual_kp', 'sales_volume_points', 'sales_volume_total', 'sponsor', 'active_account'])
->make(true);
}
private function initCurrentlySearch($archive = false, $request = true)
{
$this->setFilterVars();
$query = User::with('account')->select('users.*')
->where('users.deleted_at', '=', null)
->where('users.id', '!=', 1)
@ -114,26 +242,12 @@ class BusinessController extends Controller
//both -> payment_account only not null
}
}
if(Request::get('business_user_filter_name')){
//$query->where('users.account.first_name', 'LIKE', '%'.Request::get('business_user_filter_name').'%');
//$query->where('users.account.last_name', 'LIKE', '%'.Request::get('business_user_filter_name').'%');
//$query->where('users.account.m_account', 'LIKE', '%'.Request::get('business_user_filter_name').'%');
//$query->where('users.email', 'LIKE', '%'.Request::get('business_user_filter_name').'%');
}
//->orderBy('created_at', 'DESC');
/* $query = FlexHour::leftJoin("flex_hour_items", function($join) {
$join->on("flex_hour_items.flex_hour_id","=","flex_hours.id");
$join->where("flex_hour_items.date","=", FlexHourItemBot::$date);
})*/
return $query;
}
public function userDatatable()
private function userCurrentlyDatatable()
{
$query = $this->initSearch();
$query = $this->initCurrentlySearch();
return \DataTables::eloquent($query)
->addColumn('id', function (User $user) {
return '<button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
@ -142,25 +256,40 @@ class BusinessController extends Controller
data-back=""
data-modal="modal-xl"
data-init_from="admin"
data-route="'.route('modal_load').'"><span class="far fa-calculator"></span></button>';
//<a href="' . route('admin_business_user_detail', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-calculator"></span></a>
data-route="'.route('modal_load').'"><span class="far fa-calculator"></span></button>'
.'<a href="' . route('admin_business_user_detail', [$user->id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-calculator"></span></a>';
})
->addColumn('m_account', function (User $user) {
return $user->account ? $user->account->m_account : '';
})
->addColumn('user_level', function (User $user) {
return $user->user_level ? $user->user_level->name : '';
})
->addColumn('active_account', function (User $user) {
return get_active_badge($user->isActiveAccount());
})
->addColumn('payment_account_date', function (User $user) {
return $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
->addColumn('is_qual_kp', function (User $user) {
if($user->user_level){
$qual_kp = $user->user_level->qual_kp;
$sales_volume_points_sum = $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_sum');
$isQualKP = ($sales_volume_points_sum >= $qual_kp) ? true : false;
return '<span class="badge '.($isQualKP ? 'badge-outline-success' : 'badge-outline-danger').'"> KD '.$qual_kp.'</span>';
}
return '-';
})
->addColumn('sales_volume_points', function (User $user) {
return '<div class="no-line-break">'.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_sum').'</div>'.
'<span class="small no-line-break">B: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points').' | S: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_shop').'</span>';
})
->addColumn('sales_volume_total', function (User $user) {
return '<div class="no-line-break">'.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_sum').'</div>'.
'<span class="small no-line-break">B: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total').' | S: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_shop').'</span>';
return '<div class="no-line-break">'.formatNumber($user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_sum')).' &euro;</div>'.
'<span class="small no-line-break">B: '.formatNumber($user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total')).' | S: '.formatNumber($user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_shop')).'</span>';
})
->addColumn('email', function (User $user) {
return $user->email;
})
->addColumn('first_name', function (User $user) {
return $user->account ? $user->account->first_name : '';
})
->addColumn('last_name', function (User $user) {
return $user->account ? $user->account->last_name : '';
})
->addColumn('sponsor', function (User $user) {
if($user->user_sponsor){
@ -175,7 +304,7 @@ class BusinessController extends Controller
data-init_from="admin"
data-route="'.route('modal_load').'"><span class="far fa-calculator"></span></button><br>';
}
$sponsor .= '<span class="small no-line-break">'.$user->email;
$sponsor .= '<span class="small no-line-break">'.$user->user_sponsor->email;
if($user->user_sponsor->account){
$sponsor .= ' | '.$user->user_sponsor->account->m_account;
}
@ -184,51 +313,17 @@ class BusinessController extends Controller
return $sponsor;
}
return '-';
return '<div class="no-line-break">'.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_sum').'</div>'.
'<span class="small no-line-break">B: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total').' | S: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_shop').'</span>';
})
->addColumn('is_qual_kp', function (User $user) {
if($user->user_level){
$qual_kp = $user->user_level->qual_kp;
$sales_volume_points_sum = $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_sum');
$isQualKP = ($sales_volume_points_sum >= $qual_kp) ? true : false;
return '<span class="badge '.($isQualKP ? 'badge-outline-success' : 'badge-outline-danger').'"> KD '.$qual_kp.'</span>';
}
return '-';
->addColumn('active_account', function (User $user) {
return get_active_badge($user->isActiveAccount());
})
/* ->addColumn('sales_volume_points', function (User $user) {
return $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points');
->addColumn('payment_account_date', function (User $user) {
return $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
})
->addColumn('sales_volume_points_shop', function (User $user) {
return $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_shop');
})
->addColumn('sales_volume_points_sum', function (User $user) {
return $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_sum');
})
->addColumn('sales_volume_total', function (User $user) {
return $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total');
})
->addColumn('sales_volume_total_shop', function (User $user) {
return $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_shop');
})
->addColumn('sales_volume_total_sum', function (User $user) {
return $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_sum');
})*/
->orderColumn('id', 'id $1')
->orderColumn('m_account', 'm_account $1')
->orderColumn('first_name', 'first_name $1')
->orderColumn('last_name', 'last_name $1')
->orderColumn('user_level', 'm_level $1')
->orderColumn('active_account', 'payment_account $1')
->rawColumns(['id', 'is_qual_kp', 'confirmed', 'sales_volume_points', 'sales_volume_total', 'sponsor', 'active', 'active_account'])
->rawColumns(['id', 'is_qual_kp', 'sales_volume_points', 'sales_volume_total', 'sponsor', 'active_account'])
->make(true);
}
}

View file

@ -118,7 +118,7 @@ class BusinessPointsController extends Controller
}
}
private function initSearch($archive = false, $request = true)
private function initSearch()
{
$this->setFilterVars();
@ -184,7 +184,7 @@ class BusinessPointsController extends Controller
->orderColumn('id', 'id $1')
->orderColumn('order', 'order $1')
->orderColumn('status', 'status $1')
->orderColumn('status', 'message $1')
->orderColumn('message', 'message $1')
->rawColumns(['id', 'order', 'status', 'message', 'total_net'])
->make(true);

View file

@ -17,13 +17,19 @@ class FileController extends Controller
{
}
private function isPermission($shopping_order){
private function isPermissionShoppingOrder($shopping_order){
$user_id = $shopping_order->auth_user_id ? $shopping_order->auth_user_id : $shopping_order->member_id;
if(Auth::user()->isAdmin() || $user_id == Auth::user()->id){
return true;
}
abort(404);
}
private function isPermissionUserCredit($user_credit){
if(Auth::user()->isAdmin() || $user_credit->user_id == Auth::user()->id){
return true;
}
abort(404);
}
public function show($id = null, $disk = null, $do='file')
@ -43,7 +49,7 @@ class FileController extends Controller
if ($disk === 'invoice'){
$shopping_order = \App\Models\ShoppingOrder::findOrFail($id);
if($shopping_order->user_invoice){
$this->isPermission($shopping_order);
$this->isPermissionShoppingOrder($shopping_order);
$user_invoice = $shopping_order->user_invoice;
$filename = $user_invoice->filename;
$disk = $user_invoice->disk;
@ -53,24 +59,14 @@ class FileController extends Controller
}
$file = Storage::disk($disk)->get($path);
$mime = Storage::disk($disk)->mimeType($path);
}
}
if($do === 'download'){
return Response::make($file, 200)
->header("Content-Type", $mime)
->header('Content-disposition', 'attachment; filename="'.$filename.'"');
}
if($do === 'stream'){
return Response::make($file, 200)
->header("Content-Type", $mime)
->header('Content-disposition','inline; filename="'.$filename.'"');
}
}
if ($disk === 'delivery'){
$shopping_order = \App\Models\ShoppingOrder::findOrFail($id);
if($shopping_order->user_invoice){
$this->isPermission($shopping_order);
$this->isPermissionShoppingOrder($shopping_order);
$user_invoice = $shopping_order->user_invoice;
$filename = $user_invoice->delivery_filename;
$disk = $user_invoice->disk;
@ -80,8 +76,24 @@ class FileController extends Controller
}
$file = Storage::disk($disk)->get($path);
$mime = Storage::disk($disk)->mimeType($path);
}
}
if ($disk === 'credit'){
$user_credit = \App\Models\UserCredit::findOrFail($id);
$this->isPermissionUserCredit($user_credit);
$filename = $user_credit->filename;
$disk = $user_credit->disk;
$path = $user_credit->getDownloadPath();
if (!Storage::disk($disk)->exists($path)) {
return Response::make('File no found.', 404);;
}
$file = Storage::disk($disk)->get($path);
$mime = Storage::disk($disk)->mimeType($path);
}
if(isset($file)){
if($do === 'download'){
return Response::make($file, 200)
->header("Content-Type", $mime)
@ -94,8 +106,8 @@ class FileController extends Controller
}
}
/*if ($disk === 'credit'){
$UserCredit = \App\Models\UserCredit::findOrFail($id);
$this->isPermission($UserCredit->auth_user_id);
$filename = Credit::getFilename($UserCredit);

View file

@ -8,6 +8,7 @@ use App\Models\Product;
use App\Models\Homeparty;
use App\Models\UserLevel;
use App\Models\UserCredit;
use App\Models\ShoppingUser;
use App\Services\HTMLHelper;
use App\Models\HomepartyUser;
@ -120,7 +121,6 @@ class ModalController extends Controller
$route = "";
$ret = view("admin.modal.business_user_detail", compact('TreeCalcBot', 'user', 'data'))->render();
}
if($data['action'] === 'edit_user_sales_volume'){
$userSalesVolume = UserSalesVolume::findOrFail($data['id']);
$route = route('admin_business_points_store', );
@ -131,6 +131,14 @@ class ModalController extends Controller
$route = route('admin_business_points_store', );
$ret = view("admin.business.modal_add_points", compact('userSalesVolume', 'data', 'route'))->render();
}
if($data['action'] === 'add-user-credit'){
$value = [];
$ret = view("admin.payment.modal_add_credit", compact('value', 'data'))->render();
}
if($data['action'] === 'user-credit-status'){
$UserCredit = UserCredit::find($data['id']); //current user form order
$ret = view("admin.payment.modal_credit_status", compact('UserCredit', 'data'))->render();
}
}
return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]);
}
@ -140,8 +148,8 @@ class ModalController extends Controller
$auth_user = \Auth::user();
if($auth_user->isAdmin() || $auth_user->id === $user->id){
$TreeCalcBot = new TreeCalcBot($data['month'], $data['year'], $data['init_from']);
$TreeCalcBot->initDetailUser($user);
if(!$TreeCalcBot->user){
$TreeCalcBot->initBusinesslUserDetail($user);
if(!$TreeCalcBot->business_user){
abort(403, 'no user found');
}
return $TreeCalcBot;

View file

@ -10,9 +10,15 @@ use App\Services\Util;
use App\Services\Credit;
use App\Services\Payment;
use App\Models\UserCredit;
use App\Models\ShoppingOrderMargin;
use App\Services\HTMLHelper;
use App\Models\UserCreditItem;
use App\Models\UserCreditMargin;
use Illuminate\Support\Collection;
use App\Models\ShoppingOrderMargin;
use App\Repositories\CreditRepository;
use App\Models\Models\UserCreditMargin as ModelsUserCreditMargin;
use stdClass;
class PaymentCreditController extends Controller
{
@ -24,8 +30,8 @@ class PaymentCreditController extends Controller
public function __construct()
{
$this->middleware('auth');
$this->startYear = 2021;
$this->middleware('admin');
$this->startYear = 2022;
$this->endYear = date('Y');
$this->rangeYears = range($this->startYear, $this->endYear);
$this->activeYear = $this->endYear;
@ -34,36 +40,35 @@ class PaymentCreditController extends Controller
public function index()
{
abort(403, "in progress");
$data = $this->makeData();
return view('admin.payment.credit.index', $data);
}
$this->setFilterVars();
$data = [
'filter_months' => HTMLHelper::$months,
'filter_years' => HTMLHelper::getYearRange(2022),
'user_credit_items' => $this->makeUserCreditItems(),
];
return view('admin.payment.credit', $data);
}
public function store(){
$data = Request::all();
if(isset($data['action']) && $data['action'] === 'add-user-credit'){
$add_credit_error = false;
if(!isset($data['member_id']) || !$user = User::find($data['member_id'])){
$add_credit_error = 'Vertriebspartner nicht gefunden';
\Session()->flash('alert-error', 'Vertriebspartner nicht gefunden');
return back();
}
if(!isset($data['credit'])){
$add_credit_error = 'Bitte Betrag eingeben';
\Session()->flash('alert-error', 'Bitte Betrag eingebe');
return back();
}
if(!isset($data['message'])){
$add_credit_error = 'Bitte Mitteilung eingeben';
}
if($add_credit_error){
$data = $this->makeData();
$data['add_credit_error'] = $add_credit_error;
return view('admin.payment.credit.index', $data);
\Session()->flash('alert-error', 'Bitte Betreff eingeben');
return back();
}
$credit = Util::reFormatNumber($data['credit']);
$credit = number_format($credit, 2, '.', '');
Payment::addUserCreditMargin($user, $credit, 3, $data['message']);
\Session()->flash('alert-success', "Guthaben hinzugefügt");
}
@ -79,8 +84,8 @@ class PaymentCreditController extends Controller
abort(404);
}
$user = User::findOrFail($data['userid']);
$invoice_repo = new CreditRepository($user);
$invoice_repo->create($data);
$credit_repo = new CreditRepository($user);
$credit_repo->create($data);
\Session()->flash('alert-success', "Gutschrift erstellt");
return redirect($data['back']);
}
@ -94,79 +99,52 @@ class PaymentCreditController extends Controller
}
}
private function makeData(){
$this->setActiveYears();
//$date1 = Carbon::parse('01.01.'.$this->activeYear." 00:00:00")->format('Y-m-d H:i:s');
//$date2 = Carbon::parse('31.12.'.$this->activeYear." 23:59:59")->toDateString();
private function setFilterVars(){
if(!session('credit_filter_month')){
session(['credit_filter_month' => intval(date('m'))]);
}
if(!session('credit_filter_year')){
session(['credit_filter_year' => intval(date('Y'))]);
}
if(Request::get('credit_filter_name')){
session(['credit_filter_name' => Request::get('credit_filter_name')]);
}
if(Request::get('credit_filter_month')){
session(['credit_filter_month' => Request::get('credit_filter_month')]);
}
if(Request::get('credit_filter_year')){
session(['credit_filter_year' => Request::get('credit_filter_year')]);
}
}
$ShoppingOrderMargins = ShoppingOrderMargin::join('users', 'm_sponsor_id', '=', 'users.id')
->groupBy('m_sponsor_id')
->join('user_accounts', 'account_id', '=', 'user_accounts.id')
->select('users.id as user_id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')
->wherePaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '<', Carbon::now())
->get();
$ShoppingOrderMarginPendings = ShoppingOrderMargin::join('users', 'm_sponsor_id', '=', 'users.id')
->groupBy('m_sponsor_id')
->join('user_accounts', 'account_id', '=', 'user_accounts.id')
->select('users.id as user_id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')
->wherePaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '>=', Carbon::now())
->get();
$UserCreditMargins = UserCreditMargin::wherePaid(false)->get();
$ShoppingOrderMarginUserIds = ShoppingOrderMargin::select('m_sponsor_id')->groupBy('m_sponsor_id')
->wherePaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '<', Carbon::now())
->get()->pluck('m_sponsor_id')->toArray();
$onlyUserCreditMargins = [];
foreach($UserCreditMargins as $key => $UserCreditMargin){
if(!in_array($UserCreditMargin->user_id, $ShoppingOrderMarginUserIds)){
if(isset($onlyUserCreditMargins[$UserCreditMargin->user_id])){
$onlyUserCreditMargins[$UserCreditMargin->user_id]['sum'] += $UserCreditMargin->credit;
$onlyUserCreditMargins[$UserCreditMargin->user_id]['entries'][$UserCreditMargin->id] = $UserCreditMargin;
private function makeUserCreditItems(){
$ret = [];
$UserCreditItems = UserCreditItem::wherePaid(false)->get();
foreach($UserCreditItems as $userCreditItem){
if(isset($ret[$userCreditItem->user_id])){
$ret[$userCreditItem->user_id]['sum'] += $userCreditItem->credit;
$ret[$userCreditItem->user_id]['entries'][$userCreditItem->id] = $userCreditItem;
}else{
$onlyUserCreditMargins[$UserCreditMargin->user_id] = [
'user_id' => $UserCreditMargin->user->id,
'first_name' => $UserCreditMargin->user->account->first_name,
'last_name' => $UserCreditMargin->user->account->last_name,
'email' => $UserCreditMargin->user->email,
'sum' => $UserCreditMargin->credit,
'entries' => [$UserCreditMargin->id => $UserCreditMargin],
$ret[$userCreditItem->user_id] = [
'user_id' => $userCreditItem->user_id,
'm_account' => $userCreditItem->user->account->m_account,
'first_name' => $userCreditItem->user->account->first_name,
'last_name' => $userCreditItem->user->account->last_name,
'email' => $userCreditItem->user->email,
'sum' => $userCreditItem->credit,
'entries' => [$userCreditItem->id => $userCreditItem],
];
}
}
}
$data = [
'years' => $this->rangeYears,
'active_year' => $this->activeYear,
'ShoppingOrderMargins' => $ShoppingOrderMargins,
'ShoppingOrderMarginPendings' => $ShoppingOrderMarginPendings,
'onlyUserCreditMargins' => $onlyUserCreditMargins,
];
return $data;
}
private function setActiveYears(){
if(Request::get('filter_sales_year')){
$this->activeYear = Request::get('filter_sales_year');
}
return $ret;
}
public function delete($id, $del){
if($del === 'user_credit_margin'){
$UserCreditMargin = UserCreditMargin::findOrFail($id);
if($deleteTime = $UserCreditMargin->deleteTime()){
$UserCreditMargin->delete();
if($del === 'user_credit_item'){
$UserCreditItem = UserCreditItem::findOrFail($id);
if($deleteTime = $UserCreditItem->deleteTime()){
$UserCreditItem->delete();
\Session()->flash('alert-success', "Guthaben ist gelöscht");
}else{
\Session()->flash('alert-error', "Guthaben kann nicht gelöscht werden");
@ -177,7 +155,7 @@ class PaymentCreditController extends Controller
public function datatable(){
$this->setActiveYears();
$this->setFilterVars();
$date1 = Carbon::parse('01.01.'.$this->activeYear)->format('Y-m-d');
$date2 = Carbon::parse('31.12.'.$this->activeYear)->format('Y-m-d');
@ -188,32 +166,9 @@ class PaymentCreditController extends Controller
//->orderBy('created_at', 'DESC');
return \DataTables::eloquent($query)
->addColumn('total', function (UserCredit $UserCredit) {
return $UserCredit->getFormattedTotal()."";
})
->addColumn('user_margins', function (UserCredit $UserCredit) {
->addColumn('view', function (UserCredit $UserCredit) {
$ret = "";
if($UserCredit->user_margins){
foreach($UserCredit->user_margins as $user_margin){
$ret .= $user_margin->firstname."/".$user_margin->lastname."/".$user_margin->reference."/".$user_margin->created_at."<br>";
}
}
if($UserCredit->user_credits){
foreach($UserCredit->user_credits as $user_credit){
$ret .= nl2br($user_credit->message)." / ".$user_credit->created_at."<br>";
}
}
return $ret;
})
/* ->addColumn('txaction', function (ShoppingOrder $ShoppingOrder) {
return Payment::getShoppingOrderBadge($ShoppingOrder);
})*/
->addColumn('credit', function (UserCredit $UserCredit) {
$ret = "";
if(Credit::isCredit($UserCredit)){
if($UserCredit->isCredit()){
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
}else{
@ -222,6 +177,19 @@ class PaymentCreditController extends Controller
return $ret;
})
->addColumn('total', function (UserCredit $UserCredit) {
return $UserCredit->getFormattedTotal()."";
})
->addColumn('credits', function (UserCredit $UserCredit) {
$ret = "";
if($UserCredit->user_credit_items){
foreach($UserCredit->user_credit_items as $user_credit_item){
$ret .= nl2br($user_credit_item->message)." / ".$user_credit_item->created_at->format('d.m.Y')."<br>";
}
}
return $ret;
})
->addColumn('status', function (UserCredit $UserCredit) {
return '<a href="#" data-toggle="modal" data-target="#modals-load-content" data-modal="modal-lg"
data-id="'.$UserCredit->id.'" data-route="'.route('modal_load').'" data-action="user-credit-status" data-view="">
@ -233,7 +201,7 @@ class PaymentCreditController extends Controller
->orderColumn('id', 'id $1')
->orderColumn('status', 'status $1')
->orderColumn('total', 'total $1')
->rawColumns(['shipping_order', 'total', 'credit', 'status', 'user_margins'])
->rawColumns(['total', 'credits', 'status', 'view'])
->make(true);
}
}

View file

@ -18,7 +18,7 @@ class PaymentInvoiceController extends Controller
public function __construct()
{
$this->middleware('auth');
$this->middleware('admin');
}
public function index()
@ -115,10 +115,8 @@ class PaymentInvoiceController extends Controller
$ret = "";
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
$ret .= '<a href="'.route('storage_file', [$UserInvoice->shopping_order->id, 'invoice', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
return $ret;
})
->orderColumn('id', 'id $1')
->orderColumn('invoice_number', 'invoice_number $1')
->orderColumn('txaction', 'txaction $1')

View file

@ -9,10 +9,10 @@ use App\Services\SyS\Import;
use App\Services\SyS\Cronjobs;
use App\Services\SyS\Customers;
use App\Services\SyS\DomainSSL;
use App\Http\Controllers\Controller;
use App\Models\UserSalesVolume;
use App\Services\SyS\Correction;
use App\Http\Controllers\Controller;
use App\Services\SyS\ShoppingOrders;
use App\Services\SyS\BusinessStructur;
class SysController extends Controller
{
@ -26,27 +26,16 @@ class SysController extends Controller
public function index()
{
$UserSalesVolumes =UserSalesVolume::all();
foreach($UserSalesVolumes as $UserSalesVolume){
if($UserSalesVolume->shopping_order->member_id !== NULL && $UserSalesVolume->user_id !== $UserSalesVolume->shopping_order->member_id){
if($UserSalesVolume->shopping_order->member_id !== 6){
dump($UserSalesVolume->shopping_order_id);
dump($UserSalesVolume->shopping_order->member_id);
dump($UserSalesVolume->user_id);
dump("##");
}
}
}
dd("ebd");
return view('sys.index');
}
public function tool($serve)
{
switch ($serve) {
case 'business_structur':
return BusinessStructur::show();
break;
case 'sales_members':
return Sales::show();
break;
@ -76,6 +65,10 @@ class SysController extends Controller
public function store($serve)
{
switch ($serve) {
case 'business_structur':
return BusinessStructur::show();
break;
case 'sales_members':
return Sales::show();
break;

View file

@ -0,0 +1,133 @@
<?php
namespace App\Http\Controllers\User;
use Carbon;
use Request;
use App\User;
use App\Services\Credit;
use App\Models\UserCredit;
use App\Models\UserPayCredit;
use App\Models\UserCreditItem;
use App\Http\Controllers\Controller;
class PaymentController extends Controller
{
private $startYear;
private $endYear;
private $rangeYears;
private $activeYear;
public function __construct()
{
$this->middleware('auth');
/* $this->startYear = 2021;
$this->endYear = date('Y');
$this->rangeYears = range($this->startYear, $this->endYear);
$this->activeYear = $this->endYear;*/
}
public function credit()
{
$user = \Auth::user();
$data = [
'user' => $user,
];
return view('user.payment.credit', $data);
}
public function credit_datatable(){
$user = \Auth::user();
$query = UserCredit::with('user', 'user.account')->select('user_credits.*')->where('user_id', $user->id);
return \DataTables::eloquent($query)
->addColumn('view', function (UserCredit $UserCredit) {
$ret = "";
if(Credit::isCredit($UserCredit)){
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'download']).'" class="btn btn-primary btn-xs"><i class="fa fa-download"></i></a> ';
$ret .= '<a href="'.route('storage_file', [$UserCredit->id, 'credit', 'stream']).'" target="_blank" class="btn btn-warning btn-xs"><i class="fa fa-eye"></i></a>';
}else{
$ret = "-";
}
return $ret;
})
->addColumn('total', function (UserCredit $UserCredit) {
return $UserCredit->getFormattedTotal()."";
})
->addColumn('credits', function (UserCredit $UserCredit) {
$ret = "";
if($UserCredit->user_credit_items){
foreach($UserCredit->user_credit_items as $user_credit_item){
$ret .= nl2br($user_credit_item->message)." / ".$user_credit_item->created_at->format('d.m.Y')."<br>";
}
}
return $ret;
})
->addColumn('status', function (UserCredit $UserCredit) {
return '<span class="badge badge-pill badge-'.$UserCredit->getStatusColor().'">'.$UserCredit->getStatusType().' <span class="ion ion-md-cash"></span></span>';
})
->orderColumn('id', 'id $1')
->orderColumn('status', 'status $1')
->orderColumn('total', 'total $1')
->rawColumns(['total', 'credits', 'status', 'view'])
->make(true);
}
public function credit_item_datatable(){
$user = \Auth::user();
$query = UserCreditItem::select('user_credit_items.*')->where('user_id', $user->id);
return \DataTables::eloquent($query)
->addColumn('message', function (UserCreditItem $user_credit_item) {
return nl2br($user_credit_item->message);
})
->addColumn('credit', function (UserCreditItem $user_credit_item) {
return formatNumber($user_credit_item->credit)."";
})
->addColumn('created_at', function (UserCreditItem $user_credit_item) {
return formatDate($user_credit_item->created_at);
})
->addColumn('status', function (UserCreditItem $user_credit_item) {
return '<span class="badge badge-pill badge-'.$user_credit_item->getStatusColor().'">'.$user_credit_item->getStatusType().'</span> ';
})
->addColumn('paid', function (UserCreditItem $user_credit_item) {
return ($user_credit_item->paid && $user_credit_item->user_credit) ?
'<span class="badge badge-pill badge-success"><i class="fa fa-check"></i> '.$user_credit_item->user_credit->full_number.'</span>'
: '<span class="badge badge-pill badge-warning"><i class="fa fa-times"></i></span>';
})
->orderColumn('message', 'message $1')
->orderColumn('credit', 'credit $1')
->orderColumn('created_at', 'created_at $1')
->orderColumn('status', 'status $1')
->rawColumns(['message', 'status', 'paid'])
->make(true);
}
/*private function setActiveYears(){
if(Request::get('filter_year')){
$this->activeYear = Request::get('filter_year');
}
}
public function revenue()
{
$this->setActiveYears();
$user = \Auth::user();
$data = [
'user' => $user,
'years' => $this->rangeYears,
'active_year' => $this->activeYear,
'months' => range(1, 12),
];
return view('user.payment.revenue', $data);
}*/
}

View file

@ -2,13 +2,13 @@
namespace App\Http\Controllers\User;
use Request;
use App\User;
use App\Services\HTMLHelper;
use App\Models\UserSalesVolume;
use App\Http\Controllers\Controller;
use App\Services\BusinessPlan\TreeCalcBot;
use Request;
use Auth;
class TeamController extends Controller
{
@ -38,18 +38,32 @@ class TeamController extends Controller
$user = User::find(\Auth::user()->id);
$this->setFilterVars();
$TreeCalcBot = new TreeCalcBot(session('team_user_filter_month'), session('team_user_filter_year'), 'member');
$TreeCalcBot->initUser($user->id);
$TreeCalcBot->initStructureUser($user->id);
//for testing
//$TreeCalcBot->initUser(56);
$data = [
'filter_months' => HTMLHelper::$months,
'filter_years' => HTMLHelper::getYearRange(2022),
'filter_years' => HTMLHelper::getYearRange(date('Y')),
'TreeCalcBot' => $TreeCalcBot,
];
return view('user.team.structure', $data);
}
public function points()
{
$this->setFilterVars();
$user = User::find(\Auth::user()->id);
$userSalesVolume = $user->getUserSalesVolume(intval(session('team_user_points_filter_month')), intval(session('team_user_points_filter_year')), 'first');
$data = [
'userSalesVolume' => $userSalesVolume,
'filter_months' => HTMLHelper::$months,
'filter_years' => HTMLHelper::getYearRange(date('Y')),
];
return view('user.team.points', $data);
}
private function setFilterVars(){
if(!session('team_user_filter_month')){
@ -59,12 +73,89 @@ class TeamController extends Controller
session(['team_user_filter_year' => intval(date('Y'))]);
}
if(!session('team_user_points_filter_month')){
session(['team_user_points_filter_month' => intval(date('m'))]);
}
if(!session('team_user_points_filter_year')){
session(['team_user_points_filter_year' => intval(date('Y'))]);
}
if(Request::get('team_user_filter_month')){
session(['team_user_filter_month' => Request::get('team_user_filter_month')]);
}
if(Request::get('team_user_filter_year')){
session(['team_user_filter_year' => Request::get('team_user_filter_year')]);
if(Request::get('team_user_points_filter_year')){
session(['team_user_points_filter_year' => Request::get('team_user_points_filter_year')]);
}
if(Request::get('team_user_points_filter_month')){
session(['team_user_points_filter_month' => Request::get('team_user_points_filter_month')]);
}
if(Request::get('team_user_points_filter_year')){
session(['team_user_points_filter_year' => Request::get('team_user_points_filter_year')]);
}
}
private function initSearchPoints()
{
$this->setFilterVars();
$user_id = \Auth::user()->id;
$query = UserSalesVolume::with('user', 'user.account')->with('shopping_order')->select('user_sales_volumes.*')
->where('user_sales_volumes.user_id', '=', $user_id)
->where('user_sales_volumes.month', '=', Request::get('team_user_points_filter_month'))
->where('user_sales_volumes.year', '=', Request::get('team_user_points_filter_year'));
return $query;
}
public function datatablePoints(){
$query = $this->initSearchPoints();
return \DataTables::eloquent($query)
->addColumn('order', function (UserSalesVolume $UserSalesVolume) {
if($UserSalesVolume->shopping_order){
if($UserSalesVolume->status === 1 && $UserSalesVolume->shopping_order->auth_user_id === $UserSalesVolume->user_id){
return '<a href="' . route('user_order_detail', [$UserSalesVolume->shopping_order->id]) . '" class="btn btn-xs btn-primary">'.$UserSalesVolume->shopping_order->id.'</a>';
}
if(($UserSalesVolume->status === 2 || $UserSalesVolume->status === 3) && $UserSalesVolume->shopping_order->member_id === $UserSalesVolume->user_id){
return '<a href="' . route('user_shop_order_detail', [$UserSalesVolume->shopping_order->id]) . '" class="btn btn-xs btn-secondary">'.$UserSalesVolume->shopping_order->id.'</a>';
}
}
return '';
})
->addColumn('total_net', function (UserSalesVolume $UserSalesVolume) {
return formatNumber($UserSalesVolume->total_net).' &euro;';
})
->addColumn('status', function (UserSalesVolume $UserSalesVolume) {
return '<span class="badge badge-pill badge-'.$UserSalesVolume->getStatusColor().'">'.$UserSalesVolume->getStatusType().'</span>';
})
->addColumn('message', function (UserSalesVolume $UserSalesVolume) {
return '<span class="no-line-break">'.$UserSalesVolume->message.'</span>';
})
->orderColumn('id', 'id $1')
->orderColumn('order', 'order $1')
->orderColumn('status', 'status $1')
->orderColumn('message', 'message $1')
->rawColumns(['id', 'order', 'status', 'message', 'total_net'])
->make(true);
}
public function load(){
$user = User::find(\Auth::user()->id);
$userSalesVolume = $user->getUserSalesVolume(intval(session('team_user_points_filter_month')), intval(session('team_user_points_filter_year')), 'first');
$data = [
'userSalesVolume' => $userSalesVolume,
];
$html = view('user.team._points_sum', $data)->render();
return response()->json(['response' => true, 'data'=>$data, 'html'=>$html]);
}

54
app/Mail/MailCredit.php Normal file
View file

@ -0,0 +1,54 @@
<?php
namespace App\Mail;
use Storage;
use App\User;
use App\Services\Credit;
use App\Services\Invoice;
use App\Models\UserCredit;
use App\Models\ShoppingOrder;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class MailCredit extends Mailable
{
use Queueable, SerializesModels;
protected $user_credit;
public $subject;
public function __construct(UserCredit $user_credit)
{
$this->user_credit = $user_credit;
$this->subject = 'Deine Gutschrift auf mivita.care';
}
public function build()
{
$title = __('email.credit_title');
$copy1line = __('email.credit_copy1line');
$filename = $this->user_credit->filename;
$disk = $this->user_credit->disk;
$path = $this->user_credit->getDownloadPath();
if (!Storage::disk($disk)->exists($path)) {
return;
}
$file = Storage::disk($disk)->path($path);
$file = str_replace('//', '/', $file);
$mime = Storage::disk($disk)->mimeType($path);
return $this->view('emails.blank')->with([
'title' => $title,
'copy1line' => $copy1line,
])->attach($file,[
'as' => $filename,
'mime' => $mime,
]); // attach file;
}
}

104
app/Models/UserBusiness.php Normal file
View file

@ -0,0 +1,104 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
class UserBusiness extends Model
{
protected $table = 'user_businesses';
protected $casts = [
'user_id' => 'int',
'month' => 'int',
'year' => 'int',
'b_structure_id' => 'int',
'm_level_id' => 'int',
'active_account' => 'bool',
'm_account' => 'int',
'sales_volume_points' => 'int',
'sales_volume_points_shop' => 'int',
'sales_volume_points_sum' => 'int',
'sales_volume_total' => 'float',
'sales_volume_total_shop' => 'float',
'sales_volume_total_sum' => 'float',
'margin' => 'int',
'margin_shop' => 'int',
'qual_kp' => 'int',
'qual_tp' => 'int',
'total_tp' => 'int',
'total_qual_tp' => 'int',
'commission_team_total' => 'float',
'commission_shop_sales' => 'float',
'qual_user_level' => 'array',
'sponsor' => 'object',
'business_lines' => AsArrayObject::class,
'user_items' => AsArrayObject::class
];
protected $dates = [
'payment_account_date',
'active_date'
];
protected $fillable = [
'user_id',
'month',
'year',
'b_structure_id',
'm_level_id',
'sponsor',
'user_level_name',
'active_account',
'payment_account_date',
'active_date',
'm_account',
'email',
'first_name',
'last_name',
'sales_volume_points',
'sales_volume_points_shop',
'sales_volume_points_sum',
'sales_volume_total',
'sales_volume_total_shop',
'sales_volume_total_sum',
'margin',
'margin_shop',
'qual_kp',
'qual_tp',
'qual_user_level',
'total_tp',
'total_qual_tp',
'commission_team_total',
'commission_shop_sales',
'business_lines',
'user_items',
];
public function user_business_structure()
{
return $this->belongsTo(UserBusinessStructure::class, 'b_structure_id');
}
public function isSave(){
return $this->id !== null ? true : false;
}
public function setPaymentAccountDateAttribute( $value ) {
$this->attributes['payment_account_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
}
public function setActiveDateAttribute( $value ) {
$this->attributes['active_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL;
}
}

View file

@ -0,0 +1,73 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
/**
* Class UserBusinessStructure
*
* @property int $id
* @property int|null $month
* @property int|null $year
* @property object|null $structure
* @property object|null $parentless
* @property array|null $users
* @property bool $completed
* @property int $status
* @package App\Models
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\UserBusiness[] $user_businesses
* @property-read int|null $user_businesses_count
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure query()
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure whereCompleted($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure whereMonth($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure whereParentless($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure whereStructure($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure whereUsers($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserBusinessStructure whereYear($value)
* @mixin \Eloquent
*/
class UserBusinessStructure extends Model
{
protected $table = 'user_business_structures';
protected $casts = [
'month' => 'int',
'year' => 'int',
'completed' => 'bool',
'status' => 'int',
'structure' => 'object',
'parentless' => 'object',
'users' => 'array',
];
protected $fillable = [
'month',
'year',
'structure',
'parentless',
'users',
'completed',
'status'
];
public function user_businesses()
{
return $this->hasMany(UserBusiness::class, 'b_structure_id');
}
}

172
app/Models/UserCredit.php Normal file
View file

@ -0,0 +1,172 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use App\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class UserCredit
*
* @property int $id
* @property int $user_id
* @property int|null $month
* @property int|null $year
* @property Carbon|null $date
* @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 $filename
* @property string|null $dir
* @property string|null $disk
* @property array|null $infos
* @property bool $paid_out
* @property Carbon|null $paid_out_date
* @property bool $cancellation
* @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 $user
* @property Collection|UserCreditItem[] $user_credit_items
*
* @package App\Models
*/
class UserCredit extends Model
{
use SoftDeletes;
protected $table = 'user_credits';
protected $casts = [
'user_id' => 'int',
'month' => 'int',
'year' => 'int',
'number' => 'int',
'net' => 'float',
'tax_rate' => 'float',
'tax' => 'float',
'taxable' => 'bool',
'total' => 'float',
'paid_out' => 'bool',
'cancellation' => 'bool',
'cancellation_id' => 'int',
'status' => 'int',
'infos' => 'array'
];
protected $dates = [
'date',
'paid_out_date',
'cancellation_date'
];
protected $fillable = [
'user_id',
'month',
'year',
'date',
'full_number',
'number',
'net',
'tax_rate',
'tax',
'total',
'taxable',
'filename',
'dir',
'disk',
'infos',
'paid_out',
'paid_out_date',
'cancellation',
'cancellation_id',
'cancellation_date',
'status'
];
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(User::class);
}
public function user_credit_items()
{
return $this->hasMany(UserCreditItem::class);
}
public function isCredit(){
return $this->filename ? true : false;
}
public function getDateAttribute($value)
{
return $value ? Carbon::parse($value)->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 getFormattedTax()
{
return formatNumber($this->attributes['tax']);
}
public function getFormattedNet()
{
return formatNumber($this->attributes['net']);
}
public function getFormattedTotal()
{
return formatNumber($this->attributes['total']);
}
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";
}
public function getDownloadPath($full = false){
if(!$full){
return $this->dir.$this->filename;
}
return \Storage::disk($this->disk)->path($this->dir.$this->filename);
}
}

View file

@ -0,0 +1,99 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use App\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class UserCreditItem
*
* @property int $id
* @property int $user_id
* @property int|null $user_credit_id
* @property float|null $credit
* @property string|null $message
* @property int $status
* @property bool $paid
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property UserCredit|null $user_credit
* @property User $user
*
* @package App\Models
*/
class UserCreditItem extends Model
{
public static $statusTypes = [
1 => 'Provision Shop',
2 => 'Provision Team',
3 => 'Guthaben hinzugefügt',
4 => 'commission ...',
];
public static $statusColors = [
0 => 'warning',
1 => 'success',
2 => 'secondary',
3 => 'warning',
4 => 'info',
10 => 'danger',
];
protected $table = 'user_credit_items';
protected $casts = [
'user_id' => 'int',
'user_credit_id' => 'int',
'credit' => 'float',
'status' => 'int',
'paid' => 'bool'
];
protected $fillable = [
'user_id',
'user_credit_id',
'credit',
'message',
'status',
'paid'
];
public function user_credit()
{
return $this->belongsTo(UserCredit::class);
}
public function user()
{
return $this->belongsTo(User::class);
}
public function deleteTime(){
$time = '+100 min';
if(Carbon::parse($this->created_at)->modify($time)->gt(Carbon::now())){
return Carbon::now()->diffInMinutes(Carbon::parse($this->created_at)->modify($time));
}
return false;
}
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";
}
}

View file

@ -56,6 +56,8 @@ use App\User;
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereUserInvoiceId($value)
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereYear($value)
* @mixin \Eloquent
* @property array|null $syslog
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereSyslog($value)
*/
class UserSalesVolume extends Model
{

View file

@ -0,0 +1,125 @@
<?php
namespace App\Repositories;
use PDF;
use Storage;
use App\User;
use App\Services\Credit;
use App\Models\UserCredit;
use App\Services\UserMarign;
use App\Services\MyPDFMerger;
use App\Models\UserCreditItem;
class CreditRepository extends BaseRepository {
private $user_credit;
public function __construct(User $model)
{
$this->model = $model;
}
public function create($request = [])
{
//need invoice $data
$number = Credit::getCreditNumber();
$credit_date = isset($request['credit_date']) ? $request['credit_date'] : \Carbon::now()->format("d.m.Y");
$credit_send_mail = isset($request['credit_send_mail']) ? true: false;
$credit_number = Credit::createCreditNumber($number, $credit_date);
$this->user_credit = new UserCredit();
$user_credit_items = $this->makeUserCredit();
$data = [
'user' => $this->model,
'credit_date' => $credit_date,
'credit_number' => $credit_number,
'user_credits' => $this->user_credit,
'user_credit_items' => $user_credit_items,
];
$pdf = PDF::loadView('pdf.credit', $data);
$pdf->setPaper('A4', 'portrait');
$dir = Credit::getCreditStorageDir($credit_date);
if(!Storage::disk('public')->exists( $dir )){
Storage::disk('public')->makeDirectory($dir); //creates directory
}
$path = Storage::disk('public')->getAdapter()->getPathPrefix();
$filename = Credit::makeCreditFilename($credit_number);
$pdf->save($path.$dir.$filename);
$pdfMerger = new MyPDFMerger();
$pdfMerger->addPDF($path.$dir.$filename);
$file = $pdfMerger->myMerge('string', $filename, 'template_invoice_de');
Storage::disk('public')->put($dir.$filename, $file);
$this->user_credit->user_id = $this->model->id;
$this->user_credit->year = \Carbon::parse($credit_date)->format('Y');
$this->user_credit->month = \Carbon::parse($credit_date)->format('n');
$this->user_credit->date = $credit_date;
$this->user_credit->filename = $filename;
$this->user_credit->dir = $dir;
$this->user_credit->disk = 'public';
$this->user_credit->number = $number;
$this->user_credit->full_number = $credit_number;
$this->user_credit->save();
if($credit_send_mail){
Credit::sendCreditMail($this->user_credit);
}
$this->finishUserCredit($this->user_credit->id, $user_credit_items);
return true;
}
private function finishUserCredit($user_credit_id, $user_credit_items){
//next credits
Credit::makeNextCreditNumber();
//mark as payed
//$UserCreditItems = UserCreditItem::where('user_id', $this->model->id)->wherePaid(false)->get();
foreach($user_credit_items as $user_credit_item){
$user_credit_item->paid = true;
$user_credit_item->user_credit_id = $user_credit_id;
$user_credit_item->save();
}
}
private function makeUserCredit(){
$this->user_credit->net = 0;
$this->user_credit->infos = [];
$infos = [];
$user_credit_items = [];
$UserCreditItems = UserCreditItem::where('user_id', $this->model->id)->wherePaid(false)->get();
foreach($UserCreditItems as $userCreditItem){
$user_credit_items[] = $userCreditItem;
$infos[] = ['id' => $userCreditItem->id, 'credit' => $userCreditItem->credit];
$this->user_credit->net += $userCreditItem->credit;
}
/* taxable_sales //user tax
1 //umsatzsteuerpflichtig
2 // nicht umsatzsteuerpflichtig
*/
if($this->model->account){
$this->user_credit->taxable = $this->model->account->taxable_sales == 2 ? false : true;
if($this->user_credit->taxable){
$this->user_credit->tax_rate = config('app.main_tax_rate');
$this->user_credit->total = round($this->user_credit->net * config('app.main_tax'), 2);
$this->user_credit->tax = $this->user_credit->total - $this->user_credit->net;
}else{
$this->user_credit->tax_rate = 0;
$this->user_credit->total = $this->user_credit->net;
$this->user_credit->tax = 0;
}
}
$this->user_credit->infos = $infos;
return $user_credit_items;
}
}

View file

@ -0,0 +1,172 @@
<?php
namespace App\Services\BusinessPlan;
use App\User;
use stdClass;
use Carbon\Carbon;
use App\Models\UserLevel;
use App\Models\UserBusiness;
class TreeUserItem
{
public $items = [];
private $date;
public $lines = [];
public $user_level_active;
public function __construct($date)
{
$this->date = $date;
return $this;
}
public function makeUser(User $user){
$this->user_level_active = $user->user_level ? $user->user_level : null;
$this->b_user = new UserBusiness();
$fill = [
'user_id' => $user->id,
'month' => $this->date->month,
'year' => $this->date->year,
'm_level' => $user->m_level,
'm_sponsor' => $user->m_sponsor,
'user_level_name' => $user->user_level ? $user->user_level->name : '',
'active_account' => $user->payment_account ? Carbon::parse($user->payment_account)->gt(Carbon::parse($this->date->start_date)) : false,
'payment_account_date' => $user->payment_account ? $user->getPaymentAccountDateFormat(false) : NULL,
'active_date' => $user->active_date ? $user->active_date : NULL,
'm_account' => $user->account->m_account,
'email' => $user->email,
'first_name' => $user->account->first_name,
'last_name' => $user->account->last_name,
'sales_volume_points' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points'),
'sales_volume_points_shop' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points_shop'),
'sales_volume_points_sum' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points_sum'),
'sales_volume_total' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total'),
'sales_volume_total_shop' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total_shop'),
'sales_volume_total_sum' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total_sum'),
'margin' => $user->user_level_active ? $user->user_level_active->margin : 0,
'margin_shop' => $user->user_level_active ? $user->user_level_active->margin_shop : 0,
'qual_kp' => $user->user_level_active ? $user->user_level_active->qual_kp : 0,
'qual_tp' => $user->user_level_active ? $user->user_level_active->qual_tp : 0,
];
$this->b_user->fill($fill);
}
public function addUserID(){
TreeCalcBot::addUserID($this->user_id);
}
public function isQualKP(){
return ($this->sales_volume_points_sum >= $this->qual_kp) ? true : false;
}
public function getRestQualKP(){
return $this->sales_volume_points_sum - $this->qual_kp;
}
public function checkSponsor(){
if($this->m_sponsor === null){
$this->m_sponsor_name = 'Keinen Sponsor zugewiesen';
return;
}
$user = User::find($this->m_sponsor);
if($user){
if($user->account){
$this->m_sponsor_name = substr('Sponsor: '.$user->account->first_name.' '.$user->account->last_name.' | '.$user->email.' | '.$user->account->m_account, 0, 190);
}else{
$this->m_sponsor_name = 'Sponsor: '.$user->email;
}
return;
}
$this->m_sponsor_name = 'Sponsor wurde gelöscht.';
return;
}
/*
'total_tp' => ,
'total_qual_tp' => ,
'commission_total' => ,
'lines',
'items',
'qual_user_level_id'
*/
public function readParentsUser(){
$users = User::with('account')->select('users.*')
->where('users.deleted_at', '=', null)
->where('users.id', '!=', 1)
->where('users.admin', "<", 4)
->where('users.m_level', "!=", null)
->where('users.m_sponsor', "=", $this->user_id) //<- need the id for parents / sponsors
->where('users.payment_account', "!=", null)
->where('users.active_date', "<=", $this->date->end_date)
->get();
dd($users);
if($users){
foreach($users as $user){
$TreeUserItem = new TreeUserItem($this->date);
$TreeUserItem->makeUser($user);
$TreeUserItem->addUserID();
$this->items[] = $TreeUserItem;
}
}
foreach($this->items as $item){
$item->readParentsUser();
}
}
public function calcUserTP($line){
if(!isset($this->lines[$line])){
$this->lines[$line] = new stdClass();
$this->lines[$line]->points = 0;
}
foreach($this->items as $item){
if(count($item->items) > 0){
$this->calcUserTP($line+1);
}
$this->lines[$line]->points += $item->sales_volume_points_sum;
$this->total_tp += $item->sales_volume_points_sum;
}
}
public function calcQualTP(){
if($this->isQualKP()){
$this->total_qual_tp = $this->total_tp + $this->getRestQualKP();
$this->qual_user_level = UserLevel::where('qual_tp', '<=', $this->total_qual_tp)->where('pos', '<=', $this->user->user_level->pos)->orderBy('qual_tp', 'desc')->first();
$this->commission_total = 0;
if($this->qual_user_level){
foreach($this->lines as $line => $values){
$values->margin = $this->qual_user_level->{'pr_line_'.$line};
if($line > 6){
//wachstumsbonus
$values->margin = $this->qual_user_level->growth_bonus;
}
$values->commission = round($values->points / 100 * $values->margin, 2);
$this->commission_total += $values->commission;
$this->lines[$line] = $values;
}
}
}
}
public function __get($property) {
if (property_exists($this->b_user, $property)) {
return $this->b_user->$property;
}
if (isset($this->b_user->{$property})) {
return $this->b_user->{$property};
}
}
}

View file

@ -0,0 +1,257 @@
<?php
namespace App\Services\BusinessPlan;
use App\User;
use stdClass;
use Carbon\Carbon;
use App\Models\UserLevel;
use App\Models\UserBusiness;
use App\Models\UserBusinessStructure;
class BusinessUserItem
{
public $businessUserItems = [];
private $date;
private $b_user;
private $user_level_active_pos;
public function __construct($date)
{
$this->date = $date;
return $this;
}
public function makeUser($user_id){
//check for user an load
$this->b_user = UserBusiness::where('user_id', $user_id)->where('month', $this->date->month)->where('year', $this->date->year)->first();
if($this->b_user !== null){
return;
}
//read User here, can delete in stored data.
$user = User::find($user_id);
$user_level_active = $user->user_level ? $user->user_level : null;
$this->user_level_active_pos = $user_level_active ? $user_level_active->pos : 0;
$this->b_user = new UserBusiness();
$fill = [
'user_id' => $user->id,
'month' => $this->date->month,
'year' => $this->date->year,
'm_level_id' => $user->m_level,
'user_level_name' => $user_level_active ? $user_level_active->name : '',
'active_account' => $user->payment_account ? Carbon::parse($user->payment_account)->gt(Carbon::parse($this->date->start_date)) : false,
'payment_account_date' => $user->payment_account ? $user->getPaymentAccountDateFormat(false) : NULL,
'active_date' => $user->active_date ? $user->active_date : NULL,
'm_account' => $user->account->m_account,
'email' => $user->email,
'first_name' => $user->account->first_name,
'last_name' => $user->account->last_name,
'sales_volume_points' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points'),
'sales_volume_points_shop' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points_shop'),
'sales_volume_points_sum' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points_sum'),
'sales_volume_total' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total'),
'sales_volume_total_shop' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total_shop'),
'sales_volume_total_sum' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total_sum'),
'margin' => $user_level_active ? $user_level_active->margin : 0,
'margin_shop' => $user_level_active ? $user_level_active->margin_shop : 0,
'qual_kp' => $user_level_active ? $user_level_active->qual_kp : 0,
'qual_tp' => $user_level_active ? $user_level_active->qual_tp : 0,
'commission_team_total' => 0,
'commission_shop_sales' => 0,
];
$this->b_user->fill($fill);
$this->b_user->business_lines = [];
$this->b_user->user_items = [];
$this->b_user->commission_shop_sales = round($this->b_user->sales_volume_total_shop / 100 * $this->b_user->margin_shop, 2);
}
public function addUserID(){
TreeCalcBot::addUserID($this->b_user->user_id);
}
public function getBUser(){
return $this->b_user;
}
public function addBusinessLineToUser($line, $obj){
$this->b_user->business_lines[$line] = $obj;
}
public function addBusinessLinePoints($line, $points){
$obj = $this->business_lines[$line];
$obj->points += $points;
$this->b_user->business_lines[$line] = $obj;
}
public function addTotalTP($points){
$this->b_user->total_tp += $points;
}
public function isQualKP(){
return ($this->sales_volume_points_sum >= $this->qual_kp) ? true : false;
}
public function getRestQualKP(){
return $this->sales_volume_points_sum - $this->qual_kp;
}
public function getCommissionTotal(){
return round($this->commission_shop_sales + $this->commission_team_total, 2);
}
public function calcQualTP(){
if($this->isQualKP()){
$this->b_user->total_qual_tp = $this->total_tp + $this->getRestQualKP();
$commission_total = 0;
$qualUserLevel = UserLevel::where('qual_tp', '<=', $this->total_qual_tp)->where('pos', '<=', $this->user_level_active_pos)->orderBy('qual_tp', 'desc')->first();
if($qualUserLevel){
$this->b_user->qual_user_level = $qualUserLevel->toArray();
foreach($this->business_lines as $line => $object){
//growth_bonus = ab ebene 6 wachstumsbonus
$object->margin = ($line <= 6) ? $this->qual_user_level['pr_line_'.$line] : $this->qual_user_level['growth_bonus'];
$object->commission = round($object->points / 100 * $object->margin, 2);
$commission_total += $object->commission;
$this->b_user->business_lines[$line] = $object;
}
}
$this->b_user->commission_team_total = $commission_total;
}
}
/*public function storeUser(){
$this->b_user->user_items = $this->storeUserItems($this->businessUserItems, 1);
$this->b_user->save();
}
private function storeUserItems($userItems, $line){
$ret = [];
foreach($userItems as $userItem){
$temp = null;
if(count($userItem->businessUserItems) > 0){
$temp = $this->storeUserItems($userItem->businessUserItems, $line+1);
}
$obj = new stdClass();
$obj->user_id = $userItem->user_id;
$obj->line = $line;
$obj->points = $userItem->sales_volume_points_sum;
$obj->parents = $temp;
$ret[] = $obj;
}
return $ret;
}*/
public function readParentsBusinessUsers(){
$users = User::with('account')->select('users.*')
->where('users.deleted_at', '=', null)
->where('users.id', '!=', 1)
->where('users.admin', "<", 4)
->where('users.m_level', "!=", null)
->where('users.m_sponsor', "=", $this->b_user->user_id) //<- need the id for parents / sponsors
->where('users.payment_account', "!=", null)
->where('users.active_date', "<=", $this->date->end_date)
->get();
if($users){
foreach($users as $user){
$BusinessUserItem = new BusinessUserItem($this->date);
$BusinessUserItem->makeUser($user->id);
$BusinessUserItem->addUserID();
$this->businessUserItems[] = $BusinessUserItem;
}
}
foreach($this->businessUserItems as $businessUserItem){
$businessUserItem->readParentsBusinessUsers();
}
}
public function readStoredParentsBusinessUsers($structure){
$parents = $this->findParentsBusinessOnStored($this->b_user->user_id, $structure);
if($parents){
foreach($parents as $obj){
$BusinessUserItem = new BusinessUserItem($this->date);
$BusinessUserItem->makeUser($obj->user_id);
$BusinessUserItem->addUserID();
$this->businessUserItems[] = $BusinessUserItem;
}
foreach($this->businessUserItems as $businessUserItem){
$businessUserItem->readStoredParentsBusinessUsers($parents);
}
}
}
private function findParentsBusinessOnStored($user_id, $structures){
if($structures){
foreach($structures as $obj){
if($user_id === $obj->user_id){
return $obj->parents;
}
if($obj->parents){
if($ret = $this->findParentsBusinessOnStored($user_id, $obj->parents)){
return $ret;
}
}
}
}
return null;
}
public function checkSponsor($user){
//check is store? has ID
if($this->b_user->isSave()){
return;
}
$sponsor = new stdClass();
$sponsor->is_sponsor = false;
$sponsor->user_id = false;
$sponsor->first_name = '';
$sponsor->last_name = '';
$sponsor->email = '';
$sponsor->m_account = '';
$sponsor->full_name = 'Keinen Sponsor zugewiesen';
if($user->m_sponsor){
if($user->user_sponsor){
$sponsor->is_sponsor = true;
$sponsor->user_id = $user->user_sponsor->id;
if($user->user_sponsor->account){
$sponsor->full_name = substr('Sponsor: '.$user->user_sponsor->account->first_name.' '.$user->user_sponsor->account->last_name.' | '.$user->user_sponsor->email.' | '.$user->user_sponsor->account->m_account, 0, 250);
$sponsor->first_name = $user->user_sponsor->account->last_name;
$sponsor->last_name = $user->user_sponsor->account->first_name;
$sponsor->m_account = $user->user_sponsor->account->m_account;
}else{
$sponsor->full_name = 'Sponsor: '.$user->user_sponsor->email;
}
$sponsor->email = $user->user_sponsor->email;
}else{
$sponsor->full_name = 'Sponsor wurde gelöscht.';
}
}
$this->b_user->sponsor = $sponsor;
return;
}
public function isSave(){
return $this->b_user->isSave();
}
public function __get($property) {
if (property_exists($this->b_user, $property)) {
return $this->b_user->$property;
}
if (isset($this->b_user->{$property})) {
return $this->b_user->{$property};
}
}
}

View file

@ -1,27 +1,20 @@
<?php
namespace App\Services\BusinessPlan;
use App\Models\UserLevel;
use App\Models\UserBusinessStructure;
use App\User;
use stdClass;
class TreeCalcBot
{
private $items = [];
private $parentless = [];
public $date;
public $business_user;
public $business_users = [];
public $parentless = [];
private $sponsor;
private $date;
public $user;
public $lines = [];
public $total_tp = 0;
public $total_qual_tp = 0;
public $commission_total = 0;
public $qual_user_level = null;
private $init_from;
private static $userIDs = [];
public static function addUserID($id){
@ -39,82 +32,121 @@ class TreeCalcBot
$this->init_from = $init_from;
}
public function initMain()
public function initStructureAdmin($check = true)
{
$this->readMain();
$this->readParentsUser();
//check is month is saved.
if($check && $UserBusinessStructure = self::isFromStored($this->date->month, $this->date->year)){
$this->readStoredRootUsers($UserBusinessStructure);
$this->readStoredParentsUsers($UserBusinessStructure);
$this->readStoredParentlessUser($UserBusinessStructure);
}else{
$this->readRootUsers();
$this->readParentsUsers();
$this->readParentlessUser();
}
public function initUser($user_id)
{
$user = User::find($user_id);
$TreeUserItem = new TreeUserItem($this->date);
$TreeUserItem->makeUser($user);
$TreeUserItem->addUserID();
$this->items[] = $TreeUserItem;
}
$this->readParentsUser();
$this->readSponsorUser($user->m_sponsor);
public function initStructureUser($user_id)
{
$BusinessUserItem = new BusinessUserItem($this->date);
$BusinessUserItem->makeUser($user_id);
$BusinessUserItem->addUserID();
$this->business_users[] = $BusinessUserItem;
//check is month is saved.
if($UserBusinessStructure = self::isFromStored($this->date->month, $this->date->year)){
$this->readStoredParentsUsers($UserBusinessStructure);
if(isset($this->business_users[0]) && $this->business_users[0]->sponsor){
$this->readStoredSponsorUser($this->business_users[0]->sponsor->user_id);
}
public function initDetailUser($user)
}else{
$this->readParentsUsers();
$this->readSponsorUser($user_id);
}
}
public function initBusinesslUserDetail($user)
{
$this->user = new TreeUserItem($this->date);
$this->user->makeUser($user);
$this->user->readParentsUser();
$this->business_user = new BusinessUserItem($this->date);
$this->business_user->makeUser($user->id);
$this->business_user->checkSponsor($user);
if(!$this->business_user->isSave()){
$this->business_user->readParentsBusinessUsers();
//calculate Lines
if(count($this->user->items) > 0){
$this->calcUserTP($this->user->items, 1);
if(count($this->business_user->businessUserItems) > 0){
$this->calcUserTP($this->business_user->businessUserItems, 1);
}
$this->business_user->calcQualTP();
}
$this->calcQualTP();
}
private function calcUserTP($items, $line){
if(!isset($this->lines[$line])){
$this->lines[$line] = new stdClass();
$this->lines[$line]->points = 0;
}
foreach($items as $item){
if(count($item->items) > 0){
$this->calcUserTP($item->items, $line+1);
}
$this->lines[$line]->points += $item->sales_volume_points_sum;
$this->total_tp += $item->sales_volume_points_sum;
/*public function storeBusinesslUser()
{
$this->business_user->storeUser();
}*/
public static function isFromStored($month, $year){
//when is stored an completed
$UserBusinessStructure = UserBusinessStructure::where('year', $year)->where('month', $month)->first();
if($UserBusinessStructure && $UserBusinessStructure->completed){
return $UserBusinessStructure;
}
return false;
}
private function calcUserTP($businessUserItems, $line){
if(!isset($this->business_user->business_lines[$line])){
$obj = new stdClass();
$obj->points = 0;
$this->business_user->addBusinessLineToUser($line, $obj);
}
foreach($businessUserItems as $business_user_item){
if(count($business_user_item->businessUserItems) > 0){
$this->calcUserTP($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);
}
}
public function getGrowthBonus(){
if(count($this->business_user->business_lines) > 6){
$b_lines = $this->business_user->business_lines->toArray();
return array_slice($b_lines, 6);
}
return [];
}
public function getKeybyLine($line, $key){
if(!isset($this->lines[$line])){
if($this->business_user->business_lines){
$b_lines = $this->business_user->business_lines;
if(isset($b_lines[$line])){
if($b_lines[$line] instanceof stdClass){
if(isset($b_lines[$line]->{$key})){
return $b_lines[$line]->{$key};
}
}else{
if(isset($b_lines[$line][$key])){
return $b_lines[$line][$key];
}
}
}
}
return 0;
}
return isset($this->lines[$line]->{$key}) ? $this->lines[$line]->{$key} : 0;
}
public function calcQualTP(){
if($this->user->isQualKP()){
$this->total_qual_tp = $this->total_tp + $this->user->getRestQualKP();
$this->qual_user_level = UserLevel::where('qual_tp', '<=', $this->total_qual_tp)->orderBy('qual_tp', 'desc')->first();
$this->commission_total = 0;
if($this->qual_user_level){
foreach($this->lines as $line => $values){
$values->margin = $this->qual_user_level->{'pr_line_'.$line};
$values->commission = round($values->points / 100 * $values->margin, 2);
$this->commission_total += $values->commission;
$this->lines[$line] = $values;
}
}
}
}
private function readMain(){
//* reading from current*//
private function readRootUsers(){
$users = User::with('account')->select('users.*')
->where('users.deleted_at', '=', null)
->where('users.id', '!=', 1)
@ -126,18 +158,17 @@ class TreeCalcBot
->get();
if($users){
foreach($users as $user){
$TreeUserItem = new TreeUserItem($this->date);
$TreeUserItem->makeUser($user);
$TreeUserItem->addUserID();
$this->items[] = $TreeUserItem;
$BusinessUserItem = new BusinessUserItem($this->date);
$BusinessUserItem->makeUser($user->id);
$BusinessUserItem->addUserID();
$this->business_users[] = $BusinessUserItem;
}
}
}
private function readParentsUser(){
foreach($this->items as $item){
$item->readParentsUser();
private function readParentsUsers(){
foreach($this->business_users as $business_user){
$business_user->readParentsBusinessUsers();
}
}
@ -149,34 +180,77 @@ class TreeCalcBot
->where('users.payment_account', "!=", null)
->where('users.active_date', "<=", $this->date->end_date)
->get();
foreach($users as $user){
if(!isset(self::$userIDs[$user->id])){
$TreeUserItem = new TreeUserItem($this->date);
$TreeUserItem->makeUser($user);
$TreeUserItem->checkSponsor();
$this->parentless[] = $TreeUserItem;
$BusinessUserItem = new BusinessUserItem($this->date);
$BusinessUserItem->makeUser($user->id);
$this->parentless[] = $BusinessUserItem;
}
}
}
public function readSponsorUser($m_sponsor_id){
$sponsor = User::find($m_sponsor_id);
if($sponsor){
$this->sponsor = new TreeUserItem($this->date);
$this->sponsor->makeUser($sponsor);
//* reading from stored*//
private function readStoredRootUsers(UserBusinessStructure $userBusinessStructure){
//first level is root
if($userBusinessStructure->structure){
foreach($userBusinessStructure->structure as $obj){
$BusinessUserItem = new BusinessUserItem($this->date);
$BusinessUserItem->makeUser($obj->user_id);
$BusinessUserItem->addUserID();
$this->business_users[] = $BusinessUserItem;
}
}
}
private function readStoredParentsUsers(UserBusinessStructure $userBusinessStructure){
foreach($this->business_users as $business_user){
$business_user->readStoredParentsBusinessUsers($userBusinessStructure->structure);
}
}
private function readStoredParentlessUser(UserBusinessStructure $userBusinessStructure){
if($userBusinessStructure->parentless){
foreach($userBusinessStructure->parentless as $obj){
if(!isset(self::$userIDs[$obj->user_id])){
$BusinessUserItem = new BusinessUserItem($this->date);
$BusinessUserItem->makeUser($obj->user_id);
$this->parentless[] = $BusinessUserItem;
}
}
}
}
public function readSponsorUser($user_id){
$user = User::find($user_id);
$userSponsor = User::find($user->m_sponsor);
if($userSponsor){
$this->sponsor = new BusinessUserItem($this->date);
$this->sponsor->makeUser($userSponsor->id);
}
}
public function readStoredSponsorUser($user_id){
$this->sponsor = new BusinessUserItem($this->date);
$this->sponsor->makeUser($user_id);
}
public function getItems(){
return $this->items;
return $this->business_users;
}
public function makeHtmlTree(){
$deep = 0;
$ret = '<ol class="dd-list">';
foreach($this->items as $item){
$ret .= $this->addItem($item, $deep);
foreach($this->business_users as $business_user){
$ret .= $this->addItem($business_user, $deep);
}
$ret .= '</ol>';
return $ret;
@ -185,16 +259,16 @@ class TreeCalcBot
private function addItem($item, $deep){
$button = '';
if(($this->init_from === 'admin' && \Auth::user()->isAdmin()) || ($this->init_from === 'member' && \Auth::user()->id === $item->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->id.'"
data-id="'.$item->user_id.'"
data-action="business-user-detail"
data-back=""
data-modal="modal-xl"
data-init_from="'.$this->init_from .'"
data-route="'.route('modal_load').'"><span class="far fa-calculator"></span></button>';
}
return '<li class="dd-item dd-nodrag" data-id="'.$item->id.'">'.
return '<li class="dd-item dd-nodrag" data-id="'.$item->user_id.'">'.
'<div class="dd-handle">
<div class="media align-items-center">
<div class="d-flex flex-column justify-content-center align-items-center">
@ -203,10 +277,11 @@ class TreeCalcBot
<div class="media-body ml-2">
<span class="'.($item->active_account ? '' : 'text-muted').'">
<span class="mr-1 ion ion-ios-contact '.($item->active_account ? 'text-primary' : 'text-danger').'"></span>
<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.' | '.$item->m_account.'</span>
<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>Points: '.$item->sales_volume_points_sum.'</strong> | B: '.$item->sales_volume_points.' | S: '.$item->sales_volume_points_shop.' <strong> | Umsatz: '.$item->sales_volume_total_sum.' €</strong> | B: '.$item->sales_volume_total.' € | S: '.$item->sales_volume_total_shop.' €'.
'<strong>Gesamte Points: '.$item->sales_volume_points_sum.'</strong> | B: '.$item->sales_volume_points.' | S: '.$item->sales_volume_points_shop.' <strong>
| Umsatz netto: '.formatNumber($item->sales_volume_total_sum).' &euro;</strong> | B: '.formatNumber($item->sales_volume_total).' &euro; | S: '.formatNumber($item->sales_volume_total_shop).' &euro;'.
$button
:
'Account bis: '.$item->payment_account_date).
@ -223,9 +298,9 @@ class TreeCalcBot
}
private function addParentItem($item, $deep){
if($item->items){
if($item->businessUserItems){
$ret = '<ol class="dd-list dd-nodrag">';
foreach($item->items as $parent){
foreach($item->businessUserItems as $parent){
$ret .= $this->addItem($parent, $deep+1);
}
$ret .='</ol>';
@ -242,16 +317,17 @@ class TreeCalcBot
public function makeParentlessHtml(){
$ret = "";
foreach($this->parentless as $item){
$ret .= '<li class="dd-item dd-nodrag" data-id="'.$item->id.'">'.
$ret .= '<li class="dd-item dd-nodrag" data-id="'.$item->user_id.'">'.
'<div class="dd-handle">
<span class="'.($item->active_account ? '' : 'text-muted').'">
<span class="mr-1 ion ion-ios-contact '.($item->active_account ? 'text-primary' : 'text-danger').'"></span>
<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.' | '.$item->m_account.'</span>
<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>Points: '.$item->sales_volume_points_sum.'</strong> | B: '.$item->sales_volume_points.' | S: '.$item->sales_volume_points_shop.' <strong> | Umsatz: '.$item->sales_volume_total_sum.' €</strong> | B: '.$item->sales_volume_total.' € | S: '.$item->sales_volume_total_shop.' €'.
'<strong>Gesamte Points: '.$item->sales_volume_points_sum.'</strong> | B: '.$item->sales_volume_points.' | S: '.$item->sales_volume_points_shop.' <strong>
| Umsatz netto: '.formatNumber($item->sales_volume_total_sum).' &euro;</strong> | B: '.formatNumber($item->sales_volume_total).' &euro; | S: '.formatNumber($item->sales_volume_total_shop).' &euro;'.
' | <button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="'.$item->id.'"
data-id="'.$item->user_id.'"
data-action="business-user-detail"
data-back=""
data-modal="modal-xl"
@ -275,12 +351,13 @@ class TreeCalcBot
'<div class="dd-handle">
<span class="'.($this->sponsor->active_account ? '' : 'text-muted').'">
<span class="mr-1 ion ion-ios-contact '.($this->sponsor->active_account ? 'text-primary' : 'text-danger').'"></span>
<strong>'.$this->sponsor->first_name.' '.$this->sponsor->last_name.'</strong> <a href="mailto: '.$this->sponsor->email.'">'.$this->sponsor->email.'</a> <span class="badge badge-outline-default '.($this->sponsor->active_account ? '' : 'text-muted').'">'.$this->sponsor->user_level.' | '.$this->sponsor->m_account.'</span>';
<strong>'.$this->sponsor->first_name.' '.$this->sponsor->last_name.'</strong> <a href="mailto: '.$this->sponsor->email.'">'.$this->sponsor->email.'</a> <span class="badge badge-outline-default '.($this->sponsor->active_account ? '' : 'text-muted').'">'.$this->sponsor->user_level_name.' | '.$this->sponsor->m_account.'</span>';
if($this->init_from === 'admin'){
$ret .= '<br><span class="small">'.
($this->sponsor->active_account ?
'<strong>Points: '.$this->sponsor->sales_volume_points_sum.'</strong> | B: '.$this->sponsor->sales_volume_points.' | S: '.$this->sponsor->sales_volume_points_shop.' <strong> | Umsatz: '.$this->sponsor->sales_volume_total_sum.' €</strong> | B: '.$this->sponsor->sales_volume_total.' € | S: '.$this->sponsor->sales_volume_total_shop.' €'
'<strong>Gesamte Points: '.$this->sponsor->sales_volume_points_sum.'</strong> | B: '.$this->sponsor->sales_volume_points.' | S: '.$this->sponsor->sales_volume_points_shop.' <strong>
| Umsatz netto: '.formatNumber($this->sponsor->sales_volume_total_sum).' &euro;</strong> | B: '.formatNumber($this->sponsor->sales_volume_total).' &euro; | S: '.formatNumber($this->sponsor->sales_volume_total_shop).' &euro;'
:
'Account bis: '.$this->sponsor->payment_account_date).
'</span>';

View file

@ -2,14 +2,19 @@
namespace App\Services\BusinessPlan;
use App\User;
use stdClass;
use Carbon\Carbon;
use App\Models\UserLevel;
use App\Models\UserBusiness;
class TreeUserItem
{
public $items = [];
private $date;
public $lines = [];
public $user_level_active;
@ -21,41 +26,38 @@ class TreeUserItem
public function makeUser(User $user){
$this->id = $user->id;
$this->m_level = $user->m_level;
$this->m_sponsor = $user->m_sponsor;
$this->user_level = $user->user_level ? $user->user_level->name : '';
$this->active_account = $user->payment_account ? Carbon::parse($user->payment_account)->gt(Carbon::parse($this->date->start_date)) : false;
$this->payment_account_date = $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
$this->active_date = $user->active_date ? $user->getActiveDateFormat() : "-";
$this->m_account = $user->account->m_account;
$this->email = $user->email;
$this->first_name = $user->account->first_name;
$this->last_name = $user->account->last_name;
$this->sales_volume_points = $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points');
$this->sales_volume_points_shop = $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points_shop');
$this->sales_volume_points_sum = $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points_sum');
$this->sales_volume_total = $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total');
$this->sales_volume_total_shop = $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total_shop');
$this->sales_volume_total_sum = $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total_sum');
if($user->user_level){
$this->margin = $user->user_level->margin;
$this->margin_shop = $user->user_level->margin_shop;
$this->qual_kp = $user->user_level->qual_kp;
$this->qual_tp = $user->user_level->qual_tp;
}else{
$this->margin = 0;
$this->margin_shop = 0;
$this->qual_kp = 0;
$this->qual_tp = 0;
}
$this->user_level_active = $user->user_level ? $user->user_level : null;
$this->b_user = new UserBusiness();
$fill = [
'user_id' => $user->id,
'month' => $this->date->month,
'year' => $this->date->year,
'm_level' => $user->m_level,
'm_sponsor' => $user->m_sponsor,
'user_level_name' => $user->user_level ? $user->user_level->name : '',
'active_account' => $user->payment_account ? Carbon::parse($user->payment_account)->gt(Carbon::parse($this->date->start_date)) : false,
'payment_account_date' => $user->payment_account ? $user->getPaymentAccountDateFormat(false) : NULL,
'active_date' => $user->active_date ? $user->active_date : NULL,
'm_account' => $user->account->m_account,
'email' => $user->email,
'first_name' => $user->account->first_name,
'last_name' => $user->account->last_name,
'sales_volume_points' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points'),
'sales_volume_points_shop' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points_shop'),
'sales_volume_points_sum' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_points_sum'),
'sales_volume_total' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total'),
'sales_volume_total_shop' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total_shop'),
'sales_volume_total_sum' => $user->getUserSalesVolumeBy($this->date->month, $this->date->year, 'sales_volume_total_sum'),
'margin' => $user->user_level_active ? $user->user_level_active->margin : 0,
'margin_shop' => $user->user_level_active ? $user->user_level_active->margin_shop : 0,
'qual_kp' => $user->user_level_active ? $user->user_level_active->qual_kp : 0,
'qual_tp' => $user->user_level_active ? $user->user_level_active->qual_tp : 0,
];
$this->b_user->fill($fill);
}
public function addUserID(){
TreeCalcBot::addUserID($this->id);
TreeCalcBot::addUserID($this->user_id);
}
public function isQualKP(){
@ -74,7 +76,7 @@ class TreeUserItem
$user = User::find($this->m_sponsor);
if($user){
if($user->account){
$this->m_sponsor_name = 'Sponsor: '.$user->account->first_name.' '.$user->account->last_name.' | '.$user->email.' | '.$user->account->m_account;
$this->m_sponsor_name = substr('Sponsor: '.$user->account->first_name.' '.$user->account->last_name.' | '.$user->email.' | '.$user->account->m_account, 0, 190);
}else{
$this->m_sponsor_name = 'Sponsor: '.$user->email;
}
@ -83,7 +85,15 @@ class TreeUserItem
$this->m_sponsor_name = 'Sponsor wurde gelöscht.';
return;
}
/*
'total_tp' => ,
'total_qual_tp' => ,
'commission_total' => ,
'lines',
'items',
'qual_user_level_id'
*/
public function readParentsUser(){
$users = User::with('account')->select('users.*')
@ -91,17 +101,18 @@ class TreeUserItem
->where('users.id', '!=', 1)
->where('users.admin', "<", 4)
->where('users.m_level', "!=", null)
->where('users.m_sponsor', "=", $this->id) //<- need the id for parents / sponsors
->where('users.m_sponsor', "=", $this->user_id) //<- need the id for parents / sponsors
->where('users.payment_account', "!=", null)
->where('users.active_date', "<=", $this->date->end_date)
->get();
dd($users);
if($users){
foreach($users as $user){
$TreeUserItem = new TreeUserItem($this->date);
$TreeUserItem->makeUser($user);
$TreeUserItem->addUserID();
$this->items[] = $TreeUserItem; }
$this->items[] = $TreeUserItem;
}
}
foreach($this->items as $item){
@ -111,4 +122,51 @@ class TreeUserItem
}
public function calcUserTP($line){
if(!isset($this->lines[$line])){
$this->lines[$line] = new stdClass();
$this->lines[$line]->points = 0;
}
foreach($this->items as $item){
if(count($item->items) > 0){
$this->calcUserTP($line+1);
}
$this->lines[$line]->points += $item->sales_volume_points_sum;
$this->total_tp += $item->sales_volume_points_sum;
}
}
public function calcQualTP(){
if($this->isQualKP()){
$this->total_qual_tp = $this->total_tp + $this->getRestQualKP();
$this->qual_user_level = UserLevel::where('qual_tp', '<=', $this->total_qual_tp)->where('pos', '<=', $this->user->user_level->pos)->orderBy('qual_tp', 'desc')->first();
$this->commission_total = 0;
if($this->qual_user_level){
foreach($this->lines as $line => $values){
$values->margin = $this->qual_user_level->{'pr_line_'.$line};
if($line > 6){
//wachstumsbonus
$values->margin = $this->qual_user_level->growth_bonus;
}
$values->commission = round($values->points / 100 * $values->margin, 2);
$this->commission_total += $values->commission;
$this->lines[$line] = $values;
}
}
}
}
public function __get($property) {
if (property_exists($this->b_user, $property)) {
return $this->b_user->$property;
}
if (isset($this->b_user->{$property})) {
return $this->b_user->{$property};
}
}
}

82
app/Services/Credit.php Normal file
View file

@ -0,0 +1,82 @@
<?php
namespace App\Services;
use App\Services\Util;
use App\Models\Setting;
use App\Mail\MailCredit;
use App\Models\UserCredit;
use Illuminate\Support\Facades\Mail;
class Credit
{
public static function getCreditNumber(){
return (int) Setting::getContentBySlug('credit-number');
}
public static function makeNextCreditNumber(){
$credit_number = self::getCreditNumber();
$credit_number = $credit_number+1;
Setting::setContentBySlug('credit-number', $credit_number, 'int');
return $credit_number;
}
public static function createCreditNumber($credit_number, $credit_date){
$prefix = "GS".\Carbon::parse($credit_date)->format('Y');
$credit_number = str_pad($credit_number, 5, '0', STR_PAD_LEFT);
return $prefix.$credit_number;
}
public static function getCreditStorageDir($credit_date){
return "/credit/".\Carbon::parse($credit_date)->format('Y/m/');
}
public static function makeCreditFilename($credit_number){
return $credit_number."-MIVITA-Gutschrift.pdf";
}
public static function isCredit(UserCredit $user_credit){
return $user_credit->isCredit();
}
/*public static function getFilename(UserCredit $user_credit){
return $user_credit->filename;
}
public static function getDir(UserCredit $user_credit){
return $user_credit->dir;
}
public static function getDownloadURL(UserCredit $user_credit, $do = false){
return route('storage_file', [$user_credit->id, 'cms_download_file', $do]);
}
public static function getDownloadPath(UserCredit $user_credit, $full = false){
$dir = self::getDir($user_credit);
$filename = self::getFilename($user_credit);
if(!$full){
return $dir.$filename;
}
return \Storage::disk('public')->path($dir.$filename);
}*/
public static function sendCreditMail(UserCredit $user_credit){
$bcc = [];
$email = $user_credit->user->email;
if(!$email){
if($user_credit->user->mode === 'test'){
}else{
$email = config('app.checkout_mail');
}
}
if($user_credit->user->mode === 'test'){
$bcc[] = config('app.checkout_test_mail');
}else{
$bcc[] = config('app.checkout_mail');
}
Mail::to($email)->bcc($bcc)->send(new MailCredit($user_credit));
}
}

View file

@ -74,9 +74,12 @@ class HomepartyCart
self::addCart(self::$userCarts[$homeparty_user->id]);
}
self::caluclateShipping();
self::caluclateBonus();
self::calculateBonusHost();
self::caluclateShipping();
self::recalculate();
}
public static function addCart(HomepartyUserCart $homepartyUserCart){
@ -92,6 +95,22 @@ class HomepartyCart
return isset(self::$userCarts[$id]) ? self::$userCarts[$id] : null;
}
private static function recalculate(){
self::$points =0;
self::$price = 0;
self::$price_net = 0;
self::$ek_price = 0;
self::$ek_price_net = 0;
self::$income_price = 0;
foreach(self::$userCarts as $user_cart){
self::$points += $user_cart->points;
self::$price += $user_cart->price;
self::$price_net += $user_cart->price_net;
self::$ek_price += $user_cart->ek_price;
self::$ek_price_net += $user_cart->ek_price_net;
self::$income_price += $user_cart->income_price;
}
}
private static function caluclateBonus(){
@ -138,27 +157,51 @@ class HomepartyCart
$bonus_total = self::$bonus_value + self::$bonus_coupon;
$user_cart = self::getUserCart(self::$user_host_id);
//cart lower the bonus
if($user_cart->price <= $bonus_total){
self::$bonus_points_diff = $user_cart->points;
$user_cart->points = 0;
$user_cart->price = 0;
return;
}
$user_cart->price_net = 0;
//$price_bonus_total = $bonus_total - ($bonus_total - $user_cart->price);
/* self::$price -= $price_bonus_total;
self::$price_net -= ($price_bonus_total / config('app.main_tax'));
self::$ek_price -= $price_bonus_total;
self::$ek_price_net -= ($price_bonus_total / config('app.main_tax'));
self::$income_price -= $user_cart->income_price;*/
$user_cart->income_price = 0;
}else{
$bonus_percent = (100/$user_cart->price*$bonus_total);
self::$bonus_points_diff = round($user_cart->points/100*$bonus_percent);
$user_cart->points -= self::$bonus_points_diff;
//sub bonus on host
$user_cart->price -= $bonus_total;
$user_cart->price_net -= ($bonus_total / config('app.main_tax'));
$user_cart->ek_price -= $bonus_total;
$user_cart->ek_price_net -= ($bonus_total / config('app.main_tax'));
self::$price -= $bonus_total;
/*self::$price -= $bonus_total;
self::$price_net -= ($bonus_total / config('app.main_tax'));
self::$ek_price -= $bonus_total;
self::$ek_price_net -= ($bonus_total / config('app.main_tax'));
self::$ek_price_net -= ($bonus_total / config('app.main_tax'));*/
}
if($user_cart->ek_price <= $bonus_total){
$user_cart->ek_price = 0;
$user_cart->ek_price_net = 0;
$user_cart->income_price = $user_cart->price - $user_cart->ek_price;
}else{
$user_cart->ek_price -= $bonus_total;
$user_cart->ek_price_net -= ($bonus_total / config('app.main_tax'));
}
}
}

View file

@ -5,6 +5,7 @@ namespace App\Services;
use App\User;
use App\Mail\MailCheckout;
use App\Models\ShoppingOrder;
use App\Models\UserCreditItem;
use App\Models\ShoppingPayment;
use App\Services\ShopApiOrderCart;
use Illuminate\Support\Facades\Mail;
@ -86,6 +87,15 @@ class Payment
return '<span class="badge badge-pill badge-'.self::getFormattedTxactionColor($shopping_payment->txaction).'">'.self::getFormattedTxaction($shopping_payment->txaction).'</span>';
}
public static function addUserCreditMargin(User $user, $credit, $status, $message){
UserCreditItem::create([
'user_id' => $user->id,
'credit' => $credit,
'message' => $message,
'status' => $status,
]);
}
/*
Wir bei Zahlung aufgerufen.
Betätigung durch Payone oder Zahlung auf MIVITA Rechnung

View file

@ -95,7 +95,7 @@ class ShopApiOrderCart
$this->shoppingCollectOrder->shipping_tax = round($this->shoppingCollectOrder->shipping - $this->shoppingCollectOrder->shipping_net, 2);
$this->shoppingCollectOrder->tax_total += $this->shoppingCollectOrder->shipping_tax;
//add shipping tax to split
$this->shoppingCollectOrder->addTaxToSplit(config('app.shipping_tax'), $this->shoppingCollectOrder->shipping_tax);
$this->shoppingCollectOrder->addTaxToSplit(config('app.main_tax_rate'), $this->shoppingCollectOrder->shipping_tax);
$this->shoppingCollectOrder->price_total_net += $this->shoppingCollectOrder->shipping_net;
$this->shoppingCollectOrder->price_total = round($this->shoppingCollectOrder->tax_total + $this->shoppingCollectOrder->price_total_net, 2);

View file

@ -0,0 +1,51 @@
<?php
namespace App\Services\SyS;
use App\Cron\BusinessUsersStore;
use Carbon;
use Request;
use App\Models\SySetting;
class BusinessStructur
{
public static function show()
{
$month = 2;
$year = 2021;
dd("function on: php artisan business:store month year");
/*$businessUsersStore = new BusinessUsersStore($month, $year);
$businessUsersStore->storeUserBusinessStructure();
$businessUsersStore->storeBusinessUsersDetail();
$businessUsersStore->storeBusinessCompleted();*/
$data = [
'year' => $year,
'month' => $month,
];
return view('sys.tools.business_structur', $data);
}
public static function store()
{
$data = Request::all();
$data['active'] = isset($data['active']) ? true : false;
if($data['id'] === "new"){
$model = SySetting::create($data);
}else{
$model = SySetting::find($data['id']);
$model->fill($data);
$model->save();
}
\Session()->flash('alert-save', '1');
return redirect(route('sysadmin_tool', ['sales_members']));
}
}

View file

@ -491,19 +491,19 @@ class User extends Authenticatable
break;
case 'sales_volume_points_sum':
return $this->userSalesVolume->month_points + $this->userSalesVolume->month_shop_points;
return $this->userSalesVolume->getPointsSum();
break;
case 'sales_volume_total':
return formatNumber($this->userSalesVolume->month_total_net);
return $this->userSalesVolume->month_total_net;
break;
case 'sales_volume_total_shop':
return formatNumber($this->userSalesVolume->month_shop_total_net);
return $this->userSalesVolume->month_shop_total_net;
break;
case 'sales_volume_total_sum':
return formatNumber($this->userSalesVolume->month_total_net + $this->userSalesVolume->month_shop_total_net);
return $this->userSalesVolume->getTotalNetSum();
break;
}
}

View file

@ -53,7 +53,6 @@ if (! function_exists('get_active_badge')) {
}
}
if (! function_exists('formatNumber')) {
function formatNumber($number, $dec=2)
{
@ -75,5 +74,9 @@ if (! function_exists('cleanNumberFormat')) {
}
}
if (! function_exists('formatDate')) {
function formatDate($date)
{
return Carbon::parse($date)->format(\Util::formatDateDB());
}
}

View file

@ -68,6 +68,7 @@ return [
'info_test_mail' => env('APP_INFO_TEST_MAIL', 'devtest@mivita.care'),
'main_tax' => env('APP_MAIN_TAX', 1.19),
'main_tax_rate' => env('APP_MAIN_TAX_RATE', 19),
'shipping_tax' => env('APP_SHIPPING_TAX', 19),
/* 'url_backend' => env('APP_URL', 'http://mivita.local/'),

View file

@ -58,7 +58,6 @@ class CreateHomepartyUsersTable extends Migration
$table->text('settings')->nullable();
$table->timestamps();
$table->softDeletes();
$table->timestamp('user_deleted_at')->nullable();

View file

@ -0,0 +1,95 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserBusinessesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_businesses', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->unsignedTinyInteger('month')->nullable();
$table->unsignedSmallInteger('year')->nullable();
$table->unsignedInteger('m_level_id')->nullable();
$table->unsignedInteger('m_sponsor_id')->nullable();
$table->text('sponsor')->nullable();
$table->string('m_sponsor_name')->nullable();
$table->string('user_level_name')->nullable();
$table->boolean('active_account')->default(false);
$table->date('payment_account_date')->nullable();
$table->date('active_date')->nullable();
$table->unsignedInteger('m_account')->nullable();
$table->string('email')->nullable();
$table->string('first_name')->nullable();
$table->string('last_name')->nullable();
$table->integer('sales_volume_points')->nullable();
$table->integer('sales_volume_points_shop')->nullable();
$table->integer('sales_volume_points_sum')->nullable();
$table->decimal('sales_volume_total', 13, 2)->nullable();
$table->decimal('sales_volume_total_shop', 13, 2)->nullable();
$table->decimal('sales_volume_total_sum', 13, 2)->nullable();
$table->unsignedTinyInteger('margin')->nullable();
$table->unsignedTinyInteger('margin_shop')->nullable();
$table->decimal('commission_shop_sales', 13, 2)->nullable();
$table->unsignedSmallInteger('qual_kp')->nullable();
$table->unsignedInteger('qual_tp')->nullable();
$table->integer('total_tp')->nullable();
$table->integer('total_qual_tp')->nullable();
$table->decimal('commission_lines_total', 13, 2)->nullable();
$table->decimal('commission_shop_sales', 13, 2)->nullable();
$table->text('businessLines')->nullable();
$table->text('userItems')->nullable();
$table->text('qual_user_level')->nullable();
$table->timestamps();
/*$table->foreign('user_id')
->references('id')
->on('users');
$table->foreign('m_level')
->references('id')
->on('user_levels');
$table->foreign('m_sponsor')
->references('id')
->on('users');*/
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_businesses');
}
}

View file

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserBusinessStructuresTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_business_structures', function (Blueprint $table) {
$table->increments('id');
$table->unsignedTinyInteger('month')->index();
$table->unsignedSmallInteger('year')->index();
$table->mediumText('structure')->nullable();
$table->text('parentless')->nullable();
$table->text('users')->nullable();
$table->boolean('completed')->default(false);
$table->unsignedTinyInteger('status')->index()->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_business_structures');
}
}

View file

@ -0,0 +1,98 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserBusinessesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_businesses', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id')->index();
$table->unsignedTinyInteger('month')->index();
$table->unsignedSmallInteger('year')->index();
$table->unsignedInteger('b_structure_id')->nullable();
$table->unsignedInteger('m_level_id')->nullable();
$table->unsignedInteger('m_sponsor_id')->nullable();
$table->text('sponsor')->nullable();
$table->string('m_sponsor_name')->nullable();
$table->string('user_level_name')->nullable();
$table->boolean('active_account')->default(false);
$table->date('payment_account_date')->nullable();
$table->date('active_date')->nullable();
$table->unsignedInteger('m_account')->nullable();
$table->string('email')->nullable();
$table->string('first_name')->nullable();
$table->string('last_name')->nullable();
$table->integer('sales_volume_points')->nullable();
$table->integer('sales_volume_points_shop')->nullable();
$table->integer('sales_volume_points_sum')->nullable();
$table->decimal('sales_volume_total', 13, 2)->nullable();
$table->decimal('sales_volume_total_shop', 13, 2)->nullable();
$table->decimal('sales_volume_total_sum', 13, 2)->nullable();
$table->unsignedTinyInteger('margin')->nullable();
$table->unsignedTinyInteger('margin_shop')->nullable();
$table->unsignedSmallInteger('qual_kp')->nullable();
$table->unsignedInteger('qual_tp')->nullable();
$table->integer('total_tp')->nullable();
$table->integer('total_qual_tp')->nullable();
$table->decimal('commission_lines_total', 13, 2)->nullable();
$table->decimal('commission_shop_sales', 13, 2)->nullable();
$table->decimal('commission_team_total', 13, 2)->nullable();
$table->text('business_lines')->nullable();
$table->text('user_items')->nullable();
$table->text('qual_user_level')->nullable();
$table->timestamps();
$table->foreign('b_structure_id')
->references('id')
->on('user_business_structures');
/*$table->foreign('user_id')
->references('id')
->on('users');
$table->foreign('m_level')
->references('id')
->on('user_levels');
$table->foreign('m_sponsor')
->references('id')
->on('users');*/
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_businesses');
}
}

View file

@ -0,0 +1,68 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserCreditsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_credits', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->unsignedTinyInteger('month')->nullable();
$table->unsignedSmallInteger('year')->nullable();
$table->date('date')->nullable();
$table->string('full_number', 255)->nullable();
$table->unsignedInteger('number')->nullable();
$table->decimal('net', 13, 2)->nullable();
$table->decimal('tax_rate', 8, 2)->nullable();
$table->decimal('tax', 8, 2)->nullable();
$table->decimal('total', 13, 2)->nullable();
$table->boolean('taxable')->default(false);
$table->string('filename', 255)->nullable();
$table->string('dir', 100)->nullable();
$table->string('disk', 10)->nullable();
$table->text('infos')->nullable();
$table->boolean('paid_out')->default(false);
$table->date('paid_out_date')->nullable();
$table->boolean('cancellation')->default(false);
$table->unsignedInteger('cancellation_id')->nullable();
$table->date('cancellation_date')->nullable();
$table->unsignedTinyInteger('status')->index()->default(0);
$table->timestamps();
$table->softDeletes();
$table->foreign('user_id')
->references('id')
->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_credits');
}
}

View file

@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserCreditItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_credit_items', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->unsignedInteger('user_credit_id')->nullable();;
$table->decimal('credit', 13, 2)->nullable();
$table->text('message')->nullable();
$table->unsignedTinyInteger('status')->index()->default(0);
$table->boolean('paid')->default(false);
$table->timestamps();
$table->foreign('user_id')
->references('id')
->on('users');
$table->foreign('user_credit_id')
->references('id')
->on('user_credits');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_credit_items');
}
}

View file

@ -96,7 +96,43 @@ jQuery(document).ready(function() {
function _scrollTo(to, offset) {
$('html,body').animate({scrollTop: $(to).offset().top - offset}, 800);
}
function ajax_object_action(event, object, callback) {
// event.preventDefault();
var data = {};
$.each(object.data(), function(index, value){
if(typeof value !== 'object'){
data[index] = value;
}
});
var url = data['url'];
// console.log(data);
// console.log(url);
$.ajax({
url: url,
data: data,
type: "POST",
dataType: "json",
cache: false,
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
encode: true,
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(data) {
//console.log(data);
//data will send data to callback function
callback(data);
},
error: function(xhr, status, errorThrown) {
console.log(xhr);
console.log(xhr.responseText);
console.log(status);
console.log(errorThrown);
console.log("Sorry, there was a problem!");
}
});
return false;
}
$(function () {
$('#modals-load-content').on('show.bs.modal', function (event) {
@ -164,40 +200,4 @@ $(function () {
return false;
}
function ajax_object_action(event, object, callback) {
event.preventDefault();
var data = {};
$.each(object.data(), function(index, value){
if(typeof value !== 'object'){
data[index] = value;
}
});
var url = data['url'];
console.log(data);
console.log(url);
$.ajax({
url: url,
data: data,
type: "POST",
dataType: "json",
cache: false,
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
encode: true,
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(data) {
//data will send data to callback function
callback(data);
},
error: function(xhr, status, errorThrown) {
console.log(xhr);
console.log(xhr.responseText);
console.log(status);
console.log(errorThrown);
console.log("Sorry, there was a problem!");
}
});
return false;
}
});

View file

@ -0,0 +1,164 @@
<table class="table user-view-table m-0">
<tbody>
<tr>
<td>Account ID:</td>
<td>
{{ $TreeCalcBot->business_user->m_account }}
</td>
</tr>
<tr>
<td>Level:</td>
<td>
{{ $TreeCalcBot->business_user->user_level_name }}
</td>
</tr>
<tr>
<td>Kundenprovision:</td>
<td>
{{ $TreeCalcBot->business_user->margin }} %
</td>
</tr>
<tr>
<td>Shop Provision:</td>
<td>
{{ $TreeCalcBot->business_user->margin_shop }} %
</td>
</tr>
<tr>
<td>Account:</td>
<td>
@if($TreeCalcBot->business_user->active_account)
<span class="badge badge-outline-success">aktiv</span>
@else
<span class="badge badge-outline-danger">nicht aktiv</span>
@endif
@if($TreeCalcBot->business_user->active_date)
bis: {{ formatDate($TreeCalcBot->business_user->active_date) }}
@endif
</td>
</tr>
<tr>
<td>Sponsor:</td>
<td>
@if($TreeCalcBot->business_user->sponsor->is_sponsor)
{{ $TreeCalcBot->business_user->sponsor->first_name }} {{ $TreeCalcBot->business_user->sponsor->last_name }} |
{{ $TreeCalcBot->business_user->sponsor->email }} |
{{ $TreeCalcBot->business_user->sponsor->m_account }}
@else
-
@endif
</td>
</tr>
<tr>
<td>Datum:</td>
<td>
<strong>{{ HTMLHelper::getMonth($data['month']) }} {{ $data['year'] }}</strong> | Abgeschlossen:
@if($TreeCalcBot->business_user->isSave())
<span class="badge badge-outline-success"><i class="fa fa-check-circle"></i></span>
@else
<span class="badge badge-outline-warning"><i class="fa fa-times"></i></span>
@endif
</td>
</tr>
<tr>
<td>Gesamte Points:</td>
<td>
<strong>{{ $TreeCalcBot->business_user->sales_volume_points_sum }}</strong>
(Berater: {{ $TreeCalcBot->business_user->sales_volume_points }} | Shop: {{ $TreeCalcBot->business_user->sales_volume_points_shop }})
</td>
</tr>
<tr>
<td>Umsatz netto:</td>
<td>
<strong>{{ formatNumber($TreeCalcBot->business_user->sales_volume_total_sum) }} &euro;</strong>
(Berater: {{ formatNumber($TreeCalcBot->business_user->sales_volume_total) }} &euro; | Shop: {{ formatNumber($TreeCalcBot->business_user->sales_volume_total_shop) }} &euro;)
</td>
</tr>
<tr>
<td>Persönliches Volumen:</td>
<td>
<span class="badge {{ $TreeCalcBot->business_user->isQualKP() ? 'badge-outline-success' : 'badge-outline-danger' }}"> KD {{ $TreeCalcBot->business_user->qual_kp }}</span>
</td>
</tr>
<tr>
<td>Qualifikation:</td>
<td>
TP {{ formatNumber($TreeCalcBot->business_user->qual_tp, 0) }} /
@if($TreeCalcBot->business_user->isQualKP())
<strong> TP {{ formatNumber($TreeCalcBot->business_user->total_qual_tp, 0) }}</strong> &nbsp;
@if($TreeCalcBot->business_user->qual_user_level)
<span class="badge badge-outline-success">{{ formatNumber($TreeCalcBot->business_user->qual_tp, 0) }} | {{ $TreeCalcBot->business_user->qual_user_level['name'] }}</span>
@endif
@else
<span class="ion ion-md-close text-danger"></span>
@endif
</td>
</tr>
<tr>
<td><strong>Provision Shop:</strong></td>
<td>
<span class="badge badge-primary" style="font-size: 1em;"><strong>{{ formatNumber($TreeCalcBot->business_user->commission_shop_sales) }} &euro;</strong></span>
&nbsp;
(Umsatz Shop netto: {{ formatNumber($TreeCalcBot->business_user->sales_volume_total_shop) }} &euro; / {{ $TreeCalcBot->business_user->margin_shop }} %)
</td>
</tr>
<tr>
<td><strong>Provision Team:</strong></td>
<td>
<span class="badge badge-primary" style="font-size: 1em;"><strong>{{ formatNumber($TreeCalcBot->business_user->commission_team_total) }} &euro;</strong></span>
</td>
</tr>
<tr>
<td><strong>Provision Gesamt:</strong></td>
<td>
<span class="badge badge-secondary" style="font-size: 1em;"><strong>{{ formatNumber($TreeCalcBot->business_user->getCommissionTotal()) }} &euro;</strong></span>
</td>
</tr>
</tbody>
</table>
<hr class="border-light m-0 mb-2">
<div class="table-responsive">
<table class="table card-table m-0">
<tbody>
<tr>
<th>Linie</th>
<th>Points</th>
<th>Provision %</th>
<th>Provision &euro;</th>
</tr>
@for ($line=1; $line<=6; $line++)
<tr>
<td>
<div class="font-weight-bolder line-height-1 my-2 text-dark badge badge-outline-dark">{{ $line }}</div>
</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'points'), 0) }}</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'margin'), 0) }} %</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'commission'), 2) }} &euro;</td>
</tr>
@endfor
@foreach ($TreeCalcBot->getGrowthBonus() as $line => $growthBonu)
<tr>
<td>
<div class="font-weight-bolder line-height-1 my-2 text-dark badge badge-outline-dark">{{ $line+7 }}</div>
</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line+7, 'points'), 0) }}</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line+7, 'margin'), 0) }} %</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line+7, 'commission'), 2) }} &euro;</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td>Gesamt</td>
<td>{{ formatNumber($TreeCalcBot->business_user->total_tp, 0) }}</td>
<td></td>
<td><strong>{{ formatNumber($TreeCalcBot->business_user->commission_team_total, 2) }} &euro;</strong></td>
</tr>
</tfoot>
</table>
</div>

View file

@ -76,6 +76,7 @@
</table>
</div>
</div>
</div>
<script>
$( document ).ready(function() {

View file

@ -42,8 +42,8 @@
<th>{{__('Berater-ID') }}</th>
<th>{{ __('Level') }}</th>
<th>{{ __('KD') }}</th>
<th>{{__('Points')}}</th>
<th>{{__('Umsatz')}}</th>
<th>{{__('Gesamte Points')}}</th>
<th>{{__('Umsatz netto')}}</th>
<th>{{__('E-Mail')}}</th>
<th>{{__('Vorname')}}</th>
<th>{{__('Nachname')}}</th>
@ -57,7 +57,7 @@
</table>
</div>
</div>
</div>
<script>
$( document ).ready(function() {
var oTable = $('#datatable-users').DataTable({
@ -76,15 +76,15 @@
},
"order": [[1, "asc" ]],
"columns": [
{ data: 'id', name: 'users.id', searchable: false },
{ data: 'account.m_account', name: 'account.m_account' },
{ data: 'user_level', name: 'user_level' },
{ data: 'id', name: 'id', searchable: false },
{ data: 'm_account', name: 'm_account', orderable: false },
{ data: 'user_level', name: 'user_level', orderable: false, searchable: false },
{ data: 'is_qual_kp', name: 'is_qual_kp', orderable: false, searchable: false },
{ data: 'sales_volume_points', name: 'sales_volume_points', orderable: false, searchable: false },
{ data: 'sales_volume_total', name: 'sales_volume_total', orderable: false, searchable: false },
{ data: 'email', name: 'users.email' },
{ data: 'account.first_name', name: 'account.first_name' },
{ data: 'account.last_name', name: 'account.last_name' },
{ data: 'email', name: 'email', orderable: false },
{ data: 'first_name', name: 'first_name', orderable: false },
{ data: 'last_name', name: 'last_name', orderable: false },
{ data: 'sponsor', name: 'sponsor', orderable: false, searchable: false },
{ data: 'active_account', name: 'active_account' },
{ data: 'payment_account_date', name: 'payment_account_date' },

View file

@ -57,6 +57,7 @@
@endif
</div>
</div>
</div>
<link rel="stylesheet" href="/vendor/libs/nestable/nestable.css">
<script src="/vendor/libs/nestable/jquery-nestable.js?v=1"></script>
<script>

View file

@ -2,151 +2,36 @@
@section('content')
<div class="card">
<h5 class="card-header">
{{__('Business')}} {{__('Übersicht')}} Berater
</h5>
{!! Form::open(['url' => route('admin_business_user_detail', [$user->id]), 'class' => 'form-horizontal', 'id'=>'']) !!}
{{ Form::hidden('user_id', $user->id ) }}
{{ Form::hidden('month', $TreeCalcBot->date->month) }}
{{ Form::hidden('year', $TreeCalcBot->date->year) }}
<div class="media align-items-center pt-3 mb-0">
{{-- <img src="assets/img/avatars/5-small.png" alt="" class="d-block ui-w-100 rounded-circle">--}}
<div class="media-body ml-4">
<h4 class="font-weight-bold mb-0">{{ $user->account->first_name }} {{ $user->account->last_name }} <a class="font-weight-normal" href="mailto:{{ $user->email }}">{{ $user->email }}</a></h4>
<h4 class="font-weight-bold mb-0">
{{ $user->account->first_name }} {{ $user->account->last_name }} <a class="font-weight-normal" href="mailto:{{ $user->email }}">{{ $user->email }}</a>
{{-- <button type="submit" class="btn btn-submit btn-secondary btn-sm float-right mr-4">{{ __('save') }}</button>&nbsp; --}}
</h4>
</div>
</div>
{!! Form::close() !!}
<div class="card-body">
<table class="table user-view-table m-0">
<tbody>
<tr>
<td>Account ID:</td>
<td>{{ $user->account->m_account }}</td>
</tr>
<tr>
<td>Level:</td>
<td>
@if($user->user_level)
{{ $user->user_level->name }}
@else
-
@endif
</td>
</tr>
<tr>
<td>Kundenprovision:</td>
<td>
{{ $TreeCalcBot->user->margin }} %
</td>
</tr>
<tr>
<td>Shop Provision:</td>
<td>
{{ $TreeCalcBot->user->margin_shop }} %
</td>
</tr>
<tr>
<td>Account:</td>
<td>
@if($user->isActiveAccount())
<span class="badge badge-outline-success">aktiv</span>
@else
<span class="badge badge-outline-danger">nicht aktiv</span>
@endif
@if($user->payment_account)
bis: {{ $user->getPaymentAccountDateFormat(false) }}
@endif
</td>
</tr>
<tr>
<td>Sponsor:</td>
<td>@if($user->user_sponsor)
@if($user->user_sponsor->account)
{{ $user->user_sponsor->account->first_name }} {{ $user->user_sponsor->account->last_name }} |
@endif
{{ $user->email }} |
@if($user->user_sponsor->account)
{{ $user->user_sponsor->account->m_account }} |
@endif
<a href="{{ route('admin_business_user_detail', [$user->user_sponsor->id]) }}" class="btn icon-btn btn-xs btn-secondary"><span class="far fa-calculator"></span></a>
@else
-
@endif
</td>
</tr>
<tr>
<td>Datum:</td>
<td><strong>{{ $month }} {{ $year }}</strong></td>
</tr>
<tr>
<td>Points:</td>
<td>
<strong>{{ $TreeCalcBot->user->sales_volume_points_sum }}</strong>
| Berater: {{ $TreeCalcBot->user->sales_volume_points }} | Shop: {{ $TreeCalcBot->user->sales_volume_points_shop }}
</td>
</tr>
<tr>
<td>Umsatz:</td>
<td>
<strong>{{ $TreeCalcBot->user->sales_volume_total_sum }} </strong>
| Berater: {{ $TreeCalcBot->user->sales_volume_total }} | Shop: {{ $TreeCalcBot->user->sales_volume_total_shop }}
</td>
</tr>
<tr>
<td>Persönliches Volumen:</td>
<td>
<span class="badge {{ $TreeCalcBot->user->isQualKP() ? 'badge-outline-success' : 'badge-outline-danger' }}"> KD {{ $TreeCalcBot->user->qual_kp }}</span>
</td>
</tr>
<tr>
<td>Qualifikation:</td>
<td>
TP {{ formatNumber($TreeCalcBot->user->qual_tp, 0) }} /
@if($TreeCalcBot->user->isQualKP())
<strong> TP{{ formatNumber($TreeCalcBot->total_qual_tp, 0) }}</strong> &nbsp;
@if($TreeCalcBot->qual_user_level)
<span class="badge badge-outline-success">{{ formatNumber($TreeCalcBot->qual_user_level->qual_tp, 0) }} | {{ $TreeCalcBot->qual_user_level->name }}</span>
@endif
@else
<span class="ion ion-md-close text-danger"></span>
@endif
</td>
</tr>
</tbody>
</table>
@include('admin.business._user_detail_in')
</div>
<hr class="border-light m-0">
<div class="table-responsive">
<table class="table card-table m-0">
<tbody>
<tr>
<th>Linie</th>
<th>Points</th>
<th>Provision</th>
<th>Provision</th>
</tr>
@for ($line=1; $line<=6; $line++)
<tr>
<td>
<div class="font-weight-bolder line-height-1 my-2 text-dark badge badge-outline-dark">{{ $line }}</div>
</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'points'), 0) }}</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'margin'), 0) }} %</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'commission'), 2) }}</td>
</tr>
@endfor
</tbody>
<tfoot>
<tr>
<td>Gesamt</td>
<td>{{ formatNumber($TreeCalcBot->total_tp, 0) }}</td>
<td></td>
<td><strong>{{ formatNumber($TreeCalcBot->commission_total, 2) }}</strong></td>
</tr>
</tfoot>
</table>
</div>
<script>

View file

@ -10,149 +10,12 @@
</div>
<div class="modal-body">
@if(isset($TreeCalcBot))
<table class="table user-view-table m-0">
<tbody>
<tr>
<td>Account ID:</td>
<td>{{ $user->account->m_account }}</td>
</tr>
<tr>
<td>Level:</td>
<td>
@if($user->user_level)
{{ $user->user_level->name }}
@else
-
@include('admin.business._user_detail_in')
@endif
</td>
</tr>
<tr>
<td>Kundenprovision:</td>
<td>
{{ $TreeCalcBot->user->margin }} %
</td>
</tr>
<tr>
<td>Shop Provision:</td>
<td>
{{ $TreeCalcBot->user->margin_shop }} %
</td>
</tr>
<tr>
<td>Account:</td>
<td>
@if($user->isActiveAccount())
<span class="badge badge-outline-success">aktiv</span>
@else
<span class="badge badge-outline-danger">nicht aktiv</span>
@endif
@if($user->payment_account)
bis: {{ $user->getPaymentAccountDateFormat(false) }}
@endif
</td>
</tr>
<tr>
<td>Sponsor:</td>
<td>@if($user->user_sponsor)
@if($user->user_sponsor->account)
{{ $user->user_sponsor->account->first_name }} {{ $user->user_sponsor->account->last_name }} |
@endif
{{ $user->user_sponsor->email }} |
@if($user->user_sponsor->account)
{{ $user->user_sponsor->account->m_account }} |
@endif
{{-- <a href="{{ route('admin_business_user_detail', [$user->user_sponsor->id]) }}" class="btn icon-btn btn-xs btn-secondary"><span class="far fa-calculator"></span></a> --}}
@else
-
@endif
</td>
</tr>
<tr>
<td>Datum:</td>
<td><strong>{{ HTMLHelper::getMonth($data['month']) }} {{ $data['year'] }}</strong></td>
</tr>
<tr>
<td>Points:</td>
<td>
<strong>{{ $TreeCalcBot->user->sales_volume_points_sum }}</strong>
| Berater: {{ $TreeCalcBot->user->sales_volume_points }} | Shop: {{ $TreeCalcBot->user->sales_volume_points_shop }}
</td>
</tr>
<tr>
<td>Umsatz:</td>
<td>
<strong>{{ $TreeCalcBot->user->sales_volume_total_sum }} </strong>
| Berater: {{ $TreeCalcBot->user->sales_volume_total }} | Shop: {{ $TreeCalcBot->user->sales_volume_total_shop }}
</td>
</tr>
<tr>
<td>Persönliches Volumen:</td>
<td>
<span class="badge {{ $TreeCalcBot->user->isQualKP() ? 'badge-outline-success' : 'badge-outline-danger' }}"> KD {{ $TreeCalcBot->user->qual_kp }}</span>
</td>
</tr>
<tr>
<td>Qualifikation:</td>
<td>
TP {{ formatNumber($TreeCalcBot->user->qual_tp, 0) }} /
@if($TreeCalcBot->user->isQualKP())
<strong> TP {{ formatNumber($TreeCalcBot->total_qual_tp, 0) }}</strong> &nbsp;
@if($TreeCalcBot->qual_user_level)
<span class="badge badge-outline-success">{{ formatNumber($TreeCalcBot->qual_user_level->qual_tp, 0) }} | {{ $TreeCalcBot->qual_user_level->name }}</span>
@endif
@else
<span class="ion ion-md-close text-danger"></span>
@endif
</td>
</tr>
</tbody>
</table>
<hr class="border-light m-0">
<div class="table-responsive">
<table class="table card-table m-0">
<tbody>
<tr>
<th>Linie</th>
<th>Points</th>
<th>Provision</th>
<th>Provision</th>
</tr>
@for ($line=1; $line<=6; $line++)
<tr>
<td>
<div class="font-weight-bolder line-height-1 my-2 text-dark badge badge-outline-dark">{{ $line }}</div>
</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'points'), 0) }}</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'margin'), 0) }} %</td>
<td>{{ formatNumber($TreeCalcBot->getKeybyLine($line, 'commission'), 2) }}</td>
</tr>
@endfor
</tbody>
<tfoot>
<tr>
<td>Gesamt</td>
<td>{{ formatNumber($TreeCalcBot->total_tp, 0) }}</td>
<td></td>
<td><strong>{{ formatNumber($TreeCalcBot->commission_total, 2) }}</strong></td>
</tr>
</tfoot>
</table>
</div>
@endif
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
</div>
<script>
$( document ).ready(function() {

View file

@ -9,19 +9,19 @@
margin-bottom: 6px;
}
</style>
<div class="card">
<h6 class="card-header">
Zahlungen / offene Gutschriften
<div class="card">
<h5 class="card-header">
Guthaben offen
<div class="float-right">
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-load-content"
data-id="new"
data-action="add-user-credit"
data-back="{{url()->current()}}"
data-route="{{ route('modal_load') }}"><span class="far fa-plus-circle"></span> Gutschrift hinzufügen
data-route="{{ route('modal_load') }}"><span class="far fa-plus-circle"></span> Guthaben hinzufügen
</button>
</div>
</h6>
</h5>
@if(isset($add_credit_error) && $add_credit_error)
<div class="col-sm-12">
@ -37,42 +37,33 @@
<table class="datatables-style table table-striped table-bordered">
<thead>
<tr>
<th>{{__('Account ID')}}</th>
<th>{{__('Vorname')}}</th>
<th>{{__('Nachname') }}</th>
<th>{{__('E-Mail') }}</th>
<th>{{__('Betrag') }}</th>
<th>{{__('aus Bestellung / Gutschrift')}}</th>
<th>{{__('Guthaben')}}</th>
<th>{{__('#')}}</th>
</tr>
</thead>
<tbody>
@foreach ($ShoppingOrderMargins as $ShoppingOrderMargin)
@foreach ($user_credit_items as $user_credit_item)
<tr>
<td>{{ $ShoppingOrderMargin->first_name }}</td>
<td>{{ $ShoppingOrderMargin->last_name }}</td>
<td>{{ $ShoppingOrderMargin->email }}</td>
<td>{!! \App\Services\UserMarign::getMontlyPartnerCommissionOpenByID($ShoppingOrderMargin->user_id, null, true, true) !!} &euro;</td>
<td>{{ $user_credit_item['m_account'] }}</td>
<td>{{ $user_credit_item['first_name'] }}</td>
<td>{{ $user_credit_item['last_name'] }}</td>
<td>{{ $user_credit_item['email'] }}</td>
<td>{!! formatNumber($user_credit_item['sum']) !!} &euro;</td>
<td>
@foreach (\App\Services\UserMarign::getOrderFromPartnerCommissionByID($ShoppingOrderMargin->user_id) as $order)
@if($order->shopping_order)
<div class="td-entry-table-margin"><a href="{{ route('admin_sales_customers_detail', [$order->shopping_order->id]) }}">
{{$order->shopping_order->shopping_user->billing_firstname }}
{{$order->shopping_order->shopping_user->billing_lastname }}
/ {{ $order->shopping_order->getLastShoppingPayment('reference') }}
/ {{ $order->shopping_order->getFormattedTotalWithoutCredit()."" }}
/ {{ $order->shopping_order->created_at->format("d.m.Y") }}
</a>
</div>
@endif
@endforeach
@foreach (\App\Services\UserMarign::getUserCreditMarginByID($ShoppingOrderMargin->user_id) as $creditMaring)
@foreach ($user_credit_item['entries'] as $key => $credit)
<div class="td-entry-table-margin">
<i class="fa fa-plus-circle text-secondary"></i>
{!! nl2br($creditMaring->message) !!}
/ {{ $creditMaring->created_at->format("d.m.Y") }}
@if($deleteTime = $creditMaring->deleteTime())
{!! formatNumber($credit->credit) !!} &euro; |
{!! nl2br($credit->message) !!}
/ {{ $credit->created_at->format("d.m.Y") }}
@if($deleteTime = $credit->deleteTime())
/ <span class="no-line-break">
<a class="btn btn-danger btn-xs" href="{{ route('admin_payments_credit_delete', [$creditMaring->id, 'user_credit_margin']) }}" onclick="return confirm('Wirklich löschen?');">
<a class="btn btn-danger btn-xs" href="{{ route('admin_payments_credit_delete', [$credit->id, 'user_credit_item']) }}" onclick="return confirm('Wirklich löschen?');">
<i class="ion ion-ios-trash"></i>
</a> noch {{ $deleteTime }} min.
</span>
@ -81,45 +72,12 @@
@endforeach
</td>
<td>
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-credit"
data-userid="{{ $ShoppingOrderMargin->user_id }}"
data-email="{{ $ShoppingOrderMargin->email }}"
<button type="button" class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#modals-credit"
data-userid="{{ $user_credit_item['user_id'] }}"
data-email="{{ $user_credit_item['email'] }}"
data-back="{{url()->current()}}"
data-action="create_credit">
<span class="far fa-file-invoice-dollar"></span> <strong>Gutschrift erstellen</strong>
</button>
</td>
</tr>
@endforeach
@foreach ($onlyUserCreditMargins as $user_id => $onlyUserCreditMargin)
<tr>
<td>{{ $onlyUserCreditMargin['first_name'] }}</td>
<td>{{ $onlyUserCreditMargin['last_name'] }}</td>
<td>{{ $onlyUserCreditMargin['email'] }}</td>
<td>{!! formatNumber($onlyUserCreditMargin['sum']) !!} &euro;</td>
<td>
@foreach ($onlyUserCreditMargin['entries'] as $key => $creditMaring)
<div class="td-entry-table-margin">
<i class="fa fa-plus-circle text-secondary"></i>
{!! nl2br($creditMaring->message) !!}
/ {{ $creditMaring->created_at->format("d.m.Y") }}
@if($deleteTime = $creditMaring->deleteTime())
/ <span class="no-line-break">
<a class="btn btn-danger btn-xs" href="{{ route('admin_payments_credit_delete', [$creditMaring->id, 'user_credit_margin']) }}" onclick="return confirm('Wirklich löschen?');">
<i class="ion ion-ios-trash"></i>
</a> noch {{ $deleteTime }} min.
</span>
@endif
</div>
@endforeach
</td>
<td>
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-credit"
data-userid="{{ $onlyUserCreditMargin['user_id'] }}"
data-email="{{ $onlyUserCreditMargin['email'] }}"
data-back="{{url()->current()}}"
data-action="create_credit">
<span class="far fa-file-invoice-dollar"></span> <strong>Gutschrift erstellen</strong>
<span class="fa fa-dollar-sign"></span> <strong>Guthaben auszahlen</strong>
</button>
</td>
</tr>
@ -131,67 +89,34 @@
<div class="card mt-3">
<h6 class="card-header">
Zahlungen / offene Gutschriften pending
</h6>
<div class="card-datatable table-responsive pt-0">
<table class="datatables-style table table-striped table-bordered">
<thead>
<tr>
<th>{{__('Vorname')}}</th>
<th>{{__('Nachname') }}</th>
<th>{{__('E-Mail') }}</th>
<th>{{__('Betrag') }}</th>
<th>{{__('aus Bestellung')}}</th>
</tr>
</thead>
<tbody>
@foreach ($ShoppingOrderMarginPendings as $ShoppingOrderMarginPending)
<tr>
<td>{{ $ShoppingOrderMarginPending->first_name }}</td>
<td>{{ $ShoppingOrderMarginPending->last_name }}</td>
<td>{{ $ShoppingOrderMarginPending->email }}</td>
<td>{!! \App\Services\UserMarign::getMontlyPartnerCommissionPendingByID($ShoppingOrderMarginPending->user_id, null, true) !!} &euro;</td>
<td>
@foreach (\App\Services\UserMarign::getOrderFromPartnerCommissionPendingByID($ShoppingOrderMarginPending->user_id) as $order)
@if($order->shopping_order)
<div class="td-entry-table-margin"><a href="{{ route('admin_sales_customers_detail', [$order->shopping_order->id]) }}">
<a href="{{ route('admin_sales_customers_detail', [$order->shopping_order->id]) }}">
{{$order->shopping_order->shopping_user->billing_firstname }}
{{$order->shopping_order->shopping_user->billing_lastname }}
/ {{ $order->shopping_order->getLastShoppingPayment('reference') }}
/ {{$order->shopping_order->getFormattedTotalWithoutCredit()."" }}
/ {{ $order->shopping_order->created_at->format("d.m.Y") }}
</a>
</div>
@endif
@endforeach
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<h5 class="card-header">
Gutschriften / Auszahlungen
</h5>
<div class="card-body p-0">
{!! Form::open(['url' => route('admin_payments_invoice'), 'class' => 'form-horizontal', 'id'=>'form_filter_payment_invoices']) !!}
<div class="form-row align-items-center px-4 pb-2 pt-3">
<div class="col-12 col-sm-4 col-md-4 col-lg-4 mb-1">
<input class="form-control on_keyup_invoice" name="credit_filter_name" type="text" value="{{session('credit_filter_name')}}" placeholder="Name">
</div>
<div class="card mt-3">
<h6 class="card-header">
Zahlungen / erstellte Gutschriften
</h6>
<div class="col-sm-6 mb-0 mt-2">
{!! Form::open(['url' => route('admin_payments_credit'), 'class' => 'form-horizontal', 'id'=>'form_filter_sales_year']) !!}
<label class="form-label" for="filter_sales_year">Filter Jahr</label>
<select class="custom-select" name="filter_sales_year" id="filter_sales_year">
@foreach($years as $year)
<option value="{{$year}}" @if($active_year == $year) selected @endif>{{$year}}</option>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_invoice" name="credit_filter_month">
@foreach($filter_months as $key=>$value)
<option value="{{$key}}" @if(session('credit_filter_month') == $key) selected @endif>{{$value}}</option>
@endforeach
</select>
{!! Form::close() !!}
</div>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_invoice" name="credit_filter_year">
@foreach($filter_years as $key=>$value)
<option value="{{$value}}" @if(session('credit_filter_year') == $value) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
</div>
{!! Form::close() !!}
<div class="card-datatable table-responsive pt-0">
<table class="datatables-style table table-striped table-bordered" id="datatable-credit">
@ -206,7 +131,7 @@
<th>{{__('Betrag') }}</th>
<th>{{__('Datum') }}</th>
<th>{{__('Zahlung')}}</th>
<th>{{__('aus Bestellung / Gutschrift')}}</th>
<th>{{__('aus Guthaben')}}</th>
</tr>
</thead>
<tbody>
@ -214,6 +139,7 @@
</table>
</div>
</div>
</div>
<div class="modal fade" id="modals-credit">
<div class="modal-dialog">
@ -268,15 +194,15 @@
"order": [[0, "desc" ]],
"columns": [
{ data: 'id', searchable: false },
{ data: 'credit_number', name: 'credit_number' },
{ data: 'credit', name: 'credit', orderable: false, searchable: false },
{ data: 'full_number', name: 'full_number' },
{ data: 'view', name: 'view' },
{ data: 'user.account.first_name', name: 'user.account.first_name', orderable: false },
{ data: 'user.account.last_name', name: 'user.account.last_name', orderable: false },
{ data: 'user.email', name: 'user.email', orderable: false },
{ data: 'total', name: 'total' },
{ data: 'date', name: 'date' },
{ data: 'status', name: 'status', searchable: false },
{ data: 'user_margins', name: 'user_margins', orderable: false },
{ data: 'credits', name: 'credits', orderable: false },
],
"bLengthChange": false,
"iDisplayLength": 100,

View file

@ -51,6 +51,7 @@
</table>
</div>
</div>
</div>
<script>
$( document ).ready(function() {

View file

@ -0,0 +1,45 @@
{!! Form::open(['url' => route('admin_payments_credit'), 'class' => 'modal-content form-prevent-multiple-submits', 'enctype' => 'multipart/form-data']) !!}
<div class="modal-header">
<h5 class="modal-title">
{{ __('Gutschrift') }}
<span class="font-weight-light">hinzufügen</span>
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
<div class="modal-body">
<input type="hidden" name="action" value="{{$data['action']}}">
<input type="hidden" name="id" value="{{$data['id']}}">
<div class="form-row">
<div class="form-group col-12">
<label for="member_id" class="form-label">{{ __('Vertriebspartner auswählen') }}*</label>
<select class="selectpicker" name="member_id" data-style="btn-light" data-live-search="true" required>
{!! HTMLHelper::getMembersOptions(0, true) !!}
</select>
</div>
<div class="form-group col-12">
<label class="form-label" for="credit">{{ __('Betrag') }} netto*</label>
{{ Form::text('credit', '', array('placeholder'=>__('in Euro'), 'class'=>'form-control', 'required'=>true)) }}
</div>
<div class="form-group col-12">
<label class="form-label" for="message">{{ __('Betreff') }}*</label>
{{ Form::textarea('message', '' , array('placeholder'=>__('Mitteilung'), 'class'=>'form-control', 'rows'=>4, 'required'=>true)) }}
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
<button type="submit" class="btn btn-primary button-prevent-multiple-submits"><i class="spinner fa fa-spinner fa-spin"></i> {{__('Gutschrift hinzufügen')}}</button>
</div>
{!! Form::close() !!}
<script type="text/javascript">
$( document ).ready(function() {
});
</script>

View file

@ -0,0 +1,82 @@
{!! Form::open(['url' => route('admin_payments_credit_create'), 'class' => 'modal-content', 'enctype' => 'multipart/form-data']) !!}
<style>
.unselectable {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
.selectall {
-moz-user-select: all;
-webkit-user-select: all;
-ms-user-select: all;
}
</style>
<div class="modal-header">
<h5 class="modal-title">
{{ __('Gutschriften Zahlung') }}
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
<div class="modal-body">
<input type="hidden" name="action" value="{{$data['action']}}">
<input type="hidden" name="id" value="{{$data['id']}}">
<div class="form-row">
<div class="form-group col-12">
<label for="status" class="form-label">{{ __('Status') }}*</label>
{{ Form::select('status', $UserCredit::$statusTypes, $UserCredit->status, array('data-live-search'=>'false', 'class'=>'selectpicker') ) }}
</div>
</div>
<table class="table user-view-table m-0">
<tbody>
<tr>
<td>Betrag:</td>
<td>
{{ $UserCredit->getFormattedTotal()."" }}
</td>
</tr>
{{-- <tr>
<td>Zahlungsart:</td>
<td>
@if ($value->user->account->getPaymentData('payout') === 'paypal')
<span class="btn btn-sm btn-outline-twitter">PayPal</span>
@endif
@if ($value->user->account->getPaymentData('payout') === 'bank')
<span class="btn btn-outline-google">Banküberweisung</span>
@endif
</td>
</tr>
--}}
<tr class="unselectable">
<td>Bankinhaber</td>
<td><div class="selectall">{{ $UserCredit->user->account->bank_owner }}</div></td>
</tr>
<tr>
<td>IBAN:</td>
<td><div class="selectall">{{ $UserCredit->user->account->bank_iban }}</div></td>
</tr>
<tr>
<td>BIC:</td>
<td><div class="selectall">{{ $UserCredit->user->account->bank_bic }}</div></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
<button type="submit" class="btn btn-primary">{{__('speichern')}}</button>
</div>
{!! Form::close() !!}
<script type="text/javascript">
$( document ).ready(function() {
});
</script>

View file

@ -6,13 +6,13 @@
</h4>
{!! Form::open(['url' => route('admin_setting_store'), 'class' => 'form-horizontal']) !!}
{{-- <div class="card mb-2">
<div class="card mb-2">
<div class="card-body">
<h4>Rechnungen Einstellungen</h4>
<h4>Rechnungen / Gutschriften Einstellungen</h4>
<div class="form-row">
<div class="form-group col-sm-12">
<label class="form-label">{{ __('nächste Rechnungsnummer') }}*</label>
{{ Form::text('settings[invoice-number][val]', \App\Models\Setting::getContentBySlug('invoice-number'), array('class'=>'form-control')) }}
{{ Form::text('settings[invoice-number][val]', \App\Models\Setting::getContentBySlug('invoice-number'), array('class'=>'form-control', 'disabled')) }}
{{ Form::hidden('settings[invoice-number][type]', 'int') }}
</div>
</div>
@ -23,10 +23,16 @@
{{ Form::hidden('settings[credit-number][type]', 'int') }}
</div>
</div>
<div class="form-row">
<div class="form-group col-sm-12">
<label class="form-label">{{ __('Tag des Monats für die Fixierung/Auswertungen der Business Marketing Plans') }}*</label>
{{ Form::text('settings[day-exectute-business-structur][val]', \App\Models\Setting::getContentBySlug('day-exectute-business-structur'), array('class'=>'form-control')) }}
{{ Form::hidden('settings[day-exectute-business-structur][type]', 'int') }}
</div>
</div>
<button type="submit" name="action" value="save_prepayment" class="btn btn-primary btn-sm mb-2"><i class="ion ion-ios-save"></i> speichern</button>
</div>
</div>
--}}
{!! Form::close() !!}

View file

@ -16,7 +16,8 @@
</div>
@endif
</h6>
<table class="table table-striped table-bordered">
<div class="card-datatable table-responsive">
<table class="datatables-user-points table table-striped table-bordered">
<thead>
<tr>
<th>{{__('Datum') }}</th>
@ -62,12 +63,31 @@
@endif
</tbody>
</table>
</div>
@endif
</div>
@if($user->isActiveAccount())
<div class="card-footer py-3">
<a href="{{route('user_team_structure')}}" class="btn btn-secondary"><i class="ion ion-md-funnel rotate-180 text-default mr-1"></i> {{__('navigation.my_team')}} - {{__('navigation.structure')}}</a>
<a href="{{route('user_team_structure')}}" class="btn btn-secondary mr-2"><i class="ion ion-md-funnel rotate-180 text-default mr-1"></i> {{__('navigation.my_team')}} - {{__('navigation.structure')}}</a>
<a href="{{route('user_team_points')}}" class="btn btn-secondary mr-2"><i class="ion ion-ios-arrow-dropup-circle"></i> {{__('navigation.my_team')}} - {{__('navigation.points')}}</a>
</div>
@endif
</div>
</div>
<script>
$( document ).ready(function() {
$('.datatables-user-points').dataTable({
"bLengthChange": false,
"iDisplayLength": 50,
"stateSave": true,
"searching": false,
"language": {
"url": "/js/German.json"
}
});
});
</script>

View file

@ -31,7 +31,6 @@
@include('dashboard._reminder')
@include('dashboard._membership')
@include('dashboard._shop')

View file

@ -19,6 +19,9 @@
<div>{{ __('navigation.my_account') }}</div>
</a>
<ul class="sidenav-menu">
<li class="sidenav-item{{ Request::is('user/payment/credit') ? ' active' : '' }}">
<a href="{{ route('user_payment_credit') }}" class="sidenav-link"><i class="sidenav-icon ion ion-md-cash"></i><div>{{ __('navigation.credit') }}</div></a>
</li>
<li class="sidenav-item{{ Request::is('user/edit') ? ' active' : '' }}">
<a href="{{ route('user_edit') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-create"></i><div>{{ __('navigation.my_data') }}</div></a>
</li>
@ -59,6 +62,9 @@
<li class="sidenav-item{{ Request::is('user/team/structure') ? ' active' : '' }}">
<a href="{{ route('user_team_structure') }}" class="sidenav-link"><i class="sidenav-icon ion ion ion-md-funnel rotate-180" style="text-align: right"></i><div>{{ __('navigation.structure') }}</div></a>
</li>
<li class="sidenav-item{{ Request::is('user/team/points') ? ' active' : '' }}">
<a href="{{ route('user_team_points') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-arrow-dropup-circle"></i><div>{{ __('navigation.points') }}</div></a>
</li>
<li class="sidenav-item{{ Request::is('user/team/members') ? ' active' : '' }}">
<a href="{{ route('user_team_members') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-person-add"></i><div>neuen {{ __('navigation.member') }}</div></a>
</li>
@ -149,7 +155,7 @@
<a href="{{ route('admin_payments_invoice') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-arrow-dropleft-circle"></i><div>{{ __('navigation.invoice') }}</div></a>
</li>
<li class="sidenav-item{{ Request::is('admin/payments/credit') ? ' active' : '' }}">
<a href="{{ route('admin_payments_credit') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-arrow-dropright-circle"></i><div>{{ __('navigation.credit') }}</div> <div class="badge badge-danger">x</div></a>
<a href="{{ route('admin_payments_credit') }}" class="sidenav-link"><i class="sidenav-icon ion ion-ios-arrow-dropright-circle"></i><div>{{ __('navigation.credit') }}</div></a>
</li>
</ul>
</li>

View file

@ -0,0 +1,413 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>mivita.care</title>
<style>
/* roboto-300 - latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: url('fonts/roboto/roboto-v20-latin-300.ttf') format('truetype'), /* Safari, Android, iOS */
}
/* roboto-regular - latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: url('fonts/roboto/roboto-v20-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */
}
/* roboto-500 - latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: url('fonts/roboto/roboto-v20-latin-500.ttf') format('truetype'), /* Safari, Android, iOS */
}
/* roboto-700 - latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: url('fonts/roboto/roboto-v20-latin-700.ttf') format('truetype'), /* Safari, Android, iOS */
}
html {
width: 100%;
height: 100%;
}
body {
position: relative;
width: 100%;
height: 100%;
margin: 0 auto;
padding: 0;
color: #000;
background: #fff;
font-family: 'Roboto', sans-serif;
font-size: 9.5pt;
font-weight: 400 ;
}
table {
border: none;
}
strong {
font-weight: bold !important;
}
@page {
margin: 0px;
}
@page {
margin-top: 0px;
}
@page {
margin: 50mm 0 45mm 0;
}
.font-weight-bold {
font-weight: bold !important;
}
#address_box {
position: relative;
padding-left: 15mm;
width: 90mm;
height: 40mm;
z-index: 1;
line-height: 10pt;
letter-spacing: 0em;
}
#address_box_top {
font-size: 8.5pt;
color:#858585;
margin-bottom: 0.5em;
}
#title_box {
position: relative;
padding-left: 15mm;
width: 180mm;
height: 8mm;
z-index: 2;
text-align: left;
}
#title_box .title {
font-size: 16pt;
line-height: 12pt;
}
#title_box .subtitle {
line-height: 9pt;
}
#detail_box_right {
position: absolute;
top:-4mm;
right: 15mm;
width: 60mm;
height: 30mm;
z-index: 4;
}
#detail_box_right.for_shop {
top:10mm;
}
#detail_box_right table {
width: 100%;
line-height: 9pt;
}
.xsmall {
font-size: 0.9em;
}
#invoice_box {
position: relative;
padding-top: 0mm;
margin-left: 15mm;
width: 180mm;
line-height: 10pt;
}
#invoice_box table {
width: 100%;
border-collapse: collapse;
}
#invoice_box table tfoot tr {
page-break-after: avoid;
}
#invoice_box table tr th {
font-size: 9pt;
}
#invoice_box table tr td {
vertical-align: top;
padding-top: 2mm;
padding-bottom: 2mm;
padding-left: 1.5mm;
padding-right: 1.5mm;
border-top: 0.5pt dotted #1a1a18;
}
#invoice_box table tfoot tr td {
border-top: none;
}
#invoice_box table tfoot tr.fullline td {
border-top: 0.3pt solid #575755;
}
#invoice_box table tfoot tr.doubleline td {
border-top: 2pt double #575755;
}
#invoice_box table tfoot tr.fullline td.no-border {
border-top: none;
}
#invoice_box table tfoot tr td {
padding-top: 1.2mm;
padding-bottom: 1.2mm;
}
#invoice_box table td.small {
width: 1%;
white-space: nowrap;
}
#invoice_box table tr.foot-small td {
font-size: 0.9em;
padding-top: 1.2mm;
padding-bottom: 1.2mm;
}
#invoice_box table tfoot tr.foot-small td {
font-size: 0.9em;
padding-top: 0.9mm;
padding-bottom: 0.9mm;
}
#invoice_box table tr th {
line-height: 12pt;
padding-bottom: 1mm;
padding-left: 1mm;
padding-right: 1mm;
background-color: rgb(212, 212, 212);
}
#invoice_box table td .title {
}
#invoice_box table td .description {
padding-top: 1mm;
}
#invoice_box table td .price_net {
padding-top: 1mm;
font-size: 10pt;
padding-bottom: 1mm;
}
#invoice_box table td .price_tax {
padding-top: 0.7mm;
padding-bottom: 0.7mm;
}
.singel-line-top {
border-top: 1pt solid #1a1a18;
}
.double-line {
border-bottom: 2.5pt double #1a1a18;
}
.dotted-line {
border-bottom: 0.8pt dotted #1a1a18;
}
#footer_box {
position: relative;
top:5mm;
left: 15mm;
width: 180mm;
height: 20mm;
z-index: 6;
text-align: center;
}
.text-right {
text-align: right;
}
.text-left {
text-align: left;
}
.text-center {
text-align: center;
}
.no-line-break {
white-space: nowrap;
}
</style>
</head>
<body>
<script type="text/php">
if ( isset($pdf) ) {
$pdf->page_script('
if ($PAGE_COUNT > 1) {
$pageText = "Seite: ".$PAGE_NUM . "/" . $PAGE_COUNT;
$y = 40 * 3;
$x = 170 * 3;
$pdf->text($x, $y, $pageText, null, 9);
}
');
}
</script>
<div id="address_box">
<div id="address_box_top">mivita e.K. Leinfeld 2 87755 Kirchhaslach</div>
@if($user->account)
@if($user->account->company)
{{ $user->account->company }}<br>
@else
Firma <br>
@endif
{{ \App\Services\HTMLHelper::getSalutationLang($user->account->salutation) }}
{{ $user->account->first_name }} {{ $user->account->last_name }}<br>
{{ $user->account->address }}<br>
@if($user->account->address_2)
{{ $user->account->address_2 }}<br>
@endif
{{ $user->account->zipcode}} {{ $user->account->city }}<br>
@if($user->account->country)
{{ $user->account->country->getLocated() }}
@endif
@endif
</div>
<div id="detail_box_right" class="for_shop">
<table>
<tr>
<td class="text-left">{{ __('Berater-ID') }}:</td>
<td class="text-right">
@if(isset($user->account))
{!! str_pad($user->account->m_account, 5, "0", STR_PAD_LEFT) !!}
@endif
</td>
</tr>
<tr>
<td class="text-left">{{ __('Datum') }}:</td>
<td class="text-right">{{ $credit_date }}</td>
</tr>
<tr>
<td class="text-left">{{ __('Gutschrifts-Nr.') }}:</td>
<td class="text-right">{{ $credit_number }}</td>
</tr>
@if($user->account->tax_number)
<tr>
<td>
{{ __('St.-Nr') }}: {{ $user->account->tax_number}}
</td>
</tr>
@else
@if($user->account->tax_identification_number)
<tr>
<td>
{{ __('USt-IdNr.') }}: {{ $user->account->tax_identification_number}}
</td>
</tr>
@endif
@endif
</table>
</div>
<div id="title_box">
<div class="title">GUTSCHRIFT</div>
{{-- @if($cancellation)
<div class="subtitle">{{ $invoice->invoice_name }}</div>
@endif--}}
</div>
<div id="invoice_box">
<table>
<thead>
<tr>
<th class="text-left" style="width: 75%">Gutschrift aus</th>
<th class="text-right" style="width: 25%">Betrag</th>
</tr>
</thead>
<tbody>
@foreach($user_credit_items as $user_credit_item)
<tr class="item">
<td class="small text-left">
{!! nl2br($user_credit_item->message) !!} / {{ $user_credit_item->created_at->format('d.m.Y') }}
</td>
<td class="text-right small">
{{ \App\Services\Util::formatNumber($user_credit_item->credit) }} &euro;*
</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr class="fullline">
<td class="text-right">
Zwischensumme
</td>
<td class="text-right">
{{ \App\Services\Util::formatNumber($user_credits->net) }} &euro;*
</td>
</tr>
@if ($user_credits->taxable)
<tr class="">
<td class="text-right">
Mehrwertsteuer: {{ $user_credits->tax_rate }} % <br>
</td>
<td class="text-right">
{{ \App\Services\Util::formatNumber($user_credits->tax) }} &euro;
</td>
</tr>
@else
<tr class="">
<td class="text-right">
Mehrwertsteuer: {{ $user_credits->tax_rate }} % <br>
Gutschriftsempfänger ist Kleinunternehmer nach § 19 (1) UStG.
</td>
<td class="text-right">
{{ \App\Services\Util::formatNumber($user_credits->tax) }} &euro;
</td>
</tr>
@endif
<tr class="fullline">
<td class="text-right">
<b>Auszahlungsbetrag (Brutto):</b>
</td>
<td class="text-right">
<b> {{ \App\Services\Util::formatNumber($user_credits->total) }} &euro;</b>
<br>
<span style="font-size: 0.9em"><em>* Nettobeträge</em></span>
</td>
</tr>
</tfoot>
</table>
</div>
<div id="footer_box">
<div class="text">
</div>
</div>
</body>
</html>

View file

@ -6,6 +6,7 @@
<h5 class="card-header py-4 px-5">Sys Admin Tools</h5>
<div class="row no-gutters row-bordered">
<div class="col-md-12 p-5">
<a href="{{ route('sysadmin_tool', ['business_structur']) }}" class="d-block mb-3"><i class="ion ion-ios-arrow-forward"></i>&nbsp; Business Strukrur speichern</a>
<a href="{{ route('sysadmin_tool', ['sales_members']) }}" class="d-block mb-3"><i class="ion ion-ios-arrow-forward"></i>&nbsp; Buchnungen Pakete Berater nach Jahren</a>
<a href="{{ route('sysadmin_tool', ['customers']) }}" class="d-block mb-3"><i class="ion ion-ios-arrow-forward"></i>&nbsp; Kundenhoheit prüfen</a>
<a href="{{ route('sysadmin_tool', ['cronjobs']) }}" class="d-block mb-3"><i class="ion ion-ios-arrow-forward"></i>&nbsp; Cron Jobs</a>

View file

@ -0,0 +1,16 @@
@extends('layouts.layout-2')
@section('content')
<div class="card">
<h5 class="card-header">
SysAdmin Business Struktur speichern
</h5>
<div class="col-sm-6 mb-2">
{!! Form::open(['url' => route('sysadmin_tool_store', ['business_structur']), 'class' => 'form-horizontal', 'id'=>'filter_sales_member']) !!}
<button type="submit" name="action" value="store" class="btn btn-primary"><i class="ion"></i> store</button>
{!! Form::close() !!}
</div>
</div>
@endsection

View file

@ -0,0 +1,111 @@
@extends('layouts.layout-2')
@section('content')
<h4 class="font-weight-bold py-2 mb-2">
{{ __('navigation.my_account') }} / {{ __('navigation.credit') }}
</h4>
<div class="card">
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered" id="datatable-user-credit">
<thead>
<tr>
<th>{{ __('G.Nr.') }}</th>
<th>{{ __('Gutschrift') }}</th>
<th>{{ __('Betrag') }}</th>
<th>{{ __('Datum') }}</th>
<th>{{ __('Zahlung') }}</th>
<th>{{ __('aus Guthaben') }}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<hr>
<div class="card">
<h5 class="card-header">
Mein Guthaben
</h5>
<div class="card-datatable table-responsive">
<table class="datatables-style table table-striped table-bordered" id="datatable-user-credit-item">
<thead>
<tr>
<th style="width: 55%">Betreff</th>
<th>Betrag</th>
<th>Datum</th>
<th>Status</th>
<th>Gutschrift</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<script>
$(document).ready(function() {
var creditTable = $('#datatable-user-credit').DataTable({
"processing": true,
"serverSide": true,
ajax: {
url: '{!! route( 'user_payment_credit_datatable') !!}',
data: function(d) {
//d.filter_sales_year = $('select[name=filter_sales_year]').val();
}
},
"order": [[0, "desc" ]],
"columns": [
{ data: 'full_number', name: 'full_number' },
{ data: 'view', name: 'view', orderable: false, searchable: false },
{ data: 'total', name: 'total' },
{ data: 'date', name: 'date' },
{ data: 'status', name: 'status', searchable: false },
{ data: 'credits', name: 'credits', orderable: false },
],
"bLengthChange": false,
"iDisplayLength": 50,
"language": {
"url": "/js/German.json"
}
});
/*$('#filter_sales_year').on('change', function(){
oTable.draw();
});
*/
var creditItemTable = $('#datatable-user-credit-item').DataTable({
"processing": true,
"serverSide": true,
ajax: {
url: '{!! route('user_payment_credit_item_datatable') !!}',
/*data: function(d) {
d.filter_user_status = $('select[name=filter_user_status]').val();
}*/
},
"order": [
[2, "desc"]
],
"columns": [
{ data: 'message', name: 'message' },
{ data: 'credit', name: 'credit' },
{ data: 'created_at', name: 'created_at' },
{ data: 'status', name: 'status', orderable: false, searchable: false },
{ data: 'paid', name: 'paid', orderable: false, searchable: false },
],
"bLengthChange": false,
"iDisplayLength": 50,
"language": {
"url": "/js/German.json"
}
});
/*$('#filter_user_status').on('change', function(){
oTable.draw();
});*/
});
</script>
@endsection

View file

@ -0,0 +1,110 @@
@extends('layouts.layout-2')
@section('content')
@if ($errors->any())
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
</div>
</div>
@endif
<h4 class="font-weight-bold py-2 mb-2">
{{ __('navigation.my_team') }}
</h4>
<div class="card">
<h5 class="card-header">
{{__('Points')}}
</h5>
<div class="card-body">
{!! Form::open(['url' => route('user_team_points'), 'class' => 'form-horizontal', 'id'=>'form_filter_user_points']) !!}
<div class="form-row align-items-center px-0 pb-2 pt-0">
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_select_filter" name="team_user_points_filter_month">
@foreach($filter_months as $key=>$value)
<option value="{{$key}}" @if(session('team_user_points_filter_month') == $key) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_select_filter" name="team_user_points_filter_year">
@foreach($filter_years as $key=>$value)
<option value="{{$value}}" @if(session('team_user_points_filter_year') == $value) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
</div>
{!! Form::close() !!}
<hr class="container-m-nx border-light mt-0">
<div class="card">
<div class="card-datatable table-responsive">
<table class="table table-striped table-bordered" id="datatable-user-points">
<thead>
<tr>
<th>{{__('Datum') }}</th>
<th>{{__('Points')}}</th>
<th>{{__('Umsatz netto')}}</th>
<th>{{__('Art')}}</th>
<th>{{__('Bestellung')}}</th>
<th>{{__('Info') }}</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<script>
$( document ).ready(function() {
var oTable = $('#datatable-user-points').DataTable({
"processing": true,
"serverSide": true,
"stateSave": true,
"searching": false,
ajax: {
url: '{!! route('user_team_datatable_points') !!}',
data: function(d) {
d.team_user_points_filter_month = $('select[name=team_user_points_filter_month]').val();
d.team_user_points_filter_year = $('select[name=team_user_points_filter_year]').val();
}
},
"order": [[0, "desc" ]],
"columns": [
{ data: 'date', name: 'date' },
{ data: 'points', name: 'points' },
{ data: 'total_net', name: 'total_net' },
{ data: 'status', name: 'status', searchable: false },
{ data: 'order', name: 'order', orderable: false },
{ data: 'message', name: 'message', searchable: false },
],
"bLengthChange": false,
"iDisplayLength": 100,
"language": {
"url": "/js/German.json"
},
"drawCallback": function( settings ) {
alert( 'DataTables has redrawn the table' );
}
});
$('select.on_change_select_filter').on('change', function(){
oTable.draw();
});
$('input.on_keyup_input_filter').on('keyup', function(){
oTable.draw();
});
});
</script>
@endsection

View file

@ -0,0 +1,10 @@
<h6>
@if($userSalesVolume)
<div class="mb-2">
<strong>Gesamte Points: {{ $userSalesVolume->getPointsSum() }}</strong> | Berater: {{ $userSalesVolume->month_points }} | Shop: {{ $userSalesVolume->month_shop_points }}<br>
</div>
<div>
<strong>Gesamter Umsatz: {{ formatNumber($userSalesVolume->getTotalNetSum()) }} &euro;</strong> | Berater: {{ formatNumber($userSalesVolume->month_total_net) }} &euro; | Shop: {{ formatNumber($userSalesVolume->month_shop_total_net) }} &euro;
</div>
@endif
</h6>

View file

@ -0,0 +1,125 @@
@extends('layouts.layout-2')
@section('content')
@if ($errors->any())
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
</div>
</div>
@endif
<h4 class="font-weight-bold py-2 mb-2">
{{ __('navigation.my_team') }}
</h4>
<div class="card">
<h5 class="card-header">
{{__('Points')}}
</h5>
<div class="card-body">
{!! Form::open(['url' => route('user_team_points'), 'class' => 'form-horizontal', 'id'=>'form_filter_user_points']) !!}
<div class="form-row align-items-center px-0 pb-2 pt-0">
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_select_filter" name="team_user_points_filter_month">
@foreach($filter_months as $key=>$value)
<option value="{{$key}}" @if(session('team_user_points_filter_month') == $key) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
<select class="custom-select on_change_select_filter" name="team_user_points_filter_year">
@foreach($filter_years as $key=>$value)
<option value="{{$value}}" @if(session('team_user_points_filter_year') == $value) selected @endif>{{$value}}</option>
@endforeach
</select>
</div>
</div>
{!! Form::close() !!}
<hr class="container-m-nx border-light mt-0">
<div id="user_team_points_sum">
@include('user.team._points_sum', ['userSalesVolume' => $userSalesVolume])
</div>
<div class="card">
<div class="card-datatable table-responsive">
<table class="table table-striped table-bordered" id="datatable-user-points">
<thead>
<tr>
<th>{{__('Datum') }}</th>
<th>{{__('Points')}}</th>
<th>{{__('Umsatz netto')}}</th>
<th>{{__('Art')}}</th>
<th>{{__('Bestellung')}}</th>
<th>{{__('Info') }}</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<script>
$( document ).ready(function() {
function callback_ajax_team_user_points_sum(data){
$("#user_team_points_sum").html(data.html);
}
function load_team_user_points_sum(){
var $elem = $('<div/>');
$elem.data('action', 'load_team_user_points_sum');
$elem.data('team_user_points_filter_month', $('select[name=team_user_points_filter_month]').val());
$elem.data('team_user_points_filter_year', $('select[name=team_user_points_filter_year]').val());
$elem.data('url', '{{route('user_team_load')}}');
ajax_object_action(false, $elem, callback_ajax_team_user_points_sum);
}
var oTable = $('#datatable-user-points').DataTable({
"processing": true,
"serverSide": true,
"stateSave": true,
"searching": false,
ajax: {
url: '{!! route('user_team_datatable_points') !!}',
data: function(d) {
d.team_user_points_filter_month = $('select[name=team_user_points_filter_month]').val();
d.team_user_points_filter_year = $('select[name=team_user_points_filter_year]').val();
}
},
"order": [[0, "desc" ]],
"columns": [
{ data: 'date', name: 'date' },
{ data: 'points', name: 'points' },
{ data: 'total_net', name: 'total_net' },
{ data: 'status', name: 'status', searchable: false },
{ data: 'order', name: 'order', orderable: false },
{ data: 'message', name: 'message', searchable: false },
],
"bLengthChange": false,
"iDisplayLength": 100,
"language": {
"url": "/js/German.json"
},
"drawCallback": function( settings ) {
load_team_user_points_sum();
}
});
$('select.on_change_select_filter').on('change', function(){
oTable.draw();
});
$('input.on_keyup_input_filter').on('keyup', function(){
oTable.draw();
});
});
</script>
@endsection

View file

@ -74,6 +74,7 @@
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="/vendor/libs/nestable/nestable.css">
<script src="/vendor/libs/nestable/jquery-nestable.js?v=1"></script>
<script>

View file

@ -246,6 +246,12 @@ Route::domain(config('app.pre_url_crm').config('app.domain').config('app.tld_car
Route::get('/user/team/structure', 'User\TeamController@structure')->name('user_team_structure');
Route::post('/user/team/structure', 'User\TeamController@structure')->name('user_team_structure');
Route::get('/user/team/points', 'User\TeamController@points')->name('user_team_points');
Route::post('/user/team/points', 'User\TeamController@points')->name('user_team_points');
Route::get('/user/team/datatablePoints', 'User\TeamController@datatablePoints')->name('user_team_datatable_points');
Route::post('/user/team/load', 'User\TeamController@load')->name('user_team_load');
//user customers
Route::get('/user/customers', 'User\CustomerController@index')->name('user_customers');
@ -271,7 +277,6 @@ Route::domain(config('app.pre_url_crm').config('app.domain').config('app.tld_car
Route::post('/user/order/my/payment/{for}/{id?}', 'User\OrderController@payment')->name('user_order_my_payment');
Route::get('/user/order/my/datatable', 'User\OrderController@datatable')->name('user_order_my_datatable');
Route::post('/user/order/my/perform/request/', 'User\OrderController@performRequest')->name('user_order_my_perform_request');
//user homeparty
Route::get('/user/homepartys', 'User\HomepartyController@index')->name('user_homepartys');
@ -291,6 +296,12 @@ Route::domain(config('app.pre_url_crm').config('app.domain').config('app.tld_car
Route::get('/user/membership', 'MembershipController@index')->name('user_membership');
Route::post('/user/membership/store/{action}', 'MembershipController@storePayment')->name('user_membership_store');
Route::get('/user/payment/credit', 'User\PaymentController@credit')->name('user_payment_credit');
Route::get('/user/payment/credit/datatable', 'User\PaymentController@credit_datatable')->name('user_payment_credit_datatable');
Route::get('/user/payment/credit/item/datatable', 'User\PaymentController@credit_item_datatable')->name('user_payment_credit_item_datatable');
});
Route::group(['middleware' => ['admin']], function()
@ -405,6 +416,7 @@ Route::domain(config('app.pre_url_crm').config('app.domain').config('app.tld_car
Route::get('/admin/business/structure', 'BusinessController@structure')->name('admin_business_structure');
Route::post('/admin/business/structure', 'BusinessController@structure')->name('admin_business_structure');
Route::get('/admin/business/user/detail/{id}', 'BusinessController@userDetail')->name('admin_business_user_detail');
Route::post('/admin/business/user/detail/{id}', 'BusinessController@userStore')->name('admin_business_user_detail');
Route::get('/admin/business/user/datatable', 'BusinessController@userDatatable')->name('admin_business_user_datatable');

View file

@ -0,0 +1,572 @@
<?php return array (
'codeToName' =>
array (
32 => 'space',
160 => 'space',
33 => 'exclam',
34 => 'quotedbl',
35 => 'numbersign',
36 => 'dollar',
37 => 'percent',
38 => 'ampersand',
146 => 'quoteright',
40 => 'parenleft',
41 => 'parenright',
42 => 'asterisk',
43 => 'plus',
44 => 'comma',
45 => 'hyphen',
173 => 'hyphen',
46 => 'period',
47 => 'slash',
48 => 'zero',
49 => 'one',
50 => 'two',
51 => 'three',
52 => 'four',
53 => 'five',
54 => 'six',
55 => 'seven',
56 => 'eight',
57 => 'nine',
58 => 'colon',
59 => 'semicolon',
60 => 'less',
61 => 'equal',
62 => 'greater',
63 => 'question',
64 => 'at',
65 => 'A',
66 => 'B',
67 => 'C',
68 => 'D',
69 => 'E',
70 => 'F',
71 => 'G',
72 => 'H',
73 => 'I',
74 => 'J',
75 => 'K',
76 => 'L',
77 => 'M',
78 => 'N',
79 => 'O',
80 => 'P',
81 => 'Q',
82 => 'R',
83 => 'S',
84 => 'T',
85 => 'U',
86 => 'V',
87 => 'W',
88 => 'X',
89 => 'Y',
90 => 'Z',
91 => 'bracketleft',
92 => 'backslash',
93 => 'bracketright',
94 => 'asciicircum',
95 => 'underscore',
145 => 'quoteleft',
97 => 'a',
98 => 'b',
99 => 'c',
100 => 'd',
101 => 'e',
102 => 'f',
103 => 'g',
104 => 'h',
105 => 'i',
106 => 'j',
107 => 'k',
108 => 'l',
109 => 'm',
110 => 'n',
111 => 'o',
112 => 'p',
113 => 'q',
114 => 'r',
115 => 's',
116 => 't',
117 => 'u',
118 => 'v',
119 => 'w',
120 => 'x',
121 => 'y',
122 => 'z',
123 => 'braceleft',
124 => 'bar',
125 => 'braceright',
126 => 'asciitilde',
161 => 'exclamdown',
162 => 'cent',
163 => 'sterling',
165 => 'yen',
131 => 'florin',
167 => 'section',
164 => 'currency',
39 => 'quotesingle',
147 => 'quotedblleft',
171 => 'guillemotleft',
139 => 'guilsinglleft',
155 => 'guilsinglright',
150 => 'endash',
134 => 'dagger',
135 => 'daggerdbl',
183 => 'periodcentered',
182 => 'paragraph',
149 => 'bullet',
130 => 'quotesinglbase',
132 => 'quotedblbase',
148 => 'quotedblright',
187 => 'guillemotright',
133 => 'ellipsis',
137 => 'perthousand',
191 => 'questiondown',
96 => 'grave',
180 => 'acute',
136 => 'circumflex',
152 => 'tilde',
175 => 'macron',
168 => 'dieresis',
184 => 'cedilla',
151 => 'emdash',
198 => 'AE',
170 => 'ordfeminine',
216 => 'Oslash',
140 => 'OE',
186 => 'ordmasculine',
230 => 'ae',
248 => 'oslash',
156 => 'oe',
223 => 'germandbls',
207 => 'Idieresis',
233 => 'eacute',
159 => 'Ydieresis',
247 => 'divide',
221 => 'Yacute',
194 => 'Acircumflex',
225 => 'aacute',
219 => 'Ucircumflex',
253 => 'yacute',
234 => 'ecircumflex',
220 => 'Udieresis',
218 => 'Uacute',
203 => 'Edieresis',
169 => 'copyright',
229 => 'aring',
224 => 'agrave',
227 => 'atilde',
154 => 'scaron',
237 => 'iacute',
251 => 'ucircumflex',
226 => 'acircumflex',
231 => 'ccedilla',
222 => 'Thorn',
179 => 'threesuperior',
210 => 'Ograve',
192 => 'Agrave',
215 => 'multiply',
250 => 'uacute',
255 => 'ydieresis',
238 => 'icircumflex',
202 => 'Ecircumflex',
228 => 'adieresis',
235 => 'edieresis',
205 => 'Iacute',
177 => 'plusminus',
166 => 'brokenbar',
174 => 'registered',
200 => 'Egrave',
142 => 'Zcaron',
208 => 'Eth',
199 => 'Ccedilla',
193 => 'Aacute',
196 => 'Adieresis',
232 => 'egrave',
211 => 'Oacute',
243 => 'oacute',
239 => 'idieresis',
212 => 'Ocircumflex',
217 => 'Ugrave',
254 => 'thorn',
178 => 'twosuperior',
214 => 'Odieresis',
181 => 'mu',
236 => 'igrave',
190 => 'threequarters',
153 => 'trademark',
204 => 'Igrave',
189 => 'onehalf',
244 => 'ocircumflex',
241 => 'ntilde',
201 => 'Eacute',
188 => 'onequarter',
138 => 'Scaron',
176 => 'degree',
242 => 'ograve',
249 => 'ugrave',
209 => 'Ntilde',
245 => 'otilde',
195 => 'Atilde',
197 => 'Aring',
213 => 'Otilde',
206 => 'Icircumflex',
172 => 'logicalnot',
246 => 'odieresis',
252 => 'udieresis',
240 => 'eth',
158 => 'zcaron',
185 => 'onesuperior',
128 => 'Euro',
),
'isUnicode' => false,
'FontName' => 'Helvetica-Oblique',
'FullName' => 'Helvetica Oblique',
'FamilyName' => 'Helvetica',
'Weight' => 'Medium',
'ItalicAngle' => '-12',
'IsFixedPitch' => 'false',
'CharacterSet' => 'ExtendedRoman',
'FontBBox' =>
array (
0 => '-170',
1 => '-225',
2 => '1116',
3 => '931',
),
'UnderlinePosition' => '-100',
'UnderlineThickness' => '50',
'Version' => '002.000',
'EncodingScheme' => 'WinAnsiEncoding',
'CapHeight' => '718',
'XHeight' => '523',
'Ascender' => '718',
'Descender' => '-207',
'StdHW' => '76',
'StdVW' => '88',
'StartCharMetrics' => '317',
'C' =>
array (
32 => 278.0,
160 => 278.0,
33 => 278.0,
34 => 355.0,
35 => 556.0,
36 => 556.0,
37 => 889.0,
38 => 667.0,
146 => 222.0,
40 => 333.0,
41 => 333.0,
42 => 389.0,
43 => 584.0,
44 => 278.0,
45 => 333.0,
173 => 333.0,
46 => 278.0,
47 => 278.0,
48 => 556.0,
49 => 556.0,
50 => 556.0,
51 => 556.0,
52 => 556.0,
53 => 556.0,
54 => 556.0,
55 => 556.0,
56 => 556.0,
57 => 556.0,
58 => 278.0,
59 => 278.0,
60 => 584.0,
61 => 584.0,
62 => 584.0,
63 => 556.0,
64 => 1015.0,
65 => 667.0,
66 => 667.0,
67 => 722.0,
68 => 722.0,
69 => 667.0,
70 => 611.0,
71 => 778.0,
72 => 722.0,
73 => 278.0,
74 => 500.0,
75 => 667.0,
76 => 556.0,
77 => 833.0,
78 => 722.0,
79 => 778.0,
80 => 667.0,
81 => 778.0,
82 => 722.0,
83 => 667.0,
84 => 611.0,
85 => 722.0,
86 => 667.0,
87 => 944.0,
88 => 667.0,
89 => 667.0,
90 => 611.0,
91 => 278.0,
92 => 278.0,
93 => 278.0,
94 => 469.0,
95 => 556.0,
145 => 222.0,
97 => 556.0,
98 => 556.0,
99 => 500.0,
100 => 556.0,
101 => 556.0,
102 => 278.0,
103 => 556.0,
104 => 556.0,
105 => 222.0,
106 => 222.0,
107 => 500.0,
108 => 222.0,
109 => 833.0,
110 => 556.0,
111 => 556.0,
112 => 556.0,
113 => 556.0,
114 => 333.0,
115 => 500.0,
116 => 278.0,
117 => 556.0,
118 => 500.0,
119 => 722.0,
120 => 500.0,
121 => 500.0,
122 => 500.0,
123 => 334.0,
124 => 260.0,
125 => 334.0,
126 => 584.0,
161 => 333.0,
162 => 556.0,
163 => 556.0,
'fraction' => 167.0,
165 => 556.0,
131 => 556.0,
167 => 556.0,
164 => 556.0,
39 => 191.0,
147 => 333.0,
171 => 556.0,
139 => 333.0,
155 => 333.0,
'fi' => 500.0,
'fl' => 500.0,
150 => 556.0,
134 => 556.0,
135 => 556.0,
183 => 278.0,
182 => 537.0,
149 => 350.0,
130 => 222.0,
132 => 333.0,
148 => 333.0,
187 => 556.0,
133 => 1000.0,
137 => 1000.0,
191 => 611.0,
96 => 333.0,
180 => 333.0,
136 => 333.0,
152 => 333.0,
175 => 333.0,
'breve' => 333.0,
'dotaccent' => 333.0,
168 => 333.0,
'ring' => 333.0,
184 => 333.0,
'hungarumlaut' => 333.0,
'ogonek' => 333.0,
'caron' => 333.0,
151 => 1000.0,
198 => 1000.0,
170 => 370.0,
'Lslash' => 556.0,
216 => 778.0,
140 => 1000.0,
186 => 365.0,
230 => 889.0,
'dotlessi' => 278.0,
'lslash' => 222.0,
248 => 611.0,
156 => 944.0,
223 => 611.0,
207 => 278.0,
233 => 556.0,
'abreve' => 556.0,
'uhungarumlaut' => 556.0,
'ecaron' => 556.0,
159 => 667.0,
247 => 584.0,
221 => 667.0,
194 => 667.0,
225 => 556.0,
219 => 722.0,
253 => 500.0,
'scommaaccent' => 500.0,
234 => 556.0,
'Uring' => 722.0,
220 => 722.0,
'aogonek' => 556.0,
218 => 722.0,
'uogonek' => 556.0,
203 => 667.0,
'Dcroat' => 722.0,
'commaaccent' => 250.0,
169 => 737.0,
'Emacron' => 667.0,
'ccaron' => 500.0,
229 => 556.0,
'Ncommaaccent' => 722.0,
'lacute' => 222.0,
224 => 556.0,
'Tcommaaccent' => 611.0,
'Cacute' => 722.0,
227 => 556.0,
'Edotaccent' => 667.0,
154 => 500.0,
'scedilla' => 500.0,
237 => 278.0,
'lozenge' => 471.0,
'Rcaron' => 722.0,
'Gcommaaccent' => 778.0,
251 => 556.0,
226 => 556.0,
'Amacron' => 667.0,
'rcaron' => 333.0,
231 => 500.0,
'Zdotaccent' => 611.0,
222 => 667.0,
'Omacron' => 778.0,
'Racute' => 722.0,
'Sacute' => 667.0,
'dcaron' => 643.0,
'Umacron' => 722.0,
'uring' => 556.0,
179 => 333.0,
210 => 778.0,
192 => 667.0,
'Abreve' => 667.0,
215 => 584.0,
250 => 556.0,
'Tcaron' => 611.0,
'partialdiff' => 476.0,
255 => 500.0,
'Nacute' => 722.0,
238 => 278.0,
202 => 667.0,
228 => 556.0,
235 => 556.0,
'cacute' => 500.0,
'nacute' => 556.0,
'umacron' => 556.0,
'Ncaron' => 722.0,
205 => 278.0,
177 => 584.0,
166 => 260.0,
174 => 737.0,
'Gbreve' => 778.0,
'Idotaccent' => 278.0,
'summation' => 600.0,
200 => 667.0,
'racute' => 333.0,
'omacron' => 556.0,
'Zacute' => 611.0,
142 => 611.0,
'greaterequal' => 549.0,
208 => 722.0,
199 => 722.0,
'lcommaaccent' => 222.0,
'tcaron' => 317.0,
'eogonek' => 556.0,
'Uogonek' => 722.0,
193 => 667.0,
196 => 667.0,
232 => 556.0,
'zacute' => 500.0,
'iogonek' => 222.0,
211 => 778.0,
243 => 556.0,
'amacron' => 556.0,
'sacute' => 500.0,
239 => 278.0,
212 => 778.0,
217 => 722.0,
'Delta' => 612.0,
254 => 556.0,
178 => 333.0,
214 => 778.0,
181 => 556.0,
236 => 278.0,
'ohungarumlaut' => 556.0,
'Eogonek' => 667.0,
'dcroat' => 556.0,
190 => 834.0,
'Scedilla' => 667.0,
'lcaron' => 299.0,
'Kcommaaccent' => 667.0,
'Lacute' => 556.0,
153 => 1000.0,
'edotaccent' => 556.0,
204 => 278.0,
'Imacron' => 278.0,
'Lcaron' => 556.0,
189 => 834.0,
'lessequal' => 549.0,
244 => 556.0,
241 => 556.0,
'Uhungarumlaut' => 722.0,
201 => 667.0,
'emacron' => 556.0,
'gbreve' => 556.0,
188 => 834.0,
138 => 667.0,
'Scommaaccent' => 667.0,
'Ohungarumlaut' => 778.0,
176 => 400.0,
242 => 556.0,
'Ccaron' => 722.0,
249 => 556.0,
'radical' => 453.0,
'Dcaron' => 722.0,
'rcommaaccent' => 333.0,
209 => 722.0,
245 => 556.0,
'Rcommaaccent' => 722.0,
'Lcommaaccent' => 556.0,
195 => 667.0,
'Aogonek' => 667.0,
197 => 667.0,
213 => 778.0,
'zdotaccent' => 500.0,
'Ecaron' => 667.0,
'Iogonek' => 278.0,
'kcommaaccent' => 500.0,
'minus' => 584.0,
206 => 278.0,
'ncaron' => 556.0,
'tcommaaccent' => 278.0,
172 => 584.0,
246 => 556.0,
252 => 556.0,
'notequal' => 549.0,
'gcommaaccent' => 556.0,
240 => 556.0,
158 => 500.0,
'ncommaaccent' => 556.0,
185 => 333.0,
'imacron' => 278.0,
128 => 556.0,
),
'CIDtoGID_Compressed' => true,
'CIDtoGID' => 'eJwDAAAAAAE=',
'_version_' => 6,
);