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>
63 lines
2.2 KiB
PHP
63 lines
2.2 KiB
PHP
<?php
|
|
|
|
use App\Models\Country;
|
|
use App\Models\Shipping;
|
|
use App\Models\ShippingCountry;
|
|
use App\Models\ShippingPrice;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
uses(TestCase::class, RefreshDatabase::class);
|
|
|
|
/**
|
|
* Versandland DE mit einer Stufe: 19,90 € brutto bei 19 % MwSt (netto 16,72 €, Steueranteil 3,18 €).
|
|
*/
|
|
function makeShippingEnvForYardTaxTest(): ShippingCountry
|
|
{
|
|
$country = Country::create([
|
|
'code' => 'DE', 'phone' => '49', 'en' => 'Germany', 'de' => 'Deutschland',
|
|
'es' => 'Alemania', 'fr' => 'Allemagne', 'it' => 'Germania', 'ru' => 'Германия',
|
|
]);
|
|
$shipping = Shipping::create(['name' => 'Standard', 'active' => true]);
|
|
|
|
ShippingPrice::create([
|
|
'shipping_id' => $shipping->id, 'price' => 19.90, 'price_comp' => 19.90, 'num_comp' => 0,
|
|
'tax_rate' => 19, 'weight_from' => 1, 'weight_to' => 31500,
|
|
]);
|
|
|
|
return ShippingCountry::create(['shipping_id' => $shipping->id, 'country_id' => $country->id]);
|
|
}
|
|
|
|
describe('Yard Versandkosten-Steuer', function () {
|
|
beforeEach(function () {
|
|
$this->shippingCountry = makeShippingEnvForYardTaxTest();
|
|
});
|
|
|
|
it('berechnet den Netto-Versand und den Steueranteil (brutto minus netto)', function () {
|
|
$yard = Yard::instance('test-shipping-tax');
|
|
$yard->destroy();
|
|
$yard->setShippingCountryWithPrice($this->shippingCountry->id);
|
|
|
|
$yard->add(1, 'A', 1, 10.0, false, false, ['weight' => 500]);
|
|
$yard->reCalculateShippingPrice();
|
|
|
|
expect((float) $yard->getShippingPrice())->toBe(19.90)
|
|
->and($yard->shippingNet(2, '.', ''))->toBe('16.72')
|
|
->and((float) $yard->getYardExtra('shipping_tax'))->toBe(3.18);
|
|
|
|
$yard->destroy();
|
|
});
|
|
|
|
it('setzt den Steueranteil bei kostenlosem Versand auf 0', function () {
|
|
$yard = Yard::instance('test-shipping-tax');
|
|
$yard->destroy();
|
|
$yard->setShippingCountryWithPrice($this->shippingCountry->id);
|
|
|
|
$yard->reCalculateShippingPrice();
|
|
|
|
expect((float) $yard->getShippingPrice())->toBe(0.0)
|
|
->and((float) $yard->getYardExtra('shipping_tax'))->toBe(0.0);
|
|
|
|
$yard->destroy();
|
|
});
|
|
});
|