last changes since 6-2023
This commit is contained in:
parent
0341c9c189
commit
04d677d37a
142 changed files with 7895 additions and 2855 deletions
|
|
@ -85,7 +85,7 @@ class BusinessCommissionController extends Controller
|
|||
|
||||
if(intval(Request::get('commissions_filter_show')) === 1){
|
||||
$query->where(function($q) {
|
||||
return $q->where('user_businesses.commission_team_total', '>', 0)
|
||||
return $q->where('user_businesses.commission_pp_total', '>', 0)
|
||||
->orWhere('user_businesses.commission_shop_sales', '>', 0);
|
||||
});
|
||||
}
|
||||
|
|
@ -113,15 +113,15 @@ class BusinessCommissionController extends Controller
|
|||
|
||||
|
||||
->addColumn('commission_total', function (UserBusiness $UserBusiness) {
|
||||
$commission_total = $UserBusiness->commission_team_total + $UserBusiness->commission_shop_sales;
|
||||
$commission_total = $UserBusiness->commission_pp_total + $UserBusiness->commission_shop_sales;
|
||||
return $commission_total > 0 ?
|
||||
'<span class="badge badge-outline-info">'.formatNumber($commission_total).' €</span>'
|
||||
: $commission_total.' €';
|
||||
})
|
||||
->addColumn('commission_team_total', function (UserBusiness $UserBusiness) {
|
||||
return $UserBusiness->commission_team_total > 0 ?
|
||||
'<span class="badge badge-outline-success">'.formatNumber($UserBusiness->commission_team_total).' €</span>'
|
||||
: $UserBusiness->commission_team_total.' €';
|
||||
->addColumn('commission_pp_total', function (UserBusiness $UserBusiness) {
|
||||
return $UserBusiness->commission_pp_total > 0 ?
|
||||
'<span class="badge badge-outline-success">'.formatNumber($UserBusiness->commission_pp_total).' €</span>'
|
||||
: $UserBusiness->commission_pp_total.' €';
|
||||
})
|
||||
->addColumn('commission_shop_sales', function (UserBusiness $UserBusiness) {
|
||||
return $UserBusiness->commission_shop_sales > 0 ?
|
||||
|
|
@ -157,13 +157,13 @@ class BusinessCommissionController extends Controller
|
|||
})*/
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('commission_team_total', 'commission_team_total $1')
|
||||
->orderColumn('commission_pp_total', 'commission_pp_total $1')
|
||||
->orderColumn('commission_shop_sales', 'commission_shop_sales $1')
|
||||
->orderColumn('email', 'users.email $1')
|
||||
->orderColumn('m_account', 'm_account $1')
|
||||
->orderColumn('first_name', 'first_name $1')
|
||||
->orderColumn('last_name', 'last_name $1')
|
||||
->rawColumns(['id', 'commission_total', 'commission_team_total', 'commission_shop_sales', 'active_account'])
|
||||
->rawColumns(['id', 'commission_total', 'commission_pp_total', 'commission_shop_sales', 'active_account'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -60,7 +60,6 @@ class BusinessController extends Controller
|
|||
$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){
|
||||
|
|
@ -117,7 +116,7 @@ class BusinessController extends Controller
|
|||
$this->year = Request::get('business_user_filter_year');
|
||||
|
||||
//only the currently month get from Users -> older month from UserBusiness
|
||||
//return $this->userCurrentlyDatatable();
|
||||
return $this->userCurrentlyDatatable();
|
||||
if(TreeCalcBot::isFromStored($this->month, $this->year)){
|
||||
return $this->userStoredDatatable();
|
||||
}else{
|
||||
|
|
@ -155,8 +154,8 @@ 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', [$userBusiness->user_id]) . '" class="btn icon-btn btn-sm btn-primary"><span class="far fa-calculator"></span></a>';
|
||||
data-route="'.route('modal_load').'"><span class="fa fa-calculator"></span></button>'.
|
||||
(config('app.debug') === true ? '<a href="' . route('admin_business_user_detail', [$userBusiness->user_id]) . '" class="btn icon-btn btn-xs btn-primary"><span class="fa fa-calculator"></span></a>' : '');
|
||||
})
|
||||
->addColumn('m_account', function (UserBusiness $userBusiness) {
|
||||
return $userBusiness->m_account;
|
||||
|
|
@ -167,13 +166,13 @@ class BusinessController extends Controller
|
|||
->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 '<span class="badge '.($isQualKP ? 'badge-outline-success' : 'badge-outline-danger').'"> KP '.$userBusiness->qual_kp.'</span>';
|
||||
}
|
||||
return '-';
|
||||
})
|
||||
->addColumn('sales_volume_points', function (UserBusiness $userBusiness) {
|
||||
->addColumn('sales_volume_KP_points', function (UserBusiness $userBusiness) {
|
||||
return '<div class="no-line-break">'.$userBusiness->sales_volume_points_sum.'</div>'.
|
||||
'<span class="small no-line-break">E: '.$userBusiness->sales_volume_points.' | S: '.$userBusiness->sales_volume_points_shop.'</span>';
|
||||
'<span class="small no-line-break">E: '.$userBusiness->sales_volume_KP_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).' €</div>'.
|
||||
|
|
@ -199,7 +198,7 @@ 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><br>';
|
||||
data-route="'.route('modal_load').'"><span class="fa fa-calculator"></span></button><br>';
|
||||
|
||||
$sponsor .= '<span class="small no-line-break">'.$userBusiness->sponsor->email;
|
||||
$sponsor .= ' | '.$userBusiness->sponsor->m_account;
|
||||
|
|
@ -246,7 +245,7 @@ class BusinessController extends Controller
|
|||
->orderColumn('first_name', 'first_name $1')
|
||||
->orderColumn('last_name', 'last_name $1')
|
||||
->orderColumn('active_account', 'payment_account $1')
|
||||
->rawColumns(['id', 'is_qual_kp', 'sales_volume_points', 'sales_volume_total', 'sponsor', 'active_account'])
|
||||
->rawColumns(['id', 'is_qual_kp', 'sales_volume_KP_points', 'sales_volume_total', 'sponsor', 'active_account'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
@ -289,8 +288,8 @@ 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-info"><span class="far fa-calculator"></span></a>';
|
||||
data-route="'.route('modal_load').'"><span class="fa fa-calculator"></span></button>'.
|
||||
(config('app.debug') === true ? '<a href="' . route('admin_business_user_detail', [$user->id]) . '" class="btn icon-btn btn-xs btn-primary"><span class="fa fa-calculator"></span></a>' : '');
|
||||
})
|
||||
->addColumn('m_account', function (User $user) {
|
||||
return $user->account ? $user->account->m_account : '';
|
||||
|
|
@ -301,15 +300,15 @@ class BusinessController extends Controller
|
|||
->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');
|
||||
$sales_volume_points_sum = $user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_KP_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 '<span class="badge '.($isQualKP ? 'badge-outline-success' : 'badge-outline-warning-dark').'"> KP '.$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">E: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points').' | S: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_shop').'</span>';
|
||||
->addColumn('sales_volume_KP_points', function (User $user) {
|
||||
return '<div class="no-line-break">'.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_points_KP_sum').'</div>'.
|
||||
'<span class="small no-line-break">E: '.$user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_KP_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">'.formatNumber($user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_sum')).' €</div>'.
|
||||
|
|
@ -335,7 +334,7 @@ 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><br>';
|
||||
data-route="'.route('modal_load').'"><span class="fa fa-calculator"></span></button><br>';
|
||||
}
|
||||
$sponsor .= '<span class="small no-line-break">'.$user->user_sponsor->email;
|
||||
if($user->user_sponsor->account){
|
||||
|
|
@ -381,7 +380,7 @@ class BusinessController extends Controller
|
|||
->orderColumn('email', 'email $1')
|
||||
->orderColumn('last_name', 'last_name $1')
|
||||
->orderColumn('active_account', 'payment_account $1')
|
||||
->rawColumns(['id', 'is_qual_kp', 'sales_volume_points', 'sales_volume_total', 'sponsor', 'active_account'])
|
||||
->rawColumns(['id', 'is_qual_kp', 'sales_volume_KP_points', 'sales_volume_total', 'sponsor', 'active_account'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -131,6 +131,9 @@ class BusinessPointsController extends Controller
|
|||
->addColumn('status', function (UserSalesVolume $UserSalesVolume) {
|
||||
return '<span class="badge badge-pill badge-'.$UserSalesVolume->getStatusColor().'">'.$UserSalesVolume->getStatusType().'</span>';
|
||||
})
|
||||
->addColumn('status_points', function (UserSalesVolume $UserSalesVolume) {
|
||||
return '<span class="badge badge-pill badge-'.$UserSalesVolume->getStatusPointsColor().'">'.$UserSalesVolume->getStatusPointsType().'</span>';
|
||||
})
|
||||
->addColumn('message', function (UserSalesVolume $UserSalesVolume) {
|
||||
return '<span class="no-line-break">'.$UserSalesVolume->message.'</span>';
|
||||
})
|
||||
|
|
@ -169,7 +172,7 @@ class BusinessPointsController extends Controller
|
|||
->orderColumn('m_account', 'm_account $1')
|
||||
->orderColumn('first_name', 'first_name $1')
|
||||
->orderColumn('last_name', 'last_name $1')
|
||||
->rawColumns(['id', 'order', 'status', 'message', 'info', 'total_net'])
|
||||
->rawColumns(['id', 'order', 'status', 'status_points', 'message', 'info', 'total_net'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ class HomeController extends Controller
|
|||
//login / Dashboard
|
||||
public function show()
|
||||
{
|
||||
|
||||
if(!Auth::check()){
|
||||
return redirect('login');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,15 +145,16 @@ class ModalController extends Controller
|
|||
|
||||
private function getForBusinessUserDetail(User $user, $data){
|
||||
|
||||
$auth_user = \Auth::user();
|
||||
if($auth_user->isAdmin() || $auth_user->id === $user->id){
|
||||
//$auth_user = \Auth::user();
|
||||
//if($auth_user->isAdmin() || $auth_user->id === $user->id){
|
||||
$TreeCalcBot = new TreeCalcBot($data['month'], $data['year'], $data['init_from']);
|
||||
$TreeCalcBot->initBusinesslUserDetail($user);
|
||||
//TODO is not Admin, read is user in Parent tree ...
|
||||
if(!$TreeCalcBot->business_user){
|
||||
abort(403, 'no user found');
|
||||
}
|
||||
return $TreeCalcBot;
|
||||
}
|
||||
//}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,25 +23,14 @@ use stdClass;
|
|||
class PaymentCreditController extends Controller
|
||||
{
|
||||
|
||||
private $startYear;
|
||||
private $endYear;
|
||||
private $rangeYears;
|
||||
private $activeYear;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
$this->startYear = 2022;
|
||||
$this->endYear = date('Y');
|
||||
$this->rangeYears = range($this->startYear, $this->endYear);
|
||||
$this->activeYear = $this->endYear;
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_years' => HTMLHelper::getYearRange(2022),
|
||||
|
|
@ -59,7 +48,7 @@ class PaymentCreditController extends Controller
|
|||
return back();
|
||||
}
|
||||
if(!isset($data['credit'])){
|
||||
\Session()->flash('alert-error', 'Bitte Betrag eingebe');
|
||||
\Session()->flash('alert-error', 'Bitte Betrag eingeben');
|
||||
return back();
|
||||
}
|
||||
if(!isset($data['message'])){
|
||||
|
|
@ -153,17 +142,31 @@ class PaymentCreditController extends Controller
|
|||
return redirect(route('admin_payments_credit'));
|
||||
}
|
||||
|
||||
private function initSearch($archive = false, $request = true)
|
||||
{
|
||||
|
||||
$this->setFilterVars();
|
||||
|
||||
|
||||
$date_start = Carbon::parse('01.'.Request::get('credit_filter_month').'.'.Request::get('credit_filter_year'))->format('Y-m-d');
|
||||
$date_end = Carbon::parse('01.'.Request::get('credit_filter_month').'.'.Request::get('credit_filter_year'))->endOfMonth()->format('Y-m-d');
|
||||
$query = UserCredit::with('user', 'user.account')->select('user_credits.*')
|
||||
->whereBetween('date', [$date_start, $date_end]);
|
||||
|
||||
if(Request::get('credit_filter_name')){
|
||||
$query->whereHas('user.account', function ($query) {
|
||||
return $query->where('first_name', 'LIKE', '%'.Request::get('credit_filter_name').'%')->orWhere('last_name', 'LIKE', '%'.Request::get('credit_filter_name').'%');
|
||||
})->get();
|
||||
$query->whereHas('user', function ($query) {
|
||||
return $query->where('email', 'LIKE', '%'.Request::get('credit_filter_name').'%');
|
||||
})->get();
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function datatable(){
|
||||
|
||||
$this->setFilterVars();
|
||||
$date1 = Carbon::parse('01.01.'.$this->activeYear)->format('Y-m-d');
|
||||
$date2 = Carbon::parse('31.12.'.$this->activeYear)->format('Y-m-d');
|
||||
|
||||
$query = UserCredit::with('user', 'user.account')->select('user_credits.*')
|
||||
//::with('shopping_user', )->select('shopping_orders.*')
|
||||
//->where('paid', '=', 1)
|
||||
->whereBetween('date', [$date1, $date2]);
|
||||
//->orderBy('created_at', 'DESC');
|
||||
$query = $this->initSearch();
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('view', function (UserCredit $UserCredit) {
|
||||
|
|
@ -178,7 +181,7 @@ class PaymentCreditController extends Controller
|
|||
})
|
||||
|
||||
->addColumn('total', function (UserCredit $UserCredit) {
|
||||
return $UserCredit->getFormattedTotal()." €";
|
||||
return '<span class="no-line-break">'.$UserCredit->getFormattedTotal()." €</span>";
|
||||
})
|
||||
->addColumn('credits', function (UserCredit $UserCredit) {
|
||||
$ret = "";
|
||||
|
|
@ -197,7 +200,6 @@ class PaymentCreditController extends Controller
|
|||
</a>';
|
||||
})
|
||||
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('status', 'status $1')
|
||||
->orderColumn('total', 'total $1')
|
||||
|
|
|
|||
|
|
@ -11,10 +11,6 @@ use App\Services\HTMLHelper;
|
|||
class PaymentInvoiceController extends Controller
|
||||
{
|
||||
|
||||
private $startYear;
|
||||
private $endYear;
|
||||
private $rangeYears;
|
||||
private $activeYear;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
@ -60,22 +56,17 @@ class PaymentInvoiceController extends Controller
|
|||
->where('user_invoices.year', '=', Request::get('invoice_filter_year'));
|
||||
|
||||
if(Request::get('invoice_filter_name')){
|
||||
$query->where('shopping_order.shopping_user.billing_firstname', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
|
||||
$query->where('shopping_order.shopping_user.billing_lastname', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
|
||||
$query->where('shopping_order.shopping_user.billing_email', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
|
||||
$query->whereHas('shopping_order.shopping_user', function ($query) {
|
||||
return $query->where('billing_firstname', 'LIKE', '%'.Request::get('invoice_filter_name').'%')->orWhere('billing_lastname', 'LIKE', '%'.Request::get('invoice_filter_name').'%')->orWhere('billing_email', 'LIKE', '%'.Request::get('invoice_filter_name').'%');
|
||||
})->get();
|
||||
}
|
||||
|
||||
//->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 datatable(){
|
||||
|
||||
$query = $this->initSearch();
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('id', function (UserInvoice $UserInvoice) {
|
||||
if($UserInvoice->shopping_order->auth_user_id){
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class PaymentPointsController extends Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
|
||||
dd("function?");
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
|
|
|
|||
151
app/Http/Controllers/ProductsSalesController.php
Normal file
151
app/Http/Controllers/ProductsSalesController.php
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Auth;
|
||||
use Request;
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Exports\UserTeamExport;
|
||||
use App\Models\ShoppingOrderItem;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Services\BusinessPlan\ExportBot;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class ProductsSalesController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_years' => HTMLHelper::getYearRange(2022),
|
||||
];
|
||||
return view('admin.product.salesvolume', $data);
|
||||
}
|
||||
|
||||
public function download(){
|
||||
|
||||
if(Request::get('action') === "export"){
|
||||
$objects = $this->initSearch(false);
|
||||
$columns = [];
|
||||
$filename = "mivita-absatzmengen-".session('product_sales_vol_filter_month').'_'.session('product_sales_vol_filter_year')."-export";
|
||||
$headers = array(
|
||||
'#',
|
||||
'Produkt',
|
||||
'Artikelnummer',
|
||||
'Menge',
|
||||
|
||||
);
|
||||
if($objects){
|
||||
foreach ($objects as $key => $obj){
|
||||
$columns[] = array(
|
||||
'id' => $key,
|
||||
'name' => $obj['name'],
|
||||
'number' => $obj['number'],
|
||||
'value' => $obj['value'],
|
||||
);
|
||||
}
|
||||
}
|
||||
return Excel::download(new UserTeamExport($columns, $headers), $filename.'.xls');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function setFilterVars(){
|
||||
|
||||
if(!session('product_sales_vol_filter_month')){
|
||||
session(['product_sales_vol_filter_month' => intval(date('m'))]);
|
||||
}
|
||||
if(!session('product_sales_vol_filter_year')){
|
||||
session(['product_sales_vol_filter_year' => intval(date('Y'))]);
|
||||
}
|
||||
|
||||
if(Request::get('product_sales_vol_filter_month')){
|
||||
session(['product_sales_vol_filter_month' => Request::get('product_sales_vol_filter_month')]);
|
||||
}
|
||||
if(Request::get('product_sales_vol_filter_year')){
|
||||
session(['product_sales_vol_filter_year' => Request::get('product_sales_vol_filter_year')]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function initSearch($returnColl = true)
|
||||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$date_start = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->format('Y-m-d');
|
||||
$date_end = Carbon::parse('01.'.session('product_sales_vol_filter_month').'.'.session('product_sales_vol_filter_year'))->endOfMonth()->format('Y-m-d');
|
||||
|
||||
$ShoppingOrders = ShoppingOrder::where('paid', 1)->where('mode', 'live')->whereBetween('created_at', [$date_start, $date_end])->get();
|
||||
|
||||
$objects = [];
|
||||
foreach($ShoppingOrders as $ShoppingOrder){
|
||||
foreach($ShoppingOrder->shopping_order_items as $shopping_order_item){
|
||||
|
||||
if($shopping_order_item->product){
|
||||
if(isset($objects[$shopping_order_item->product->id])){
|
||||
$value = intval($objects[$shopping_order_item->product->id]['value'] + $shopping_order_item->qty);
|
||||
$objects[$shopping_order_item->product->id]['value'] = $value;
|
||||
}else{
|
||||
$objects[$shopping_order_item->product->id] = [
|
||||
'name' => $shopping_order_item->product->name,
|
||||
'number' => $shopping_order_item->product->number,
|
||||
'value' => $shopping_order_item->qty
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if($returnColl){
|
||||
$collection = collect();
|
||||
|
||||
foreach($objects as $key => $obj){
|
||||
$collection->push([
|
||||
'id' => $key,
|
||||
'name' => $obj['name'],
|
||||
'number' => $obj['number'],
|
||||
'value' => $obj['value'],
|
||||
]);
|
||||
}
|
||||
return $collection;
|
||||
}
|
||||
return $objects;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function datatable(){
|
||||
|
||||
$collection = $this->initSearch(true);
|
||||
|
||||
$collect = collect([
|
||||
['id' => 1, 'name' => 'John', 'number'=>92012, 'value'=>123],
|
||||
['id' => 2, 'name' => 'Jane', 'number'=>92012, 'value'=>123],
|
||||
['id' => 3, 'name' => 'James', 'number'=>92012, 'value'=>123],
|
||||
]);
|
||||
|
||||
return \DataTables::of($collection)->toJson();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -38,10 +38,10 @@ class SalesController extends Controller
|
|||
return redirect(route('admin_sales_customers_detail', [$ShoppingOrder->id]));
|
||||
abort(403, 'Kundenbestellung');
|
||||
}
|
||||
if($ShoppingOrder->shipped === 0){
|
||||
/*if($ShoppingOrder->shipped === 0){
|
||||
$ShoppingOrder->shipped = 1;
|
||||
$ShoppingOrder->save();
|
||||
}
|
||||
}*/
|
||||
|
||||
$data = [
|
||||
'shopping_order' => $ShoppingOrder,
|
||||
|
|
@ -149,10 +149,12 @@ class SalesController extends Controller
|
|||
return redirect(route('admin_sales_users_detail', [$ShoppingOrder->id]));
|
||||
abort(403, 'Beraterbestellung');
|
||||
}
|
||||
/*
|
||||
if($ShoppingOrder->shipped === 0){
|
||||
$ShoppingOrder->shipped = 1;
|
||||
$ShoppingOrder->save();
|
||||
}
|
||||
*/
|
||||
$data = [
|
||||
'shopping_order' => $ShoppingOrder,
|
||||
'isAdmin' => true,
|
||||
|
|
@ -278,7 +280,7 @@ class SalesController extends Controller
|
|||
return $ShoppingOrder->getLastShoppingPayment('reference');
|
||||
})
|
||||
->addColumn('member_id', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->member_id) {
|
||||
if($ShoppingOrder->member_id && $ShoppingOrder->member) {
|
||||
return $ShoppingOrder->member ? '<a href="' . route('admin_lead_edit', [$ShoppingOrder->member_id]) . '">' . $ShoppingOrder->member->getFullName() . '</a>' : 'gelöscht';
|
||||
}
|
||||
if($ShoppingOrder->shopping_user && $ShoppingOrder->shopping_user->is_like){
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ use App\Http\Controllers\Controller;
|
|||
use App\Services\SyS\ShoppingOrders;
|
||||
use App\Services\SyS\BuyingsProducts;
|
||||
use App\Services\SyS\BusinessStructur;
|
||||
use App\Services\SyS\ChangeUserBusinesses;
|
||||
|
||||
class SysController extends Controller
|
||||
{
|
||||
|
|
@ -62,6 +63,10 @@ class SysController extends Controller
|
|||
case 'corrections':
|
||||
return Correction::show();
|
||||
break;
|
||||
case 'change_user_businesses':
|
||||
return ChangeUserBusinesses::show();
|
||||
break;
|
||||
|
||||
}
|
||||
abort(403, 'not found tool');
|
||||
}
|
||||
|
|
@ -96,6 +101,9 @@ class SysController extends Controller
|
|||
case 'corrections':
|
||||
return Correction::store();
|
||||
break;
|
||||
case 'change_user_businesses':
|
||||
return ChangeUserBusinesses::store();
|
||||
break;
|
||||
}
|
||||
abort(403, 'not found tool');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,7 +189,6 @@ class CustomerController extends Controller
|
|||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
}
|
||||
|
||||
$data['faker_mail'] = isset($data['faker_mail']) ? true : false;
|
||||
$data['has_buyed'] = isset($data['has_buyed']) ? true : false;
|
||||
$data['subscribed'] = isset($data['subscribed']) ? true : false;
|
||||
|
|
|
|||
|
|
@ -2,13 +2,16 @@
|
|||
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
use Auth;
|
||||
use Request;
|
||||
use App\User;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Exports\UserTeamExport;
|
||||
use App\Models\UserSalesVolume;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Services\BusinessPlan\ExportBot;
|
||||
use App\Services\BusinessPlan\TreeCalcBot;
|
||||
use Auth;
|
||||
|
||||
class TeamController extends Controller
|
||||
{
|
||||
|
|
@ -49,7 +52,6 @@ class TeamController extends Controller
|
|||
return view('user.team.structure', $data);
|
||||
}
|
||||
|
||||
|
||||
public function points()
|
||||
{
|
||||
$this->setFilterVars();
|
||||
|
|
@ -63,6 +65,69 @@ class TeamController extends Controller
|
|||
return view('user.team.points', $data);
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$ExportBot = new ExportBot('member');
|
||||
$ExportBot->initStructureUser($user, 'list'); //tree or list
|
||||
$data = [
|
||||
'ExportBot' => $ExportBot,
|
||||
];
|
||||
return view('user.team.export', $data);
|
||||
}
|
||||
|
||||
public function userTeamExport(){
|
||||
|
||||
if(Request::get('action') === "export"){
|
||||
$user = User::find(\Auth::user()->id);
|
||||
$ExportBot = new ExportBot('member');
|
||||
$ExportBot->initStructureUser($user, 'list'); //tree or list
|
||||
$columns = [];
|
||||
$filename = "mivita-mein-team-export-".date('Y-m-d-H-i-s');
|
||||
$headers = array(
|
||||
'Line',
|
||||
'Level',
|
||||
'E-Mail',
|
||||
'Vorname',
|
||||
'Nachname',
|
||||
'Adresse',
|
||||
'Zusatz',
|
||||
'PLZ',
|
||||
'Ort',
|
||||
'Land',
|
||||
'Tel',
|
||||
'Mobil',
|
||||
'Geburtstag',
|
||||
'Account',
|
||||
'Account bis',
|
||||
'Sponsor',
|
||||
);
|
||||
if(isset($ExportBot->user_list->childs)){
|
||||
foreach ($ExportBot->user_list->childs as $child){
|
||||
$columns[] = array(
|
||||
'Line' => $child->line,
|
||||
'Level' => $child->level_name,
|
||||
'E-Mail' => $child->email,
|
||||
'Vorname' => $child->first_name,
|
||||
'Nachname' => $child->last_name,
|
||||
'Adresse' => $child->address,
|
||||
'Zusatz' => $child->address_2,
|
||||
'PLZ' => $child->zipcode,
|
||||
'Ort' => $child->city,
|
||||
'Land' => $child->country_id,
|
||||
'Tel' => $child->phone,
|
||||
'Mobil' => $child->mobil,
|
||||
'Geburtstag' => $child->birthday,
|
||||
'Account' => ($child->active_account == 1 ? 'JA' : 'NEIN'),
|
||||
'Account bis' => $child->payment_account_date,
|
||||
'Sponsor' => $child->sponsor_name,
|
||||
);
|
||||
}
|
||||
}
|
||||
return Excel::download(new UserTeamExport($columns, $headers), $filename.'.xls');
|
||||
}
|
||||
}
|
||||
|
||||
private function setFilterVars(){
|
||||
|
||||
|
|
@ -72,7 +137,6 @@ class TeamController extends Controller
|
|||
if(!session('team_user_filter_year')){
|
||||
session(['team_user_filter_year' => intval(date('Y'))]);
|
||||
}
|
||||
|
||||
if(!session('team_user_points_filter_month')){
|
||||
session(['team_user_points_filter_month' => intval(date('m'))]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,12 @@ class UserLevelController extends Controller
|
|||
$value->save();
|
||||
}
|
||||
}
|
||||
|
||||
//set paylines //pr_line_1
|
||||
for ($i=1; $i <=8; $i++) {
|
||||
if(isset($data['pr_line_'.$i])){
|
||||
$data['paylines'] = $i;
|
||||
}
|
||||
}
|
||||
if($data['id'] == "new"){
|
||||
$model = UserLevel::create($data);
|
||||
}else{
|
||||
|
|
@ -47,23 +52,8 @@ class UserLevelController extends Controller
|
|||
$model->save();
|
||||
}
|
||||
|
||||
/*if(!empty($data['trans'])){
|
||||
$trans = [];
|
||||
foreach ($data['trans'] as $lang => $value){
|
||||
if($value && $value != null){
|
||||
$trans[$lang] = $value;
|
||||
}
|
||||
}
|
||||
if(count($trans)){
|
||||
$model->trans_name = $trans;
|
||||
$model->save();
|
||||
}
|
||||
}*/
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_levels'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -150,12 +150,13 @@ class CardController extends Controller
|
|||
|
||||
public function deleteCard(){
|
||||
|
||||
Yard::instance('shopping')->destroy();
|
||||
return back();
|
||||
$setCode = Shop::getUserShopLang();
|
||||
$mylangs = Shop::getLangChange();
|
||||
foreach($mylangs as $code => $country){
|
||||
if(strtolower($setCode) === strtolower($code)){
|
||||
Shop::initUserShopLang($country);
|
||||
return back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -283,7 +283,7 @@ class CheckoutController extends Controller
|
|||
$shopping_order = $this->makeShoppingOrder($shopping_user);
|
||||
//CustomerPriority
|
||||
if($shopping_user->is_from === 'shopping'){
|
||||
CustomerPriority::checkOne(ShoppingUser::find($shopping_user->id), true);
|
||||
$ret = CustomerPriority::checkOne(ShoppingUser::find($shopping_user->id), true);
|
||||
}
|
||||
Util::setUserHistoryValue(['status'=>2, 'shopping_order_id'=>$shopping_order->id]);
|
||||
|
||||
|
|
@ -402,6 +402,8 @@ class CheckoutController extends Controller
|
|||
Yard::instance('shopping')->destroy();
|
||||
$this->destroy();
|
||||
|
||||
|
||||
|
||||
$payt = $ShoppingPayment->payment_transactions->last();
|
||||
|
||||
$data = [
|
||||
|
|
@ -678,6 +680,7 @@ class CheckoutController extends Controller
|
|||
{
|
||||
$this->session->remove($this->instance);
|
||||
}
|
||||
|
||||
//is for Rechnung MIV
|
||||
private function directPaymentStatus(PaymentTransaction $payt){
|
||||
|
||||
|
|
|
|||
|
|
@ -79,8 +79,6 @@ class SiteController extends Controller
|
|||
$headline_image = $category->iq_image;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$product_categories = ProductCategory::where('category_id', $category->id)->whereHas('product', function ($query) use ($category) {
|
||||
$query->where('active', true)->whereJsonContains('show_on', '1');
|
||||
})->orderBy('pos', 'DESC')->get();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue