Statistiken/Abo: Kundenfeedback 2026-07-24 komplett umgesetzt + Steuern: DATEV-Fixes 08+09/2025 (Sammel-Commit Branch-WIP)

Feedback-Umsetzung (dev/2026-07-22/feedback-analyse-2026-07-24.md, alle 10 Punkte):
- VIP-Statistik: eigener Berater ('ich', Linie 0) in Neue-Kundenabos- und beiden Top-10-Listen; Top-10-Umsatz sortiert nach abgerechneten Ist-Punkten + Abo-Anzahl-Spalte; Fußnote nicht-payline-wirksame Punkte (SalesVolumePoints::nonPaylinePoints)
- Führungskräfte-Liste: beide Sichten 'direkt' (an nächster FK abgeschnitten, additiv) und 'gesamt' (komplette Downline), Gesamt-Spalte nach Kundenzählweise
- Team-Abos: je Ebene 'abgerechnet (Monat)' und 'bis zum 25. erwartet'; Payline-Karte mit Teamabo-/Kundenabo-Zählern
- Incentive-Live-Ranking: Qualifizierte zuerst nummeriert (fixt auch isWinner rank<=max_winners)
- Porto: Netto-/Brutto-Kennzeichnung (Berater netto, Endkunden inkl. MwSt., portal_view-Flag; auch CRM-/Shop-Warenkorb + Checkout), Yard::shipping_tax-Fix
- Struktur-Ansicht: Abo-Badges 'A' (eigenes Abo) und '(n)' (Kundenabos) je Teampartner, gebatcht
- Abo-Löschung: Softdelete setzt active=0 (UserAbo deleting-Hook) + Bereinigungs-Migration für gelöschte-aber-aktive Abos
- Doku: technische Analyse + Kundinnen-Feedback-Dokument unter dev/2026-07-22/
- Tests: IncentiveRankingTest, TeamStructureAboBadgesTest, YardShippingTaxTest (neu); BackofficeStatisticsListsTest, TeamAboOverviewTest, PaylineForecastServiceTest, AboAdminDeleteTest, AboOneTimeViewTest erweitert

Außerdem enthalten (Branch-WIP vor dem Feedback): DATEV-Abgleich-Fixes 08+09/2025, USt-ID-Live-Validierung sowie restliche unkommittete Stände (u. a. Abo-Pause-Sprachkeys).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin 2026-07-24 13:51:16 +00:00
parent 657d4bd5b7
commit ac3bd6e8ea
136 changed files with 7610 additions and 2688 deletions

View file

@ -3,34 +3,37 @@
use App\Models\Incentive;
use App\Models\IncentiveParticipant;
use App\Models\IncentivePointsLog;
use App\Models\UserSalesVolume;
use App\Services\Incentive\IncentiveTracker;
// === Ranking Logic ===
it('ranking logic assigns ranks by total_points descending', function () {
$p1 = new IncentiveParticipant(['total_points' => 1000]);
$p2 = new IncentiveParticipant(['total_points' => 3000]);
$p3 = new IncentiveParticipant(['total_points' => 2000]);
it('ranking logic assigns ranks qualified first, then by total_points descending', function () {
$p1 = new IncentiveParticipant(['total_points' => 3000, 'is_qualified' => false]);
$p2 = new IncentiveParticipant(['total_points' => 1000, 'is_qualified' => true]);
$p3 = new IncentiveParticipant(['total_points' => 2000, 'is_qualified' => true]);
// Simulate the ranking logic from IncentiveTracker::updateRanking
$participants = collect([$p1, $p2, $p3])->sortByDesc('total_points')->values();
$participants = collect([$p1, $p2, $p3])
->sortByDesc(fn (IncentiveParticipant $p) => [$p->is_qualified, $p->total_points])
->values();
$rank = 1;
foreach ($participants as $p) {
$p->rank = $rank;
$rank++;
}
expect($p2->rank)->toBe(1)
->and($p3->rank)->toBe(2)
expect($p3->rank)->toBe(1)
->and($p2->rank)->toBe(2)
->and($p1->rank)->toBe(3);
});
// === Determine Log Type ===
it('determines abo type for shop orders', function () {
$method = new ReflectionMethod(IncentiveTracker::class, 'determineLogType');
$method = new ReflectionMethod(IncentiveParticipant::class, 'determineLogType');
$usv = new \App\Models\UserSalesVolume([
$usv = new UserSalesVolume([
'status_turnover' => 2,
'status_points' => 1,
]);
@ -39,9 +42,9 @@ it('determines abo type for shop orders', function () {
});
it('determines abo type for customer-only points', function () {
$method = new ReflectionMethod(IncentiveTracker::class, 'determineLogType');
$method = new ReflectionMethod(IncentiveParticipant::class, 'determineLogType');
$usv = new \App\Models\UserSalesVolume([
$usv = new UserSalesVolume([
'status_turnover' => 1,
'status_points' => 2,
]);
@ -50,9 +53,9 @@ it('determines abo type for customer-only points', function () {
});
it('determines partner type for advisor orders', function () {
$method = new ReflectionMethod(IncentiveTracker::class, 'determineLogType');
$method = new ReflectionMethod(IncentiveParticipant::class, 'determineLogType');
$usv = new \App\Models\UserSalesVolume([
$usv = new UserSalesVolume([
'status_turnover' => 1,
'status_points' => 1,
]);