Free Shipping, Business Levels correction, Products Buying, Fonts
This commit is contained in:
parent
3f2fbd6d5b
commit
0341c9c189
197 changed files with 9161 additions and 329 deletions
|
|
@ -5,10 +5,13 @@ namespace App\Console\Commands;
|
|||
use App\Models\Setting;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Cron\BusinessUsersStore;
|
||||
use App\Cron\UserLevelUpdate;
|
||||
use App\Cron\UserPaymentCredits;
|
||||
|
||||
class BusinessStore extends Command
|
||||
{
|
||||
/**
|
||||
* ln -sfv /usr/bin/php73 /usr/bin/php
|
||||
* php artisan business:store month year
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
|
|
@ -23,6 +26,15 @@ class BusinessStore extends Command
|
|||
*/
|
||||
protected $description = 'Create Business Structur and UserDetails';
|
||||
|
||||
private $timeStart;
|
||||
private $month;
|
||||
private $year;
|
||||
|
||||
private $sendCreditMail = false;
|
||||
private $sendUpdateMail = true;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
|
|
@ -40,39 +52,139 @@ class BusinessStore extends Command
|
|||
*/
|
||||
public function handle()
|
||||
{
|
||||
$day = (int) Setting::getContentBySlug('day-exectute-business-structur');
|
||||
$this->info('RUN Command BusinessStore on Day '. $day);
|
||||
$executeDay = (int) Setting::getContentBySlug('day-exectute-business-structur');
|
||||
$this->info('RUN Command BusinessStore on Day: '. $executeDay);
|
||||
|
||||
$timeStart = microtime(true);
|
||||
$this->info('RUN Command BusinessStore');
|
||||
$presentDay = (int) date('d');
|
||||
$this->info('RUN Command BusinessStore present Day: '. $presentDay);
|
||||
|
||||
$month = $this->argument('month');
|
||||
$year = $this->argument('year');
|
||||
if(!$month || !$year){
|
||||
$this->info('need arguments month & year');
|
||||
if($executeDay !== $presentDay){
|
||||
$this->info('NOT RUN Command BusinessStore is not present Day: '. $presentDay);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//$this->info('month: '.$month.' year:'.$year);
|
||||
for($i = 1; $i<=6; $i++){
|
||||
$this->timeStart = microtime(true);
|
||||
//$this->info('RUN Command BusinessStore');
|
||||
$this->month = $this->argument('month');
|
||||
$this->year = $this->argument('year');
|
||||
|
||||
|
||||
if(!$this->month || !$this->year){
|
||||
$this->month = (int) date("m", strtotime("-1 month", time()));
|
||||
$this->year = (int) date("Y", strtotime("-1 month", time()));
|
||||
}
|
||||
|
||||
$this->info('RUN Command BusinessStore on month: '.$this->month.' | year: '.$this->year);
|
||||
|
||||
//erstellt die Business Struktur und die Details
|
||||
$this->storeBusinessStructureUsersDetailMonth();
|
||||
|
||||
//Struktur und die Details für mehrere Montate for / to month
|
||||
//$this->storeBusinessStructureUsersDetailPeriod(1, 6);
|
||||
|
||||
//erstellt die Gutschriften
|
||||
//$this->userBusinessCommissionsToCredit();
|
||||
|
||||
//erstellt aus den Gutschriften die PDFs
|
||||
//$this->userCreatePaymentCreditsPDF();
|
||||
|
||||
//update user Level
|
||||
//$this->userLevelUpdate();
|
||||
return 0;
|
||||
|
||||
//\Log::info('Cron is running');
|
||||
//return 0;
|
||||
}
|
||||
|
||||
private function storeBusinessStructureUsersDetailMonth(){
|
||||
|
||||
$this->info('storeBusinessStructureUsersDetailMonth month: '.$this->month.' year:'.$this->year);
|
||||
$businessUsersStore = new BusinessUsersStore($this->month, $this->year);
|
||||
$businessUsersStore->storeUserBusinessStructure();
|
||||
$businessUsersStore->storeBusinessUsersDetail();
|
||||
$bool = $businessUsersStore->storeBusinessCompleted();
|
||||
|
||||
$diff = microtime(true) - $this->timeStart;
|
||||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
|
||||
$this->info('END Command storeBusinessStructureUsersDetailMonth: '.$bool. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
|
||||
}
|
||||
|
||||
private function userBusinessCommissionsToCredit(){
|
||||
|
||||
$this->info('userBusinessCommissionsToCredit month: '.$this->month.' year:'.$this->year);
|
||||
$userPaymentCredits = new UserPaymentCredits($this->month, $this->year);
|
||||
$userBusinesses = $userPaymentCredits->getUserBusinessByMonthYear();
|
||||
|
||||
foreach($userBusinesses as $userBusiness){
|
||||
$ret = $userPaymentCredits->addUserCreditItem($userBusiness);
|
||||
$this->info('userBusinessCredit: '.$ret->user_id.' : Team: '.$ret->commission_team_total.' | Shop: '.$ret->commission_shop_sales);
|
||||
}
|
||||
$diff = microtime(true) - $this->timeStart;
|
||||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
|
||||
$this->info('END Command userBusinessCommissionsToCredit: | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
|
||||
}
|
||||
|
||||
private function userCreatePaymentCreditsPDF(){
|
||||
|
||||
$this->info('userCreatePaymentCreditsPDF month: '.$this->month.' year:'.$this->year);
|
||||
$userPaymentCredits = new UserPaymentCredits($this->month, $this->year);
|
||||
$creditItemUsers = $userPaymentCredits->getUserCreditItemUsersByMonthYear();
|
||||
|
||||
foreach($creditItemUsers as $creditItemUser){
|
||||
$bool = $userPaymentCredits->makeCreditPaymentPDF($creditItemUser->user_id, $this->sendCreditMail);
|
||||
$this->info('creditsPDF: '.$bool.' user_id: '.$creditItemUser->user_id);
|
||||
}
|
||||
|
||||
$diff = microtime(true) - $this->timeStart;
|
||||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
|
||||
$this->info('END Command userCreatePaymentCreditsPDF: | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
|
||||
}
|
||||
|
||||
private function userLevelUpdate(){
|
||||
|
||||
$this->info('userLevelUpdate month: '.$this->month.' year:'.$this->year);
|
||||
|
||||
$userLevelUpdate = new UserLevelUpdate($this->month, $this->year);
|
||||
$levelUpdateUsers = $userLevelUpdate->getUserBusinessByMonthYear();
|
||||
|
||||
foreach($levelUpdateUsers as $userBusiness){
|
||||
$ret = $userLevelUpdate->makeUserLevelUpdate($userBusiness, $this->sendUpdateMail);
|
||||
if($ret){
|
||||
$this->info('updateLevel: '.$userBusiness->user->id.' | '.$userBusiness->user->email.' | '.
|
||||
'from: '.$userBusiness->m_level_id.' '.$userBusiness->user_level_name.' | '.
|
||||
'to: '.$ret);
|
||||
}
|
||||
|
||||
}
|
||||
$diff = microtime(true) - $this->timeStart;
|
||||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
|
||||
$this->info('END Command userLevelUpdate: | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
|
||||
}
|
||||
|
||||
|
||||
private function storeBusinessStructureUsersDetailPeriod($for, $to){
|
||||
for($i = $for; $i<=$to; $i++){
|
||||
$month = $i;
|
||||
$this->info('month: '.$month.' year:'.$year);
|
||||
$businessUsersStore = new BusinessUsersStore($month, $year);
|
||||
$this->info('Store Business Structure Users Detail month: '.$month.' year:'.$this->year);
|
||||
$businessUsersStore = new BusinessUsersStore($month, $this->year);
|
||||
$businessUsersStore->storeUserBusinessStructure();
|
||||
$businessUsersStore->storeBusinessUsersDetail();
|
||||
$bool = $businessUsersStore->storeBusinessCompleted();
|
||||
|
||||
$diff = microtime(true) - $timeStart;
|
||||
$diff = microtime(true) - $this->timeStart;
|
||||
$sec = intval($diff);
|
||||
$micro = $diff - $sec;
|
||||
$this->info('BusinessStore: '.$bool. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms");
|
||||
$this->info('Period 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
68
app/Cron/UserLevelUpdate.php
Normal file
68
app/Cron/UserLevelUpdate.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
namespace App\Cron;
|
||||
|
||||
use App\User;
|
||||
use App\Models\UserBusiness;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Models\UserCreditItem;
|
||||
use App\Mail\MailUserLevelUpdate;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Repositories\CreditRepository;
|
||||
|
||||
class UserLevelUpdate
|
||||
{
|
||||
private $month;
|
||||
private $year;
|
||||
|
||||
|
||||
public function __construct($month, $year)
|
||||
{
|
||||
$this->month = $month;
|
||||
$this->year = $year;
|
||||
}
|
||||
|
||||
|
||||
public function getUserBusinessByMonthYear(){
|
||||
return UserBusiness::select('user_businesses.*')
|
||||
->where('user_businesses.month', '=', $this->month)
|
||||
->where('user_businesses.year', '=', $this->year)
|
||||
->where('user_businesses.next_qual_user_level', '!=', NULL)
|
||||
->get();
|
||||
}
|
||||
|
||||
public function makeUserLevelUpdate(UserBusiness $userBusiness, $send_update_mail){
|
||||
$ret = false;
|
||||
$nextQualUserLevel = $userBusiness->next_qual_user_level;
|
||||
if(!isset($nextQualUserLevel['hasUpdated']) && $userBusiness->user){
|
||||
$userBusiness->user->m_level = $nextQualUserLevel['id'];
|
||||
$userBusiness->user->save();
|
||||
$nextQualUserLevel['hasUpdated'] = 1;
|
||||
$userBusiness->next_qual_user_level = $nextQualUserLevel;
|
||||
$userBusiness->save();
|
||||
$ret = $nextQualUserLevel['id'].' '.$nextQualUserLevel['name'];
|
||||
if($send_update_mail){
|
||||
self::sendUpdateMail($userBusiness->user, $userBusiness->total_qual_tp, $nextQualUserLevel['name']);
|
||||
}
|
||||
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
private function sendUpdateMail(User $user, $tp, $to){
|
||||
$bcc = [];
|
||||
$email = $user->email;
|
||||
if(!$email){
|
||||
if($user->mode === 'test'){
|
||||
}else{
|
||||
$email = config('app.checkout_mail');
|
||||
}
|
||||
}
|
||||
if($user->mode === 'test'){
|
||||
$bcc[] = config('app.checkout_test_mail');
|
||||
}else{
|
||||
$bcc[] = config('app.checkout_mail');
|
||||
}
|
||||
Mail::to($email)->bcc($bcc)->send(new MailUserLevelUpdate($tp, $to));
|
||||
}
|
||||
}
|
||||
87
app/Cron/UserPaymentCredits.php
Normal file
87
app/Cron/UserPaymentCredits.php
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
namespace App\Cron;
|
||||
|
||||
use App\User;
|
||||
use App\Models\UserBusiness;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Models\UserCreditItem;
|
||||
use App\Repositories\CreditRepository;
|
||||
|
||||
class UserPaymentCredits
|
||||
{
|
||||
private $month;
|
||||
private $year;
|
||||
|
||||
|
||||
public function __construct($month, $year)
|
||||
{
|
||||
$this->month = $month;
|
||||
$this->year = $year;
|
||||
}
|
||||
|
||||
|
||||
public function getUserBusinessByMonthYear(){
|
||||
return UserBusiness::select('user_businesses.*')
|
||||
->where('user_businesses.month', '=', $this->month)
|
||||
->where('user_businesses.year', '=', $this->year)
|
||||
->where(function($q) {
|
||||
return $q->where('user_businesses.commission_team_total', '>', 0)
|
||||
->orWhere('user_businesses.commission_shop_sales', '>', 0);
|
||||
})
|
||||
->get();
|
||||
}
|
||||
|
||||
public function addUserCreditItem($userBusiness)
|
||||
{
|
||||
$date = HTMLHelper::getMonth($userBusiness->month).' '.$userBusiness->year;
|
||||
|
||||
if($userBusiness->commission_shop_sales > 0){
|
||||
if($this->hasNotUserCreditItem($userBusiness, 1)){
|
||||
UserCreditItem::create([
|
||||
'user_id' => $userBusiness->user_id,
|
||||
'user_business_id' => $userBusiness->id,
|
||||
'credit' => $userBusiness->commission_shop_sales,
|
||||
'message' => 'Provision Shop '.$date,
|
||||
'status' => 1,
|
||||
]);
|
||||
}
|
||||
}
|
||||
if($userBusiness->commission_team_total > 0){
|
||||
if($this->hasNotUserCreditItem($userBusiness, 2)){
|
||||
UserCreditItem::create([
|
||||
'user_id' => $userBusiness->user_id,
|
||||
'user_business_id' => $userBusiness->id,
|
||||
'credit' => $userBusiness->commission_team_total,
|
||||
'message' => 'Provision Team '.$date,
|
||||
'status' => 2,
|
||||
]);
|
||||
}
|
||||
}
|
||||
return $userBusiness;
|
||||
|
||||
}
|
||||
|
||||
public function getUserCreditItemUsersByMonthYear(){
|
||||
return UserCreditItem::select('user_credit_items.*')
|
||||
->where('paid', '=', false)
|
||||
->groupBy('user_id')
|
||||
->get();
|
||||
}
|
||||
|
||||
public function makeCreditPaymentPDF($user_id, $credit_send_mail)
|
||||
{
|
||||
//$user_id = 2;
|
||||
$user = User::findOrFail($user_id);
|
||||
$data = [];
|
||||
if($credit_send_mail){
|
||||
$data['credit_send_mail'] = true;
|
||||
}
|
||||
$credit_repo = new CreditRepository($user);
|
||||
return $credit_repo->create($data);
|
||||
}
|
||||
|
||||
private function hasNotUserCreditItem($userBusiness, $status){
|
||||
return (UserCreditItem::where('user_business_id', $userBusiness->id)
|
||||
->where('user_id', $userBusiness->user_id)->where('status', $status)->count() > 0) ? false : true;
|
||||
}
|
||||
}
|
||||
|
|
@ -78,8 +78,8 @@ class KasController extends Controller
|
|||
]);
|
||||
$this->CredentialToken = $SoapLogon->KasAuth(json_encode(array(
|
||||
'KasUser' => $this->kas_user,
|
||||
'KasAuthType' => 'sha1',
|
||||
'KasPassword' => sha1($this->kas_pass),
|
||||
'KasAuthType' => 'plain',
|
||||
'KasPassword' => $this->kas_pass,
|
||||
'SessionLifeTime' => $this->session_lifetime,
|
||||
'SessionUpdateLifeTime' => $this->session_update_lifetime
|
||||
)));
|
||||
|
|
|
|||
|
|
@ -55,18 +55,18 @@ diQ860kC4h++erAa8dvB1DUG5oldYYPiEKOyyyn+tNU298QcEkLrG1JcLuUXpfTg
|
|||
8dPIr+VpGomsvpwGTfJFjlE=
|
||||
-----END PRIVATE KEY-----";
|
||||
private static $ssl_certificate_sni_crt = "-----BEGIN CERTIFICATE-----
|
||||
MIIGLzCCBRegAwIBAgIRAJ6HzyfKXWCtRn3q9gGkgYEwDQYJKoZIhvcNAQELBQAw
|
||||
MIIGMTCCBRmgAwIBAgIRANRDAE1KIec3seJ9ed+Qy4UwDQYJKoZIhvcNAQELBQAw
|
||||
gY8xCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO
|
||||
BgNVBAcTB1NhbGZvcmQxGDAWBgNVBAoTD1NlY3RpZ28gTGltaXRlZDE3MDUGA1UE
|
||||
AxMuU2VjdGlnbyBSU0EgRG9tYWluIFZhbGlkYXRpb24gU2VjdXJlIFNlcnZlciBD
|
||||
QTAeFw0yMTA3MjIwMDAwMDBaFw0yMjA3MjIyMzU5NTlaMBgxFjAUBgNVBAMMDSou
|
||||
QTAeFw0yMjA3MTIwMDAwMDBaFw0yMzA4MTIyMzU5NTlaMBgxFjAUBgNVBAMMDSou
|
||||
bWl2aXRhLmNhcmUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVOhtO
|
||||
TJBn5V9SmHmo/EawNiO0VwHOVnnrfnaPD2A1DeKqHmAfMTaybHaCfi+mufV8veem
|
||||
fY1j6rXq7RFU46SMBbFlfZqKS/3zb2d3yRT7OBU83PV5P8JXHrqEArlmKiOZcPoj
|
||||
86TTAbq5wwxjFXkePzJSdOdUN/Z1E1tI8ieUQC40tpMsRvf5XOzQZousXBT1P6F9
|
||||
Q2FbUKEfiEBJ0wjnz74a73U7DebuYGEFPSjVjrkVB11+55y1MBkwg/6JIro+BlXo
|
||||
rW6Xaifb1PKFbTFQnlC4BAKyPHxNKWZCSHgw/C3A7fBQKHM1wVhZo2BZrumdE+X1
|
||||
FOScWlN+M/+TyUybAgMBAAGjggL6MIIC9jAfBgNVHSMEGDAWgBSNjF7EVK2K4Xfp
|
||||
FOScWlN+M/+TyUybAgMBAAGjggL8MIIC+DAfBgNVHSMEGDAWgBSNjF7EVK2K4Xfp
|
||||
m/mbBeG4AY1h4TAdBgNVHQ4EFgQUCS0Y1v7p19isO7cTuP3YrKVr2OcwDgYDVR0P
|
||||
AQH/BAQDAgWgMAwGA1UdEwEB/wQCMAAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsG
|
||||
AQUFBwMCMEkGA1UdIARCMEAwNAYLKwYBBAGyMQECAgcwJTAjBggrBgEFBQcCARYX
|
||||
|
|
@ -74,21 +74,21 @@ aHR0cHM6Ly9zZWN0aWdvLmNvbS9DUFMwCAYGZ4EMAQIBMIGEBggrBgEFBQcBAQR4
|
|||
MHYwTwYIKwYBBQUHMAKGQ2h0dHA6Ly9jcnQuc2VjdGlnby5jb20vU2VjdGlnb1JT
|
||||
QURvbWFpblZhbGlkYXRpb25TZWN1cmVTZXJ2ZXJDQS5jcnQwIwYIKwYBBQUHMAGG
|
||||
F2h0dHA6Ly9vY3NwLnNlY3RpZ28uY29tMCUGA1UdEQQeMByCDSoubWl2aXRhLmNh
|
||||
cmWCC21pdml0YS5jYXJlMIIBfAYKKwYBBAHWeQIEAgSCAWwEggFoAWYAdQBGpVXr
|
||||
dfqRIDC1oolp9PN9ESxBdL79SbiFq/L8cP5tRwAAAXrNeYDBAAAEAwBGMEQCIFzd
|
||||
+zLvEGolSmSaa7vaQxv63DuX5vHQggER6/Dh+jZGAiAcUn8AZjF7GQOd4LTzGMhU
|
||||
KsGNyn6d3n4cJ9fy9BzRxAB1AEHIyrHfIkZKEMahOglCh15OMYsbA+vrS8do8JBi
|
||||
lgb2AAABes15gIYAAAQDAEYwRAIgE0NFzvN7qEre8Bc1C8EsMHD+5PDyQHZRBJkN
|
||||
OdxsH9MCIDBSFFZTheD2+nzbHm5WLvAI75xyUvyBx/LEy3XBtjulAHYAKXm+8J45
|
||||
OSHwVnOfY6V35b5XfZxgCvj5TV0mXCVdx4QAAAF6zXmAWwAABAMARzBFAiAbRPVk
|
||||
w3AIzVF7gE0R3ZJgou7P4o9KL2yRgAaeGbbClgIhAPL86sD0GwPZ9ZsL31q07Y/S
|
||||
1kq5ohBt907fOisMwI0HMA0GCSqGSIb3DQEBCwUAA4IBAQAaYeV2NtUM2HkxWbfd
|
||||
3jVAs1PdBIYtktBpx7UwNphylqF4qlsZwV5XZxeD/K7mTW5tgNaHHrEjaOME/y1s
|
||||
rWTIt1D+UUmDdiSgKfVF5gfajPFVepOcb5OC+ielevvnVJn/6Tqa/RNz0GstwMnB
|
||||
3lBaoP7oGuBy2Ow3LG0+yO4Q0j82gIkOM15CsjY9ZK540HAXllxKGN29Yf+RDkqE
|
||||
zRk4TE12MEW+Ugw6RxDSUCfKmev4iUAT9vq790OESAfOKY1zg/6hIF3noH1IFt1d
|
||||
e0wVWz58KTXBqHsmxX3F1PUuT6NY+wRsVfnc8hR8mfJibJ0VL8wxjzScDXyHpZr/
|
||||
o3I7
|
||||
cmWCC21pdml0YS5jYXJlMIIBfgYKKwYBBAHWeQIEAgSCAW4EggFqAWgAdQCt9776
|
||||
fP8QyIudPZwePhhqtGcpXc+xDCTKhYY069yCigAAAYHxRovYAAAEAwBGMEQCIA3z
|
||||
UR5BFV7bwBcdRhS8mru20uq36DNz3ILivZh9yl4CAiAUjDxqZBW0Po/0Rm0gumI1
|
||||
VBZfqMSDiA7Cr1peGN8B8wB3AHoyjFTYty22IOo44FIe6YQWcDIThU070ivBOlej
|
||||
UutSAAABgfFGi6UAAAQDAEgwRgIhAN9s3/v2ygh1tfPQ8iX2dLZdOVxyuvC7bf15
|
||||
KP4NQyabAiEAz88hRBxRu3FifpLaYNjwxy1fRUc2luWfDdw+f31TOfoAdgDoPtDa
|
||||
PvUGNTLnVyi8iWvJA9PL0RFr7Otp4Xd9bQa9bgAAAYHxRot7AAAEAwBHMEUCIQCQ
|
||||
RYqkeiRlStQacqUjuw5435NqNDqDlydAVYgywX05pwIgdcFtcLMGevO/KRyUeuWw
|
||||
8hYY6y1S7VYVdcFIuZVp5mswDQYJKoZIhvcNAQELBQADggEBAA0eEYSKcbgEPczo
|
||||
ABXpVsfbmaZqPhAKqcqKeGUcmFo7JHVPRUyck8RAF+SravyaHhilygU727QG4oUt
|
||||
riCewV39cKD2m7CO24WHe5+Fw8eslsJE+DBq/2WpLRJIGSWLl1r7WUELKQhqEYkr
|
||||
DCpkDXpG+lsDIfc5DC4dPLSWc9ezObsS4KEMCMDw+bj5GMGV6dHQZxAnbyqi71+v
|
||||
4+AOHpcYfe6v63w82M0YN5oTnaOukLVDgMXJ7WZP2op7atojB7DeM7k3+fj79kVJ
|
||||
jUGlvHLdN9jsczEZGGxL3w5oIjC4HMK1U5kyzEFWpc8ZLg+YPvF8w15lbhIXG94l
|
||||
JscmCFU=
|
||||
-----END CERTIFICATE-----";
|
||||
private static $ssl_certificate_sni_bundle = "-----BEGIN CERTIFICATE-----
|
||||
MIIGEzCCA/ugAwIBAgIQfVtRJrR2uhHbdBYLvFMNpzANBgkqhkiG9w0BAQwFADCB
|
||||
|
|
|
|||
169
app/Http/Controllers/BusinessCommissionController.php
Normal file
169
app/Http/Controllers/BusinessCommissionController.php
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Carbon;
|
||||
use Request;
|
||||
use App\Services\Payment;
|
||||
use App\Models\UserInvoice;
|
||||
use App\Models\UserBusiness;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\Models\UserSalesVolume;
|
||||
use App\Services\BusinessPlan\SalesPointsVolume;
|
||||
|
||||
class BusinessCommissionController extends Controller
|
||||
{
|
||||
|
||||
private $filter_show = [1 => 'nur Provisionen', 2 => 'alle'];
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$filter_members = UserBusiness::join('users', 'user_id', '=', 'users.id')
|
||||
->groupBy('user_id')->join('user_accounts', 'account_id', '=', 'user_accounts.id')
|
||||
->select('users.id', 'users.email', 'user_accounts.first_name', 'user_accounts.last_name')->get();
|
||||
|
||||
|
||||
$this->setFilterVars();
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_years' => HTMLHelper::getYearRange(),
|
||||
'filter_members' => $filter_members,
|
||||
'filter_show' => $this->filter_show,
|
||||
|
||||
];
|
||||
return view('admin.business.commissions', $data);
|
||||
}
|
||||
|
||||
public function store(){
|
||||
$data = Request::all();
|
||||
|
||||
dd($data);
|
||||
|
||||
return redirect(route('admin_business_commissions'));
|
||||
}
|
||||
|
||||
|
||||
private function setFilterVars(){
|
||||
|
||||
if(!session('commissions_filter_month')){
|
||||
session(['commissions_filter_month' => intval(date('m'))]);
|
||||
}
|
||||
if(!session('commissions_filter_year')){
|
||||
session(['commissions_filter_year' => intval(date('Y'))]);
|
||||
}
|
||||
if(!session('commissions_filter_show')){
|
||||
session(['commissions_filter_show' => 1]);
|
||||
}
|
||||
|
||||
session(['commissions_filter_member_id' => Request::get('commissions_filter_member_id')]);
|
||||
|
||||
if(Request::get('commissions_filter_month')){
|
||||
session(['commissions_filter_month' => Request::get('commissions_filter_month')]);
|
||||
}
|
||||
if(Request::get('commissions_filter_year')){
|
||||
session(['commissions_filter_year' => Request::get('commissions_filter_year')]);
|
||||
}
|
||||
if(Request::get('commissions_filter_show')){
|
||||
session(['commissions_filter_show' => Request::get('commissions_filter_show')]);
|
||||
}
|
||||
}
|
||||
|
||||
private function initSearch()
|
||||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$query = UserBusiness::select('user_businesses.*')
|
||||
->where('user_businesses.month', '=', Request::get('commissions_filter_month'))
|
||||
->where('user_businesses.year', '=', Request::get('commissions_filter_year'));
|
||||
|
||||
if(intval(Request::get('commissions_filter_show')) === 1){
|
||||
$query->where(function($q) {
|
||||
return $q->where('user_businesses.commission_team_total', '>', 0)
|
||||
->orWhere('user_businesses.commission_shop_sales', '>', 0);
|
||||
});
|
||||
}
|
||||
|
||||
if(Request::get('commissions_filter_member_id')){
|
||||
$query->where('user_businesses.user_id', '=', Request::get('commissions_filter_member_id'));
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function datatable(){
|
||||
|
||||
$query = $this->initSearch();
|
||||
return \DataTables::eloquent($query)
|
||||
/* ->addColumn('id', function (UserSalesVolume $UserSalesVolume) {
|
||||
return '<button type="button" class="btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
|
||||
data-id="'.$UserSalesVolume->id.'"
|
||||
data-action="edit_user_sales_volume"
|
||||
data-back=""
|
||||
data-modal="modal-xl"
|
||||
data-init_from="user"
|
||||
data-route="'.route('modal_load').'"><span class="far fa-eye"></span></button>';
|
||||
})*/
|
||||
|
||||
|
||||
->addColumn('commission_total', function (UserBusiness $UserBusiness) {
|
||||
$commission_total = $UserBusiness->commission_team_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_shop_sales', function (UserBusiness $UserBusiness) {
|
||||
return $UserBusiness->commission_shop_sales > 0 ?
|
||||
'<span class="badge badge-outline-success">'.formatNumber($UserBusiness->commission_shop_sales).' €</span>'
|
||||
: $UserBusiness->commission_shop_sales.' €';
|
||||
})
|
||||
->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) : "-";
|
||||
})
|
||||
|
||||
/* ->filterColumn('m_account', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("m_account LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('first_name', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("first_name LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('last_name', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("last_name LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('email', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("email LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})*/
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('commission_team_total', 'commission_team_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'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,9 @@ class BusinessController extends Controller
|
|||
{
|
||||
|
||||
private $filter_active = [1 => 'aktiv', 2 => 'nicht aktiv', 3 => 'alle'];
|
||||
private $month;
|
||||
private $year;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
|
@ -170,11 +173,11 @@ class BusinessController extends Controller
|
|||
})
|
||||
->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>';
|
||||
'<span class="small no-line-break">E: '.$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).' €</div>'.
|
||||
'<span class="small no-line-break">B: '.formatNumber($userBusiness->sales_volume_total).' | S: '.formatNumber($userBusiness->sales_volume_total_shop).'</span>';
|
||||
'<span class="small no-line-break">E: '.formatNumber($userBusiness->sales_volume_total).' | S: '.formatNumber($userBusiness->sales_volume_total_shop).'</span>';
|
||||
})
|
||||
->addColumn('email', function (UserBusiness $userBusiness) {
|
||||
return $userBusiness->email;
|
||||
|
|
@ -214,7 +217,34 @@ class BusinessController extends Controller
|
|||
->addColumn('payment_account_date', function (UserBusiness $userBusiness) {
|
||||
return $userBusiness->active_date ? formatDate($userBusiness->active_date) : "-";
|
||||
})
|
||||
|
||||
|
||||
->filterColumn('m_account', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("m_account LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('first_name', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("first_name LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('last_name', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("last_name LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('email', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("email LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('m_account', 'm_account $1')
|
||||
->orderColumn('email', 'email $1')
|
||||
->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'])
|
||||
->make(true);
|
||||
|
|
@ -224,13 +254,16 @@ class BusinessController extends Controller
|
|||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$query = 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.payment_account', "!=", null);
|
||||
$query = User::join('user_accounts', 'account_id', '=', 'user_accounts.id')
|
||||
->select('users.*', 'user_accounts.m_account', 'user_accounts.first_name', 'user_accounts.last_name')
|
||||
->where('users.deleted_at', '=', null)
|
||||
->where('users.id', '!=', 1)
|
||||
->where('users.admin', "<", 4)
|
||||
->where('users.m_level', "!=", null)
|
||||
->where('users.payment_account', "!=", null);
|
||||
|
||||
// $query = User::with('account')->select('users.*')
|
||||
|
||||
if(Request::get('business_user_filter_active')){
|
||||
if(Request::get('business_user_filter_active') == 1){
|
||||
$query->where('users.payment_account', ">=", now());
|
||||
|
|
@ -256,8 +289,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-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-info"><span class="far fa-calculator"></span></a>';
|
||||
})
|
||||
->addColumn('m_account', function (User $user) {
|
||||
return $user->account ? $user->account->m_account : '';
|
||||
|
|
@ -276,11 +309,11 @@ class BusinessController extends Controller
|
|||
})
|
||||
->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>';
|
||||
'<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_total', function (User $user) {
|
||||
return '<div class="no-line-break">'.formatNumber($user->getUserSalesVolumeBy($this->month, $this->year, 'sales_volume_total_sum')).' €</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>';
|
||||
'<span class="small no-line-break">E: '.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;
|
||||
|
|
@ -321,7 +354,32 @@ class BusinessController extends Controller
|
|||
->addColumn('payment_account_date', function (User $user) {
|
||||
return $user->payment_account ? $user->getPaymentAccountDateFormat(false) : "-";
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
|
||||
->filterColumn('m_account', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("m_account LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('first_name', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("first_name LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('last_name', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("last_name LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('email', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("email LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->orderColumn('id', 'm_account $1')
|
||||
->orderColumn('m_account', 'm_account $1')
|
||||
->orderColumn('first_name', 'first_name $1')
|
||||
->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'])
|
||||
->make(true);
|
||||
|
|
|
|||
|
|
@ -13,14 +13,9 @@ use App\Services\BusinessPlan\SalesPointsVolume;
|
|||
class BusinessPointsController extends Controller
|
||||
{
|
||||
|
||||
private $startYear;
|
||||
private $endYear;
|
||||
private $rangeYears;
|
||||
private $activeYear;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
|
|
@ -68,34 +63,6 @@ class BusinessPointsController extends Controller
|
|||
dd($data);
|
||||
|
||||
return redirect(route('admin_business_points'));
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
/*
|
||||
$add_credit_error = false;
|
||||
if(!isset($data['member_id']) || !$user = User::find($data['member_id'])){
|
||||
$add_credit_error = 'Vertriebspartner nicht gefunden';
|
||||
}
|
||||
if(!isset($data['credit'])){
|
||||
$add_credit_error = 'Bitte Betrag eingeben';
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
// $credit = Util::reFormatNumber($data['credit']);
|
||||
//$credit = number_format($credit, 2, '.', '');
|
||||
|
||||
//Payment::addUserCreditMargin($user, $credit, 3, $data['message']);
|
||||
\Session()->flash('alert-success', "Guthaben hinzugefügt");
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -107,9 +74,9 @@ class BusinessPointsController extends Controller
|
|||
if(!session('points_filter_year')){
|
||||
session(['points_filter_year' => intval(date('Y'))]);
|
||||
}
|
||||
if(Request::get('points_filter_member_id')){
|
||||
session(['points_filter_member_id' => Request::get('points_filter_member_id')]);
|
||||
}
|
||||
|
||||
session(['points_filter_member_id' => Request::get('points_filter_member_id')]);
|
||||
|
||||
if(Request::get('points_filter_month')){
|
||||
session(['points_filter_month' => Request::get('points_filter_month')]);
|
||||
}
|
||||
|
|
@ -122,19 +89,15 @@ class BusinessPointsController extends Controller
|
|||
{
|
||||
$this->setFilterVars();
|
||||
|
||||
$query = UserSalesVolume::with('user', 'user.account')->with('shopping_order')->select('user_sales_volumes.*')
|
||||
//$query = UserSalesVolume::with('user', 'user.account')->with('shopping_order')->select('user_sales_volumes.*')
|
||||
$query = UserSalesVolume::join('users', 'user_id', '=', 'users.id')->join('user_accounts', 'account_id', '=', 'user_accounts.id')
|
||||
->select('user_sales_volumes.*', 'users.email', 'user_accounts.m_account', 'user_accounts.first_name', 'user_accounts.last_name')
|
||||
->where('user_sales_volumes.month', '=', Request::get('points_filter_month'))
|
||||
->where('user_sales_volumes.year', '=', Request::get('points_filter_year'));
|
||||
|
||||
if(Request::get('points_filter_member_id')){
|
||||
$query->where('user_sales_volumes.user_id', '=', Request::get('points_filter_member_id'));
|
||||
}
|
||||
|
||||
//->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;
|
||||
}
|
||||
|
||||
|
|
@ -165,28 +128,48 @@ class BusinessPointsController extends Controller
|
|||
->addColumn('total_net', function (UserSalesVolume $UserSalesVolume) {
|
||||
return formatNumber($UserSalesVolume->total_net).' €';
|
||||
})
|
||||
->addColumn('first_name', function (UserSalesVolume $UserSalesVolume) {
|
||||
return isset($UserSalesVolume->user) ? $UserSalesVolume->user->account->first_name : '';
|
||||
})
|
||||
->addColumn('last_name', function (UserSalesVolume $UserSalesVolume) {
|
||||
return isset($UserSalesVolume->user) ? $UserSalesVolume->user->account->last_name : '';
|
||||
})
|
||||
->addColumn('email', function (UserSalesVolume $UserSalesVolume) {
|
||||
return isset($UserSalesVolume->user) ? $UserSalesVolume->user->email : '';
|
||||
})
|
||||
->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>';
|
||||
})
|
||||
|
||||
->addColumn('info', function (UserSalesVolume $UserSalesVolume) {
|
||||
return '<span class="no-line-break">'.$UserSalesVolume->info.'</span>';
|
||||
})
|
||||
|
||||
->filterColumn('m_account', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("m_account LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('first_name', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("first_name LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('last_name', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("last_name LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('email', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->whereRaw("email LIKE ?", '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('order', 'order $1')
|
||||
->orderColumn('status', 'status $1')
|
||||
->orderColumn('message', 'message $1')
|
||||
|
||||
->rawColumns(['id', 'order', 'status', 'message', 'total_net'])
|
||||
->orderColumn('info', 'info $1')
|
||||
->orderColumn('total_net', 'total_net $1')
|
||||
->orderColumn('email', 'email $1')
|
||||
->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'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ class CronController extends Controller
|
|||
|
||||
public function action($action = false, $key = false){
|
||||
|
||||
if($key !== 'key'){
|
||||
if($key !== 'CqZHL79FwUCcy9pjvi'){
|
||||
abort(404);
|
||||
}
|
||||
if($action === 'check_payments_account'){
|
||||
|
|
@ -269,4 +269,15 @@ class CronController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function runCron($key)
|
||||
{
|
||||
if($key !== 'G8ZvEbnP8fEPfnWX4L'){
|
||||
abort(404);
|
||||
}
|
||||
exec("/bin/bash ../cron_script.sh 2>&1", $out, $result);
|
||||
echo "Returncode: " .$result ."<br>";
|
||||
echo "Ausgabe des Scripts: " ."<br>";
|
||||
echo "<pre>"; print_r($out);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -113,12 +113,15 @@ class CustomerController extends Controller
|
|||
}
|
||||
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
$data['has_buyed'] = true;
|
||||
$data['subscribed'] = true;
|
||||
if($shopping_user->auth_user_id > 0){
|
||||
$data['has_buyed'] = isset($data['has_buyed']) ? true : false;
|
||||
$data['subscribed'] = isset($data['subscribed']) ? true : false;
|
||||
//subscribed can only true when has_buyed ist active
|
||||
$data['subscribed'] = $data['has_buyed'] ? $data['subscribed'] : false;
|
||||
|
||||
/* if($shopping_user->auth_user_id > 0){
|
||||
$data['has_buyed'] = true;
|
||||
$data['subscribed'] = false;
|
||||
}
|
||||
}*/
|
||||
$data['same_as_billing'] = isset($data['same_as_billing']) ? true : false;
|
||||
$data['shipping_country_id'] = isset($data['shipping_country_id']) ? $data['shipping_country_id'] : $data['billing_country_id'];
|
||||
CustomerPriority::checkChangeOne($shopping_user, $data, true);
|
||||
|
|
@ -174,7 +177,7 @@ class CustomerController extends Controller
|
|||
data-modal="modal-xl"
|
||||
data-route="'.route('modal_load').'"><span class="fa fa-edit"></span> Berater zuordnen</button>';
|
||||
}
|
||||
if($ShoppingUser->member_id){
|
||||
if($ShoppingUser->member){
|
||||
return '<a href="'.route('admin_lead_edit', [$ShoppingUser->member_id]).'">'.$ShoppingUser->member->getFullName().'</a>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ class SalesController extends Controller
|
|||
})
|
||||
->addColumn('member_id', function (ShoppingOrder $ShoppingOrder) {
|
||||
if($ShoppingOrder->member_id) {
|
||||
return $ShoppingOrder->member_id ? '<a href="' . route('admin_lead_edit', [$ShoppingOrder->member_id]) . '">' . $ShoppingOrder->member->getFullName() . '</a>' : '';
|
||||
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){
|
||||
return '<button type="button" class="btn btn-xs btn-outline-info" data-toggle="modal" data-target="#modals-load-content"
|
||||
|
|
@ -291,11 +291,9 @@ class SalesController extends Controller
|
|||
}
|
||||
return '';
|
||||
})
|
||||
|
||||
->addColumn('user_shop_id', function (ShoppingOrder $ShoppingOrder) {
|
||||
return $ShoppingOrder->user_shop ? '<a href="'.$ShoppingOrder->user_shop->getSubdomain(false).'" target="_blank">'.$ShoppingOrder->user_shop->getSubdomain(false).'</span>' : '';
|
||||
})
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('txaction', 'txaction $1')
|
||||
->orderColumn('user_shop_id', 'user_shop_id $1')
|
||||
|
|
@ -372,9 +370,6 @@ class SalesController extends Controller
|
|||
return redirect(route('admin_sales_customers_detail', [$shopping_order->id]));
|
||||
}
|
||||
return redirect(route('admin_sales_users_detail', [$shopping_order->id]));
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use App\Services\SyS\DomainSSL;
|
|||
use App\Services\SyS\Correction;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\SyS\ShoppingOrders;
|
||||
use App\Services\SyS\BuyingsProducts;
|
||||
use App\Services\SyS\BusinessStructur;
|
||||
|
||||
class SysController extends Controller
|
||||
|
|
@ -33,6 +34,10 @@ class SysController extends Controller
|
|||
{
|
||||
switch ($serve) {
|
||||
|
||||
|
||||
case 'buyings_products':
|
||||
return BuyingsProducts::show();
|
||||
break;
|
||||
case 'business_structur':
|
||||
return BusinessStructur::show();
|
||||
break;
|
||||
|
|
@ -61,11 +66,12 @@ class SysController extends Controller
|
|||
abort(403, 'not found tool');
|
||||
}
|
||||
|
||||
|
||||
public function store($serve)
|
||||
{
|
||||
switch ($serve) {
|
||||
|
||||
case 'buyings_products':
|
||||
return BuyingsProducts::store();
|
||||
break;
|
||||
case 'business_structur':
|
||||
return BusinessStructur::show();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -105,30 +105,41 @@ class CustomerController extends Controller
|
|||
return view('user.customer.add', $data);
|
||||
}
|
||||
|
||||
private function checkShoppingUsersEmail($data){
|
||||
private function checkShoppingUsersEmail($email = 'email', $action = 'return', $id=null){
|
||||
|
||||
$rules = array(
|
||||
'email' => 'required|string|email|max:255|unique:shopping_users,billing_email',
|
||||
$email => 'required|string|email|max:255|unique:shopping_users,billing_email',
|
||||
);
|
||||
$messages = [
|
||||
'unique' => __('validation.custom.unique_email_client'),
|
||||
];
|
||||
$validator = Validator::make(Request::all(), $rules, $messages);
|
||||
if ($validator->fails()) {
|
||||
\Session()->flash('alert-error', __('validation.custom.unique_email_client'));
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
$rules = array(
|
||||
'email' => 'required|string|email|max:255|unique:users,email',
|
||||
$email => 'required|string|email|max:255|unique:users,email',
|
||||
);
|
||||
$messages = [
|
||||
'unique' => __('validation.custom.unique_email_member'),
|
||||
];
|
||||
$validator = Validator::make(Request::all(), $rules, $messages);
|
||||
if ($validator->fails()) {
|
||||
\Session()->flash('alert-error', __('validation.custom.unique_email_member'));
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
if($action === 'return'){
|
||||
return back()->withInput(Request::all());
|
||||
}
|
||||
|
||||
return back()->withInput(Request::all());
|
||||
if($action === 'save'){
|
||||
$shopping_user = ShoppingUser::findOrFail($id);
|
||||
$shopping_user->faker_mail = false;
|
||||
$shopping_user->billing_email = Request::get($email);
|
||||
$shopping_user->save();
|
||||
return redirect(route('user_customer_detail', [$shopping_user->id]));
|
||||
}
|
||||
}
|
||||
|
||||
public function store($id)
|
||||
|
|
@ -136,12 +147,20 @@ class CustomerController extends Controller
|
|||
$data = Request::all();
|
||||
|
||||
if($id === 'new' && $data['action'] === 'add_customer_with_email'){
|
||||
return $this->checkShoppingUsersEmail($data);
|
||||
return $this->checkShoppingUsersEmail('email', 'return');
|
||||
}
|
||||
if($id === 'new' && $data['action'] === 'add_customer_without_email'){
|
||||
return back()->withInput(Request::all());
|
||||
}
|
||||
|
||||
if($id === 'new' && $data['action'] === ''){
|
||||
return back()->withInput(Request::all());
|
||||
}
|
||||
|
||||
if($id !== 'new' && $data['action'] === 'add-mail-shopping-user-store'){
|
||||
return $this->checkShoppingUsersEmail('new_email_address', 'save', $id);
|
||||
}
|
||||
|
||||
if($data['action'] === 'shopping-user-store-new' || $data['action']==='shopping-user-store'){
|
||||
$rules = array(
|
||||
'billing_salutation' => 'required',
|
||||
|
|
|
|||
|
|
@ -288,7 +288,15 @@ class OrderController extends Controller
|
|||
public function datatable(){
|
||||
|
||||
if(Request::get('shipping_is_for') === 'me'){
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '2');
|
||||
// $query = Product::with('product_buyings')->select('products.*')->where('active', true)->whereJsonContains('show_on', '2');
|
||||
|
||||
|
||||
$query = Product::with('product_buyings')
|
||||
->select('products.*')->where('products.active', true)
|
||||
->whereJsonContains('products.show_on', '2')
|
||||
->whereDoesntHave('product_buyings', function ($q){
|
||||
$q->where('product_buyings.user_id', '=', \Auth::user()->id);
|
||||
});
|
||||
}else{
|
||||
$query = Product::select('products.*')->where('active', true)->whereJsonContains('show_on', '3');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class TeamController extends Controller
|
|||
//$TreeCalcBot->initUser(56);
|
||||
$data = [
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_years' => HTMLHelper::getYearRange(date('Y')),
|
||||
'filter_years' => HTMLHelper::getYearRange(2022),
|
||||
'TreeCalcBot' => $TreeCalcBot,
|
||||
];
|
||||
return view('user.team.structure', $data);
|
||||
|
|
@ -58,7 +58,7 @@ class TeamController extends Controller
|
|||
$data = [
|
||||
'userSalesVolume' => $userSalesVolume,
|
||||
'filter_months' => HTMLHelper::$months,
|
||||
'filter_years' => HTMLHelper::getYearRange(date('Y')),
|
||||
'filter_years' => HTMLHelper::getYearRange(2022),
|
||||
];
|
||||
return view('user.team.points', $data);
|
||||
}
|
||||
|
|
@ -83,8 +83,8 @@ class TeamController extends Controller
|
|||
if(Request::get('team_user_filter_month')){
|
||||
session(['team_user_filter_month' => Request::get('team_user_filter_month')]);
|
||||
}
|
||||
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_filter_year')){
|
||||
session(['team_user_filter_year' => Request::get('team_user_filter_year')]);
|
||||
}
|
||||
|
||||
if(Request::get('team_user_points_filter_month')){
|
||||
|
|
@ -135,13 +135,17 @@ class TeamController extends Controller
|
|||
->addColumn('message', function (UserSalesVolume $UserSalesVolume) {
|
||||
return '<span class="no-line-break">'.$UserSalesVolume->message.'</span>';
|
||||
})
|
||||
->addColumn('info', function (UserSalesVolume $UserSalesVolume) {
|
||||
return '<span class="no-line-break">'.$UserSalesVolume->info.'</span>';
|
||||
})
|
||||
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('order', 'order $1')
|
||||
->orderColumn('status', 'status $1')
|
||||
->orderColumn('message', 'message $1')
|
||||
->orderColumn('info', 'info $1')
|
||||
|
||||
->rawColumns(['id', 'order', 'status', 'message', 'total_net'])
|
||||
->rawColumns(['id', 'order', 'status', 'message', 'info', 'total_net'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class CardController extends Controller
|
|||
if($product->images->count()){
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping]);
|
||||
if(Yard::instance('shopping')->getUserTaxFree()){
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
}else{
|
||||
|
|
@ -59,7 +59,7 @@ class CardController extends Controller
|
|||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$quantity = Request::get('quantity') ? Request::get('quantity') : 1;
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission]);
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), $quantity, $product->getPriceWith(Yard::instance('shopping')->getUserTaxFree(), false, Yard::instance('shopping')->getUserCountry()), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping]);
|
||||
if(Yard::instance('shopping')->getUserTaxFree()){
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
}else{
|
||||
|
|
|
|||
|
|
@ -289,7 +289,6 @@ class CheckoutController extends Controller
|
|||
|
||||
//check credit Card
|
||||
if(Request::get('payment_method')){
|
||||
|
||||
$ret = [];
|
||||
//Rechnungskauf ohne PAYONE
|
||||
if(Request::get('payment_method') === 'fnc#MIV'){
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ class HomepartyController extends Controller
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public function detail($token = null, $gid = null)
|
||||
{
|
||||
if(!$token){
|
||||
|
|
@ -60,7 +59,6 @@ class HomepartyController extends Controller
|
|||
'homeparty_host' => $homeparty->homeparty_host,
|
||||
'mivita_member' => $homeparty->auth_user
|
||||
];
|
||||
|
||||
return view('user.homeparty.self_guest_detail', $data);
|
||||
}
|
||||
|
||||
|
|
@ -75,8 +73,6 @@ class HomepartyController extends Controller
|
|||
abort(403, 'Link für die Homeparty wurde nicht gefunden, oder ist nicht mehr aktiv.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
$rules = array(
|
||||
'billing_salutation' => 'required',
|
||||
'billing_firstname' => 'required',
|
||||
|
|
@ -88,6 +84,7 @@ class HomepartyController extends Controller
|
|||
'checkbox_datenverarbeitung' => 'required',
|
||||
'checkbox_daten_completely' => 'required'
|
||||
);
|
||||
|
||||
if (!Request::get('same_as_billing')) {
|
||||
$rules = array_merge($rules, [
|
||||
'shipping_firstname' => 'required',
|
||||
|
|
@ -99,10 +96,12 @@ class HomepartyController extends Controller
|
|||
'shipping_country_id' => 'required'
|
||||
]);
|
||||
}
|
||||
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator)->withInput(Request::all());
|
||||
}
|
||||
|
||||
if($gid === null){
|
||||
$homeparty_user = HomepartyUser::create([
|
||||
'homeparty_id' => $homeparty->id,
|
||||
|
|
|
|||
41
app/Mail/MailUserLevelUpdate.php
Normal file
41
app/Mail/MailUserLevelUpdate.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?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 MailUserLevelUpdate extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
protected $team_points;
|
||||
protected $update_to;
|
||||
public $subject;
|
||||
|
||||
public function __construct($team_points, $update_to)
|
||||
{
|
||||
$this->team_points = $team_points;
|
||||
$this->update_to = $update_to;
|
||||
|
||||
$this->subject = 'Deine Karriere-Level auf mivita.care';
|
||||
}
|
||||
|
||||
public function build()
|
||||
{
|
||||
$title = __('email.update_level_title');
|
||||
$copy1line = __('email.update_level_copy1line', ['tp'=>$this->team_points, 'to'=>$this->update_to]);
|
||||
|
||||
return $this->view('emails.blank')->with([
|
||||
'title' => $title,
|
||||
'copy1line' => $copy1line,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -117,6 +117,12 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|Product withUniqueSlugConstraints(\Illuminate\Database\Eloquent\Model $model, string $attribute, array $config, string $slug)
|
||||
* @property string|null $ean
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereEan($value)
|
||||
* @property bool|null $no_free_shipping
|
||||
* @property bool|null $buying_restriction
|
||||
* @property int|null $buying_restriction_amount
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereBuyingRestriction($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereBuyingRestrictionAmount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Product whereNoFreeShipping($value)
|
||||
*/
|
||||
class Product extends Model
|
||||
{
|
||||
|
|
@ -143,6 +149,9 @@ class Product extends Model
|
|||
'shipping_addon' => 'bool',
|
||||
'active' => 'bool',
|
||||
'no_commission' => 'bool',
|
||||
'no_free_shipping' => 'bool',
|
||||
'buying_restriction' => 'bool',
|
||||
'buying_restriction_amount' => 'int',
|
||||
];
|
||||
use Sluggable;
|
||||
|
||||
|
|
@ -161,6 +170,7 @@ class Product extends Model
|
|||
'points',
|
||||
'weight',
|
||||
'no_commission',
|
||||
'no_free_shipping',
|
||||
'contents',
|
||||
'contents_total',
|
||||
'unit',
|
||||
|
|
@ -177,6 +187,8 @@ class Product extends Model
|
|||
'show_at',
|
||||
'show_on',
|
||||
'shipping_addon',
|
||||
'buying_restriction',
|
||||
'buying_restriction_amount',
|
||||
'identifier',
|
||||
'action',
|
||||
'upgrade_to_id'
|
||||
|
|
@ -245,6 +257,10 @@ class Product extends Model
|
|||
];
|
||||
}
|
||||
|
||||
public function product_buyings(){
|
||||
return $this->hasMany('App\Models\ProductBuying', 'product_id', 'id');
|
||||
}
|
||||
|
||||
public function attributes(){
|
||||
return $this->hasMany('App\Models\ProductAttribute', 'product_id', 'id');
|
||||
}
|
||||
|
|
|
|||
68
app/Models/ProductBuying.php
Normal file
68
app/Models/ProductBuying.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class ProductBuying
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $product_id
|
||||
* @property int $amount
|
||||
* @property string|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Product $product
|
||||
* @property User $user
|
||||
* @package App\Models
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductBuying newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductBuying newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|ProductBuying onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductBuying query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductBuying whereAmount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductBuying whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductBuying whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductBuying whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductBuying whereProductId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductBuying whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ProductBuying whereUserId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|ProductBuying withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|ProductBuying withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ProductBuying extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $table = 'product_buyings';
|
||||
|
||||
protected $casts = [
|
||||
'user_id' => 'int',
|
||||
'product_id' => 'int',
|
||||
'amount' => 'int'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'product_id',
|
||||
'amount'
|
||||
];
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
|
|
@ -114,7 +114,7 @@ class ShoppingCollectOrder extends Model
|
|||
public function addTaxToSplit($tax_rate, $add_tax)
|
||||
{
|
||||
$tax_split = $this->tax_split;
|
||||
$tax_split[$tax_rate] = isset($tax_split[$tax_rate]) ? round($tax_split[$tax_rate] += $add_tax, 2) : $add_tax;
|
||||
$tax_split[$tax_rate] = isset($tax_split[$tax_rate]) ? round($tax_split[$tax_rate] += $add_tax, 2) : round($add_tax, 2);
|
||||
$this->tax_split = $tax_split;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShoppingUser whereShoppingUserId($value)
|
||||
* @property int|null $homeparty_id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUser whereHomepartyId($value)
|
||||
* @property int|null $shopping_collect_order_id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingUser whereShoppingCollectOrderId($value)
|
||||
*/
|
||||
class ShoppingUser extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -125,6 +125,12 @@ use Carbon\Carbon;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereReverseCharge($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereReverseChargeCode($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereReverseChargeValid($value)
|
||||
* @property string|null $bank_owner
|
||||
* @property string|null $bank_iban
|
||||
* @property string|null $bank_bic
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereBankBic($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereBankIban($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserAccount whereBankOwner($value)
|
||||
*/
|
||||
class UserAccount extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,10 +6,96 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
|
||||
|
||||
/**
|
||||
* App\Models\UserBusiness
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $month
|
||||
* @property int $year
|
||||
* @property int|null $b_structure_id
|
||||
* @property int|null $m_level_id
|
||||
* @property int|null $m_sponsor_id
|
||||
* @property object|null $sponsor
|
||||
* @property string|null $m_sponsor_name
|
||||
* @property string|null $user_level_name
|
||||
* @property bool $active_account
|
||||
* @property \Illuminate\Support\Carbon|null $payment_account_date
|
||||
* @property \Illuminate\Support\Carbon|null $active_date
|
||||
* @property int|null $m_account
|
||||
* @property string|null $email
|
||||
* @property string|null $first_name
|
||||
* @property string|null $last_name
|
||||
* @property int|null $sales_volume_points
|
||||
* @property int|null $sales_volume_points_shop
|
||||
* @property int|null $sales_volume_points_sum
|
||||
* @property float|null $sales_volume_total
|
||||
* @property float|null $sales_volume_total_shop
|
||||
* @property float|null $sales_volume_total_sum
|
||||
* @property int|null $margin
|
||||
* @property int|null $margin_shop
|
||||
* @property int|null $qual_kp
|
||||
* @property int|null $qual_tp
|
||||
* @property int|null $total_tp
|
||||
* @property int|null $total_qual_tp
|
||||
* @property string|null $commission_lines_total
|
||||
* @property float|null $commission_shop_sales
|
||||
* @property float|null $commission_team_total
|
||||
* @property mixed|null $business_lines
|
||||
* @property mixed|null $user_items
|
||||
* @property array|null $qual_user_level
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \App\Models\UserBusinessStructure|null $user_business_structure
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereActiveAccount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereActiveDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereBStructureId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereBusinessLines($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereCommissionLinesTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereCommissionShopSales($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereCommissionTeamTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereEmail($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereFirstName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereLastName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereMAccount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereMLevelId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereMSponsorId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereMSponsorName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereMargin($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereMarginShop($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereMonth($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness wherePaymentAccountDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereQualKp($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereQualTp($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereQualUserLevel($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereSalesVolumePoints($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereSalesVolumePointsShop($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereSalesVolumePointsSum($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereSalesVolumeTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereSalesVolumeTotalShop($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereSalesVolumeTotalSum($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereSponsor($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereTotalQualTp($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereTotalTp($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereUserItems($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereUserLevelName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereYear($value)
|
||||
* @mixin \Eloquent
|
||||
* @property array|null $next_qual_user_level
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserBusiness whereNextQualUserLevel($value)
|
||||
*/
|
||||
class UserBusiness extends Model
|
||||
{
|
||||
protected $table = 'user_businesses';
|
||||
|
|
@ -28,8 +114,8 @@ class UserBusiness extends Model
|
|||
'sales_volume_total' => 'float',
|
||||
'sales_volume_total_shop' => 'float',
|
||||
'sales_volume_total_sum' => 'float',
|
||||
'margin' => 'int',
|
||||
'margin_shop' => 'int',
|
||||
'margin' => 'float',
|
||||
'margin_shop' => 'float',
|
||||
'qual_kp' => 'int',
|
||||
'qual_tp' => 'int',
|
||||
'total_tp' => 'int',
|
||||
|
|
@ -37,6 +123,7 @@ class UserBusiness extends Model
|
|||
'commission_team_total' => 'float',
|
||||
'commission_shop_sales' => 'float',
|
||||
'qual_user_level' => 'array',
|
||||
'next_qual_user_level' => 'array',
|
||||
'sponsor' => 'object',
|
||||
'business_lines' => AsArrayObject::class,
|
||||
'user_items' => AsArrayObject::class
|
||||
|
|
@ -73,6 +160,7 @@ class UserBusiness extends Model
|
|||
'qual_kp',
|
||||
'qual_tp',
|
||||
'qual_user_level',
|
||||
'next_qual_user_level',
|
||||
'total_tp',
|
||||
'total_qual_tp',
|
||||
'commission_team_total',
|
||||
|
|
@ -81,6 +169,11 @@ class UserBusiness extends Model
|
|||
'user_items',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function user_business_structure()
|
||||
{
|
||||
return $this->belongsTo(UserBusinessStructure::class, 'b_structure_id');
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
|
||||
/**
|
||||
* Class UserCredit
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int|null $month
|
||||
|
|
@ -39,11 +39,43 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @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
|
||||
* @property bool $taxable
|
||||
* @property-read int|null $user_credit_items_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|UserCredit onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereCancellation($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereCancellationDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereCancellationId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereDir($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereDisk($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereFilename($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereFullNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereInfos($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereMonth($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereNet($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit wherePaidOut($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit wherePaidOutDate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereTax($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereTaxRate($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereTaxable($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereTotal($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCredit whereYear($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|UserCredit withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|UserCredit withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserCredit extends Model
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
|
||||
/**
|
||||
* Class UserCreditItem
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int|null $user_credit_id
|
||||
|
|
@ -22,11 +22,24 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property bool $paid
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @property UserCredit|null $user_credit
|
||||
* @property User $user
|
||||
*
|
||||
* @package App\Models
|
||||
* @property int|null $user_business_id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereCredit($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereMessage($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem wherePaid($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUserBusinessId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUserCreditId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserCreditItem whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserCreditItem extends Model
|
||||
{
|
||||
|
|
@ -54,6 +67,7 @@ class UserCreditItem extends Model
|
|||
protected $casts = [
|
||||
'user_id' => 'int',
|
||||
'user_credit_id' => 'int',
|
||||
'user_business_id' => 'int',
|
||||
'credit' => 'float',
|
||||
'status' => 'int',
|
||||
'paid' => 'bool'
|
||||
|
|
@ -62,6 +76,7 @@ class UserCreditItem extends Model
|
|||
protected $fillable = [
|
||||
'user_id',
|
||||
'user_credit_id',
|
||||
'user_business_id',
|
||||
'credit',
|
||||
'message',
|
||||
'status',
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ use App\User;
|
|||
* @property float|null $total_net
|
||||
* @property float|null $month_total_net
|
||||
* @property string|null $message
|
||||
* @property string|null $info
|
||||
* @property int $status
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
|
|
@ -58,6 +59,7 @@ use App\User;
|
|||
* @mixin \Eloquent
|
||||
* @property array|null $syslog
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereSyslog($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSalesVolume whereInfo($value)
|
||||
*/
|
||||
class UserSalesVolume extends Model
|
||||
{
|
||||
|
|
@ -97,6 +99,7 @@ class UserSalesVolume extends Model
|
|||
'month_total_net',
|
||||
'month_shop_total_net',
|
||||
'message',
|
||||
'info',
|
||||
'status',
|
||||
'syslog'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ 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;
|
||||
|
||||
|
|
@ -30,6 +28,9 @@ class CreditRepository extends BaseRepository {
|
|||
|
||||
$this->user_credit = new UserCredit();
|
||||
$user_credit_items = $this->makeUserCredit();
|
||||
if(!count($user_credit_items)){
|
||||
return false;
|
||||
}
|
||||
$data = [
|
||||
'user' => $this->model,
|
||||
'credit_date' => $credit_date,
|
||||
|
|
@ -45,17 +46,17 @@ class CreditRepository extends BaseRepository {
|
|||
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');
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ class ProductRepository extends BaseRepository {
|
|||
$data['active'] = isset($data['active']) ? 1 : 0;
|
||||
$data['shipping_addon'] = isset($data['shipping_addon']) ? 1 : 0;
|
||||
$data['no_commission'] = isset($data['no_commission']) ? 1 : 0;
|
||||
$data['no_free_shipping'] = isset($data['no_free_shipping']) ? 1 : 0;
|
||||
$data['buying_restriction'] = isset($data['buying_restriction']) ? 1 : 0;
|
||||
$data['show_on'] = isset($data['show_on']) ? $data['show_on'] : null;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -109,6 +109,10 @@ class BusinessUserItem
|
|||
$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();
|
||||
$nextQualUserLevel = UserLevel::where('qual_tp', '<=', $this->total_qual_tp)->where('pos', '>', $this->user_level_active_pos)->orderBy('qual_tp', 'desc')->first();
|
||||
if($nextQualUserLevel){
|
||||
$this->b_user->next_qual_user_level = $nextQualUserLevel->toArray();
|
||||
}
|
||||
if($qualUserLevel){
|
||||
$this->b_user->qual_user_level = $qualUserLevel->toArray();
|
||||
foreach($this->business_lines as $line => $object){
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ class SalesPointsVolume
|
|||
$user_sales_volume->points = intval($data['points']);
|
||||
|
||||
$user_sales_volume->message = 'geändert: '.date('d.m.Y');
|
||||
$user_sales_volume->info = $data['info'];
|
||||
|
||||
$syslog = $user_sales_volume->syslog;
|
||||
$syslog[date('d.m.Y-h:i:s')] = 'edit points: #'.$old_points.' '.$user_sales_volume->points .' total: #'.$old_total_net.' '.$user_sales_volume->total_ne;
|
||||
|
|
@ -221,6 +222,7 @@ class SalesPointsVolume
|
|||
'points' => $points,
|
||||
'total_net' => $total_net,
|
||||
'message' => 'hinzugefügt: '.date('d.m.Y'),
|
||||
'info' => $data['info'],
|
||||
'syslog' => $syslog,
|
||||
'status' => 4,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -280,8 +280,8 @@ class TreeCalcBot
|
|||
<strong>'.$item->first_name.' '.$item->last_name.'</strong> <a href="mailto: '.$item->email.'">'.$item->email.'</a> <span class="badge badge-outline-default '.($item->active_account ? '' : 'text-muted').'">'.$item->user_level_name.' | '.$item->m_account.'</span>
|
||||
<br><span class="small">'.
|
||||
($item->active_account ?
|
||||
'<strong>Gesamte Points: '.$item->sales_volume_points_sum.'</strong> | B: '.$item->sales_volume_points.' | S: '.$item->sales_volume_points_shop.' <strong>
|
||||
| Umsatz netto: '.formatNumber($item->sales_volume_total_sum).' €</strong> | B: '.formatNumber($item->sales_volume_total).' € | S: '.formatNumber($item->sales_volume_total_shop).' €'.
|
||||
'<strong>Gesamte Points: '.$item->sales_volume_points_sum.'</strong> | E: '.$item->sales_volume_points.' | S: '.$item->sales_volume_points_shop.' <strong>
|
||||
| Umsatz netto: '.formatNumber($item->sales_volume_total_sum).' €</strong> | E: '.formatNumber($item->sales_volume_total).' € | S: '.formatNumber($item->sales_volume_total_shop).' €'.
|
||||
$button
|
||||
:
|
||||
'Account bis: '.$item->payment_account_date).
|
||||
|
|
@ -324,8 +324,8 @@ class TreeCalcBot
|
|||
<strong>'.$item->first_name.' '.$item->last_name.'</strong> <a href="mailto: '.$item->email.'">'.$item->email.'</a> <span class="badge badge-outline-default '.($item->active_account ? '' : 'text-muted').'">'.$item->user_level_name.' | '.$item->m_account.'</span>
|
||||
<br><span class="small">'.
|
||||
($item->active_account ?
|
||||
'<strong>Gesamte Points: '.$item->sales_volume_points_sum.'</strong> | B: '.$item->sales_volume_points.' | S: '.$item->sales_volume_points_shop.' <strong>
|
||||
| Umsatz netto: '.formatNumber($item->sales_volume_total_sum).' €</strong> | B: '.formatNumber($item->sales_volume_total).' € | S: '.formatNumber($item->sales_volume_total_shop).' €'.
|
||||
'<strong>Gesamte Points: '.$item->sales_volume_points_sum.'</strong> | E: '.$item->sales_volume_points.' | S: '.$item->sales_volume_points_shop.' <strong>
|
||||
| Umsatz netto: '.formatNumber($item->sales_volume_total_sum).' €</strong> | E: '.formatNumber($item->sales_volume_total).' € | S: '.formatNumber($item->sales_volume_total_shop).' €'.
|
||||
' | <button type="button" class="btn icon-btn btn-xs btn-secondary" data-toggle="modal" data-target="#modals-load-content"
|
||||
data-id="'.$item->user_id.'"
|
||||
data-action="business-user-detail"
|
||||
|
|
@ -356,8 +356,8 @@ class TreeCalcBot
|
|||
if($this->init_from === 'admin'){
|
||||
$ret .= '<br><span class="small">'.
|
||||
($this->sponsor->active_account ?
|
||||
'<strong>Gesamte Points: '.$this->sponsor->sales_volume_points_sum.'</strong> | B: '.$this->sponsor->sales_volume_points.' | S: '.$this->sponsor->sales_volume_points_shop.' <strong>
|
||||
| Umsatz netto: '.formatNumber($this->sponsor->sales_volume_total_sum).' €</strong> | B: '.formatNumber($this->sponsor->sales_volume_total).' € | S: '.formatNumber($this->sponsor->sales_volume_total_shop).' €'
|
||||
'<strong>Gesamte Points: '.$this->sponsor->sales_volume_points_sum.'</strong> | E: '.$this->sponsor->sales_volume_points.' | S: '.$this->sponsor->sales_volume_points_shop.' <strong>
|
||||
| Umsatz netto: '.formatNumber($this->sponsor->sales_volume_total_sum).' €</strong> | E: '.formatNumber($this->sponsor->sales_volume_total).' € | S: '.formatNumber($this->sponsor->sales_volume_total_shop).' €'
|
||||
:
|
||||
'Account bis: '.$this->sponsor->payment_account_date).
|
||||
'</span>';
|
||||
|
|
|
|||
|
|
@ -31,20 +31,24 @@ class CustomerPriority
|
|||
}
|
||||
|
||||
public static function checkOne($shopping_user, $mail=false, $newCustomer = true, $entryExistsLike = false){
|
||||
//ist die Mail ein Berater, dann sich selbst zuweisen.
|
||||
if(self::entryIsMember($shopping_user)){
|
||||
return 'self';
|
||||
}
|
||||
//look for entry
|
||||
if($entryExistsLike){
|
||||
if(self::entryExistsLike($shopping_user)){
|
||||
if(self::entryExistsLike($shopping_user)){ //existiert die Email bei einem anderem member?
|
||||
if($mail){ //send mail
|
||||
Mail::to(config('app.info_mail'))->send(new MailInfo($shopping_user, 'check_is_like_customer'));
|
||||
}
|
||||
return 'exists';
|
||||
}
|
||||
}else{
|
||||
if(self::entryExists($shopping_user)){
|
||||
if(self::entryExists($shopping_user)){ //Berater zuweisen, wenn die Mail existiert
|
||||
return 'exists';
|
||||
}
|
||||
}
|
||||
if(self::entryLike($shopping_user)){
|
||||
if(self::entryLike($shopping_user)){ //existiert die Adresse bei einem anderem member?
|
||||
if($mail){ //send mail
|
||||
Mail::to(config('app.info_mail'))->send(new MailInfo($shopping_user, 'check_is_like_customer'));
|
||||
}
|
||||
|
|
@ -181,8 +185,9 @@ class CustomerPriority
|
|||
|
||||
}
|
||||
|
||||
public static function checkNewOne($shopping_user, $mail=false){
|
||||
|
||||
|
||||
public static function checkNewOne($shopping_user, $mail=false){
|
||||
if(self::entryLike($shopping_user)){
|
||||
if($mail){ //send mail
|
||||
Mail::to(config('app.info_mail'))->send(new MailInfo($shopping_user, 'check_is_like_customer'));
|
||||
|
|
@ -194,6 +199,19 @@ class CustomerPriority
|
|||
return true;
|
||||
}
|
||||
|
||||
public static function entryIsMember($shopping_user){
|
||||
if($user = User::whereEmail($shopping_user->billing_email)->first()){
|
||||
$member_id = $user->id;
|
||||
$shopping_user->member_id = $member_id;
|
||||
$shopping_user->number = self::nextNumber();
|
||||
$shopping_user->save();
|
||||
$shopping_user->shopping_order->member_id = $member_id;
|
||||
$shopping_user->shopping_order->save();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static function entryExists($shopping_user){
|
||||
//check same email
|
||||
$matches = ShoppingUser::where('auth_user_id', '=', NULL)
|
||||
|
|
@ -218,6 +236,7 @@ class CustomerPriority
|
|||
|
||||
private static function entryExistsLike($shopping_user)
|
||||
{
|
||||
//existiert die Email bei einem anderem member?
|
||||
$matches = ShoppingUser::where('auth_user_id', '=', NULL)
|
||||
->where('number', '!=', NULL) //has number
|
||||
->where('id', '!=', $shopping_user->id)
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ namespace App\Services;
|
|||
|
||||
|
||||
|
||||
use App\Models\Homeparty;
|
||||
use App\Models\Product;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Homeparty;
|
||||
|
||||
class HomepartyCart
|
||||
{
|
||||
|
|
@ -43,7 +43,6 @@ class HomepartyCart
|
|||
|
||||
|
||||
private static $bonus_coupon = 0;
|
||||
private static $bonus_value = 30;
|
||||
|
||||
private static $voucher_price = 0;
|
||||
public static $voucher_name = "";
|
||||
|
|
@ -54,7 +53,10 @@ class HomepartyCart
|
|||
private static $bonus_coupon_fault = 0;
|
||||
private static $bonus_coupon_next_step = 0;
|
||||
private static $bonus_coupon_next_value = 0;
|
||||
private static $bonus_start = 230;
|
||||
private static $bonus_start = 230; //230
|
||||
private static $bonus_value = 30; //30
|
||||
|
||||
|
||||
private static $bonusTable = [
|
||||
295 => 15,
|
||||
350 => 20,
|
||||
|
|
@ -63,8 +65,20 @@ class HomepartyCart
|
|||
670 => 40,
|
||||
780 => 50,
|
||||
];
|
||||
public static function calculateHomeparty(Homeparty $homeparty){
|
||||
|
||||
public static function init(){
|
||||
self::$bonus_value = Setting::getContentBySlug('hp-bonus-value');
|
||||
self::$bonus_start = Setting::getContentBySlug('hp-bonus-start');
|
||||
if($hpBonusSteps = Setting::getContentBySlug('hp-bonus-steps')){
|
||||
self::$bonusTable = [];
|
||||
for ($i=1; $i <= $hpBonusSteps; $i++) {
|
||||
self::$bonusTable[Setting::getContentBySlug('hp-bonus-step-start-'.$i)] = Setting::getContentBySlug('hp-bonus-step-value-'.$i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function calculateHomeparty(Homeparty $homeparty){
|
||||
self::init();
|
||||
self::$homeparty = $homeparty;
|
||||
foreach ($homeparty->homeparty_users as $homeparty_user){
|
||||
if($homeparty_user->is_host){
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class MyPDFMerger
|
|||
|
||||
$fpdi->AddPage($orientation, array($size['width'], $size['height']));
|
||||
if($theme){
|
||||
$fpdi->setSourceFile('pdf/'.$theme.'-'.$first.'.pdf');
|
||||
$fpdi->setSourceFile(__DIR__ . '/../../public/pdf/'.$theme.'-'.$first.'.pdf');
|
||||
if($first == 1){
|
||||
$first = 2;
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ class MyPDFMerger
|
|||
|
||||
$fpdi->AddPage($orientation, array($size['w'], $size['h']));
|
||||
if($theme){
|
||||
$fpdi->setSourceFile('pdf/'.$theme.'-'.$first.'.pdf');
|
||||
$fpdi->setSourceFile(__DIR__ . '/../../public/pdf/'.$theme.'-'.$first.'.pdf');
|
||||
if($first == 1){
|
||||
$first = 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ namespace App\Services;
|
|||
|
||||
|
||||
use App\User;
|
||||
use App\Models\UserLevel;
|
||||
use App\Mail\MailCheckout;
|
||||
use App\Models\ProductBuying;
|
||||
use App\Models\ShoppingOrder;
|
||||
use App\Models\UserCreditItem;
|
||||
use App\Models\ShoppingPayment;
|
||||
|
|
@ -96,6 +98,26 @@ class Payment
|
|||
]);
|
||||
}
|
||||
|
||||
public static function addBuyingRestriction(User $user, $product_id){
|
||||
ProductBuying::create([
|
||||
'user_id' => $user->id,
|
||||
'product_id' => $product_id,
|
||||
'amount' => 1
|
||||
]);
|
||||
}
|
||||
|
||||
public static function updateUserLevel(User $user, $to_level_id){
|
||||
//nur updaten, wenn der user->m_level kleiner ist als $to_level_id
|
||||
if($user->user_level){
|
||||
$ToUserLevel = UserLevel::find($to_level_id);
|
||||
if($user->user_level->pos < $ToUserLevel->pos){
|
||||
$user->m_level = $to_level_id;
|
||||
}
|
||||
}else{
|
||||
$user->m_level = $to_level_id;
|
||||
}
|
||||
$user->save();
|
||||
}
|
||||
/*
|
||||
Wir bei Zahlung aufgerufen.
|
||||
Betätigung durch Payone oder Zahlung auf MIVITA Rechnung
|
||||
|
|
@ -113,9 +135,12 @@ class Payment
|
|||
if($shopping_order->shopping_order_items && $shopping_order->auth_user_id){
|
||||
foreach($shopping_order->shopping_order_items as $shopping_order_item){
|
||||
if($shopping_order_item->product){
|
||||
$user = User::findOrFail($shopping_order->auth_user_id);
|
||||
$user->save();
|
||||
if($shopping_order_item->product->buying_restriction){
|
||||
self::addBuyingRestriction($user, $shopping_order_item->product->id);
|
||||
}
|
||||
if($shopping_order_item->product->action){
|
||||
$user = User::findOrFail($shopping_order->auth_user_id);
|
||||
$user->save();
|
||||
$send_link = true;
|
||||
//new date
|
||||
$date = \Carbon::now()->modify('1 year');
|
||||
|
|
@ -144,7 +169,7 @@ class Payment
|
|||
}
|
||||
if($shopping_order_item->product->getActionName($do) === 'payment_for_lead_upgrade'){
|
||||
if($shopping_order_item->product->upgrade_to_id){
|
||||
$user->m_level = $shopping_order_item->product->upgrade_to_id;
|
||||
self::updateUserLevel($user, $shopping_order_item->product->upgrade_to_id);
|
||||
}
|
||||
}
|
||||
$user->save();
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class Shop
|
|||
public static $user_country;
|
||||
public static $shipping_country;
|
||||
public static $user_tax_free;
|
||||
public static $shipping_free;
|
||||
public static $user_reverse_charge = false;
|
||||
|
||||
public static function userOrders() {
|
||||
|
|
@ -51,7 +52,6 @@ class Shop
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static function getShippingCountryCountryId($shipping_country_id){
|
||||
$shippingCountry = ShippingCountry::find($shipping_country_id);
|
||||
if($shippingCountry && $shippingCountry->country){
|
||||
|
|
@ -111,19 +111,21 @@ class Shop
|
|||
//Lieferadresse im Drittland?
|
||||
self::$user_tax_free = $country->supply_country ? true : false;
|
||||
$ShippingCountry = ShippingCountry::whereCountryId($country->id)->first();
|
||||
self::$shipping_free = $ShippingCountry->shipping->free;
|
||||
self::$shipping_country = $ShippingCountry;
|
||||
self::$user_country = $country;
|
||||
|
||||
Yard::instance('shopping')->setShippingCountryWithPrice($ShippingCountry->id);
|
||||
Yard::instance('shopping')->setUserPriceInfos(Shop::getYardInfo());
|
||||
Yard::instance('shopping')->setUserPriceInfos(Shop::getShopYardInfo());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static function getYardInfo(){
|
||||
public static function getShopYardInfo(){
|
||||
return [
|
||||
'user_tax_free' => self::$user_tax_free,
|
||||
'shipping_free' => self::$shipping_free,
|
||||
'user_reverse_charge' => self::$user_reverse_charge,
|
||||
'user_country_id' => self::$user_country->id,
|
||||
'shipping_country_id' => self::$shipping_country->id,
|
||||
|
|
|
|||
|
|
@ -70,10 +70,10 @@ class ShopApiOrderCart
|
|||
|
||||
$shop_item->tax_rate = $tax_rate;
|
||||
$shop_item->points = $item->points;
|
||||
$shop_item->user_price_net = $user_price_net;
|
||||
$shop_item->user_price_total_net = $user_price_net_qty;
|
||||
$shop_item->user_tax = $user_tax;
|
||||
$shop_item->user_tax_total = $user_tax_qty;
|
||||
$shop_item->user_price_net = round($user_price_net, 2);
|
||||
$shop_item->user_price_total_net = round($user_price_net_qty, 2);
|
||||
$shop_item->user_tax = round($user_tax, 2);
|
||||
$shop_item->user_tax_total = round($user_tax_qty, 2);
|
||||
$shop_item->points_total = ($item->points * $item->qty);
|
||||
}
|
||||
|
||||
|
|
|
|||
80
app/Services/SyS/BuyingsProducts.php
Normal file
80
app/Services/SyS/BuyingsProducts.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
namespace App\Services\SyS;
|
||||
|
||||
use Carbon;
|
||||
use Request;
|
||||
use App\Models\SySetting;
|
||||
use App\Models\ProductBuying;
|
||||
use App\Cron\BusinessUsersStore;
|
||||
use App\Models\ShoppingOrderItem;
|
||||
|
||||
class BuyingsProducts
|
||||
{
|
||||
|
||||
public static function show()
|
||||
{
|
||||
|
||||
$data = [
|
||||
];
|
||||
|
||||
return view('sys.tools.buyings_products', $data);
|
||||
}
|
||||
|
||||
|
||||
public static function store()
|
||||
{
|
||||
|
||||
$ShoppingOrderItems = ShoppingOrderItem::where('product_id', 37)->get();
|
||||
$count = 0;
|
||||
foreach($ShoppingOrderItems as $ShoppingOrderItem){
|
||||
if(!ProductBuying::where('user_id', $ShoppingOrderItem->shopping_order->auth_user_id)->where('product_id', $ShoppingOrderItem->product_id)->count()){
|
||||
ProductBuying::create([
|
||||
'user_id' => $ShoppingOrderItem->shopping_order->auth_user_id,
|
||||
'product_id' => 37,
|
||||
'amount' => 1
|
||||
]);
|
||||
$count ++;
|
||||
}
|
||||
|
||||
}
|
||||
dump("ADD ".$count." product_id 37");
|
||||
|
||||
$ShoppingOrderItems = ShoppingOrderItem::where('product_id', 100)->get();
|
||||
$count = 0;
|
||||
foreach($ShoppingOrderItems as $ShoppingOrderItem){
|
||||
if(!ProductBuying::where('user_id', $ShoppingOrderItem->shopping_order->auth_user_id)->where('product_id', $ShoppingOrderItem->product_id)->count()){
|
||||
ProductBuying::create([
|
||||
'user_id' => $ShoppingOrderItem->shopping_order->auth_user_id,
|
||||
'product_id' => 118,
|
||||
'amount' => 1
|
||||
]);
|
||||
$count ++;
|
||||
}
|
||||
|
||||
}
|
||||
dump("ADD ".$count." product_id 100 to 118");
|
||||
|
||||
|
||||
$ShoppingOrderItems = ShoppingOrderItem::where('product_id', 118)->get();
|
||||
$count = 0;
|
||||
foreach($ShoppingOrderItems as $ShoppingOrderItem){
|
||||
if(!ProductBuying::where('user_id', $ShoppingOrderItem->shopping_order->auth_user_id)->where('product_id', $ShoppingOrderItem->product_id)->count()){
|
||||
ProductBuying::create([
|
||||
'user_id' => $ShoppingOrderItem->shopping_order->auth_user_id,
|
||||
'product_id' => 118,
|
||||
'amount' => 1
|
||||
]);
|
||||
$count ++;
|
||||
}
|
||||
|
||||
}
|
||||
dump("ADD ".$count." product_id 118");
|
||||
|
||||
|
||||
die();
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('sysadmin_tool', ['buyings_products']));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -97,6 +97,20 @@ class DomainSSL
|
|||
|
||||
}
|
||||
|
||||
if(isset($data['update_ssl'])){
|
||||
$user_shop = UserShop::findOrFail($data['update_ssl']);
|
||||
$subdomain_name = $user_shop->slug.'.mivita.care';
|
||||
$kas = new KasController();
|
||||
$ssl = KasSLLController::getApiSSLParameter();
|
||||
$pra = array(
|
||||
'hostname' => $subdomain_name
|
||||
);
|
||||
$pra = array_merge($pra, $ssl);
|
||||
$value = $kas->action('update_ssl', $pra);
|
||||
\Session()->flash('alert-success', 'update SSL: '.$value.'');
|
||||
|
||||
}
|
||||
|
||||
|
||||
return back();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ class UserService
|
|||
|
||||
public static function getYardInfo(){
|
||||
return [
|
||||
'shipping_free' => false,
|
||||
'user_tax_free' => self::$user_tax_free,
|
||||
'user_reverse_charge' => self::$user_reverse_charge,
|
||||
'user_country_id' => self::$user_country->id,
|
||||
|
|
|
|||
|
|
@ -65,6 +65,17 @@ class Util
|
|||
}
|
||||
|
||||
|
||||
public static function maxStrLength($str, $length = 40){
|
||||
|
||||
if(strlen($str) > $length){
|
||||
$str = substr($str, 0, $length);
|
||||
//$str = substr($str, 0, strrpos($str, " "));
|
||||
$str = $str." ...";
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
public static function reFormatNumber($value){
|
||||
return (float) str_replace(',', '.', self::_format_number($value));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ class Yard extends Cart
|
|||
private $num_comp;
|
||||
private $ysession;
|
||||
private $user_tax_free;
|
||||
private $shipping_free;
|
||||
private $user_reverse_charge;
|
||||
private $user_country_id;
|
||||
private $user_country;
|
||||
|
|
@ -62,6 +63,9 @@ class Yard extends Cart
|
|||
if($this->getYardExtra('user_tax_free')){
|
||||
$this->user_tax_free = $this->getYardExtra('user_tax_free');
|
||||
}
|
||||
if($this->getYardExtra('shipping_free')){
|
||||
$this->shipping_free = $this->getYardExtra('shipping_free');
|
||||
}
|
||||
if($this->getYardExtra('user_reverse_charge')){
|
||||
$this->user_reverse_charge = $this->getYardExtra('user_reverse_charge');
|
||||
}
|
||||
|
|
@ -159,14 +163,17 @@ class Yard extends Cart
|
|||
|
||||
public function setUserPriceInfos($setUserPriceInfos = [])
|
||||
{
|
||||
$this->shipping_free = isset($setUserPriceInfos['shipping_free']) ? $setUserPriceInfos['shipping_free'] : false;
|
||||
$this->putYardExtra('shipping_free', $this->shipping_free);
|
||||
|
||||
$this->user_tax_free = $setUserPriceInfos['user_tax_free'];
|
||||
$this->putYardExtra('user_tax_free', $setUserPriceInfos['user_tax_free']);
|
||||
$this->putYardExtra('user_tax_free', $this->user_tax_free);
|
||||
|
||||
$this->user_reverse_charge = $setUserPriceInfos['user_reverse_charge'];
|
||||
$this->putYardExtra('user_reverse_charge', $setUserPriceInfos['user_reverse_charge']);
|
||||
$this->putYardExtra('user_reverse_charge', $this->user_reverse_charge);
|
||||
|
||||
$this->user_country_id = $setUserPriceInfos['user_country_id'];
|
||||
$this->putYardExtra('user_country_id', $setUserPriceInfos['user_country_id']);
|
||||
$this->putYardExtra('user_country_id', $this->user_country_id);
|
||||
|
||||
$this->user_country = Country::findOrFail($setUserPriceInfos['user_country_id']);
|
||||
$this->putYardExtra('user_country', $this->user_country);
|
||||
|
|
@ -177,6 +184,7 @@ class Yard extends Cart
|
|||
'user_tax_free' =>$this->user_tax_free,
|
||||
'user_reverse_charge' =>$this->user_reverse_charge,
|
||||
'user_country_id' =>$this->user_country_id,
|
||||
'shipping_free' => $this->shipping_free,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -195,6 +203,11 @@ class Yard extends Cart
|
|||
return $this->user_tax_free ? true : false;
|
||||
}
|
||||
|
||||
public function getShippingFree()
|
||||
{
|
||||
return $this->shipping_free;
|
||||
}
|
||||
|
||||
private function calculateShippingPrice(){
|
||||
|
||||
$shippingCountry = ShippingCountry::find($this->shipping_country_id);
|
||||
|
|
@ -202,19 +215,29 @@ class Yard extends Cart
|
|||
return;
|
||||
}
|
||||
$shipping = $shippingCountry->shipping;
|
||||
$shipping_price = $shipping->shipping_prices->first();
|
||||
if(!$shipping_price){
|
||||
return;
|
||||
}
|
||||
if($this->weight() == 0){
|
||||
$shipping_price = $shipping->shipping_prices->first();
|
||||
if(!$shipping_price){
|
||||
return;
|
||||
}
|
||||
$shipping_price->price = 0;
|
||||
$shipping_price->price_comp = 0;
|
||||
}else{
|
||||
//first by price
|
||||
$shipping_price = $this->shippingPriceByTotal($shipping->shipping_prices, $this->total(2, '.', ''));
|
||||
//sec by weight
|
||||
if(!$shipping_price){
|
||||
if($this->shipping_free && $this->total(2, '.', '') >= $this->shipping_free){
|
||||
if($this->weightByFreeShipping() == 0){
|
||||
$shipping_price->price = 0;
|
||||
$shipping_price->price_comp = 0;
|
||||
}else{
|
||||
$shipping_price = $this->shippingPriceByWeight($shipping->shipping_prices, $this->weightByFreeShipping());
|
||||
}
|
||||
|
||||
}else{
|
||||
$shipping_price = $this->shippingPriceByWeight($shipping->shipping_prices, $this->weight());
|
||||
//first by price
|
||||
//$shipping_price = $this->shippingPriceByTotal($shipping->shipping_prices, $this->total(2, '.', ''));
|
||||
//sec by weight
|
||||
//if(!$shipping_price){
|
||||
//}
|
||||
}
|
||||
//default
|
||||
if(!$shipping_price){
|
||||
|
|
@ -338,6 +361,18 @@ class Yard extends Cart
|
|||
return $total;
|
||||
}
|
||||
|
||||
public function weightByFreeShipping($decimals = null, $decimalPoint = null, $thousandSeperator = null)
|
||||
{
|
||||
$content = $this->getContent();
|
||||
$total = $content->reduce(function ($total, CartItem $cartItem) {
|
||||
if($cartItem->options->no_free_shipping){
|
||||
return $total + ($cartItem->options->weight ? ($cartItem->options->weight*$cartItem->qty) : 0);
|
||||
}
|
||||
return $total;
|
||||
}, 0);
|
||||
return $total;
|
||||
}
|
||||
|
||||
public function points()
|
||||
{
|
||||
$content = $this->getContent();
|
||||
|
|
|
|||
|
|
@ -79,4 +79,10 @@ if (! function_exists('formatDate')) {
|
|||
{
|
||||
return Carbon::parse($date)->format(\Util::formatDateDB());
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('maxStrLength')) {
|
||||
function maxStrLength($str, $lenght = 40)
|
||||
{
|
||||
return !$str ? $str : Util::maxStrLength($str, $lenght); }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue