Updates to 03-2025

This commit is contained in:
Kevin Adametz 2025-04-01 10:39:21 +02:00
parent 6167273a48
commit 9b54eb0512
348 changed files with 34535 additions and 5774 deletions

View file

@ -18,7 +18,7 @@ class UserMarign
$sum_net_amount = ShoppingOrderMargin::whereUserId($user->id)
->whereBetween('from', [$startDay, $endDay])
->wherePaid(true)
->whereOrderPaid(true)
->whereCancellation(false)
->sum('net_price');
if($format){
@ -35,7 +35,7 @@ class UserMarign
$sum_net_amount = ShoppingOrderMargin::whereUserId($user->id)
->whereBetween('from', [$startDay, $endDay])
->wherePaid(false)
->whereOrderPaid(false)
->whereCancellation(false)
->sum('net_price');
if($format){
@ -52,7 +52,7 @@ class UserMarign
$sum_net_amount = ShoppingOrderMargin::whereUserId($user->id)
->whereBetween('from', [$startDay, $endDay])
->wherePaid(true)
->whereOrderPaid(true)
->whereCancellation(false)
->sum('net_amount');
if($format){
@ -73,7 +73,7 @@ class UserMarign
$sum_net_amount = ShoppingOrderMargin::whereMSponsorId($user->id)
->whereBetween('from', [$startDay, $endDay])
->wherePaid(true)
->whereOrderPaid(true)
->whereCancellation(false)
->sum('net_partner_commission');
if($format){
@ -99,7 +99,7 @@ class UserMarign
$sum_net_amount = ShoppingOrderMargin::whereMSponsorId($user->id)
->whereBetween('from', [$startDay, $endDay])
->wherePaid(true)
->whereOrderPaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '<', Carbon::now())
@ -109,11 +109,37 @@ class UserMarign
}
return $sum_net_amount;
}
public static function getMontlyPartnerCommissionPending(User $user, $date = null, $format = false){
if(!$date){
$start = Carbon::parse('01.01.2021');
$end = Carbon::now();
$startDay = $start->startOfMonth()->toDateString();
$endDay = $end->endOfMonth()->toDateString();
}else{
$now = $date ? Carbon::parse($date) : Carbon::now();
$startDay = $now->startOfMonth()->toDateString();
$endDay = $now->endOfMonth()->toDateString();
}
$sum_net_amount = ShoppingOrderMargin::whereMSponsorId($user->id)
->whereBetween('from', [$startDay, $endDay])
->whereOrderPaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '>=', Carbon::now())
->sum('net_partner_commission');
if($format){
$sum_net_amount = Util::formatNumber($sum_net_amount);
}
return $sum_net_amount;
}
/*
public static function getMontlyPartnerCommissionOpenByID($user_id, $date = null, $format = false, $addUserCreditMargin = false){
$sum_net_amount = ShoppingOrderMargin::whereMSponsorId($user_id)
->wherePaid(true)
->whereOrderPaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '<', Carbon::now())
@ -131,38 +157,14 @@ class UserMarign
return $sum_net_amount;
}
*/
public static function getMontlyPartnerCommissionPending(User $user, $date = null, $format = false){
if(!$date){
$start = Carbon::parse('01.01.2021');
$end = Carbon::now();
$startDay = $start->startOfMonth()->toDateString();
$endDay = $end->endOfMonth()->toDateString();
}else{
$now = $date ? Carbon::parse($date) : Carbon::now();
$startDay = $now->startOfMonth()->toDateString();
$endDay = $now->endOfMonth()->toDateString();
}
$sum_net_amount = ShoppingOrderMargin::whereMSponsorId($user->id)
->whereBetween('from', [$startDay, $endDay])
->wherePaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '>=', Carbon::now())
->sum('net_partner_commission');
if($format){
$sum_net_amount = Util::formatNumber($sum_net_amount);
}
return $sum_net_amount;
}
/*
public static function getMontlyPartnerCommissionPendingByID($user_id, $date = null, $format = false){
$sum_net_amount = ShoppingOrderMargin::whereMSponsorId($user_id)
->wherePaid(true)
->whereOrderPaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '>=', Carbon::now())
@ -173,33 +175,53 @@ class UserMarign
return $sum_net_amount;
}
*/
public static function getPartnerCommissionItems($user_id, $isPending = false){
public static function getOrderFromPartnerCommissionByID($user_id){
$ShoppingOrderMargins = ShoppingOrderMargin::whereMSponsorId($user_id)
->wherePaid(true)
$query = ShoppingOrderMargin::whereMSponsorId($user_id)
->whereOrderPaid(true)
->whereOutPaid(false)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '<', Carbon::now())
->get();
return $ShoppingOrderMargins;
->whereNotNull('partner_commission_pending_to');
if ($isPending) {
$query->where('partner_commission_pending_to', '>=', Carbon::now());
} else {
$query->where('partner_commission_pending_to', '<', Carbon::now());
}
return $query->get();
}
public static function getUserCreditMarginByID($user_id){
public static function getShopCommissionItems($user_id, $isPending = false){
$UserCreditMargin = UserCreditMargin::whereUserId($user_id)
->wherePaid(false)
->get();
return $UserCreditMargin;
$query = ShoppingOrderMargin::whereUserId($user_id)
->whereOrderPaid(true)
->whereOutPaid(false)
->whereCancellation(false)
->whereMarginPaid(false)
->whereNotNull('margin_pending_to');
if ($isPending) {
$query->where('margin_pending_to', '>=', Carbon::now());
} else {
$query->where('margin_pending_to', '<', Carbon::now());
}
return $query->get();
}
public static function getOrderFromPartnerCommissionPendingByID($user_id){
public static function getUserCreditMarginByUserID($user_id){
$query = UserCreditMargin::whereUserId($user_id)
->wherePaid(false);
return $query->get();
}
/*public static function getOrderFromPartnerCommissionPendingByID($user_id){
$ShoppingOrderMargins = ShoppingOrderMargin::whereMSponsorId($user_id)
->wherePaid(true)
->whereOrderPaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->where('partner_commission_pending_to', '>=', Carbon::now())
@ -207,4 +229,19 @@ class UserMarign
return $ShoppingOrderMargins;
}
*/
/*
public static function getOrderFromShopPendingByID($user_id){
$ShoppingOrderMargins = ShoppingOrderMargin::whereUserId($user_id)
->whereOrderPaid(true)
->whereCancellation(false)
->wherePartnerCommissionPaid(false)
->whereIn('status', [7, 8])
->where('partner_commission_pending_to', '>=', Carbon::now())
->get();
return $ShoppingOrderMargins;
}
*/
}